* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. */ /** * \file idsconnect/tab_supplierorder.php * \ingroup idsconnect * \brief IDS Connect Tab in Lieferantenbestellungen */ // Dolibarr laden $res = 0; if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) { $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php"; } $tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1; while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { $i--; $j--; } if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) { $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php"; } if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) { $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php"; } if (!$res && file_exists("../main.inc.php")) { $res = @include "../main.inc.php"; } if (!$res && file_exists("../../main.inc.php")) { $res = @include "../../main.inc.php"; } if (!$res) { die("Include of main fails"); } require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/fourn.lib.php'; dol_include_once('/idsconnect/class/idssupplier.class.php'); dol_include_once('/idsconnect/class/idsconnect.class.php'); dol_include_once('/idsconnect/lib/idsconnect.lib.php'); /** * @var Conf $conf * @var DoliDB $db * @var Translate $langs * @var User $user */ $langs->loadLangs(array("idsconnect@idsconnect", "orders")); if (!$user->hasRight('idsconnect', 'use')) { accessforbidden(); } $id = GETPOSTINT('id'); // Bestellung laden $object = new CommandeFournisseur($db); $object->fetch($id); $object->fetch_thirdparty(); /* * View */ llxHeader('', $langs->trans("IdsConnectTab"), '', '', 0, 0, '', '', '', 'mod-idsconnect page-tab_supplierorder'); // Tabs der Lieferantenbestellung $head = ordersupplier_prepare_head($object); print dol_get_fiche_head($head, 'idsconnect', $langs->trans("SupplierOrder"), -1, 'order'); // Bestellungs-Info print ''; print ''; print ''; print '
'.$langs->trans("Ref").''.$object->getNomUrl(1).'
'.$langs->trans("Supplier").''.$object->thirdparty->getNomUrl(1).'
'; print '
'; idsconnectShowTestModeBanner(); // Passende Großhändler für diesen Lieferanten finden $supplierObj = new IdsSupplier($db); $allSuppliers = $supplierObj->fetchAll(1); $matchingSuppliers = array(); if (is_array($allSuppliers)) { foreach ($allSuppliers as $sup) { // Großhändler die mit diesem Dolibarr-Lieferanten verknüpft sind if ($sup->fk_soc == $object->socid) { $matchingSuppliers[] = $sup; } } } if (!empty($matchingSuppliers)) { print '

'.$langs->trans("IdsconnectSuppliers").'

'; foreach ($matchingSuppliers as $sup) { print '
'; print '
'.htmlspecialchars($sup->label).' ('.htmlspecialchars($sup->ref).')
'; print '
'.htmlspecialchars($sup->ids_url).' | IDS '.htmlspecialchars($sup->ids_version).'
'; if ($sup->testmode) { print ' Testmodus'; } print '
'; // Shop öffnen (WKE) print ''; print $langs->trans("IdsconnectOpenShop"); print ''; // Warenkorb aus Bestellung senden (WKS) if (count($object->lines) > 0) { print ''; print $langs->trans("IdsconnectSendCart"); print ''; } print '
'; } } else { print '
'; print 'Kein IDS Connect Großhändler für diesen Lieferanten konfiguriert.
'; if ($user->hasRight('idsconnect', 'config')) { print ''; print $langs->trans("IdsconnectNewSupplier"); print ''; } print '
'; } print dol_get_fiche_end(); llxFooter(); $db->close();