24 require_once DOL_DOCUMENT_ROOT.
'/expedition/class/expedition.class.php';
25 require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
26 require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/entrepot.class.php';
37 global $db, $langs, $conf, $user;
40 $langs->loadLangs(array(
"sendings",
"deliveries"));
45 $head[$h][0] = DOL_URL_ROOT.
"/expedition/card.php?id=".$object->id;
46 $head[$h][1] = $langs->trans(
"SendingCard");
47 $head[$h][2] =
'shipping';
50 if ($conf->delivery_note->enabled && $user->rights->expedition->delivery->lire)
53 $object->fetchObjectLinked($object->id, $object->element);
54 if (is_array($object->linkedObjectsIds[
'delivery']) && count($object->linkedObjectsIds[
'delivery']) > 0)
57 $tmp = reset($object->linkedObjectsIds[
'delivery']);
59 $head[$h][0] = DOL_URL_ROOT.
"/delivery/card.php?id=".$tmp;
60 $head[$h][1] = $langs->trans(
"DeliveryCard");
61 $head[$h][2] =
'delivery';
66 if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
69 if ($object->origin ==
'commande' && $object->origin_id > 0)
72 $objectsrc->fetch($object->origin_id);
74 $nbContact = count($objectsrc->liste_contact(-1,
'internal')) + count($objectsrc->liste_contact(-1,
'external'));
75 $head[$h][0] = DOL_URL_ROOT.
"/expedition/contact.php?id=".$object->id;
76 $head[$h][1] = $langs->trans(
"ContactsAddresses");
77 if ($nbContact > 0) $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbContact.
'</span>';
78 $head[$h][2] =
'contact';
82 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
83 require_once DOL_DOCUMENT_ROOT.
'/core/class/link.class.php';
85 $nbFiles = count(
dol_dir_list($upload_dir,
'files', 0,
'',
'(\.meta|_preview.*\.png)$'));
86 $nbLinks =
Link::count($db, $object->element, $object->id);
87 $head[$h][0] = DOL_URL_ROOT.
'/expedition/document.php?id='.$object->id;
88 $head[$h][1] = $langs->trans(
'Documents');
89 if (($nbFiles + $nbLinks) > 0) $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).
'</span>';
90 $head[$h][2] =
'documents';
94 if (!empty($object->note_private)) $nbNote++;
95 if (!empty($object->note_public)) $nbNote++;
96 $head[$h][0] = DOL_URL_ROOT.
"/expedition/note.php?id=".$object->id;
97 $head[$h][1] = $langs->trans(
"Notes");
98 if ($nbNote > 0) $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbNote.
'</span>';
99 $head[$h][2] =
'note';
122 global $langs, $db, $conf, $user;
125 $langs->loadLangs(array(
"sendings",
"deliveries"));
130 if ($conf->expedition_bon->enabled && $user->rights->expedition->lire)
132 $head[$h][0] = DOL_URL_ROOT.
"/expedition/card.php?id=".$object->origin_id;
133 $head[$h][1] = $langs->trans(
"SendingCard");
134 $head[$h][2] =
'shipping';
138 $head[$h][0] = DOL_URL_ROOT.
"/delivery/card.php?id=".$object->id;
139 $head[$h][1] = $langs->trans(
"DeliveryCard");
140 $head[$h][2] =
'delivery';
149 $savObjectId = $object->id;
153 if ($object->origin) {
155 $tmpobject->fetch($object->origin_id);
157 $tmpobject = $object;
160 if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
162 $objectsrc = $tmpobject;
163 if ($tmpobject->origin ==
'commande' && $tmpobject->origin_id > 0)
166 $objectsrc->fetch($tmpobject->origin_id);
168 $nbContact = count($objectsrc->liste_contact(-1,
'internal')) + count($objectsrc->liste_contact(-1,
'external'));
169 $head[$h][0] = DOL_URL_ROOT.
"/expedition/contact.php?id=".$tmpobject->id;
170 $head[$h][1] = $langs->trans(
"ContactsAddresses");
171 if ($nbContact > 0) $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbContact.
'</span>';
172 $head[$h][2] =
'contact';
176 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
177 require_once DOL_DOCUMENT_ROOT.
'/core/class/link.class.php';
179 $nbFiles = count(
dol_dir_list($upload_dir,
'files', 0,
'',
'(\.meta|_preview.*\.png)$'));
180 $nbLinks =
Link::count($db, $tmpobject->element, $tmpobject->id);
181 $head[$h][0] = DOL_URL_ROOT.
'/expedition/document.php?id='.$tmpobject->id;
182 $head[$h][1] = $langs->trans(
'Documents');
183 if (($nbFiles + $nbLinks) > 0) $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).
'</span>';
184 $head[$h][2] =
'documents';
188 if (!empty($tmpobject->note_private)) $nbNote++;
189 if (!empty($tmpobject->note_public)) $nbNote++;
190 $head[$h][0] = DOL_URL_ROOT.
"/expedition/note.php?id=".$tmpobject->id;
191 $head[$h][1] = $langs->trans(
"Notes");
192 if ($nbNote > 0) $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbNote.
'</span>';
193 $head[$h][2] =
'note';
196 $object->id = $tmpobject->id;
202 $object->id = $savObjectId;
216 global $db, $conf, $langs;
219 $product_static =
new Product($db);
221 $warehousestatic =
new Entrepot($db);
223 $sql =
"SELECT obj.rowid, obj.fk_product, obj.label, obj.description, obj.product_type as fk_product_type, obj.qty as qty_asked, obj.date_start, obj.date_end,";
224 $sql .=
" ed.rowid as edrowid, ed.qty as qty_shipped, ed.fk_expedition as expedition_id, ed.fk_origin_line, ed.fk_entrepot as warehouse_id,";
225 $sql .=
" e.rowid as sendingid, e.ref as exp_ref, e.date_creation, e.date_delivery, e.date_expedition,";
227 $sql .=
' p.label as product_label, p.ref, p.fk_product_type, p.rowid as prodid, p.tobatch as product_tobatch,';
228 $sql .=
' p.description as product_desc';
229 $sql .=
" FROM ".MAIN_DB_PREFIX.
"expeditiondet as ed";
230 $sql .=
", ".MAIN_DB_PREFIX.
"expedition as e";
231 $sql .=
", ".MAIN_DB_PREFIX.$origin.
"det as obj";
233 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"product as p ON obj.fk_product = p.rowid";
235 $sql .=
" WHERE e.entity IN (".getEntity(
'expedition').
")";
236 $sql .=
" AND obj.fk_".$origin.
" = ".$origin_id;
237 $sql .=
" AND obj.rowid = ed.fk_origin_line";
238 $sql .=
" AND ed.fk_expedition = e.rowid";
239 if ($filter) $sql .= $filter;
241 $sql .=
" ORDER BY obj.fk_product";
243 dol_syslog(
"show_list_sending_receive", LOG_DEBUG);
244 $resql = $db->query($sql);
247 $num = $db->num_rows(
$resql);
255 print '<table class="liste centpercent">';
256 print
'<tr class="liste_titre">';
258 print
'<td>'.$langs->trans(
"SendingSheet").
'</td>';
259 print
'<td>'.$langs->trans(
"Description").
'</td>';
260 print
'<td class="center">'.$langs->trans(
"DateCreation").
'</td>';
261 print
'<td class="center">'.$langs->trans(
"DateDeliveryPlanned").
'</td>';
262 print
'<td class="center">'.$langs->trans(
"QtyPreparedOrShipped").
'</td>';
263 if (!empty($conf->stock->enabled))
265 print
'<td>'.$langs->trans(
"Warehouse").
'</td>';
273 if (!empty($conf->delivery_note->enabled))
275 print
'<td>'.$langs->trans(
"DeliveryOrder").
'</td>';
277 print
'<td class="right">'.$langs->trans(
"DeliveryDate").
'</td>';
283 $objp = $db->fetch_object(
$resql);
285 print
'<tr class="oddeven">';
288 print
'<td class="nowrap left">';
289 print
'<a href="'.DOL_URL_ROOT.
'/expedition/card.php?id='.$objp->expedition_id.
'">'.
img_object($langs->trans(
"ShowSending"),
'sending').
' '.$objp->exp_ref.
'<a>';
293 if ($objp->fk_product > 0)
296 if (!empty($conf->global->MAIN_MULTILANGS) && !empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE))
298 $object =
new $origin($db);
299 $object->fetch($origin_id);
300 $object->fetch_thirdparty();
303 $prod->id = $objp->fk_product;
304 $prod->getMultiLangs();
306 $outputlangs = $langs;
308 if (empty($newlang) && !empty($_REQUEST[
'lang_id'])) $newlang = $_REQUEST[
'lang_id'];
309 if (empty($newlang)) $newlang = $object->thirdparty->default_lang;
310 if (!empty($newlang))
313 $outputlangs->setDefaultLang($newlang);
316 $label = (!empty($prod->multilangs[$outputlangs->defaultlang][
"label"])) ? $prod->multilangs[$outputlangs->defaultlang][
"label"] : $objp->product_label;
318 $label = (!empty($objp->label) ? $objp->label : $objp->product_label);
324 $product_static->type = $objp->fk_product_type;
325 $product_static->id = $objp->fk_product;
326 $product_static->ref = $objp->ref;
327 $product_static->status_batch = $objp->product_tobatch;
328 $text = $product_static->getNomUrl(1);
329 $text .=
' - '.$label;
330 $description = (!empty($conf->global->PRODUIT_DESC_IN_FORM) ?
'' :
dol_htmlentitiesbr($objp->description));
331 print $form->textwithtooltip($text, $description, 3,
'',
'', $i);
337 if (!empty($conf->global->PRODUIT_DESC_IN_FORM))
339 print (!empty($objp->description) && $objp->description != $objp->product) ?
'<br>'.dol_htmlentitiesbr($objp->description) :
'';
345 if ($objp->fk_product_type == 1) $text =
img_object($langs->trans(
'Service'),
'service');
346 else $text =
img_object($langs->trans(
'Product'),
'product');
348 if (!empty($objp->label)) {
349 $text .=
' <strong>'.$objp->label.
'</strong>';
350 print $form->textwithtooltip($text, $objp->description, 3,
'',
'', $i);
352 print $text.
' '.nl2br($objp->description);
363 print
'<td class="nowrap center">'.dol_print_date($db->jdate($objp->date_creation),
'day').
'</td>';
366 print
'<td class="nowrap center">'.dol_print_date($db->jdate($objp->date_delivery),
'day').
'</td>';
369 print
'<td class="center">'.$objp->qty_shipped.
'</td>';
372 if (!empty($conf->stock->enabled))
375 if ($objp->warehouse_id > 0)
377 $warehousestatic->fetch($objp->warehouse_id);
378 print $warehousestatic->getNomUrl(1);
416 if (!empty($conf->delivery_note->enabled))
418 include_once DOL_DOCUMENT_ROOT.
'/delivery/class/delivery.class.php';
419 $expedition->id = $objp->sendingid;
420 $expedition->fetchObjectLinked($expedition->id, $expedition->element);
424 if (!empty($expedition->linkedObjects[
'delivery'])) $receiving = reset($expedition->linkedObjects[
'delivery']);
426 if (!empty($receiving))
435 print $receiving->getNomUrl($db);
445 print
'<td class="right">';
450 print
'<td> </td>';
451 print
'<td> </td>';
shipping_prepare_head($object)
Prepare array with list of tabs.
Class to manage products or services.
dol_htmlentitiesbr($stringtoencode, $nl2brmode=0, $pagecodefrom= 'UTF-8', $removelasteolbr=1)
This function is called to encode a string into a HTML string but differs from htmlentities because a...
show_list_sending_receive($origin, $origin_id, $filter= '')
List sendings and receive receipts.
delivery_prepare_head($object)
Prepare array with list of tabs.
load_fiche_titre($titre, $morehtmlright= '', $picto= 'generic', $pictoisfullpath=0, $id= '', $morecssontable= '', $morehtmlcenter= '')
Load a title with picto.
Class to manage shipments.
Class to manage customers orders.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename= '', $restricttologhandler= '', $logcontext=null)
Write log message into outputs.
img_object($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
Class to manage translations.
dol_sanitizeFileName($str, $newstr= '_', $unaccent=1)
Clean a string to use it as a file name.
dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="", $donotfollowsymlinks=0)
Scan a directory and return a list of files/directories.
static count($db, $objecttype, $objectid)
Return nb of links.
print
Draft customers invoices.
dol_print_date($time, $format= '', $tzoutput= 'auto', $outputlangs= '', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) if(!empty($conf->don->enabled)&&$user->rights->don->lire) if(!empty($conf->tax->enabled)&&$user->rights->tax->charges->lire) if(!empty($conf->facture->enabled)&&!empty($conf->commande->enabled)&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
print_date_range($date_start, $date_end, $format= '', $outputlangs= '')
Format output for start and end date.
complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type, $mode= 'add')
Complete or removed entries into a head array (used to build tabs).
if(!defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN'
Draft customers invoices.
Class to manage warehouses.