25require_once DOL_DOCUMENT_ROOT.
'/expedition/class/expedition.class.php';
26require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
27require_once DOL_DOCUMENT_ROOT.
'/product/stock/class/entrepot.class.php';
38 global $db, $langs, $conf, $user;
41 $langs->loadLangs(array(
"sendings",
"deliveries"));
46 $head[$h][0] = DOL_URL_ROOT.
"/expedition/card.php?id=".
$object->id;
47 $head[$h][1] = $langs->trans(
"SendingCard");
48 $head[$h][2] =
'shipping';
52 $head[$h][0] = DOL_URL_ROOT.
"/expedition/dispatch.php?id=".
$object->id;
53 $head[$h][1] = $langs->trans(
"ShipmentDistribution");
54 $head[$h][2] =
'dispatch';
58 if (
getDolGlobalInt(
'MAIN_SUBMODULE_DELIVERY') && $user->hasRight(
'expedition',
'delivery',
'lire')) {
61 if (isset(
$object->linkedObjectsIds[
'delivery']) && is_array(
$object->linkedObjectsIds[
'delivery']) && count(
$object->linkedObjectsIds[
'delivery']) > 0) {
63 $tmp = reset(
$object->linkedObjectsIds[
'delivery']);
65 $head[$h][0] = DOL_URL_ROOT.
"/delivery/card.php?id=".((int) $tmp);
66 $head[$h][1] = $langs->trans(
"DeliveryCard");
67 $head[$h][2] =
'delivery';
76 $objectsrc->fetch(
$object->origin_id);
78 $nbContact = count($objectsrc->liste_contact(-1,
'internal')) + count($objectsrc->liste_contact(-1,
'external'));
79 $head[$h][0] = DOL_URL_ROOT.
"/expedition/contact.php?id=".((int)
$object->id);
80 $head[$h][1] = $langs->trans(
"ContactsAddresses");
82 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbContact.
'</span>';
84 $head[$h][2] =
'contact';
88 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
89 require_once DOL_DOCUMENT_ROOT.
'/core/class/link.class.php';
91 $nbFiles = count(
dol_dir_list($upload_dir,
'files', 0,
'',
'(\.meta|_preview.*\.png)$'));
93 $head[$h][0] = DOL_URL_ROOT.
'/expedition/document.php?id='.
$object->id;
94 $head[$h][1] = $langs->trans(
'Documents');
95 if (($nbFiles + $nbLinks) > 0) {
96 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).
'</span>';
98 $head[$h][2] =
'documents';
102 if (!empty(
$object->note_private)) {
105 if (!empty(
$object->note_public)) {
108 $head[$h][0] = DOL_URL_ROOT.
"/expedition/note.php?id=".
$object->id;
109 $head[$h][1] = $langs->trans(
"Notes");
111 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbNote.
'</span>';
113 $head[$h][2] =
'note';
136 global $langs, $db, $conf, $user;
139 $langs->loadLangs(array(
"sendings",
"deliveries"));
144 if (
getDolGlobalInt(
'MAIN_SUBMODULE_EXPEDITION') && $user->hasRight(
'expedition',
'lire')) {
145 $head[$h][0] = DOL_URL_ROOT.
"/expedition/card.php?id=".
$object->origin_id;
146 $head[$h][1] = $langs->trans(
"SendingCard");
147 $head[$h][2] =
'shipping';
151 $head[$h][0] = DOL_URL_ROOT.
"/delivery/card.php?id=".
$object->id;
152 $head[$h][1] = $langs->trans(
"DeliveryCard");
153 $head[$h][2] =
'delivery';
168 $tmpobject->fetch(
$object->origin_id);
174 $objectsrc = $tmpobject;
175 if ($tmpobject->origin ==
'commande' && $tmpobject->origin_id > 0) {
177 $objectsrc->fetch($tmpobject->origin_id);
179 $nbContact = count($objectsrc->liste_contact(-1,
'internal')) + count($objectsrc->liste_contact(-1,
'external'));
180 $head[$h][0] = DOL_URL_ROOT.
"/expedition/contact.php?id=".$tmpobject->id;
181 $head[$h][1] = $langs->trans(
"ContactsAddresses");
182 if ($nbContact > 0) {
183 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbContact.
'</span>';
185 $head[$h][2] =
'contact';
189 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
190 require_once DOL_DOCUMENT_ROOT.
'/core/class/link.class.php';
192 $nbFiles = count(
dol_dir_list($upload_dir,
'files', 0,
'',
'(\.meta|_preview.*\.png)$'));
193 $nbLinks =
Link::count($db, $tmpobject->element, $tmpobject->id);
194 $head[$h][0] = DOL_URL_ROOT.
'/expedition/document.php?id='.$tmpobject->id;
195 $head[$h][1] = $langs->trans(
'Documents');
196 if (($nbFiles + $nbLinks) > 0) {
197 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).
'</span>';
199 $head[$h][2] =
'documents';
203 if (!empty($tmpobject->note_private)) {
206 if (!empty($tmpobject->note_public)) {
209 $head[$h][0] = DOL_URL_ROOT.
"/expedition/note.php?id=".$tmpobject->id;
210 $head[$h][1] = $langs->trans(
"Notes");
212 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbNote.
'</span>';
214 $head[$h][2] =
'note';
237 global $db, $conf, $langs;
240 $product_static =
new Product($db);
242 $warehousestatic =
new Entrepot($db);
244 $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,";
245 $sql .=
" ed.rowid as edrowid, ed.qty as qty_shipped, ed.fk_expedition as expedition_id, ed.fk_elementdet, ed.fk_entrepot as warehouse_id,";
246 $sql .=
" e.rowid as sendingid, e.ref as exp_ref, e.date_creation, e.date_delivery, e.date_expedition, e.billed, e.fk_statut as status, e.signed_status,";
247 $sql .=
' p.label as product_label, p.ref, p.fk_product_type, p.rowid as prodid, p.tobatch as product_tobatch,';
248 $sql .=
' p.description as product_desc';
249 $sql .=
" FROM ".MAIN_DB_PREFIX.
"expeditiondet as ed,";
250 $sql .=
" ".MAIN_DB_PREFIX.
"expedition as e,";
251 $sql .=
" ".MAIN_DB_PREFIX.$origin.
"det as obj";
252 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"product as p ON obj.fk_product = p.rowid";
254 $sql .=
" WHERE e.entity IN (".getEntity(
'expedition').
")";
255 $sql .=
" AND obj.fk_".$origin.
" = ".((int) $origin_id);
256 $sql .=
" AND obj.rowid = ed.fk_elementdet";
257 $sql .=
" AND ed.fk_expedition = e.rowid";
261 $sql .=
" ORDER BY obj.rowid, obj.fk_product";
263 dol_syslog(
"show_list_sending_receive", LOG_DEBUG);
264 $resql = $db->query($sql);
266 $num = $db->num_rows($resql);
276 print
'<table class="liste centpercent">';
277 print
'<tr class="liste_titre">';
279 print
'<td>'.$langs->trans(
"SendingSheet").
'</td>';
280 print
'<td>'.$langs->trans(
"Description").
'</td>';
281 print
'<td class="center">'.$langs->trans(
"DateCreation").
'</td>';
282 print
'<td class="center">'.$langs->trans(
"DateDeliveryPlanned").
'</td>';
283 print
'<td class="center">'.$langs->trans(
"QtyPreparedOrShipped").
'</td>';
284 if (isModEnabled(
'stock')) {
285 print
'<td>'.$langs->trans(
"Warehouse").
'</td>';
294 print
'<td>'.$langs->trans(
"DeliveryOrder").
'</td>';
296 print
'<td class="right">'.$langs->trans(
"DeliveryDate").
'</td>';
301 $objp = $db->fetch_object($resql);
303 $expedition->id = $objp->expedition_id;
304 $expedition->ref = $objp->exp_ref;
305 $expedition->billed = $objp->billed;
306 $expedition->statut = $objp->status;
307 $expedition->status = $objp->status;
308 $expedition->signed_status = $objp->signed_status;
310 print
'<tr class="oddeven">';
313 print
'<td class="nowrap left">';
314 print $expedition->getNomUrl(1);
319 if ($objp->fk_product > 0) {
323 '@phan-var-force CommonObject $object';
328 $prod->id = $objp->fk_product;
329 $prod->getMultiLangs();
331 $outputlangs = $langs;
333 if (empty($newlang) &&
GETPOST(
'lang_id',
'aZ09')) {
334 $newlang =
GETPOST(
'lang_id',
'aZ09');
336 if (empty($newlang)) {
337 $newlang =
$object->thirdparty->default_lang;
339 if (!empty($newlang)) {
341 $outputlangs->setDefaultLang($newlang);
344 $label = (!empty($prod->multilangs[$outputlangs->defaultlang][
"label"])) ? $prod->multilangs[$outputlangs->defaultlang][
"label"] : $objp->product_label;
346 $label = (!empty($objp->label) ? $objp->label : $objp->product_label);
352 $product_static->type = $objp->fk_product_type;
353 $product_static->id = $objp->fk_product;
354 $product_static->ref = $objp->ref;
355 $product_static->status_batch = $objp->product_tobatch;
357 $text = $product_static->getNomUrl(1);
358 $text .=
' - '.$label;
360 print $form->textwithtooltip($text, $description, 3, 0,
'', $i);
367 print(!empty($objp->description) ? ((empty($objp->product) || $objp->description != $objp->product) ?
'<br>'.dol_htmlentitiesbr($objp->description) :
'') :
'');
373 if ($objp->fk_product_type == 1) {
374 $text =
img_object($langs->trans(
'Service'),
'service');
376 $text =
img_object($langs->trans(
'Product'),
'product');
379 if (!empty($objp->label)) {
380 $text .=
' <strong>'.$objp->label.
'</strong>';
381 print $form->textwithtooltip($text, $objp->description, 3, 0,
'', $i);
383 print $text.
' '.nl2br($objp->description);
394 print
'<td class="nowrap center">'.dol_print_date($db->jdate($objp->date_creation),
'day').
'</td>';
397 print
'<td class="nowrap center">'.dol_print_date($db->jdate($objp->date_delivery),
'day').
'</td>';
400 print
'<td class="center">'.$objp->qty_shipped.
'</td>';
403 if (isModEnabled(
'stock')) {
405 if ($objp->warehouse_id > 0) {
406 $warehousestatic->fetch($objp->warehouse_id);
407 print $warehousestatic->getNomUrl(1);
446 include_once DOL_DOCUMENT_ROOT.
'/delivery/class/delivery.class.php';
447 $expedition->fetchObjectLinked($expedition->id, $expedition->element);
451 if (!empty($expedition->linkedObjects[
'delivery'])) {
452 $receiving = reset($expedition->linkedObjects[
'delivery']);
455 if (!empty($receiving)) {
456 '@phan-var-force Delivery $receiving';
464 print $receiving->getNomUrl($db);
474 print
'<td class="right">';
479 print
'<td> </td>';
480 print
'<td> </td>';
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Class to manage customers orders.
Class to manage warehouses.
const STATUS_DRAFT
Draft status.
static count($dbs, $objecttype, $objectid)
Return nb of links.
Class to manage products or services.
Class to manage translations.
dol_dir_list($utf8_path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="", $donotfollowsymlinks=0, $nbsecondsold=0)
Scan a directory and return a list of files/directories.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
print_date_range($date_start, $date_end, $format='', $outputlangs=null)
Format output for start and end date.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type, $mode='add', $filterorigmodule='')
Complete or removed entries into a head array (used to build tabs).
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...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
delivery_prepare_head($object)
Prepare array with list of tabs.
show_list_sending_receive($origin, $origin_id, $filter='')
List sendings and receive receipts.
shipping_prepare_head($object)
Prepare array with list of tabs.