31require 
'../main.inc.php';
 
   32require_once DOL_DOCUMENT_ROOT.
'/expedition/class/expedition.class.php';
 
   33require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
 
   34require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
 
   35require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
 
   36require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
 
   37require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
 
   38require_once DOL_DOCUMENT_ROOT.
'/core/lib/product.lib.php';
 
   41$langs->loadLangs(array(
"sendings", 
"deliveries", 
'companies', 
'bills', 
'products'));
 
   43$contextpage = 
GETPOST(
'contextpage', 
'aZ') ?
GETPOST(
'contextpage', 
'aZ') : 
'shipmentlist'; 
 
   45$socid = 
GETPOST(
'socid', 
'int');
 
   47$action     = 
GETPOST(
'action', 
'alpha');
 
   48$massaction = 
GETPOST(
'massaction', 
'alpha');
 
   49$show_files = 
GETPOST(
'show_files', 
'int');
 
   50$toselect   = 
GETPOST(
'toselect', 
'array');
 
   53$expeditionid = 
GETPOST(
'id', 
'int');
 
   55  $socid = $user->socid;
 
   59$search_ref_exp = 
GETPOST(
"search_ref_exp", 
'alpha');
 
   60$search_ref_liv = 
GETPOST(
'search_ref_liv', 
'alpha');
 
   61$search_ref_customer = 
GETPOST(
'search_ref_customer', 
'alpha');
 
   62$search_company = 
GETPOST(
"search_company", 
'alpha');
 
   63$search_shipping_method_id = 
GETPOST(
'search_shipping_method_id');
 
   64$search_tracking = 
GETPOST(
"search_tracking", 
'alpha');
 
   65$search_town = 
GETPOST(
'search_town', 
'alpha');
 
   66$search_zip = 
GETPOST(
'search_zip', 
'alpha');
 
   67$search_state = 
GETPOST(
"search_state");
 
   68$search_country = 
GETPOST(
"search_country", 
'int');
 
   69$search_type_thirdparty = 
GETPOST(
"search_type_thirdparty", 
'int');
 
   70$search_billed = 
GETPOST(
"search_billed", 
'int');
 
   71$search_datedelivery_start = 
dol_mktime(0, 0, 0, 
GETPOST(
'search_datedelivery_startmonth', 
'int'), 
GETPOST(
'search_datedelivery_startday', 
'int'), 
GETPOST(
'search_datedelivery_startyear', 
'int'));
 
   72$search_datedelivery_end = 
dol_mktime(23, 59, 59, 
GETPOST(
'search_datedelivery_endmonth', 
'int'), 
GETPOST(
'search_datedelivery_endday', 
'int'), 
GETPOST(
'search_datedelivery_endyear', 
'int'));
 
   73$search_datereceipt_start = 
dol_mktime(0, 0, 0, 
GETPOST(
'search_datereceipt_startmonth', 
'int'), 
GETPOST(
'search_datereceipt_startday', 
'int'), 
GETPOST(
'search_datereceipt_startyear', 
'int'));
 
   74$search_datereceipt_end = 
dol_mktime(23, 59, 59, 
GETPOST(
'search_datereceipt_endmonth', 
'int'), 
GETPOST(
'search_datereceipt_endday', 
'int'), 
GETPOST(
'search_datereceipt_endyear', 
'int'));
 
   75$sall = trim((
GETPOST(
'search_all', 
'alphanohtml') != 
'') ?
GETPOST(
'search_all', 
'alphanohtml') : 
GETPOST(
'sall', 
'alphanohtml'));
 
   76$search_user = 
GETPOST(
'search_user', 
'int');
 
   77$search_sale = 
GETPOST(
'search_sale', 
'int');
 
   78$search_categ_cus = 
GETPOST(
"search_categ_cus", 
'int');
 
   79$search_product_category = 
GETPOST(
'search_product_category', 
'int');
 
   80$optioncss = 
GETPOST(
'optioncss', 
'alpha');
 
   81$mode = 
GETPOST(
'mode', 
'alpha');
 
   83$limit = 
GETPOST(
'limit', 
'int') ?
GETPOST(
'limit', 
'int') : $conf->liste_limit;
 
   84$sortfield = 
GETPOST(
'sortfield', 
'aZ09comma');
 
   85$sortorder = 
