29 require
'../main.inc.php';
30 require_once DOL_DOCUMENT_ROOT.
'/expedition/class/expedition.class.php';
31 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
32 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
33 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
34 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
35 require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
36 require_once DOL_DOCUMENT_ROOT.
'/core/lib/product.lib.php';
39 $langs->loadLangs(array(
"sendings",
"deliveries",
'companies',
'bills',
'products'));
41 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'shipmentlist';
43 $socid =
GETPOST(
'socid',
'int');
45 $action =
GETPOST(
'action',
'alpha');
46 $massaction =
GETPOST(
'massaction',
'alpha');
47 $show_files =
GETPOST(
'show_files',
'int');
48 $toselect =
GETPOST(
'toselect',
'array');
51 $expeditionid =
GETPOST(
'id',
'int');
52 if ($user->socid) $socid = $user->socid;
55 $search_ref_exp =
GETPOST(
"search_ref_exp",
'alpha');
56 $search_ref_liv =
GETPOST(
'search_ref_liv',
'alpha');
57 $search_ref_customer =
GETPOST(
'search_ref_customer',
'alpha');
58 $search_company =
GETPOST(
"search_company",
'alpha');
59 $search_tracking =
GETPOST(
"search_tracking",
'alpha');
60 $search_town =
GETPOST(
'search_town',
'alpha');
61 $search_zip =
GETPOST(
'search_zip',
'alpha');
62 $search_state =
GETPOST(
"search_state");
63 $search_country =
GETPOST(
"search_country",
'int');
64 $search_type_thirdparty =
GETPOST(
"search_type_thirdparty",
'int');
65 $search_billed =
GETPOST(
"search_billed",
'int');
66 $search_datedelivery_start =
dol_mktime(0, 0, 0,
GETPOST(
'search_datedelivery_startmonth',
'int'),
GETPOST(
'search_datedelivery_startday',
'int'),
GETPOST(
'search_datedelivery_startyear',
'int'));
67 $search_datedelivery_end =
dol_mktime(23, 59, 59,
GETPOST(
'search_datedelivery_endmonth',
'int'),
GETPOST(
'search_datedelivery_endday',
'int'),
GETPOST(
'search_datedelivery_endyear',
'int'));
68 $search_datereceipt_start =
dol_mktime(0, 0, 0,
GETPOST(
'search_datereceipt_startmonth',
'int'),
GETPOST(
'search_datereceipt_startday',
'int'),
GETPOST(
'search_datereceipt_startyear',
'int'));
69 $search_datereceipt_end =
dol_mktime(23, 59, 59,
GETPOST(
'search_datereceipt_endmonth',
'int'),
GETPOST(
'search_datereceipt_endday',
'int'),
GETPOST(
'search_datereceipt_endyear',
'int'));
70 $sall = trim((
GETPOST(
'search_all',
'alphanohtml') !=
'') ?
GETPOST(
'search_all',
'alphanohtml') :
GETPOST(
'sall',
'alphanohtml'));
71 $socid =
GETPOST(
'socid',
'int');
72 $search_user =
GETPOST(
'search_user',
'int');
73 $search_sale =
GETPOST(
'search_sale',
'int');
74 $search_categ_cus =
GETPOST(
"search_categ_cus",
'int');
75 $search_product_category =
GETPOST(
'search_product_category',
'int');
76 $optioncss =
GETPOST(
'optioncss',
'alpha');
78 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
79 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
80 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
82 if (!$sortfield) $sortfield =
"e.ref";
83 if (!$sortorder) $sortorder =
"DESC";
84 if (empty($page) || $page == -1 || (empty($toselect) && $massaction ===
'0')) { $page = 0; }
85 $offset = $limit * $page;
86 $pageprev = $page - 1;
87 $pagenext = $page + 1;
89 $search_status =
GETPOST(
'search_status');
91 $diroutputmassaction = $conf->expedition->dir_output.
'/sending/temp/massgeneration/'.$user->id;
94 $form =
new Form($db);
97 $hookmanager->initHooks(array(
'shipmentlist'));
101 $extrafields->fetch_name_optionals_label($object->table_element);
103 $search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
106 $fieldstosearchall = array(
108 's.nom'=>
"ThirdParty",
109 'e.note_public'=>
'NotePublic',
110 'e.tracking_number'=>
"TrackingNumber",
112 if (empty($user->socid)) $fieldstosearchall[
"e.note_private"] =
"NotePrivate";
114 $checkedtypetiers = 0;
115 $arrayfields = array(
116 'e.ref'=>array(
'label'=>$langs->trans(
"Ref"),
'checked'=>1),
117 'e.ref_customer'=>array(
'label'=>$langs->trans(
"RefCustomer"),
'checked'=>1),
118 's.nom'=>array(
'label'=>$langs->trans(
"ThirdParty"),
'checked'=>1),
119 's.town'=>array(
'label'=>$langs->trans(
"Town"),
'checked'=>1),
120 's.zip'=>array(
'label'=>$langs->trans(
"Zip"),
'checked'=>1),
121 'state.nom'=>array(
'label'=>$langs->trans(
"StateShort"),
'checked'=>0),
122 'country.code_iso'=>array(
'label'=>$langs->trans(
"Country"),
'checked'=>0),
123 'typent.code'=>array(
'label'=>$langs->trans(
"ThirdPartyType"),
'checked'=>$checkedtypetiers),
124 'e.date_delivery'=>array(
'label'=>$langs->trans(
"DateDeliveryPlanned"),
'checked'=>1),
125 'e.tracking_number'=>array(
'label'=>$langs->trans(
"TrackingNumber"),
'checked'=>1),
126 'e.weight'=>array(
'label'=>$langs->trans(
"Weight"),
'checked'=>0),
127 'e.datec'=>array(
'label'=>$langs->trans(
"DateCreation"),
'checked'=>0,
'position'=>500),
128 'e.tms'=>array(
'label'=>$langs->trans(
"DateModificationShort"),
'checked'=>0,
'position'=>500),
129 'e.fk_statut'=>array(
'label'=>$langs->trans(
"Status"),
'checked'=>1,
'position'=>1000),
130 'l.ref'=>array(
'label'=>$langs->trans(
"DeliveryRef"),
'checked'=>1,
'enabled'=>(empty($conf->delivery_note->enabled) ? 0 : 1)),
131 'l.date_delivery'=>array(
'label'=>$langs->trans(
"DateReceived"),
'checked'=>1,
'enabled'=>(empty($conf->delivery_note->enabled) ? 0 : 1)),
132 'e.billed'=>array(
'label'=>$langs->trans(
"Billed"),
'checked'=>1,
'position'=>1000,
'enabled'=>(!empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)))
136 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
147 if (
GETPOST(
'cancel',
'alpha')) { $action =
'list'; $massaction =
''; }
148 if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') { $massaction =
''; }
150 $parameters = array(
'socid'=>$socid);
151 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
152 if ($reshook < 0)
setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
154 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
157 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha'))
162 $search_product_category =
'';
163 $search_ref_exp =
'';
164 $search_ref_liv =
'';
165 $search_ref_customer =
'';
166 $search_company =
'';
171 $search_country =
'';
172 $search_tracking =
'';
173 $search_type_thirdparty =
'';
175 $search_datedelivery_start =
'';
176 $search_datedelivery_end =
'';
177 $search_datereceipt_start =
'';
178 $search_datereceipt_end =
'';
181 $search_array_options = array();
182 $search_categ_cus = 0;
187 $objectclass =
'Expedition';
188 $objectlabel =
'Sendings';
189 $permissiontoread = $user->rights->expedition->lire;
190 $permissiontoadd = $user->rights->expedition->creer;
191 $permissiontodelete = $user->rights->expedition->supprimer;
192 $uploaddir = $conf->expedition->dir_output.
'/sending';
193 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
203 $form =
new Form($db);
206 $companystatic =
new Societe($db);
210 $helpurl =
'EN:Module_Shipments|FR:Module_Expéditions|ES:Módulo_Expediciones';
211 llxHeader(
'', $langs->trans(
'ListOfSendings'), $helpurl);
214 if ($sall || $search_product_category > 0 || $search_user > 0) $sql =
'SELECT DISTINCT';
215 $sql .=
" e.rowid, e.ref, e.ref_customer, e.date_expedition as date_expedition, e.weight, e.weight_units, e.date_delivery as delivery_date, e.fk_statut, e.billed, e.tracking_number,";
216 $sql .=
" l.date_delivery as date_reception,";
217 $sql .=
" s.rowid as socid, s.nom as name, s.town, s.zip, s.fk_pays, s.client, s.code_client, ";
218 $sql .=
" typent.code as typent_code,";
219 $sql .=
" state.code_departement as state_code, state.nom as state_name,";
220 $sql .=
" e.date_creation as date_creation, e.tms as date_update,";
222 if ($search_categ_cus) $sql .=
", cc.fk_categorie, cc.fk_soc";
224 if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
225 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
' as options_'.$key :
'');
228 $parameters = array();
229 $reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters);
230 $sql .= $hookmanager->resPrint;
231 $sql .=
" FROM ".MAIN_DB_PREFIX.
"expedition as e";
232 if (is_array($extrafields->attributes[$object->table_element][
'label']) && count($extrafields->attributes[$object->table_element][
'label'])) $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (e.rowid = ef.fk_object)";
233 if ($sall || $search_product_category > 0) {
234 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'expeditiondet as ed ON e.rowid=ed.fk_expedition';
235 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'commandedet as pd ON pd.rowid=ed.fk_origin_line';
237 if ($search_product_category > 0) $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'categorie_product as cp ON cp.fk_product=pd.fk_product';
238 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s ON s.rowid = e.fk_soc";
239 if (!empty($search_categ_cus)) $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
"categorie_societe as cc ON s.rowid = cc.fk_soc";
240 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as country on (country.rowid = s.fk_pays)";
241 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_typent as typent on (typent.id = s.fk_typent)";
242 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_departements as state on (state.rowid = s.fk_departement)";
243 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"element_element as ee ON e.rowid = ee.fk_source AND ee.sourcetype = 'shipping' AND ee.targettype = 'delivery'";
244 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"delivery as l ON l.rowid = ee.fk_target";
245 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'user as u ON e.fk_user_author = u.rowid';
246 if ($search_user > 0) {
247 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"element_element as eesource ON eesource.fk_target = e.rowid AND eesource.targettype = 'shipping' AND eesource.sourcetype = 'commande'";
250 if ($search_sale > 0 || (!$user->rights->societe->client->voir && !$socid)) $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
251 if ($search_user > 0) {
252 $sql .=
", ".MAIN_DB_PREFIX.
"element_contact as ec";
253 $sql .=
", ".MAIN_DB_PREFIX.
"c_type_contact as tc";
255 $sql .=
" WHERE e.entity IN (".getEntity(
'expedition').
")";
256 if ($search_product_category > 0) $sql .=
" AND cp.fk_categorie = ".$search_product_category;
257 if ($socid > 0) $sql .=
' AND s.rowid = '.$socid;
258 if (!$user->rights->societe->client->voir && !$socid)
260 $sql .=
" AND e.fk_soc = sc.fk_soc";
261 $sql .=
" AND sc.fk_user = ".$user->id;
265 $sql .=
" AND e.fk_soc = ".$socid;
267 if ($search_status <>
'' && $search_status >= 0) {
268 $sql .=
" AND e.fk_statut = ".$search_status;
270 if ($search_ref_customer !=
'') $sql .=
natural_search(
'e.ref_customer', $search_ref_customer);
271 if ($search_billed !=
'' && $search_billed >= 0) $sql .=
' AND e.billed = '.$search_billed;
274 if ($search_state) $sql .=
natural_search(
"state.nom", $search_state);
275 if ($search_country) $sql .=
" AND s.fk_pays IN (".$search_country.
')';
276 if ($search_tracking) $sql .=
natural_search(
"e.tracking_number", $search_tracking);
277 if ($search_type_thirdparty) $sql .=
" AND s.fk_typent IN (".$search_type_thirdparty.
')';
278 if ($search_sale > 0) $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".$search_sale;
279 if ($search_user > 0)
282 $sql .=
" AND ec.fk_c_type_contact = tc.rowid AND tc.element='commande' AND tc.source='internal' AND ec.element_id = eesource.fk_source AND ec.fk_socpeople = ".$db->escape($search_user);
284 if ($search_ref_exp) $sql .=
natural_search(
'e.ref', $search_ref_exp);
285 if ($search_ref_liv) $sql .=
natural_search(
'l.ref', $search_ref_liv);
286 if ($search_company) $sql .=
natural_search(
's.nom', $search_company);
287 if ($search_datedelivery_start) $sql .=
" AND e.date_delivery >= '".$db->idate($search_datedelivery_start).
"'";
288 if ($search_datedelivery_end) $sql .=
" AND e.date_delivery <= '".$db->idate($search_datedelivery_end).
"'";
289 if ($search_datereceipt_start) $sql .=
" AND l.date_delivery >= '".$db->idate($search_datereceipt_start).
"'";
290 if ($search_datereceipt_end) $sql .=
" AND l.date_delivery <= '".$db->idate($search_datereceipt_end).
"'";
291 if ($sall) $sql .=
natural_search(array_keys($fieldstosearchall), $sall);
292 if ($search_categ_cus > 0) $sql .=
" AND cc.fk_categorie = ".$db->escape($search_categ_cus);
293 if ($search_categ_cus == -2) $sql .=
" AND cc.fk_categorie IS NULL";
296 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
299 $parameters = array();
300 $reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters);
301 $sql .= $hookmanager->resPrint;
303 $sql .= $db->order($sortfield, $sortorder);
305 $nbtotalofrecords =
'';
306 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
308 $result = $db->query($sql);
309 $nbtotalofrecords = $db->num_rows($result);
310 if (($page * $limit) > $nbtotalofrecords)
317 $sql .= $db->plimit($limit + 1, $offset);
320 $resql = $db->query($sql);
323 $num = $db->num_rows(
$resql);
325 $arrayofselected = is_array($toselect) ? $toselect : array();
330 if (!empty($contextpage) && $contextpage !=
$_SERVER[
"PHP_SELF"]) $param .=
'&contextpage='.urlencode($contextpage);
331 if ($limit > 0 && $limit != $conf->liste_limit) $param .=
'&limit='.urlencode($limit);
332 if ($sall) $param .=
"&sall=".urlencode($sall);
333 if ($search_ref_exp) $param .=
"&search_ref_exp=".urlencode($search_ref_exp);
334 if ($search_ref_liv) $param .=
"&search_ref_liv=".urlencode($search_ref_liv);
335 if ($search_ref_customer) $param .=
"&search_ref_customer=".urlencode($search_ref_customer);
336 if ($search_user > 0) $param .=
'&search_user='.urlencode($search_user);
337 if ($search_sale > 0) $param .=
'&search_sale='.urlencode($search_sale);
338 if ($search_company) $param .=
"&search_company=".urlencode($search_company);
339 if ($search_tracking) $param .=
"&search_tracking=".urlencode($search_tracking);
340 if ($search_town) $param .=
'&search_town='.urlencode($search_town);
341 if ($search_zip) $param .=
'&search_zip='.urlencode($search_zip);
343 if ($search_datedelivery_start) $param .=
'&search_datedelivery_start='.urlencode($search_datedelivery_start);
344 if ($search_datedelivery_end) $param .=
'&search_datedelivery_end='.urlencode($search_datedelivery_end);
345 if ($search_datereceipt_start) $param .=
'&search_datereceipt_start='.urlencode($search_datereceipt_start);
346 if ($search_datereceipt_end) $param .=
'&search_datereceipt_end='.urlencode($search_datereceipt_end);
348 if ($search_product_category !=
'') $param .=
'&search_product_category='.urlencode($search_product_category);
349 if ($search_categ_cus > 0) $param .=
'&search_categ_cus='.urlencode($search_categ_cus);
350 if ($search_status !=
'') $param .=
'&search_status='.urlencode($search_status);
351 if ($optioncss !=
'') $param .=
'&optioncss='.urlencode($optioncss);
353 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
355 $arrayofmassactions = array(
356 'builddoc' => $langs->trans(
"PDFMerge"),
358 'presend' => $langs->trans(
"SendByMail"),
360 if (in_array($massaction, array(
'presend'))) $arrayofmassactions = array();
361 $massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
367 $newcardbutton =
dolGetButtonTitle($langs->trans(
'NewSending'),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/expedition/card.php?action=create2',
'', $user->rights->expedition->creer);
370 print '<form method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
371 if ($optioncss !=
'')
print '<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
372 print '<input type="hidden" name="token" value="'.newToken().
'">';
373 print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
374 print '<input type="hidden" name="action" value="list">';
375 print '<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
376 print '<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
378 print_barre_liste($langs->trans(
'ListOfSendings'), $page,
$_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'dolly', 0, $newcardbutton,
'', $limit, 0, 0, 1);
380 $topicmail =
"SendShippingRef";
381 $modelmail =
"shipping_send";
383 $trackid =
'shi'.$object->id;
384 include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
388 foreach ($fieldstosearchall as $key => $val) $fieldstosearchall[$key] = $langs->trans($val);
389 print '<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $sall).join(
', ', $fieldstosearchall).
'</div>';
395 if ($user->rights->societe->client->voir || $socid)
397 $langs->load(
"commercial");
398 $moreforfilter .=
'<div class="divsearchfield">';
399 $moreforfilter .= $langs->trans(
'ThirdPartiesOfSaleRepresentative').
': ';
400 $moreforfilter .= $formother->select_salesrepresentatives($search_sale,
'search_sale', $user, 0, 1,
'maxwidth200');
401 $moreforfilter .=
'</div>';
404 if ($user->rights->user->user->lire)
406 $moreforfilter .=
'<div class="divsearchfield">';
407 $moreforfilter .= $langs->trans(
'LinkedToSpecificUsers').
': ';
408 $moreforfilter .= $form->select_dolusers($search_user,
'search_user', 1,
'', 0,
'',
'', 0, 0, 0,
'', 0,
'',
'maxwidth200');
409 $moreforfilter .=
'</div>';
412 if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire && ($user->rights->produit->lire || $user->rights->service->lire))
414 include_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
415 $moreforfilter .=
'<div class="divsearchfield">';
416 $moreforfilter .= $langs->trans(
'IncludingProductWithTag').
': ';
417 $cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, null,
'parent', null, null, 1);
418 $moreforfilter .= $form->selectarray(
'search_product_category', $cate_arbo, $search_product_category, 1, 0, 0,
'', 0, 0, 0, 0,
'maxwidth300', 1);
419 $moreforfilter .=
'</div>';
421 if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire)
423 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
424 $moreforfilter .=
'<div class="divsearchfield">';
425 $moreforfilter .= $langs->trans(
'CustomersProspectsCategoriesShort').
': ';
426 $moreforfilter .= $formother->select_categories(
'customer', $search_categ_cus,
'search_categ_cus', 1);
427 $moreforfilter .=
'</div>';
429 $parameters = array();
430 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters);
431 if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint;
432 else $moreforfilter = $hookmanager->resPrint;
434 if (!empty($moreforfilter))
436 print '<div class="liste_titre liste_titre_bydiv centpercent">';
437 print $moreforfilter;
441 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
442 $selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
443 if ($massactionbutton) $selectedfields .= $form->showCheckAddButtons(
'checkforselect', 1);
445 print '<div class="div-table-responsive">';
446 print '<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
449 print '<tr class="liste_titre_filter">';
451 if (!empty($arrayfields[
'e.ref'][
'checked']))
453 print
'<td class="liste_titre">';
454 print
'<input class="flat" size="6" type="text" name="search_ref_exp" value="'.$search_ref_exp.
'">';
458 if (!empty($arrayfields[
'e.ref_customer'][
'checked']))
460 print
'<td class="liste_titre">';
461 print
'<input class="flat" size="6" type="text" name="search_ref_customer" value="'.$search_ref_customer.
'">';
465 if (!empty($arrayfields[
's.nom'][
'checked']))
467 print
'<td class="liste_titre left">';
468 print
'<input class="flat" type="text" size="8" name="search_company" value="'.dol_escape_htmltag($search_company).
'">';
472 if (!empty($arrayfields[
's.town'][
'checked'])) print
'<td class="liste_titre"><input class="flat" type="text" size="6" name="search_town" value="'.$search_town.
'"></td>';
474 if (!empty($arrayfields[
's.zip'][
'checked'])) print
'<td class="liste_titre"><input class="flat" type="text" size="6" name="search_zip" value="'.$search_zip.
'"></td>';
476 if (!empty($arrayfields[
'state.nom'][
'checked']))
478 print
'<td class="liste_titre">';
479 print
'<input class="flat" size="4" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).
'">';
483 if (!empty($arrayfields[
'country.code_iso'][
'checked']))
485 print
'<td class="liste_titre center">';
486 print $form->select_country($search_country,
'search_country',
'', 0,
'minwidth100imp maxwidth100');
490 if (!empty($arrayfields[
'typent.code'][
'checked']))
492 print
'<td class="liste_titre maxwidthonsmartphone center">';
493 print $form->selectarray(
"search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 0, 0, 0,
'', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ?
'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT));
497 if (!empty($arrayfields[
'e.weight'][
'checked']))
499 print
'<td class="liste_titre maxwidthonsmartphone center">';
504 if (!empty($arrayfields[
'e.date_delivery'][
'checked']))
506 print
'<td class="liste_titre center">';
507 print
'<div class="nowrap">';
508 print $langs->trans(
'From').
' ';
509 print $form->selectDate($search_delivery_start ? $search_delivery_start : -1,
'search_delivery_start', 0, 0, 1);
511 print
'<div class="nowrap">';
512 print $langs->trans(
'to').
' ';
513 print $form->selectDate($search_delivery_end ? $search_delivery_end : -1,
'search_delivery_end', 0, 0, 1);
518 if (!empty($arrayfields[
'e.tracking_number'][
'checked']))
520 print
'<td class="liste_titre center">';
521 print
'<input class="flat" size="6" type="text" name="search_tracking" value="'.dol_escape_htmltag($search_tracking).
'">';
524 if (!empty($arrayfields[
'l.ref'][
'checked']))
527 print
'<td class="liste_titre">';
528 print
'<input class="flat" size="10" type="text" name="search_ref_liv" value="'.$search_ref_liv.
'"';
531 if (!empty($arrayfields[
'l.date_delivery'][
'checked']))
534 print
'<td class="liste_titre center">';
535 print
'<div class="nowrap">';
536 print $langs->trans(
'From').
' ';
537 print $form->selectDate($search_receipt_start ? $search_receipt_start : -1,
'search_receipt_start', 0, 0, 1);
539 print
'<div class="nowrap">';
540 print $langs->trans(
'to').
' ';
541 print $form->selectDate($search_receipt_end ? $search_receipt_end : -1,
'search_receipt_end', 0, 0, 1);
546 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
549 $parameters = array(
'arrayfields'=>$arrayfields);
550 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters);
551 print $hookmanager->resPrint;
553 if (!empty($arrayfields[
'e.datec'][
'checked']))
555 print
'<td class="liste_titre">';
559 if (!empty($arrayfields[
'e.tms'][
'checked']))
561 print
'<td class="liste_titre">';
565 if (!empty($arrayfields[
'e.fk_statut'][
'checked']))
567 print
'<td class="liste_titre maxwidthonsmartphone right">';
568 print $form->selectarray(
'search_status', array(
'0'=>$langs->trans(
'StatusSendingDraftShort'),
'1'=>$langs->trans(
'StatusSendingValidatedShort'),
'2'=>$langs->trans(
'StatusSendingProcessedShort')), $search_status, 1);
572 if (!empty($arrayfields[
'e.billed'][
'checked']))
574 print
'<td class="liste_titre maxwidthonsmartphone center">';
575 print $form->selectyesno(
'search_billed', $search_billed, 1, 0, 1);
579 print
'<td class="liste_titre middle">';
580 $searchpicto = $form->showFilterAndCheckAddButtons(0);
585 print
'<tr class="liste_titre">';
586 if (!empty($arrayfields[
'e.ref'][
'checked']))
print_liste_field_titre($arrayfields[
'e.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"e.ref",
"", $param,
'', $sortfield, $sortorder);
587 if (!empty($arrayfields[
'e.ref_customer'][
'checked']))
print_liste_field_titre($arrayfields[
'e.ref_customer'][
'label'], $_SERVER[
"PHP_SELF"],
"e.ref_customer",
"", $param,
'', $sortfield, $sortorder);
588 if (!empty($arrayfields[
's.nom'][
'checked']))
print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"s.nom",
"", $param,
'', $sortfield, $sortorder,
'left ');
589 if (!empty($arrayfields[
's.town'][
'checked']))
print_liste_field_titre($arrayfields[
's.town'][
'label'], $_SERVER[
"PHP_SELF"],
's.town',
'', $param,
'', $sortfield, $sortorder);
590 if (!empty($arrayfields[
's.zip'][
'checked']))
print_liste_field_titre($arrayfields[
's.zip'][
'label'], $_SERVER[
"PHP_SELF"],
's.zip',
'', $param,
'', $sortfield, $sortorder);
591 if (!empty($arrayfields[
'state.nom'][
'checked']))
print_liste_field_titre($arrayfields[
'state.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"state.nom",
"", $param,
'', $sortfield, $sortorder);
592 if (!empty($arrayfields[
'country.code_iso'][
'checked']))
print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'], $_SERVER[
"PHP_SELF"],
"country.code_iso",
"", $param,
'', $sortfield, $sortorder,
'center ');
593 if (!empty($arrayfields[
'typent.code'][
'checked']))
print_liste_field_titre($arrayfields[
'typent.code'][
'label'], $_SERVER[
"PHP_SELF"],
"typent.code",
"", $param,
'', $sortfield, $sortorder,
'center ');
594 if (!empty($arrayfields[
'e.weight'][
'checked']))
print_liste_field_titre($arrayfields[
'e.weight'][
'label'], $_SERVER[
"PHP_SELF"],
"e.weight",
"", $param,
'', $sortfield, $sortorder,
'center ');
595 if (!empty($arrayfields[
'e.date_delivery'][
'checked']))
print_liste_field_titre($arrayfields[
'e.date_delivery'][
'label'], $_SERVER[
"PHP_SELF"],
"e.date_delivery",
"", $param,
'', $sortfield, $sortorder,
'center ');
596 if (!empty($arrayfields[
'e.tracking_number'][
'checked']))
print_liste_field_titre($arrayfields[
'e.tracking_number'][
'label'], $_SERVER[
"PHP_SELF"],
"e.tracking_number",
"", $param,
'', $sortfield, $sortorder,
'center ');
597 if (!empty($arrayfields[
'l.ref'][
'checked']))
print_liste_field_titre($arrayfields[
'l.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"l.ref",
"", $param,
'', $sortfield, $sortorder);
598 if (!empty($arrayfields[
'l.date_delivery'][
'checked']))
print_liste_field_titre($arrayfields[
'l.date_delivery'][
'label'], $_SERVER[
"PHP_SELF"],
"l.date_delivery",
"", $param,
'', $sortfield, $sortorder,
'center ');
600 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
602 $parameters = array(
'arrayfields'=>$arrayfields,
'param'=>$param,
'sortfield'=>$sortfield,
'sortorder'=>$sortorder);
603 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters);
604 print $hookmanager->resPrint;
605 if (!empty($arrayfields[
'e.datec'][
'checked']))
print_liste_field_titre($arrayfields[
'e.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"e.date_creation",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
606 if (!empty($arrayfields[
'e.tms'][
'checked']))
print_liste_field_titre($arrayfields[
'e.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"e.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
607 if (!empty($arrayfields[
'e.fk_statut'][
'checked']))
print_liste_field_titre($arrayfields[
'e.fk_statut'][
'label'], $_SERVER[
"PHP_SELF"],
"e.fk_statut",
"", $param,
'', $sortfield, $sortorder,
'right ');
608 if (!empty($arrayfields[
'e.billed'][
'checked']))
print_liste_field_titre($arrayfields[
'e.billed'][
'label'], $_SERVER[
"PHP_SELF"],
"e.billed",
"", $param,
'', $sortfield, $sortorder,
'center ');
609 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ');
612 $typenArray = $formcompany->typent_array(1);
614 $totalarray = array();
615 while ($i < min($num, $limit))
617 $obj = $db->fetch_object(
$resql);
619 $shipment->id = $obj->rowid;
620 $shipment->ref = $obj->ref;
622 $companystatic->id = $obj->socid;
623 $companystatic->ref = $obj->name;
624 $companystatic->name = $obj->name;
627 $object->fetch($obj->rowid);
629 print
'<tr class="oddeven">';
632 if (!empty($arrayfields[
'e.ref'][
'checked']))
635 print $shipment->getNomUrl(1);
637 if (!$i) $totalarray[
'nbfield']++;
641 if (!empty($arrayfields[
'e.ref_customer'][
'checked']))
644 print $obj->ref_customer;
646 if (!$i) $totalarray[
'nbfield']++;
650 if (!empty($arrayfields[
's.nom'][
'checked']))
653 print $companystatic->getNomUrl(1);
655 if (!$i) $totalarray[
'nbfield']++;
658 if (!empty($arrayfields[
's.town'][
'checked']))
660 print
'<td class="nocellnopadd">';
663 if (!$i) $totalarray[
'nbfield']++;
666 if (!empty($arrayfields[
's.zip'][
'checked']))
668 print
'<td class="nocellnopadd">';
671 if (!$i) $totalarray[
'nbfield']++;
674 if (!empty($arrayfields[
'state.nom'][
'checked']))
676 print
"<td>".$obj->state_name.
"</td>\n";
677 if (!$i) $totalarray[
'nbfield']++;
680 if (!empty($arrayfields[
'country.code_iso'][
'checked']))
682 print
'<td class="center">';
684 print $tmparray[
'label'];
686 if (!$i) $totalarray[
'nbfield']++;
689 if (!empty($arrayfields[
'typent.code'][
'checked']))
691 print
'<td class="center">';
692 if (isset($typenArray[$obj->typent_code])) print $typenArray[$obj->typent_code];
694 if (!$i) $totalarray[
'nbfield']++;
697 if (!empty($arrayfields[
'e.weight'][
'checked']))
699 print
'<td class="center">';
700 if (empty($object->trueWeight))
702 $tmparray = $object->getTotalWeightVolume();
703 print
showDimensionInBestUnit($tmparray[
'weight'], 0,
"weight", $langs, isset($conf->global->MAIN_WEIGHT_DEFAULT_ROUND) ? $conf->global->MAIN_WEIGHT_DEFAULT_ROUND : -1, isset($conf->global->MAIN_WEIGHT_DEFAULT_UNIT) ? $conf->global->MAIN_WEIGHT_DEFAULT_UNIT :
'no');
704 print $form->textwithpicto(
'', $langs->trans(
'EstimatedWeight'), 1);
706 print $object->trueWeight;
707 print ($object->trueWeight && $object->weight_units !=
'') ?
' '.measuringUnitString(0,
"weight", $object->weight_units) :
'';
710 if (!$i) $totalarray[
'nbfield']++;
713 if (!empty($arrayfields[
'e.date_delivery'][
'checked']))
715 print
'<td class="center">';
724 if (!empty($arrayfields[
'e.tracking_number'][
'checked']))
726 print
'<td class="center">'.$obj->tracking_number.
"</td>\n";
727 if (!$i) $totalarray[
'nbfield']++;
730 if (!empty($arrayfields[
'l.ref'][
'checked']) || !empty($arrayfields[
'l.date_delivery'][
'checked']))
732 $shipment->fetchObjectLinked($shipment->id, $shipment->element);
734 if (is_array($shipment->linkedObjects[
'delivery']) && count($shipment->linkedObjects[
'delivery']) > 0) $receiving = reset($shipment->linkedObjects[
'delivery']);
736 if (!empty($arrayfields[
'l.ref'][
'checked']))
740 print !empty($receiving) ? $receiving->getNomUrl($db) :
'';
744 if (!empty($arrayfields[
'l.date_delivery'][
'checked']))
747 print
'<td class="center">';
754 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
756 $parameters = array(
'arrayfields'=>$arrayfields,
'obj'=>$obj,
'i'=>$i,
'totalarray'=>&$totalarray);
757 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters);
758 print $hookmanager->resPrint;
760 if (!empty($arrayfields[
'e.datec'][
'checked']))
762 print
'<td class="center nowrap">';
763 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuser');
765 if (!$i) $totalarray[
'nbfield']++;
768 if (!empty($arrayfields[
'e.tms'][
'checked']))
770 print
'<td class="center nowrap">';
771 print
dol_print_date($db->jdate($obj->date_update),
'dayhour',
'tzuser');
773 if (!$i) $totalarray[
'nbfield']++;
776 if (!empty($arrayfields[
'e.fk_statut'][
'checked']))
778 print
'<td class="right nowrap">'.$shipment->LibStatut($obj->fk_statut, 5).
'</td>';
779 if (!$i) $totalarray[
'nbfield']++;
782 if (!empty($arrayfields[
'e.billed'][
'checked']))
784 print
'<td class="center">'.yn($obj->billed).
'</td>';
785 if (!$i) $totalarray[
'nbfield']++;
789 print
'<td class="nowrap" align="center">';
790 if ($massactionbutton || $massaction)
793 if (in_array($obj->rowid, $arrayofselected)) $selected = 1;
794 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
797 if (!$i) $totalarray[
'nbfield']++;
805 $parameters = array(
'arrayfields'=>$arrayfields,
'totalarray' => $totalarray,
'sql'=>$sql);
806 $reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters);
807 print $hookmanager->resPrint;
813 $hidegeneratedfilelistifempty = 1;
814 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) $hidegeneratedfilelistifempty = 0;
817 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
818 $urlsource .= str_replace(
'&',
'&', $param);
820 $filedir = $diroutputmassaction;
821 $genallowed = $user->rights->expedition->lire;
822 $delallowed = $user->rights->expedition->creer;
825 print $formfile->showdocuments(
'massfilesarea_sendings',
'', $filedir, $urlsource, 0, $delallowed,
'', 1, 1, 0, 48, 1, $param, $title,
'',
'',
'', null, $hidegeneratedfilelistifempty);
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm= 'auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
dolGetButtonTitle($label, $helpText= '', $iconClass= 'fa fa-file', $url= '', $id= '', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
dol_now($mode= 'auto')
Return date for now.
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
print_barre_liste($titre, $page, $file, $options= '', $sortfield= '', $sortorder= '', $morehtmlcenter= '', $num=-1, $totalnboflines= '', $picto= 'generic', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow= '')
Print a title with navigation controls for pagination.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname.
Class to manage third parties objects (customers, suppliers, prospects...)
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
showDimensionInBestUnit($dimension, $unit, $type, $outputlangs, $round=-1, $forceunitoutput= 'no')
Output a dimension with best unit.
Class to manage shipments.
restrictedArea($user, $features, $objectid=0, $tableandshare= '', $feature2= '', $dbt_keyfield= 'fk_soc', $dbt_select= 'rowid', $isdraft=0)
Check permissions of a user to show a page and an object.
natural_search($fields, $value, $mode=0, $nofirstand=0)
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
print $_SERVER["PHP_SELF"]
Edit parameters.
dol_sort_array(&$array, $index, $order= 'asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by second index function, which produces ascending (default) or descending output...
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...
getCountry($searchkey, $withcode= '', $dbtouse=0, $outputlangs= '', $entconv=1, $searchlabel= '')
Return country label, code or id from an id, code or label.