GETPOST(
'sortorder', 
'aZ09comma');
 
   86$page = GETPOSTISSET(
'pageplusone') ? (
GETPOST(
'pageplusone') - 1) : 
GETPOST(
"page", 
'int');
 
   93if (empty($page) || $page == -1 || (empty($toselect) && $massaction === 
'0')) {
 
   96$offset = $limit * $page;
 
  100$search_status = 
GETPOST(
'search_status', 
'intcomma');
 
  102$diroutputmassaction = $conf->expedition->dir_output.
'/sending/temp/massgeneration/'.$user->id;
 
  105$form = 
new Form($db);
 
  108$hookmanager->initHooks(array(
'shipmentlist'));
 
  112$extrafields->fetch_name_optionals_label($object->table_element);
 
  114$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, 
'', 
'search_');
 
  117$fieldstosearchall = array(
 
  119  's.nom'=>
"ThirdParty",
 
  120  'e.note_public'=>
'NotePublic',
 
  122  'e.tracking_number'=>
"TrackingNumber",
 
  124if (empty($user->socid)) {
 
  125  $fieldstosearchall[
"e.note_private"] = 
"NotePrivate";
 
  128$checkedtypetiers = 0;
 
  130  'e.ref'=>array(
'label'=>$langs->trans(
"Ref"), 
'checked'=>1, 
'position'=>1),
 
  131  'e.ref_customer'=>array(
'label'=>$langs->trans(
"RefCustomer"), 
'checked'=>1, 
'position'=>2),
 
  132  's.nom'=>array(
'label'=>$langs->trans(
"ThirdParty"), 
'checked'=>1, 
'position'=>3),
 
  133  's.town'=>array(
'label'=>$langs->trans(
"Town"), 
'checked'=>1, 
'position'=>4),
 
  134  's.zip'=>array(
'label'=>$langs->trans(
"Zip"), 
'checked'=>1, 
'position'=>5),
 
  135  'state.nom'=>array(
'label'=>$langs->trans(
"StateShort"), 
'checked'=>0, 
'position'=>6),
 
  136  'country.code_iso'=>array(
'label'=>$langs->trans(
"Country"), 
'checked'=>0, 
'position'=>7),
 
  137  'typent.code'=>array(
'label'=>$langs->trans(
"ThirdPartyType"), 
'checked'=>$checkedtypetiers, 
'position'=>8),
 
  138  'e.date_delivery'=>array(
'label'=>$langs->trans(
"DateDeliveryPlanned"), 
'checked'=>1, 
'position'=>9),
 
  139  'e.fk_shipping_method'=>array(
'label'=>$langs->trans(
'SendingMethod'), 
'checked'=>1, 
'position'=>10),
 
  140  'e.tracking_number'=>array(
'label'=>$langs->trans(
"TrackingNumber"), 
'checked'=>1, 
'position'=>11),
 
  141  'e.weight'=>array(
'label'=>$langs->trans(
"Weight"), 
'checked'=>0, 
'position'=>12),
 
  142  'e.datec'=>array(
'label'=>$langs->trans(
"DateCreation"), 
'checked'=>0, 
'position'=>500),
 
  143  'e.tms'=>array(
'label'=>$langs->trans(
"DateModificationShort"), 
'checked'=>0, 
'position'=>500),
 
  144  'e.fk_statut'=>array(
'label'=>$langs->trans(
"Status"), 
'checked'=>1, 
'position'=>1000),
 
  145  'l.ref'=>array(
'label'=>$langs->trans(
"DeliveryRef"), 
'checked'=>1, 
'enabled'=>(
getDolGlobalInt(
'MAIN_SUBMODULE_DELIVERY') ? 1 : 0)),
 
  146  'l.date_delivery'=>array(
'label'=>$langs->trans(
"DateReceived"), 
'checked'=>1, 
'enabled'=>(
getDolGlobalInt(
'MAIN_SUBMODULE_DELIVERY') ? 1 : 0)),
 
  147  'e.billed'=>array(
'label'=>$langs->trans(
"Billed"), 
'checked'=>1, 
'position'=>1000, 
'enabled'=>(!empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)))
 
  151include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
 
  162if (
GETPOST(
'cancel', 
'alpha')) {
 
  163  $action = 
'list'; $massaction = 
'';
 
  165if (!
GETPOST(
'confirmmassaction', 
'alpha') && $massaction != 
'presend' && $massaction != 
'confirm_presend') {
 
  169$parameters = array(
'socid'=>$socid);
 
  170$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action); 
 
  175include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
 
  178if (
GETPOST(
'button_removefilter_x', 
'alpha') || 
GETPOST(
'button_removefilter.x', 
'alpha') || 
GETPOST(
'button_removefilter', 
'alpha')) { 
 
  182  $search_product_category = 
'';
 
  183  $search_ref_exp = 
'';
 
  184  $search_ref_liv = 
'';
 
  185  $search_ref_customer = 
'';
 
  186  $search_company = 
'';
 
  191  $search_country = 
'';
 
  192  $search_tracking = 
'';
 
  193  $search_shipping_method_id = 
'';
 
  194  $search_type_thirdparty = 
'';
 
  196  $search_datedelivery_start = 
'';
 
  197  $search_datedelivery_end = 
'';
 
  198  $search_datereceipt_start = 
'';
 
  199  $search_datereceipt_end = 
'';
 
  202  $search_array_options = array();
 
  203  $search_categ_cus = 0;
 
  206if (empty($reshook)) {
 
  207  $objectclass  = 
'Expedition';
 
  208  $objectlabel  = 
'Sendings';
 
  209  $permissiontoread   = $user->rights->expedition->lire;
 
  210  $permissiontoadd = $user->rights->expedition->creer;
 
  211  $permissiontodelete = $user->rights->expedition->supprimer;
 
  212  $uploaddir = $conf->expedition->dir_output.
'/sending';
 
  213  include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
 
  217if ($massaction == 
'classifyclose') {
 
  219  $selectids = 
GETPOST(
'toselect', 
'array');
 
  220  foreach ($selectids as $selectid) {
 
  222    $object->fetch($selectid);
 
  223    $result = $object->setClosed();
 
  226  $massaction = $action = 
'classifyclose';
 
  237    header(
'Location: '.$_SERVER[
"PHP_SELF"]);
 
  251$form = 
new Form($db);
 
  254$companystatic = 
new Societe($db);
 
  258$helpurl = 
'EN:Module_Shipments|FR:Module_Expéditions|ES:Módulo_Expediciones';
 
  259llxHeader(
'', $langs->trans(
'ListOfSendings'), $helpurl);
 
  262if ($sall || $search_user > 0) {
 
  263  $sql = 
'SELECT DISTINCT';
 
  265$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, e.fk_shipping_method,";
 
  268  $sql .= 
" l.date_delivery as date_reception,";
 
  270$sql .= 
" s.rowid as socid, s.nom as name, s.town, s.zip, s.fk_pays, s.client, s.code_client, ";
 
  271$sql .= 
" typent.code as typent_code,";
 
  272$sql .= 
" state.code_departement as state_code, state.nom as state_name,";
 
  273$sql .= 
" e.date_creation as date_creation, e.tms as date_update,";
 
  275if (($search_categ_cus > 0) || ($search_categ_cus == -2)) {
 
  276  $sql .= 
", cc.fk_categorie, cc.fk_soc";
 
  279if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
 
  280  foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) {
 
  281    $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] != 
'separate' ? 
", ef.".$key.
" as options_".$key : 
'');
 
  285$parameters = array();
 
  286$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters); 
 
  287$sql .= $hookmanager->resPrint;
 
  291$sql .= 
" FROM ".MAIN_DB_PREFIX.
"expedition as e";
 
  292if (!empty($extrafields->attributes[$object->table_element][
'label']) && is_array($extrafields->attributes[$object->table_element][
'label']) && count($extrafields->attributes[$object->table_element][
'label'])) {
 
  293  $sql .= 
" LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element.
"_extrafields as ef on (e.rowid = ef.fk_object)";
 
  296  $sql .= 
' LEFT JOIN '.MAIN_DB_PREFIX.
'expeditiondet as ed ON e.rowid=ed.fk_expedition';
 
  297  $sql .= 
' LEFT JOIN '.MAIN_DB_PREFIX.
'commandedet as pd ON pd.rowid=ed.fk_origin_line';
 
  299$sql .= 
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s ON s.rowid = e.fk_soc";
 
  300if (($search_categ_cus > 0) || ($search_categ_cus == -2)) {
 
  301  $sql .= 
' LEFT JOIN '.MAIN_DB_PREFIX.
"categorie_societe as cc ON s.rowid = cc.fk_soc"; 
 
  303$sql .= 
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as country on (country.rowid = s.fk_pays)";
 
  304$sql .= 
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_typent as typent on (typent.id = s.fk_typent)";
 
  305$sql .= 
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_departements as state on (state.rowid = s.fk_departement)";
 
  308  $sql .= 
" LEFT JOIN ".MAIN_DB_PREFIX.
"element_element as ee ON e.rowid = ee.fk_source AND ee.sourcetype = 'shipping' AND ee.targettype = 'delivery'";
 
  309  $sql .= 
" LEFT JOIN ".MAIN_DB_PREFIX.
"delivery as l ON l.rowid = ee.fk_target";
 
  311$sql .= 
' LEFT JOIN '.MAIN_DB_PREFIX.
'user as u ON e.fk_user_author = u.rowid';
 
  312if ($search_user > 0) {   
 
  313  $sql .= 
" LEFT JOIN ".MAIN_DB_PREFIX.
"element_element as eesource ON eesource.fk_target = e.rowid AND eesource.targettype = 'shipping' AND eesource.sourcetype = 'commande'";
 
  316if ($search_sale > 0 || (empty($user->rights->societe->client->voir) && !$socid)) {
 
  317  $sql .= 
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
 
  319if ($search_user > 0) {
 
  320  $sql .= 
", ".MAIN_DB_PREFIX.
"element_contact as ec";
 
  321  $sql .= 
", ".MAIN_DB_PREFIX.
"c_type_contact as tc";
 
  325$parameters = array();
 
  326$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object); 
 
  327$sql .= $hookmanager->resPrint;
 
  329$sql .= 
" WHERE e.entity IN (".getEntity(
'expedition').
")";
 
  332  $sql .= 
" AND s.rowid = ".((int) $socid);
 
  334if (empty($user->rights->societe->client->voir) && !$socid) { 
 
  335  $sql .= 
" AND e.fk_soc = sc.fk_soc";
 
  336  $sql .= 
" AND sc.fk_user = ".((int) $user->id);
 
  339  $sql .= 
" AND e.fk_soc = ".((int) $socid);
 
  341if ($search_status <> 
'' && $search_status >= 0) {
 
  342  $sql .= 
" AND e.fk_statut = ".((int) $search_status);
 
  344if ($search_ref_customer != 
'') {
 
  347if ($search_billed != 
'' && $search_billed >= 0) {
 
  348  $sql .= 
' AND e.billed = '.((int) $search_billed);
 
  359if ($search_country) {
 
  360  $sql .= 
" AND s.fk_pays IN (".$db->sanitize($search_country).
')';
 
  362if ($search_shipping_method_id > 0) {
 
  363  $sql .= 
" AND e.fk_shipping_method = ".((int) $search_shipping_method_id);
 
  365if ($search_tracking) {
 
  368if ($search_type_thirdparty != 
'' && $search_type_thirdparty > 0) {
 
  369  $sql .= 
" AND s.fk_typent IN (".$db->sanitize($search_type_thirdparty).
')';
 
  371if ($search_sale > 0) {
 
  372  $sql .= 
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $search_sale);
 
  374if ($search_user > 0) {
 
  376  $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 = ".((int) $search_user);
 
  378if ($search_company) {
 
  381if ($search_ref_exp) {
 
  384if ($search_datedelivery_start) {
 
  385  $sql .= 
" AND e.date_delivery >= '".$db->idate($search_datedelivery_start).
"'";
 
  387if ($search_datedelivery_end) {
 
  388  $sql .= 
" AND e.date_delivery <= '".$db->idate($search_datedelivery_end).
"'";
 
  391  if ($search_ref_liv) {
 
  394  if ($search_datereceipt_start) {
 
  395    $sql .= 
" AND l.date_delivery >= '".$db->idate($search_datereceipt_start).
"'";
 
  397  if ($search_datereceipt_end) {
 
  398    $sql .= 
" AND l.date_delivery <= '".$db->idate($search_datereceipt_end).
"'";
 
  404if ($search_categ_cus > 0) {
 
  405  $sql .= 
" AND cc.fk_categorie = ".((int) $search_categ_cus);
 
  407if ($search_categ_cus == -2) {
 
  408  $sql .= 
" AND cc.fk_categorie IS NULL";
 
  411$searchCategoryProductOperator = -1;
 
  412$searchCategoryProductList = array($search_product_category);
 
  413if (!empty($searchCategoryProductList)) {
 
  414  $searchCategoryProductSqlList = array();
 
  415  $listofcategoryid = 
'';
 
  416  foreach ($searchCategoryProductList as $searchCategoryProduct) {
 
  417    if (intval($searchCategoryProduct) == -2) {
 
  418      $searchCategoryProductSqlList[] = 
"NOT EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX.
"categorie_product as ck, ".MAIN_DB_PREFIX.
"expeditiondet as ed, ".MAIN_DB_PREFIX.
"commandedet as cd WHERE ed.fk_expedition = e.rowid AND ed.fk_origin_line = cd.rowid AND cd.fk_product = ck.fk_product)";
 
  419    } elseif (intval($searchCategoryProduct) > 0) {
 
  420      if ($searchCategoryProductOperator == 0) {
 
  421        $searchCategoryProductSqlList[] = 
" EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX.
"categorie_product as ck, ".MAIN_DB_PREFIX.
"expeditiondet as ed, ".MAIN_DB_PREFIX.
"commandedet as cd WHERE ed.fk_expedition = e.rowid AND ed.fk_origin_line = cd.rowid AND cd.fk_product = ck.fk_product AND ck.fk_categorie = ".((int) $searchCategoryProduct).
")";
 
  423        $listofcategoryid .= ($listofcategoryid ? 
', ' : 
'') .((
int) $searchCategoryProduct);
 
  427  if ($listofcategoryid) {
 
  428    $searchCategoryProductSqlList[] = 
" EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX.
"categorie_product as ck, ".MAIN_DB_PREFIX.
"expeditiondet as ed, ".MAIN_DB_PREFIX.
"commandedet as cd WHERE ed.fk_expedition = e.rowid AND ed.fk_origin_line = cd.rowid AND cd.fk_product = ck.fk_product AND ck.fk_categorie IN (".$db->sanitize($listofcategoryid).
"))";
 
  430  if ($searchCategoryProductOperator == 1) {
 
  431    if (!empty($searchCategoryProductSqlList)) {
 
  432      $sql .= 
" AND (".implode(
' OR ', $searchCategoryProductSqlList).
")";
 
  435    if (!empty($searchCategoryProductSqlList)) {
 
  436      $sql .= 
" AND (".implode(
' AND ', $searchCategoryProductSqlList).
")";
 
  441include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
 
  444$parameters = array();
 
  445$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters); 
 
  446$sql .= $hookmanager->resPrint;
 
  449$parameters = array();
 
  450$reshook = $hookmanager->executeHooks(
'printFieldListHaving', $parameters, $object); 
 
  451$sql .= empty($hookmanager->resPrint) ? 
"" : 
" HAVING 1=1 ".$hookmanager->resPrint;
 
  453$nbtotalofrecords = 
'';
 
  456  $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields, 
'/').
'/', 
'SELECT COUNT(*) as nbtotalofrecords', $sql);
 
  457  $sqlforcount = preg_replace(
'/GROUP BY .*$/', 
'', $sqlforcount);
 
  458  $resql = $db->query($sqlforcount);
 
  460    $objforcount = $db->fetch_object($resql);
 
  461    $nbtotalofrecords = $objforcount->nbtotalofrecords;
 
  466  if (($page * $limit) > $nbtotalofrecords) { 
 
  474$sql .= $db->order($sortfield, $sortorder);
 
  476  $sql .= $db->plimit($limit + 1, $offset);
 
  480$resql = $db->query($sql);
 
  486$num = $db->num_rows($resql);
 
  488$arrayofselected = is_array($toselect) ? $toselect : array();
 
  494  $param .= 
'&mode='.urlencode($mode);
 
  496if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
 
  497  $param .= 
'&contextpage='.urlencode($contextpage);
 
  499if ($limit > 0 && $limit != $conf->liste_limit) {
 
  500  $param .= 
'&limit='.((int) $limit);
 
  503  $param .= 
"&sall=".urlencode($sall);
 
  505if ($search_ref_exp) {
 
  506  $param .= 
"&search_ref_exp=".urlencode($search_ref_exp);
 
  508if ($search_ref_liv) {
 
  509  $param .= 
"&search_ref_liv=".urlencode($search_ref_liv);
 
  511if ($search_ref_customer) {
 
  512  $param .= 
"&search_ref_customer=".urlencode($search_ref_customer);
 
  514if ($search_user > 0) {
 
  515  $param .= 
'&search_user='.urlencode($search_user);
 
  517if ($search_sale > 0) {
 
  518  $param .= 
'&search_sale='.urlencode($search_sale);
 
  520if ($search_company) {
 
  521  $param .= 
"&search_company=".urlencode($search_company);
 
  523if ($search_shipping_method_id) {
 
  524  $param .= 
"&search_shipping_method_id=".urlencode($search_shipping_method_id);
 
  526if ($search_tracking) {
 
  527  $param .= 
"&search_tracking=".urlencode($search_tracking);
 
  530  $param .= 
'&search_town='.urlencode($search_town);
 
  533  $param .= 
'&search_zip='.urlencode($search_zip);
 
  535if ($search_type_thirdparty != 
'' && $search_type_thirdparty > 0) {
 
  536  $param .= 
'&search_type_thirdparty='.urlencode($search_type_thirdparty);
 
  538if ($search_datedelivery_start) {
 
  539  $param .= 
'&search_datedelivery_startday='.urlencode(
dol_print_date($search_datedelivery_start, 
'%d')).
'&search_datedelivery_startmonth='.urlencode(
dol_print_date($search_datedelivery_start, 
'%m')).
'&search_datedelivery_startyear='.urlencode(
dol_print_date($search_datedelivery_start, 
'%Y'));
 
  541if ($search_datedelivery_end) {
 
  542  $param .= 
'&search_datedelivery_endday='.urlencode(
dol_print_date($search_datedelivery_end, 
'%d')).
'&search_datedelivery_endmonth='.urlencode(
dol_print_date($search_datedelivery_end, 
'%m')).
'&search_datedelivery_endyear='.urlencode(
dol_print_date($search_datedelivery_end, 
'%Y'));
 
  544if ($search_datereceipt_start) {
 
  545  $param .= 
'&search_datereceipt_startday='.urlencode(
dol_print_date($search_datereceipt_start, 
'%d')).
'&search_datereceipt_startmonth='.urlencode(
dol_print_date($search_datereceipt_start, 
'%m')).
'&search_datereceipt_startyear='.urlencode(
dol_print_date($search_datereceipt_start, 
'%Y'));
 
  547if ($search_datereceipt_end) {
 
  548  $param .= 
'&search_datereceipt_endday='.urlencode(
dol_print_date($search_datereceipt_end, 
'%d')).
'&search_datereceipt_endmonth='.urlencode(
dol_print_date($search_datereceipt_end, 
'%m')).
'&search_datereceipt_endyear='.urlencode(
dol_print_date($search_datereceipt_end, 
'%Y'));
 
  550if ($search_product_category != 
'') {
 
  551  $param .= 
'&search_product_category='.urlencode($search_product_category);
 
  553if (($search_categ_cus > 0) || ($search_categ_cus == -2)) {
 
  554  $param .= 
'&search_categ_cus='.urlencode($search_categ_cus);
 
  556if ($search_status != 
'') {
 
  557  $param .= 
'&search_status='.urlencode($search_status);
 
  559if ($optioncss != 
'') {
 
  560  $param .= 
'&optioncss='.urlencode($optioncss);
 
  563include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
 
  566$parameters = array();
 
  567$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object); 
 
  568$param .= $hookmanager->resPrint;
 
  570$arrayofmassactions = array(
 
  571  'builddoc' => 
img_picto(
'', 
'pdf', 
'class="pictofixedwidth"').$langs->trans(
"PDFMerge"),
 
  572  'classifyclose' => 
img_picto(
'', 
'stop-circle', 
'class="pictofixedwidth"').$langs->trans(
"Close"),
 
  573  'presend'  => 
img_picto(
'', 
'email', 
'class="pictofixedwidth"').$langs->trans(
"SendByMail"),
 
  575if (in_array($massaction, array(
'presend'))) {
 
  576  $arrayofmassactions = array();
 
  578$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
 
  585$newcardbutton .= 
dolGetButtonTitle($langs->trans(
'ViewList'), 
'', 
'fa fa-bars imgforviewmode', $_SERVER[
"PHP_SELF"].
'?mode=common'.preg_replace(
'/(&|\?)*mode=[^&]+/', 
'', $param), 
'', ((empty($mode) || $mode == 
'common') ? 2 : 1), array(
'morecss'=>
'reposition'));
 
  586$newcardbutton .= 
dolGetButtonTitle($langs->trans(
'ViewKanban'), 
'', 
'fa fa-th-list imgforviewmode', $_SERVER[
"PHP_SELF"].
'?mode=kanban'.preg_replace(
'/(&|\?)*mode=[^&]+/', 
'', $param), 
'', ($mode == 
'kanban' ? 2 : 1), array(
'morecss'=>
'reposition'));
 
  587$newcardbutton .= 
dolGetButtonTitle($langs->trans(
'NewSending'), 
'', 
'fa fa-plus-circle', DOL_URL_ROOT.
'/expedition/card.php?action=create2', 
'', $user->rights->expedition->creer);
 
  590print 
'<form method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
 
  591if ($optioncss != 
'') {
 
  592  print 
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
 
  594print 
'<input type="hidden" name="token" value="'.newToken().
'">';
 
  595print 
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
 
  596print 
'<input type="hidden" name="action" value="list">';
 
  597print 
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
 
  598print 
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
 
  599print 
'<input type="hidden" name="mode" value="'.$mode.
'">';
 
  601print_barre_liste($langs->trans(
'ListOfSendings'), $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 
'dolly', 0, $newcardbutton, 
'', $limit, 0, 0, 1);
 
  603$topicmail = 
"SendShippingRef";
 
  604$modelmail = 
"shipping_send";
 
  606$trackid = 
'shi'.$object->id;
 
  607include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
 
  610  foreach ($fieldstosearchall as $key => $val) {
 
  611    $fieldstosearchall[$key] = $langs->trans($val);
 
  613  print 
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $sall).join(
', ', $fieldstosearchall).
'</div>';
 
  619if ($user->rights->user->user->lire) {
 
  620  $langs->load(
"commercial");
 
  621  $moreforfilter .= 
'<div class="divsearchfield">';
 
  622  $tmptitle = $langs->trans(
'ThirdPartiesOfSaleRepresentative');
 
  623  $moreforfilter .= 
img_picto($tmptitle, 
'user', 
'class="pictofixedwidth"');
 
  624  $moreforfilter .= $formother->select_salesrepresentatives($search_sale, 
'search_sale', $user, 0, $tmptitle, 
'maxwidth200');
 
  625  $moreforfilter .= 
'</div>';
 
  628if ($user->rights->user->user->lire) {
 
  629  $moreforfilter .= 
'<div class="divsearchfield">';
 
  630  $tmptitle = $langs->trans(
'LinkedToSpecificUsers');
 
  631  $moreforfilter .= 
img_picto($tmptitle, 
'user', 
'class="pictofixedwidth"');
 
  632  $moreforfilter .= $form->select_dolusers($search_user, 
'search_user', $tmptitle, 
'', 0, 
'', 
'', 0, 0, 0, 
'', 0, 
'', 
'maxwidth200');
 
  633  $moreforfilter .= 
'</div>';
 
  636if (isModEnabled(
'categorie') && $user->hasRight(
'categorie', 
'lire') && ($user->hasRight(
'produit', 
'lire') || $user->hasRight(
'service', 
'lire'))) {
 
  637  include_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
 
  638  $moreforfilter .= 
'<div class="divsearchfield">';
 
  639  $tmptitle = $langs->trans(
'IncludingProductWithTag');
 
  640  $moreforfilter .= 
img_picto($tmptitle, 
'category');
 
  643  $moreforfilter .= $formother->select_categories(Categorie::TYPE_PRODUCT, $search_product_category, 
'search_product_category', 1, $tmptitle);
 
  645  $moreforfilter .= 
'</div>';
 
  647if (isModEnabled(
'categorie') && $user->hasRight(
'categorie', 
'lire')) {
 
  648  require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
 
  649  $moreforfilter .= 
'<div class="divsearchfield">';
 
  650  $tmptitle = $langs->trans(
'CustomersProspectsCategoriesShort');
 
  651  $moreforfilter .= 
img_picto($tmptitle, 
'category');
 
  652  $moreforfilter .= $formother->select_categories(
'customer', $search_categ_cus, 
'search_categ_cus', 1, $tmptitle);
 
  653  $moreforfilter .= 
'</div>';
 
  655$parameters = array();
 
  656$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters); 
 
  657if (empty($reshook)) {
 
  658  $moreforfilter .= $hookmanager->resPrint;
 
  660  $moreforfilter = $hookmanager->resPrint;
 
  663if (!empty($moreforfilter)) {
 
  664  print 
'<div class="liste_titre liste_titre_bydiv centpercent">';
 
  665  print $moreforfilter;
 
  669$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
 
  670$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage, 
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN', 
''));
 
  671if ($massactionbutton) {
 
  672  $selectedfields .= $form->showCheckAddButtons(
'checkforselect', 1); 
 
  675print 
'<div class="div-table-responsive">';
 
  676print 
'<table class="tagtable liste'.($moreforfilter ? 
" listwithfilterbefore" : 
"").
'">'.
"\n";
 
  679print 
'<tr class="liste_titre_filter">';
 
  681if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
 
  682  print 
'<td class="liste_titre middle">';
 
  683  $searchpicto = $form->showFilterButtons(
'left');
 
  688if (!empty($arrayfields[
'e.ref'][
'checked'])) {
 
  689  print 
'<td class="liste_titre">';
 
  690  print 
'<input class="flat" size="6" type="text" name="search_ref_exp" value="'.$search_ref_exp.
'">';
 
  694if (!empty($arrayfields[
'e.ref_customer'][
'checked'])) {
 
  695  print 
'<td class="liste_titre">';
 
  696  print 
'<input class="flat" size="6" type="text" name="search_ref_customer" value="'.$search_ref_customer.
'">';
 
  700if (!empty($arrayfields[
's.nom'][
'checked'])) {
 
  701  print 
'<td class="liste_titre left">';
 
  702  print 
'<input class="flat" type="text" size="8" name="search_company" value="'.dol_escape_htmltag($search_company).
'">';
 
  706if (!empty($arrayfields[
's.town'][
'checked'])) {
 
  707  print 
'<td class="liste_titre"><input class="flat" type="text" size="6" name="search_town" value="'.$search_town.
'"></td>';
 
  710if (!empty($arrayfields[
's.zip'][
'checked'])) {
 
  711  print 
'<td class="liste_titre"><input class="flat" type="text" size="6" name="search_zip" value="'.$search_zip.
'"></td>';
 
  714if (!empty($arrayfields[
'state.nom'][
'checked'])) {
 
  715  print 
'<td class="liste_titre">';
 
  716  print 
'<input class="flat" size="4" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).
'">';
 
  720if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
 
  721  print 
'<td class="liste_titre center">';
 
  722  print $form->select_country($search_country, 
'search_country', 
'', 0, 
'minwidth100imp maxwidth100');
 
  726if (!empty($arrayfields[
'typent.code'][
'checked'])) {
 
  727  print 
'<td class="liste_titre maxwidthonsmartphone center">';
 
  728  print $form->selectarray(
"search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 1, 0, 0, 
'', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 
'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT), 
'', 1);
 
  732if (!empty($arrayfields[
'e.weight'][
'checked'])) {
 
  733  print 
'<td class="liste_titre maxwidthonsmartphone center">';
 
  738if (!empty($arrayfields[
'e.date_delivery'][
'checked'])) {
 
  739  print 
'<td class="liste_titre center">';
 
  740  print 
'<div class="nowrap">';
 
  741  print $form->selectDate($search_datedelivery_start ? $search_datedelivery_start : -1, 
'search_datedelivery_start', 0, 0, 1, 
'', 1, 0, 0, 
'', 
'', 
'', 
'', 1, 
'', $langs->trans(
'From'));
 
  743  print 
'<div class="nowrap">';
 
  744  print $form->selectDate($search_datedelivery_end ? $search_datedelivery_end : -1, 
'search_datedelivery_end', 0, 0, 1, 
'', 1, 0, 0, 
'', 
'', 
'', 
'', 1, 
'', $langs->trans(
'to'));
 
  748if (!empty($arrayfields[
'e.fk_shipping_method'][
'checked'])) {
 
  750  print 
'<td class="liste_titre center">';
 
  751  $shipment->fetch_delivery_methods();
 
  752  print $form->selectarray(
"search_shipping_method_id", $shipment->meths, $search_shipping_method_id, 1, 0, 0, 
"", 1, 0, 0, 
'', 
'maxwidth150');
 
  756if (!empty($arrayfields[
'e.tracking_number'][
'checked'])) {
 
  757  print 
'<td class="liste_titre center">';
 
  758  print 
'<input class="flat" size="6" type="text" name="search_tracking" value="'.dol_escape_htmltag($search_tracking).
'">';
 
  761if (!empty($arrayfields[
'l.ref'][
'checked'])) {
 
  763  print 
'<td class="liste_titre">';
 
  764  print 
'<input class="flat" size="10" type="text" name="search_ref_liv" value="'.dol_escape_htmltag($search_ref_liv).
'"';
 
  767if (!empty($arrayfields[
'l.date_delivery'][
'checked'])) {
 
  769  print 
'<td class="liste_titre center">';
 
  770  print 
'<div class="nowrap">';
 
  771  print $form->selectDate($search_datereceipt_start ? $search_datereceipt_start : -1, 
'search_datereceipt_start', 0, 0, 1, 
'', 1, 0, 0, 
'', 
'', 
'', 
'', 1, 
'', $langs->trans(
'From'));
 
  773  print 
'<div class="nowrap">';
 
  774  print $form->selectDate($search_datereceipt_end ? $search_datereceipt_end : -1, 
'search_datereceipt_end', 0, 0, 1, 
'', 1, 0, 0, 
'', 
'', 
'', 
'', 1, 
'', $langs->trans(
'to'));
 
  779include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
 
  782$parameters = array(
'arrayfields'=>$arrayfields);
 
  783$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters); 
 
  784print $hookmanager->resPrint;
 
  786if (!empty($arrayfields[
'e.datec'][
'checked'])) {
 
  787  print 
'<td class="liste_titre">';
 
  791if (!empty($arrayfields[
'e.tms'][
'checked'])) {
 
  792  print 
'<td class="liste_titre">';
 
  796if (!empty($arrayfields[
'e.fk_statut'][
'checked'])) {
 
  797  print 
'<td class="liste_titre right parentonrightofpage">';
 
  798  print $form->selectarray(
'search_status', array(
'0'=>$langs->trans(
'StatusSendingDraftShort'), 
'1'=>$langs->trans(
'StatusSendingValidatedShort'), 
'2'=>$langs->trans(
'StatusSendingProcessedShort')), $search_status, 1, 0, 0, 
'', 0, 0, 0, 
'', 
'search_status width100 onrightofpage');
 
  802if (!empty($arrayfields[
'e.billed'][
'checked'])) {
 
  803  print 
'<td class="liste_titre maxwidthonsmartphone center">';
 
  804  print $form->selectyesno(
'search_billed', $search_billed, 1, 0, 1);
 
  808if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
 
  809  print 
'<td class="liste_titre middle">';
 
  810  $searchpicto = $form->showFilterAndCheckAddButtons(0);
 
  816print 
'<tr class="liste_titre">';
 
  817if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
 
  818  print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"], 
"", 
'', 
'', 
'', $sortfield, $sortorder, 
'center maxwidthsearch ');
 
  820if (!empty($arrayfields[
'e.ref'][
'checked'])) {
 
  821  print_liste_field_titre($arrayfields[
'e.ref'][
'label'], $_SERVER[
"PHP_SELF"], 
"e.ref", 
"", $param, 
'', $sortfield, $sortorder);
 
  823if (!empty($arrayfields[
'e.ref_customer'][
'checked'])) {
 
  824  print_liste_field_titre($arrayfields[
'e.ref_customer'][
'label'], $_SERVER[
"PHP_SELF"], 
"e.ref_customer", 
"", $param, 
'', $sortfield, $sortorder);
 
  826if (!empty($arrayfields[
's.nom'][
'checked'])) {
 
  827  print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
"PHP_SELF"], 
"s.nom", 
"", $param, 
'', $sortfield, $sortorder, 
'left ');
 
  829if (!empty($arrayfields[
's.town'][
'checked'])) {
 
  830  print_liste_field_titre($arrayfields[
's.town'][
'label'], $_SERVER[
"PHP_SELF"], 
's.town', 
'', $param, 
'', $sortfield, $sortorder);
 
  832if (!empty($arrayfields[
's.zip'][
'checked'])) {
 
  833  print_liste_field_titre($arrayfields[
's.zip'][
'label'], $_SERVER[
"PHP_SELF"], 
's.zip', 
'', $param, 
'', $sortfield, $sortorder);
 
  835if (!empty($arrayfields[
'state.nom'][
'checked'])) {
 
  836  print_liste_field_titre($arrayfields[
'state.nom'][
'label'], $_SERVER[
"PHP_SELF"], 
"state.nom", 
"", $param, 
'', $sortfield, $sortorder);
 
  838if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
 
  839  print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'], $_SERVER[
"PHP_SELF"], 
"country.code_iso", 
"", $param, 
'', $sortfield, $sortorder, 
'center ');
 
  841if (!empty($arrayfields[
'typent.code'][
'checked'])) {
 
  842  print_liste_field_titre($arrayfields[
'typent.code'][
'label'], $_SERVER[
"PHP_SELF"], 
"typent.code", 
"", $param, 
'', $sortfield, $sortorder, 
'center ');
 
  844if (!empty($arrayfields[
'e.weight'][
'checked'])) {
 
  845  print_liste_field_titre($arrayfields[
'e.weight'][
'label'], $_SERVER[
"PHP_SELF"], 
"e.weight", 
"", $param, 
'', $sortfield, $sortorder, 
'center ');
 
  847if (!empty($arrayfields[
'e.date_delivery'][
'checked'])) {
 
  848  print_liste_field_titre($arrayfields[
'e.date_delivery'][
'label'], $_SERVER[
"PHP_SELF"], 
"e.date_delivery", 
"", $param, 
'', $sortfield, $sortorder, 
'center ');
 
  850if (!empty($arrayfields[
'e.fk_shipping_method'][
'checked'])) {
 
  851  print_liste_field_titre($arrayfields[
'e.fk_shipping_method'][
'label'], $_SERVER[
"PHP_SELF"], 
"e.fk_shipping_method", 
"", $param, 
'', $sortfield, $sortorder, 
'center ');
 
  853if (!empty($arrayfields[
'e.tracking_number'][
'checked'])) {
 
  854  print_liste_field_titre($arrayfields[
'e.tracking_number'][
'label'], $_SERVER[
"PHP_SELF"], 
"e.tracking_number", 
"", $param, 
'', $sortfield, $sortorder, 
'center ');
 
  856if (!empty($arrayfields[
'l.ref'][
'checked'])) {
 
  857  print_liste_field_titre($arrayfields[
'l.ref'][
'label'], $_SERVER[
"PHP_SELF"], 
"l.ref", 
"", $param, 
'', $sortfield, $sortorder);
 
  859if (!empty($arrayfields[
'l.date_delivery'][
'checked'])) {
 
  860  print_liste_field_titre($arrayfields[
'l.date_delivery'][
'label'], $_SERVER[
"PHP_SELF"], 
"l.date_delivery", 
"", $param, 
'', $sortfield, $sortorder, 
'center ');
 
  863include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
 
  865$parameters = array(
'arrayfields'=>$arrayfields, 
'param'=>$param, 
'sortfield'=>$sortfield, 
'sortorder'=>$sortorder);
 
  866$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters); 
 
  867print $hookmanager->resPrint;
 
  868if (!empty($arrayfields[
'e.datec'][
'checked'])) {
 
  869  print_liste_field_titre($arrayfields[
'e.datec'][
'label'], $_SERVER[
"PHP_SELF"], 
"e.date_creation", 
"", $param, 
'', $sortfield, $sortorder, 
'center nowrap ');
 
  871if (!empty($arrayfields[
'e.tms'][
'checked'])) {
 
  872  print_liste_field_titre($arrayfields[
'e.tms'][
'label'], $_SERVER[
"PHP_SELF"], 
"e.tms", 
"", $param, 
'', $sortfield, $sortorder, 
'center nowrap ');
 
  874if (!empty($arrayfields[
'e.fk_statut'][
'checked'])) {
 
  875  print_liste_field_titre($arrayfields[
'e.fk_statut'][
'label'], $_SERVER[
"PHP_SELF"], 
"e.fk_statut", 
"", $param, 
'', $sortfield, $sortorder, 
'right ');
 
  877if (!empty($arrayfields[
'e.billed'][
'checked'])) {
 
  878  print_liste_field_titre($arrayfields[
'e.billed'][
'label'], $_SERVER[
"PHP_SELF"], 
"e.billed", 
"", $param, 
'', $sortfield, $sortorder, 
'center ');
 
  880if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
 
  881  print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"], 
"", 
'', 
'', 
'', $sortfield, $sortorder, 
'center maxwidthsearch ');
 
  885$typenArray = $formcompany->typent_array(1);
 
  887$savnbfield = $totalarray[
'nbfield'];
 
  888$totalarray = array();
 
  889$totalarray[
'nbfield'] = 0;
 
  890while ($i < min($num, $limit)) {
 
  891  $obj = $db->fetch_object($resql);
 
  893  $shipment->id = $obj->rowid;
 
  894  $shipment->ref = $obj->ref;
 
  895  $shipment->shipping_method_id=$obj->fk_shipping_method;
 
  897  $companystatic->id = $obj->socid;
 
  898  $companystatic->ref = $obj->name;
 
  899  $companystatic->name = $obj->name;
 
  902  $object->fetch($obj->rowid);
 
  904  if ($mode == 
'kanban') {
 
  906      print 
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
 
  907      print 
'<div class="box-flex-container kanban">';
 
  909    $object->date_delivery = $obj->delivery_date;
 
  910    $object->town = $obj->town;
 
  911    print $object->getKanbanView(
'', array(
'thirdparty' => $companystatic->getNomUrl(1), 
'selected' => in_array($obj->id, $arrayofselected)));
 
  912    if ($i == min($num, $limit) - 1) {
 
  917    print 
'<tr class="oddeven">';
 
  920    if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
 
  921      print 
'<td class="nowrap center">';
 
  922      if ($massactionbutton || $massaction) {   
 
  924        if (in_array($obj->rowid, $arrayofselected)) {
 
  927        print 
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ? 
' checked="checked"' : 
'').
'>';
 
  932    if (!empty($arrayfields[
'e.ref'][
'checked'])) {
 
  933      print 
'<td class="nowraponall">';
 
  934      print $shipment->getNomUrl(1);
 
  937        $totalarray[
'nbfield']++;
 
  942    if (!empty($arrayfields[
'e.ref_customer'][
'checked'])) {
 
  943      print 
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->ref_customer).
'">';
 
  947        $totalarray[
'nbfield']++;
 
  952    if (!empty($arrayfields[
's.nom'][
'checked'])) {
 
  953      print 
'<td class="tdoverflowmax150">';
 
  954      print $companystatic->getNomUrl(1);
 
  957        $totalarray[
'nbfield']++;
 
  961    if (!empty($arrayfields[
's.town'][
'checked'])) {
 
  962      print 
'<td class="nocellnopadd">';
 
  966        $totalarray[
'nbfield']++;
 
  970    if (!empty($arrayfields[
's.zip'][
'checked'])) {
 
  971      print 
'<td class="nocellnopadd center">';
 
  975        $totalarray[
'nbfield']++;
 
  979    if (!empty($arrayfields[
'state.nom'][
'checked'])) {
 
  980      print 
'<td class="center">'.$obj->state_name.
"</td>\n";
 
  982        $totalarray[
'nbfield']++;
 
  986    if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
 
  987      print 
'<td class="center">';
 
  992        $totalarray[
'nbfield']++;
 
  996    if (!empty($arrayfields[
'typent.code'][
'checked'])) {
 
  997      print 
'<td class="center">';
 
  998      if (isset($typenArray[$obj->typent_code])) {
 
  999        print $typenArray[$obj->typent_code];
 
 1003        $totalarray[
'nbfield']++;
 
 1007    if (!empty($arrayfields[
'e.weight'][
'checked'])) {
 
 1008      print 
'<td class="center">';
 
 1009      if (empty($object->trueWeight)) {
 
 1010        $tmparray = $object->getTotalWeightVolume();
 
 1011        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');
 
 1012        print $form->textwithpicto(
'', $langs->trans(
'EstimatedWeight'), 1);
 
 1014        print $object->trueWeight;
 
 1015        print ($object->trueWeight && $object->weight_units != 
'') ? 
' '.measuringUnitString(0, 
"weight", $object->weight_units) : 
'';
 
 1019        $totalarray[
'nbfield']++;
 
 1023    if (!empty($arrayfields[
'e.date_delivery'][
'checked'])) {
 
 1024      print 
'<td class="center">';
 
 1025      print 
dol_print_date($db->jdate($obj->delivery_date), 
"dayhour");
 
 1028        $totalarray[
'nbfield']++;
 
 1031    if (!empty($arrayfields[
'e.fk_shipping_method'][
'checked'])) {
 
 1033      $code=$langs->getLabelFromKey($db, $shipment->shipping_method_id, 
'c_shipment_mode', 
'rowid', 
'code');
 
 1034      print 
'<td class="center tdoverflowmax150" title="'.dol_escape_htmltag($langs->trans(
"SendingMethod".strtoupper($code))).
'">';
 
 1035      if ($shipment->shipping_method_id > 0) print $langs->trans(
"SendingMethod".strtoupper($code));
 
 1038        $totalarray[
'nbfield']++;
 
 1042    if (!empty($arrayfields[
'e.tracking_number'][
'checked'])) {
 
 1043      $shipment->getUrlTrackingStatus($obj->tracking_number);
 
 1044      print 
'<td class="center">'.$shipment->tracking_url.
"</td>\n";
 
 1047        $totalarray[
'nbfield']++;
 
 1051    if (!empty($arrayfields[
'l.ref'][
'checked']) || !empty($arrayfields[
'l.date_delivery'][
'checked'])) {
 
 1052      $shipment->fetchObjectLinked($shipment->id, $shipment->element);
 
 1054      if (is_array($shipment->linkedObjects[
'delivery']) && count($shipment->linkedObjects[
'delivery']) > 0) {
 
 1055        $receiving = reset($shipment->linkedObjects[
'delivery']);
 
 1058      if (!empty($arrayfields[
'l.ref'][
'checked'])) {
 
 1061        print !empty($receiving) ? $receiving->getNomUrl($db) : 
'';
 
 1065      if (!empty($arrayfields[
'l.date_delivery'][
'checked'])) {
 
 1067        print 
'<td class="center">';
 
 1074    include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
 
 1076    $parameters = array(
'arrayfields'=>$arrayfields, 
'obj'=>$obj, 
'i'=>$i, 
'totalarray'=>&$totalarray);
 
 1077    $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters); 
 
 1078    print $hookmanager->resPrint;
 
 1080    if (!empty($arrayfields[
'e.datec'][
'checked'])) {
 
 1081      print 
'<td class="center nowrap">';
 
 1082      print 
dol_print_date($db->jdate($obj->date_creation), 
'dayhour', 
'tzuser');
 
 1085        $totalarray[
'nbfield']++;
 
 1089    if (!empty($arrayfields[
'e.tms'][
'checked'])) {
 
 1090      print 
'<td class="center nowrap">';
 
 1091      print 
dol_print_date($db->jdate($obj->date_update), 
'dayhour', 
'tzuser');
 
 1094        $totalarray[
'nbfield']++;
 
 1098    if (!empty($arrayfields[
'e.fk_statut'][
'checked'])) {
 
 1099      print 
'<td class="right nowrap">'.$shipment->LibStatut($obj->fk_statut, 5).
'</td>';
 
 1101        $totalarray[
'nbfield']++;
 
 1105    if (!empty($arrayfields[
'e.billed'][
'checked'])) {
 
 1106      print 
'<td class="center">'.yn($obj->billed).
'</td>';
 
 1108        $totalarray[
'nbfield']++;
 
 1113    if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
 
 1114      print 
'<td class="nowrap center">';
 
 1115      if ($massactionbutton || $massaction) {   
 
 1117        if (in_array($obj->rowid, $arrayofselected)) {
 
 1120        print 
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ? 
' checked="checked"' : 
'').
'>';
 
 1125      $totalarray[
'nbfield']++;
 
 1136  foreach ($arrayfields as $key => $val) {
 
 1137    if (!empty($val[
'checked'])) {
 
 1141  print 
'<tr><td colspan="'.$colspan.
'" class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</td></tr>';
 
 1146$parameters = array(
'arrayfields'=>$arrayfields, 
'totalarray' => $totalarray, 
'sql'=>$sql);
 
 1147$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters); 
 
 1148print $hookmanager->resPrint;
 
 1154$hidegeneratedfilelistifempty = 1;
 
 1155if ($massaction == 
'builddoc' || $action == 
'remove_file' || $show_files) {
 
 1156  $hidegeneratedfilelistifempty = 0;
 
 1160$urlsource  = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
 
 1161$urlsource .= str_replace(
'&', 
'&', $param);
 
 1163$filedir    = $diroutputmassaction;
 
 1164$genallowed = $user->rights->expedition->lire;
 
 1165$delallowed = $user->rights->expedition->creer;
 
 1168print $formfile->showdocuments(
'massfilesarea_sendings', 
'', $filedir, $urlsource, 0, $delallowed, 
'', 1, 1, 0, 48, 1, $param, $title, 
'', 
'', 
'', 
null, $hidegeneratedfilelistifempty);
 
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
 
Class to manage shipments.
 
Class to manage third parties objects (customers, suppliers, prospects...)
 
getCountry($searchkey, $withcode='', $dbtouse=0, $outputlangs='', $entconv=1, $searchlabel='')
Return country label, code or id from an id, code or label.
 
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...
 
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
 
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.
 
setEventMessage($mesgs, $style='mesgs', $noduplicate=0)
Set event message in dol_events session 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...
 
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
 
dol_now($mode='auto')
Return date for now.
 
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
 
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
 
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...
 
showDimensionInBestUnit($dimension, $unit, $type, $outputlangs, $round=-1, $forceunitoutput='no', $use_short_label=0)
Output a dimension with best unit.
 
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
 
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
 
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
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.
 
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
 
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
 
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.