2004-10-19 22:43:23 +02:00
< ? php
2005-04-15 10:05:18 +02:00
/* Copyright ( C ) 2001 - 2005 Rodolphe Quiedeville < rodolphe @ quiedeville . org >
2015-06-30 01:34:17 +02:00
* Copyright ( C ) 2004 - 2015 Laurent Destailleur < eldy @ users . sourceforge . net >
2018-10-27 14:43:12 +02:00
* Copyright ( C ) 2005 - 2010 Regis Houssin < regis . houssin @ inodbox . com >
2021-05-14 13:50:12 +02:00
* Copyright ( C ) 2016 - 2021 Ferran Marcet < fmarcet @ 2 byte . es >
2019-03-28 17:27:30 +01:00
* Copyright ( C ) 2019 Nicolas ZABOURI < info @ inovea - conseil . com >
2020-04-02 19:45:28 +02:00
* Copyright ( C ) 2020 Thibault FOUCART < support @ ptibogxiv . net >
2003-11-13 18:36:45 +01:00
*
* This program is free software ; you can redistribute it and / or modify
* it under the terms of the GNU General Public License as published by
2013-01-16 15:36:08 +01:00
* the Free Software Foundation ; either version 3 of the License , or
2003-11-13 18:36:45 +01:00
* ( at your option ) any later version .
*
* This program is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU General Public License for more details .
*
* You should have received a copy of the GNU General Public License
2019-09-23 21:55:30 +02:00
* along with this program . If not , see < https :// www . gnu . org / licenses />.
2003-11-13 18:36:45 +01:00
*/
2005-04-04 21:38:17 +02:00
/**
2014-09-18 20:33:37 +02:00
* \file htdocs / expedition / list . php
2009-08-24 15:01:29 +02:00
* \ingroup expedition
2010-04-21 10:53:55 +02:00
* \brief Page to list all shipments
2009-08-24 15:01:29 +02:00
*/
2003-11-13 18:36:45 +01:00
2012-08-22 23:24:21 +02:00
require '../main.inc.php' ;
2012-08-22 23:11:24 +02:00
require_once DOL_DOCUMENT_ROOT . '/expedition/class/expedition.class.php' ;
2019-08-14 17:04:13 +02:00
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formfile.class.php' ;
2020-04-02 19:43:29 +02:00
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php' ;
2016-04-08 01:00:02 +02:00
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formcompany.class.php' ;
2016-04-08 02:39:57 +02:00
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php' ;
require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php' ;
2020-04-04 12:46:02 +02:00
require_once DOL_DOCUMENT_ROOT . '/core/lib/product.lib.php' ;
2003-11-13 18:36:45 +01:00
2018-05-26 20:51:17 +02:00
// Load translation files required by the page
2021-01-05 10:44:28 +01:00
$langs -> loadLangs ( array ( " sendings " , " deliveries " , 'companies' , 'bills' , 'products' ));
2008-01-17 11:27:59 +01:00
2019-11-12 09:46:08 +01:00
$contextpage = GETPOST ( 'contextpage' , 'aZ' ) ? GETPOST ( 'contextpage' , 'aZ' ) : 'shipmentlist' ; // To manage different context of search
2018-03-31 18:48:27 +02:00
2019-11-12 09:46:08 +01:00
$socid = GETPOST ( 'socid' , 'int' );
2019-08-14 17:04:13 +02:00
$action = GETPOST ( 'action' , 'alpha' );
$massaction = GETPOST ( 'massaction' , 'alpha' );
$show_files = GETPOST ( 'show_files' , 'int' );
$toselect = GETPOST ( 'toselect' , 'array' );
2008-02-25 17:30:43 +01:00
// Security check
2019-01-27 11:55:16 +01:00
$expeditionid = GETPOST ( 'id' , 'int' );
2021-02-25 22:38:35 +01:00
if ( $user -> socid ) {
$socid = $user -> socid ;
}
2019-01-27 11:55:16 +01:00
$result = restrictedArea ( $user , 'expedition' , $expeditionid , '' );
2016-04-08 02:53:10 +02:00
2017-10-03 16:00:52 +02:00
$search_ref_exp = GETPOST ( " search_ref_exp " , 'alpha' );
$search_ref_liv = GETPOST ( 'search_ref_liv' , 'alpha' );
$search_ref_customer = GETPOST ( 'search_ref_customer' , 'alpha' );
$search_company = GETPOST ( " search_company " , 'alpha' );
2021-08-04 17:47:40 +02:00
$search_shipping_method_id = GETPOST ( 'search_shipping_method_id' );
2020-05-19 10:34:55 +02:00
$search_tracking = GETPOST ( " search_tracking " , 'alpha' );
2019-11-12 09:46:08 +01:00
$search_town = GETPOST ( 'search_town' , 'alpha' );
$search_zip = GETPOST ( 'search_zip' , 'alpha' );
2020-08-28 21:27:50 +02:00
$search_state = GETPOST ( " search_state " );
2019-11-12 09:46:08 +01:00
$search_country = GETPOST ( " search_country " , 'int' );
$search_type_thirdparty = GETPOST ( " search_type_thirdparty " , 'int' );
$search_billed = GETPOST ( " search_billed " , 'int' );
2019-12-23 21:25:43 +01:00
$search_datedelivery_start = dol_mktime ( 0 , 0 , 0 , GETPOST ( 'search_datedelivery_startmonth' , 'int' ), GETPOST ( 'search_datedelivery_startday' , 'int' ), GETPOST ( 'search_datedelivery_startyear' , 'int' ));
$search_datedelivery_end = dol_mktime ( 23 , 59 , 59 , GETPOST ( 'search_datedelivery_endmonth' , 'int' ), GETPOST ( 'search_datedelivery_endday' , 'int' ), GETPOST ( 'search_datedelivery_endyear' , 'int' ));
$search_datereceipt_start = dol_mktime ( 0 , 0 , 0 , GETPOST ( 'search_datereceipt_startmonth' , 'int' ), GETPOST ( 'search_datereceipt_startday' , 'int' ), GETPOST ( 'search_datereceipt_startyear' , 'int' ));
$search_datereceipt_end = dol_mktime ( 23 , 59 , 59 , GETPOST ( 'search_datereceipt_endmonth' , 'int' ), GETPOST ( 'search_datereceipt_endday' , 'int' ), GETPOST ( 'search_datereceipt_endyear' , 'int' ));
2019-11-12 09:46:08 +01:00
$sall = trim (( GETPOST ( 'search_all' , 'alphanohtml' ) != '' ) ? GETPOST ( 'search_all' , 'alphanohtml' ) : GETPOST ( 'sall' , 'alphanohtml' ));
2020-04-02 19:43:29 +02:00
$socid = GETPOST ( 'socid' , 'int' );
$search_user = GETPOST ( 'search_user' , 'int' );
$search_sale = GETPOST ( 'search_sale' , 'int' );
2020-08-28 21:27:50 +02:00
$search_categ_cus = GETPOST ( " search_categ_cus " , 'int' );
2020-04-02 19:43:29 +02:00
$search_product_category = GETPOST ( 'search_product_category' , 'int' );
2019-01-27 11:55:16 +01:00
$optioncss = GETPOST ( 'optioncss' , 'alpha' );
2014-09-17 17:58:37 +02:00
2019-11-12 09:46:08 +01:00
$limit = GETPOST ( 'limit' , 'int' ) ? GETPOST ( 'limit' , 'int' ) : $conf -> liste_limit ;
2020-09-18 17:13:01 +02:00
$sortfield = GETPOST ( 'sortfield' , 'aZ09comma' );
2020-09-17 14:31:25 +02:00
$sortorder = GETPOST ( 'sortorder' , 'aZ09comma' );
2020-03-13 13:07:11 +01:00
$page = GETPOSTISSET ( 'pageplusone' ) ? ( GETPOST ( 'pageplusone' ) - 1 ) : GETPOST ( " page " , 'int' );
2021-02-25 22:38:35 +01:00
if ( ! $sortfield ) {
$sortfield = " e.ref " ;
}
if ( ! $sortorder ) {
$sortorder = " DESC " ;
}
if ( empty ( $page ) || $page == - 1 || ( empty ( $toselect ) && $massaction === '0' )) {
$page = 0 ;
} // If $page is not defined, or '' or -1
2015-12-16 19:38:40 +01:00
$offset = $limit * $page ;
2010-11-20 14:08:44 +01:00
$pageprev = $page - 1 ;
$pagenext = $page + 1 ;
2005-04-14 22:08:48 +02:00
2022-01-13 11:00:52 +01:00
$search_status = GETPOST ( 'search_status' , 'intcomma' );
2015-04-18 01:21:22 +02:00
2019-08-14 17:04:13 +02:00
$diroutputmassaction = $conf -> expedition -> dir_output . '/sending/temp/massgeneration/' . $user -> id ;
2018-11-07 12:49:17 +01:00
$object = new Expedition ( $db );
2020-04-04 12:46:02 +02:00
$form = new Form ( $db );
2018-11-07 12:49:17 +01:00
2017-06-10 12:56:28 +02:00
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
2016-04-08 01:00:02 +02:00
$hookmanager -> initHooks ( array ( 'shipmentlist' ));
$extrafields = new ExtraFields ( $db );
// fetch optionals attributes and labels
2019-10-06 14:41:52 +02:00
$extrafields -> fetch_name_optionals_label ( $object -> table_element );
2019-11-12 09:46:08 +01:00
$search_array_options = $extrafields -> getOptionalsFromPost ( $object -> table_element , '' , 'search_' );
2005-08-15 00:29:38 +02:00
2016-01-08 23:59:02 +01:00
// List of fields to search into when doing a "search in all"
$fieldstosearchall = array (
2017-10-13 13:28:26 +02:00
'e.ref' => " Ref " ,
's.nom' => " ThirdParty " ,
'e.note_public' => 'NotePublic' ,
2022-02-25 16:11:16 +01:00
//'e.fk_shipping_method'=>'SendingMethod', // TODO fix this, does not work
2020-05-19 10:34:55 +02:00
'e.tracking_number' => " TrackingNumber " ,
2016-01-08 23:59:02 +01:00
);
2021-02-25 22:38:35 +01:00
if ( empty ( $user -> socid )) {
$fieldstosearchall [ " e.note_private " ] = " NotePrivate " ;
}
2016-01-08 23:59:02 +01:00
2019-11-12 09:46:08 +01:00
$checkedtypetiers = 0 ;
$arrayfields = array (
2021-08-04 17:47:40 +02:00
'e.ref' => array ( 'label' => $langs -> trans ( " Ref " ), 'checked' => 1 , 'position' => 1 ),
'e.ref_customer' => array ( 'label' => $langs -> trans ( " RefCustomer " ), 'checked' => 1 , 'position' => 2 ),
's.nom' => array ( 'label' => $langs -> trans ( " ThirdParty " ), 'checked' => 1 , 'position' => 3 ),
's.town' => array ( 'label' => $langs -> trans ( " Town " ), 'checked' => 1 , 'position' => 4 ),
's.zip' => array ( 'label' => $langs -> trans ( " Zip " ), 'checked' => 1 , 'position' => 5 ),
'state.nom' => array ( 'label' => $langs -> trans ( " StateShort " ), 'checked' => 0 , 'position' => 6 ),
'country.code_iso' => array ( 'label' => $langs -> trans ( " Country " ), 'checked' => 0 , 'position' => 7 ),
'typent.code' => array ( 'label' => $langs -> trans ( " ThirdPartyType " ), 'checked' => $checkedtypetiers , 'position' => 8 ),
'e.date_delivery' => array ( 'label' => $langs -> trans ( " DateDeliveryPlanned " ), 'checked' => 1 , 'position' => 9 ),
2022-02-25 16:11:16 +01:00
'e.fk_shipping_method' => array ( 'label' => $langs -> trans ( 'SendingMethod' ), 'checked' => 1 , 'position' => 10 ),
2021-08-04 17:47:40 +02:00
'e.tracking_number' => array ( 'label' => $langs -> trans ( " TrackingNumber " ), 'checked' => 1 , 'position' => 11 ),
'e.weight' => array ( 'label' => $langs -> trans ( " Weight " ), 'checked' => 0 , 'position' => 12 ),
2017-10-13 13:28:26 +02:00
'e.datec' => array ( 'label' => $langs -> trans ( " DateCreation " ), 'checked' => 0 , 'position' => 500 ),
'e.tms' => array ( 'label' => $langs -> trans ( " DateModificationShort " ), 'checked' => 0 , 'position' => 500 ),
'e.fk_statut' => array ( 'label' => $langs -> trans ( " Status " ), 'checked' => 1 , 'position' => 1000 ),
2020-10-06 15:57:50 +02:00
'l.ref' => array ( 'label' => $langs -> trans ( " DeliveryRef " ), 'checked' => 1 , 'enabled' => ( empty ( $conf -> delivery_note -> enabled ) ? 0 : 1 )),
'l.date_delivery' => array ( 'label' => $langs -> trans ( " DateReceived " ), 'checked' => 1 , 'enabled' => ( empty ( $conf -> delivery_note -> enabled ) ? 0 : 1 )),
2017-10-13 13:28:26 +02:00
'e.billed' => array ( 'label' => $langs -> trans ( " Billed " ), 'checked' => 1 , 'position' => 1000 , 'enabled' => ( ! empty ( $conf -> global -> WORKFLOW_BILL_ON_SHIPMENT )))
2016-02-10 23:37:34 +01:00
);
2016-04-08 01:00:02 +02:00
2016-02-10 23:37:34 +01:00
// Extra fields
2020-12-01 02:41:19 +01:00
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_array_fields.tpl.php' ;
2020-11-06 12:19:45 +01:00
2019-09-02 03:58:00 +02:00
$object -> fields = dol_sort_array ( $object -> fields , 'position' );
$arrayfields = dol_sort_array ( $arrayfields , 'position' );
2016-02-10 23:37:34 +01:00
2016-01-08 23:59:02 +01:00
2016-04-08 01:00:02 +02:00
/*
* Actions
*/
2019-08-14 17:04:13 +02:00
$error = 0 ;
2016-04-08 01:00:02 +02:00
2021-02-25 22:38:35 +01:00
if ( GETPOST ( 'cancel' , 'alpha' )) {
$action = 'list' ; $massaction = '' ;
}
if ( ! GETPOST ( 'confirmmassaction' , 'alpha' ) && $massaction != 'presend' && $massaction != 'confirm_presend' ) {
$massaction = '' ;
}
2016-04-08 01:00:02 +02:00
2019-11-12 09:46:08 +01:00
$parameters = array ( 'socid' => $socid );
$reshook = $hookmanager -> executeHooks ( 'doActions' , $parameters , $object , $action ); // Note that $action and $object may have been modified by some hooks
2021-02-25 22:38:35 +01:00
if ( $reshook < 0 ) {
setEventMessages ( $hookmanager -> error , $hookmanager -> errors , 'errors' );
}
2016-04-08 01:00:02 +02:00
include DOL_DOCUMENT_ROOT . '/core/actions_changeselectedfields.inc.php' ;
// Purge search criteria
2021-02-25 22:38:35 +01:00
if ( GETPOST ( 'button_removefilter_x' , 'alpha' ) || GETPOST ( 'button_removefilter.x' , 'alpha' ) || GETPOST ( 'button_removefilter' , 'alpha' )) { // All tests are required to be compatible with all browsers
2020-04-02 19:43:29 +02:00
$search_categ = '' ;
$search_user = '' ;
$search_sale = '' ;
$search_product_category = '' ;
2020-04-02 19:45:28 +02:00
$search_ref_exp = '' ;
2019-11-12 09:46:08 +01:00
$search_ref_liv = '' ;
$search_ref_customer = '' ;
$search_company = '' ;
$search_town = '' ;
$search_zip = " " ;
$search_state = " " ;
$search_type = '' ;
$search_country = '' ;
2020-10-31 14:32:18 +01:00
$search_tracking = '' ;
2021-08-04 17:47:40 +02:00
$search_shipping_method_id = '' ;
2019-11-12 09:46:08 +01:00
$search_type_thirdparty = '' ;
$search_billed = '' ;
2019-12-23 21:25:43 +01:00
$search_datedelivery_start = '' ;
$search_datedelivery_end = '' ;
$search_datereceipt_start = '' ;
$search_datereceipt_end = '' ;
2020-04-15 15:01:00 +02:00
$search_status = '' ;
2020-10-31 14:32:18 +01:00
$toselect = '' ;
2019-11-12 09:46:08 +01:00
$search_array_options = array ();
2020-04-02 20:10:57 +02:00
$search_categ_cus = 0 ;
2016-04-08 01:00:02 +02:00
}
2021-02-25 22:38:35 +01:00
if ( empty ( $reshook )) {
2020-04-05 02:44:59 +02:00
$objectclass = 'Expedition' ;
$objectlabel = 'Sendings' ;
$permissiontoread = $user -> rights -> expedition -> lire ;
$permissiontoadd = $user -> rights -> expedition -> creer ;
$permissiontodelete = $user -> rights -> expedition -> supprimer ;
$uploaddir = $conf -> expedition -> dir_output . '/sending' ;
include DOL_DOCUMENT_ROOT . '/core/actions_massactions.inc.php' ;
2016-04-08 01:00:02 +02:00
}
2017-06-19 14:31:08 +02:00
2021-11-30 11:46:06 +01:00
// If massaction is close
2021-11-30 11:51:09 +01:00
if ( $massaction == 'classifyclose' ) {
2021-11-30 11:46:06 +01:00
$error = 0 ;
$selectids = GETPOST ( 'toselect' , 'array' );
2021-11-30 11:51:09 +01:00
foreach ( $selectids as $selectid ) {
// $object->fetch($selectid);
2021-11-30 11:46:06 +01:00
$object -> fetch ( $selectid );
$result = $object -> setClosed ();
}
2021-11-30 11:51:09 +01:00
$massaction = $action = 'classifyclose' ;
2021-11-30 11:46:06 +01:00
2021-11-30 11:51:09 +01:00
if ( $result < 0 ) {
2021-11-30 11:46:06 +01:00
$error ++ ;
}
2021-11-30 11:51:09 +01:00
if ( ! $error ) {
2021-11-30 11:46:06 +01:00
$db -> commit ();
setEventMessage ( $langs -> trans ( " Close Done " ));
header ( 'Location: ' . $_SERVER [ " PHP_SELF " ]);
exit ;
} else {
$db -> rollback ();
exit ;
}
}
2017-06-19 14:31:08 +02:00
2009-08-24 15:01:29 +02:00
/*
* View
*/
2005-08-15 00:29:38 +02:00
2020-04-02 19:43:29 +02:00
$now = dol_now ();
2019-11-12 09:46:08 +01:00
$form = new Form ( $db );
2020-04-02 19:43:29 +02:00
$formother = new FormOther ( $db );
2019-08-14 17:04:13 +02:00
$formfile = new FormFile ( $db );
2019-11-12 09:46:08 +01:00
$companystatic = new Societe ( $db );
$formcompany = new FormCompany ( $db );
2020-04-02 19:43:29 +02:00
$shipment = new Expedition ( $db );
2010-04-21 10:53:55 +02:00
2019-11-12 09:46:08 +01:00
$helpurl = 'EN:Module_Shipments|FR:Module_Expéditions|ES:Módulo_Expediciones' ;
2019-01-27 11:55:16 +01:00
llxHeader ( '' , $langs -> trans ( 'ListOfSendings' ), $helpurl );
2006-05-06 12:50:56 +02:00
2020-04-02 19:43:29 +02:00
$sql = 'SELECT' ;
2021-02-25 22:38:35 +01:00
if ( $sall || $search_product_category > 0 || $search_user > 0 ) {
$sql = 'SELECT DISTINCT' ;
}
2021-08-04 17:47:40 +02:00
$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, " ;
2021-01-30 18:09:13 +01:00
$sql .= " l.date_delivery as date_reception, " ;
2020-04-02 19:43:29 +02:00
$sql .= " s.rowid as socid, s.nom as name, s.town, s.zip, s.fk_pays, s.client, s.code_client, " ;
2019-11-12 09:46:08 +01:00
$sql .= " typent.code as typent_code, " ;
$sql .= " state.code_departement as state_code, state.nom as state_name, " ;
2020-04-02 19:43:29 +02:00
$sql .= " e.date_creation as date_creation, e.tms as date_update, " ;
$sql .= " u.login " ;
2021-09-09 17:56:28 +02:00
if (( $search_categ_cus > 0 ) || ( $search_categ_cus == - 2 )) {
2021-02-25 22:38:35 +01:00
$sql .= " , cc.fk_categorie, cc.fk_soc " ;
}
2016-04-08 01:00:02 +02:00
// Add fields from extrafields
2019-11-12 09:46:08 +01:00
if ( ! empty ( $extrafields -> attributes [ $object -> table_element ][ 'label' ])) {
2021-02-25 22:38:35 +01:00
foreach ( $extrafields -> attributes [ $object -> table_element ][ 'label' ] as $key => $val ) {
2021-08-27 22:42:04 +02:00
$sql .= ( $extrafields -> attributes [ $object -> table_element ][ 'type' ][ $key ] != 'separate' ? " , ef. " . $key . " as options_ " . $key : '' );
2021-02-25 22:38:35 +01:00
}
2019-10-16 03:34:32 +02:00
}
2016-04-08 01:00:02 +02:00
// Add fields from hooks
2019-11-12 09:46:08 +01:00
$parameters = array ();
$reshook = $hookmanager -> executeHooks ( 'printFieldListSelect' , $parameters ); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager -> resPrint ;
$sql .= " FROM " . MAIN_DB_PREFIX . " expedition as e " ;
2021-12-08 18:50:42 +01:00
if ( ! empty ( $extrafields -> attributes [ $object -> table_element ][ 'label' ]) && is_array ( $extrafields -> attributes [ $object -> table_element ][ 'label' ]) && count ( $extrafields -> attributes [ $object -> table_element ][ 'label' ])) {
2021-02-25 22:38:35 +01:00
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . $object -> table_element . " _extrafields as ef on (e.rowid = ef.fk_object) " ;
}
2020-04-02 19:43:29 +02:00
if ( $sall || $search_product_category > 0 ) {
2020-04-02 19:45:28 +02:00
$sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'expeditiondet as ed ON e.rowid=ed.fk_expedition' ;
$sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'commandedet as pd ON pd.rowid=ed.fk_origin_line' ;
2020-04-02 19:43:29 +02:00
}
2021-02-25 22:38:35 +01:00
if ( $search_product_category > 0 ) {
$sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'categorie_product as cp ON cp.fk_product=pd.fk_product' ;
}
2019-11-12 09:46:08 +01:00
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . " societe as s ON s.rowid = e.fk_soc " ;
2021-09-09 17:56:28 +02:00
if (( $search_categ_cus > 0 ) || ( $search_categ_cus == - 2 )) {
2021-02-25 22:38:35 +01:00
$sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . " categorie_societe as cc ON s.rowid = cc.fk_soc " ; // We'll need this table joined to the select in order to filter by categ
}
2019-11-12 09:46:08 +01:00
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . " c_country as country on (country.rowid = s.fk_pays) " ;
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . " c_typent as typent on (typent.id = s.fk_typent) " ;
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . " c_departements as state on (state.rowid = s.fk_departement) " ;
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . " element_element as ee ON e.rowid = ee.fk_source AND ee.sourcetype = 'shipping' AND ee.targettype = 'delivery' " ;
2020-10-06 11:04:31 +02:00
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . " delivery as l ON l.rowid = ee.fk_target " ;
2020-04-02 19:43:29 +02:00
$sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'user as u ON e.fk_user_author = u.rowid' ;
2021-01-30 18:09:13 +01:00
if ( $search_user > 0 ) { // Get link to order to get the order id in eesource.fk_source
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . " element_element as eesource ON eesource.fk_target = e.rowid AND eesource.targettype = 'shipping' AND eesource.sourcetype = 'commande' " ;
}
2020-04-02 19:43:29 +02:00
// We'll need this table joined to the select in order to filter by sale
2021-10-22 22:15:59 +02:00
if ( $search_sale > 0 || ( empty ( $user -> rights -> societe -> client -> voir ) && ! $socid )) {
2021-02-25 22:38:35 +01:00
$sql .= " , " . MAIN_DB_PREFIX . " societe_commerciaux as sc " ;
}
2021-01-30 18:09:13 +01:00
if ( $search_user > 0 ) {
2020-04-02 19:43:29 +02:00
$sql .= " , " . MAIN_DB_PREFIX . " element_contact as ec " ;
$sql .= " , " . MAIN_DB_PREFIX . " c_type_contact as tc " ;
2016-04-08 02:39:57 +02:00
}
2021-11-29 16:54:26 +01:00
// Add table from hooks
$parameters = array ();
$reshook = $hookmanager -> executeHooks ( 'printFieldListFrom' , $parameters , $object ); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager -> resPrint ;
2019-11-12 09:46:08 +01:00
$sql .= " WHERE e.entity IN ( " . getEntity ( 'expedition' ) . " ) " ;
2021-02-25 22:38:35 +01:00
if ( $search_product_category > 0 ) {
2021-06-09 15:36:47 +02:00
$sql .= " AND cp.fk_categorie = " . (( int ) $search_product_category );
2021-02-25 22:38:35 +01:00
}
if ( $socid > 0 ) {
2022-01-03 18:15:19 +01:00
$sql .= " AND s.rowid = " . (( int ) $socid );
2021-02-25 22:38:35 +01:00
}
2021-10-22 22:15:59 +02:00
if ( empty ( $user -> rights -> societe -> client -> voir ) && ! $socid ) { // Internal user with no permission to see all
2019-11-12 09:46:08 +01:00
$sql .= " AND e.fk_soc = sc.fk_soc " ;
2021-08-23 17:41:11 +02:00
$sql .= " AND sc.fk_user = " . (( int ) $user -> id );
2008-01-17 11:27:59 +01:00
}
2021-02-25 22:38:35 +01:00
if ( $socid ) {
2021-06-09 15:36:47 +02:00
$sql .= " AND e.fk_soc = " . (( int ) $socid );
2003-11-13 18:36:45 +01:00
}
2020-04-15 15:01:00 +02:00
if ( $search_status <> '' && $search_status >= 0 ) {
2021-04-26 19:12:23 +02:00
$sql .= " AND e.fk_statut = " . (( int ) $search_status );
2015-04-18 01:21:22 +02:00
}
2021-02-25 22:38:35 +01:00
if ( $search_ref_customer != '' ) {
$sql .= natural_search ( 'e.ref_customer' , $search_ref_customer );
}
if ( $search_billed != '' && $search_billed >= 0 ) {
2021-04-26 19:12:23 +02:00
$sql .= ' AND e.billed = ' . (( int ) $search_billed );
2021-02-25 22:38:35 +01:00
}
if ( $search_town ) {
$sql .= natural_search ( 's.town' , $search_town );
}
if ( $search_zip ) {
$sql .= natural_search ( " s.zip " , $search_zip );
}
if ( $search_state ) {
$sql .= natural_search ( " state.nom " , $search_state );
}
if ( $search_country ) {
2021-03-22 11:30:18 +01:00
$sql .= " AND s.fk_pays IN ( " . $db -> sanitize ( $search_country ) . ')' ;
2021-02-25 22:38:35 +01:00
}
2021-08-04 17:47:40 +02:00
if ( $search_shipping_method_id > 0 ) {
2021-08-24 16:38:39 +02:00
$sql .= " AND e.fk_shipping_method = " . (( int ) $search_shipping_method_id );
2021-08-04 17:47:40 +02:00
}
2021-02-25 22:38:35 +01:00
if ( $search_tracking ) {
$sql .= natural_search ( " e.tracking_number " , $search_tracking );
}
if ( $search_type_thirdparty != '' && $search_type_thirdparty > 0 ) {
2021-03-22 11:30:18 +01:00
$sql .= " AND s.fk_typent IN ( " . $db -> sanitize ( $search_type_thirdparty ) . ')' ;
2021-02-25 22:38:35 +01:00
}
if ( $search_sale > 0 ) {
2021-06-09 15:36:47 +02:00
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " . (( int ) $search_sale );
2021-02-25 22:38:35 +01:00
}
if ( $search_user > 0 ) {
2021-01-30 18:09:13 +01:00
// The contact on a shipment is also the contact of the order.
2021-08-23 18:56:46 +02:00
$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 );
2021-01-30 18:09:13 +01:00
}
2021-02-25 22:38:35 +01:00
if ( $search_ref_exp ) {
$sql .= natural_search ( 'e.ref' , $search_ref_exp );
}
if ( $search_ref_liv ) {
$sql .= natural_search ( 'l.ref' , $search_ref_liv );
}
if ( $search_company ) {
$sql .= natural_search ( 's.nom' , $search_company );
}
if ( $search_datedelivery_start ) {
$sql .= " AND e.date_delivery >= ' " . $db -> idate ( $search_datedelivery_start ) . " ' " ;
}
if ( $search_datedelivery_end ) {
$sql .= " AND e.date_delivery <= ' " . $db -> idate ( $search_datedelivery_end ) . " ' " ;
}
if ( $search_datereceipt_start ) {
$sql .= " AND l.date_delivery >= ' " . $db -> idate ( $search_datereceipt_start ) . " ' " ;
}
if ( $search_datereceipt_end ) {
$sql .= " AND l.date_delivery <= ' " . $db -> idate ( $search_datereceipt_end ) . " ' " ;
}
if ( $sall ) {
$sql .= natural_search ( array_keys ( $fieldstosearchall ), $sall );
}
if ( $search_categ_cus > 0 ) {
2021-06-09 15:36:47 +02:00
$sql .= " AND cc.fk_categorie = " . (( int ) $search_categ_cus );
2021-02-25 22:38:35 +01:00
}
if ( $search_categ_cus == - 2 ) {
$sql .= " AND cc.fk_categorie IS NULL " ;
}
2003-11-13 18:36:45 +01:00
2016-04-08 01:00:02 +02:00
// Add where from extra fields
2017-11-27 15:24:29 +01:00
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_search_sql.tpl.php' ;
2016-04-08 01:00:02 +02:00
// Add where from hooks
2019-11-12 09:46:08 +01:00
$parameters = array ();
$reshook = $hookmanager -> executeHooks ( 'printFieldListWhere' , $parameters ); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager -> resPrint ;
2016-04-08 01:00:02 +02:00
2021-11-30 16:27:50 +01:00
// Add HAVING from hooks
$parameters = array ();
$reshook = $hookmanager -> executeHooks ( 'printFieldListHaving' , $parameters , $object ); // Note that $action and $object may have been modified by hook
2021-12-09 17:19:31 +01:00
$sql .= empty ( $hookmanager -> resPrint ) ? " " : " HAVING 1=1 " . $hookmanager -> resPrint ;
2021-11-30 16:27:50 +01:00
2019-11-12 09:46:08 +01:00
$sql .= $db -> order ( $sortfield , $sortorder );
2018-04-24 11:37:57 +02:00
2017-01-15 20:49:20 +01:00
$nbtotalofrecords = '' ;
2021-02-25 22:38:35 +01:00
if ( empty ( $conf -> global -> MAIN_DISABLE_FULL_SCANLIST )) {
2017-10-13 13:28:26 +02:00
$result = $db -> query ( $sql );
$nbtotalofrecords = $db -> num_rows ( $result );
2021-02-25 22:38:35 +01:00
if (( $page * $limit ) > $nbtotalofrecords ) { // if total resultset is smaller then paging size (filtering), goto and load page 0
2018-04-24 11:37:57 +02:00
$page = 0 ;
$offset = 0 ;
}
2016-01-12 08:41:25 +01:00
}
2019-11-12 09:46:08 +01:00
$sql .= $db -> plimit ( $limit + 1 , $offset );
2003-11-13 18:36:45 +01:00
2016-01-13 20:56:20 +01:00
//print $sql;
2019-11-12 09:46:08 +01:00
$resql = $db -> query ( $sql );
2021-02-27 18:33:01 +01:00
if ( ! $resql ) {
dol_print_error ( $db );
exit ;
}
2010-04-21 10:53:55 +02:00
2021-02-27 18:33:01 +01:00
$num = $db -> num_rows ( $resql );
2019-08-14 17:04:13 +02:00
2021-02-27 18:33:01 +01:00
$arrayofselected = is_array ( $toselect ) ? $toselect : array ();
2010-04-21 10:53:55 +02:00
2021-02-27 18:33:01 +01:00
$expedition = new Expedition ( $db );
2021-02-25 22:38:35 +01:00
2021-02-27 18:33:01 +01:00
$param = '' ;
if ( ! empty ( $contextpage ) && $contextpage != $_SERVER [ " PHP_SELF " ]) {
$param .= '&contextpage=' . urlencode ( $contextpage );
}
if ( $limit > 0 && $limit != $conf -> liste_limit ) {
$param .= '&limit=' . urlencode ( $limit );
}
if ( $sall ) {
2021-09-19 21:13:27 +02:00
$param .= " &sall= " . urlencode ( $sall );
2021-02-27 18:33:01 +01:00
}
if ( $search_ref_exp ) {
2021-09-19 21:13:27 +02:00
$param .= " &search_ref_exp= " . urlencode ( $search_ref_exp );
2021-02-27 18:33:01 +01:00
}
if ( $search_ref_liv ) {
2021-09-19 21:13:27 +02:00
$param .= " &search_ref_liv= " . urlencode ( $search_ref_liv );
2021-02-27 18:33:01 +01:00
}
if ( $search_ref_customer ) {
2021-09-19 21:13:27 +02:00
$param .= " &search_ref_customer= " . urlencode ( $search_ref_customer );
2021-02-27 18:33:01 +01:00
}
if ( $search_user > 0 ) {
$param .= '&search_user=' . urlencode ( $search_user );
}
if ( $search_sale > 0 ) {
$param .= '&search_sale=' . urlencode ( $search_sale );
}
if ( $search_company ) {
2021-09-19 21:13:27 +02:00
$param .= " &search_company= " . urlencode ( $search_company );
2021-02-27 18:33:01 +01:00
}
2021-08-04 17:47:40 +02:00
if ( $search_shipping_method_id ) {
$param .= " &search_shipping_method_id= " . urlencode ( $search_shipping_method_id );
}
2021-02-27 18:33:01 +01:00
if ( $search_tracking ) {
2021-09-19 21:13:27 +02:00
$param .= " &search_tracking= " . urlencode ( $search_tracking );
2021-02-27 18:33:01 +01:00
}
if ( $search_town ) {
$param .= '&search_town=' . urlencode ( $search_town );
}
if ( $search_zip ) {
$param .= '&search_zip=' . urlencode ( $search_zip );
}
if ( $search_type_thirdparty != '' && $search_type_thirdparty > 0 ) {
$param .= '&search_type_thirdparty=' . urlencode ( $search_type_thirdparty );
}
2021-05-17 07:57:32 +02:00
if ( $search_datedelivery_start ) {
$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' ));
2021-02-27 18:33:01 +01:00
}
if ( $search_datedelivery_end ) {
2021-05-17 07:57:32 +02:00
$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' ));
2021-02-27 18:33:01 +01:00
}
if ( $search_datereceipt_start ) {
2021-05-17 07:57:32 +02:00
$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' ));
2021-02-27 18:33:01 +01:00
}
if ( $search_datereceipt_end ) {
2021-05-17 07:57:32 +02:00
$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' ));
2021-02-27 18:33:01 +01:00
}
if ( $search_product_category != '' ) {
$param .= '&search_product_category=' . urlencode ( $search_product_category );
}
2021-09-09 17:56:28 +02:00
if (( $search_categ_cus > 0 ) || ( $search_categ_cus == - 2 )) {
2021-02-27 18:33:01 +01:00
$param .= '&search_categ_cus=' . urlencode ( $search_categ_cus );
}
if ( $search_status != '' ) {
$param .= '&search_status=' . urlencode ( $search_status );
}
if ( $optioncss != '' ) {
$param .= '&optioncss=' . urlencode ( $optioncss );
}
// Add $param from extra fields
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_search_param.tpl.php' ;
2020-04-02 19:43:29 +02:00
2021-11-29 17:02:57 +01:00
// Add $param from hooks
$parameters = array ();
$reshook = $hookmanager -> executeHooks ( 'printFieldListSearchParam' , $parameters , $object ); // Note that $action and $object may have been modified by hook
$param .= $hookmanager -> resPrint ;
2021-02-27 18:33:01 +01:00
$arrayofmassactions = array (
2021-04-14 12:28:01 +02:00
'builddoc' => img_picto ( '' , 'pdf' , 'class="pictofixedwidth"' ) . $langs -> trans ( " PDFMerge " ),
2021-11-30 14:11:28 +01:00
'classifyclose' => $langs -> trans ( " Close " ),
2021-04-14 12:28:01 +02:00
'presend' => img_picto ( '' , 'email' , 'class="pictofixedwidth"' ) . $langs -> trans ( " SendByMail " ),
2021-02-27 18:33:01 +01:00
);
if ( in_array ( $massaction , array ( 'presend' ))) {
$arrayofmassactions = array ();
}
$massactionbutton = $form -> selectMassAction ( '' , $arrayofmassactions );
2020-04-02 19:43:29 +02:00
2021-02-27 18:33:01 +01:00
// Currently: a sending can't create from sending list
// $url = DOL_URL_ROOT.'/expedition/card.php?action=create';
// if (!empty($socid)) $url .= '&socid='.$socid;
// $newcardbutton = dolGetButtonTitle($langs->trans('NewSending'), '', 'fa fa-plus-circle', $url, '', $user->rights->expedition->creer);
$newcardbutton = dolGetButtonTitle ( $langs -> trans ( 'NewSending' ), '' , 'fa fa-plus-circle' , DOL_URL_ROOT . '/expedition/card.php?action=create2' , '' , $user -> rights -> expedition -> creer );
2017-10-13 13:28:26 +02:00
2021-02-27 18:33:01 +01:00
$i = 0 ;
print '<form method="POST" action="' . $_SERVER [ " PHP_SELF " ] . '">' . " \n " ;
if ( $optioncss != '' ) {
print '<input type="hidden" name="optioncss" value="' . $optioncss . '">' ;
}
print '<input type="hidden" name="token" value="' . newToken () . '">' ;
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">' ;
print '<input type="hidden" name="action" value="list">' ;
print '<input type="hidden" name="sortfield" value="' . $sortfield . '">' ;
print '<input type="hidden" name="sortorder" value="' . $sortorder . '">' ;
print_barre_liste ( $langs -> trans ( 'ListOfSendings' ), $page , $_SERVER [ " PHP_SELF " ], $param , $sortfield , $sortorder , $massactionbutton , $num , $nbtotalofrecords , 'dolly' , 0 , $newcardbutton , '' , $limit , 0 , 0 , 1 );
$topicmail = " SendShippingRef " ;
$modelmail = " shipping_send " ;
$objecttmp = new Expedition ( $db );
$trackid = 'shi' . $object -> id ;
include DOL_DOCUMENT_ROOT . '/core/tpl/massactions_pre.tpl.php' ;
if ( $sall ) {
foreach ( $fieldstosearchall as $key => $val ) {
$fieldstosearchall [ $key ] = $langs -> trans ( $val );
}
print '<div class="divsearchfieldfilter">' . $langs -> trans ( " FilterOnInto " , $sall ) . join ( ', ' , $fieldstosearchall ) . '</div>' ;
}
$moreforfilter = '' ;
// If the user can view prospects other than his'
2022-05-03 17:05:14 +02:00
if ( $user -> rights -> user -> user -> lire ) {
2021-02-27 18:33:01 +01:00
$langs -> load ( " commercial " );
$moreforfilter .= '<div class="divsearchfield">' ;
2021-03-27 13:17:56 +01:00
$tmptitle = $langs -> trans ( 'ThirdPartiesOfSaleRepresentative' );
2022-05-03 17:05:14 +02:00
$moreforfilter .= img_picto ( $tmptitle , 'user' , 'class="pictofixedwidth"' );
2021-03-27 13:17:56 +01:00
$moreforfilter .= $formother -> select_salesrepresentatives ( $search_sale , 'search_sale' , $user , 0 , $tmptitle , 'maxwidth200' );
2021-02-27 18:33:01 +01:00
$moreforfilter .= '</div>' ;
}
// If the user can view other users
if ( $user -> rights -> user -> user -> lire ) {
$moreforfilter .= '<div class="divsearchfield">' ;
2021-03-27 13:17:56 +01:00
$tmptitle = $langs -> trans ( 'LinkedToSpecificUsers' );
2022-05-03 17:05:14 +02:00
$moreforfilter .= img_picto ( $tmptitle , 'user' , 'class="pictofixedwidth"' );
2021-03-27 13:17:56 +01:00
$moreforfilter .= $form -> select_dolusers ( $search_user , 'search_user' , $tmptitle , '' , 0 , '' , '' , 0 , 0 , 0 , '' , 0 , '' , 'maxwidth200' );
2021-02-27 18:33:01 +01:00
$moreforfilter .= '</div>' ;
}
// If the user can view prospects other than his'
if ( ! empty ( $conf -> categorie -> enabled ) && $user -> rights -> categorie -> lire && ( $user -> rights -> produit -> lire || $user -> rights -> service -> lire )) {
include_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php' ;
$moreforfilter .= '<div class="divsearchfield">' ;
2021-03-27 13:17:56 +01:00
$tmptitle = $langs -> trans ( 'IncludingProductWithTag' );
$moreforfilter .= img_picto ( $tmptitle , 'category' );
//$cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, null, 'parent', null, null, 1);
//$moreforfilter .= $form->selectarray('search_product_category', $cate_arbo, $search_product_category, 1, 0, 0, '', 0, 0, 0, 0, 'maxwidth300', 1);
$moreforfilter .= $formother -> select_categories ( Categorie :: TYPE_PRODUCT , $search_product_category , 'parent' , 1 , $tmptitle );
2021-02-27 18:33:01 +01:00
$moreforfilter .= '</div>' ;
}
if ( ! empty ( $conf -> categorie -> enabled ) && $user -> rights -> categorie -> lire ) {
require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php' ;
$moreforfilter .= '<div class="divsearchfield">' ;
2021-03-27 13:17:56 +01:00
$tmptitle = $langs -> trans ( 'CustomersProspectsCategoriesShort' );
$moreforfilter .= img_picto ( $tmptitle , 'category' );
$moreforfilter .= $formother -> select_categories ( 'customer' , $search_categ_cus , 'search_categ_cus' , 1 , $tmptitle );
2021-02-27 18:33:01 +01:00
$moreforfilter .= '</div>' ;
}
$parameters = array ();
$reshook = $hookmanager -> executeHooks ( 'printFieldPreListTitle' , $parameters ); // Note that $action and $object may have been modified by hook
if ( empty ( $reshook )) {
$moreforfilter .= $hookmanager -> resPrint ;
} else {
$moreforfilter = $hookmanager -> resPrint ;
}
2017-10-13 13:28:26 +02:00
2021-02-27 18:33:01 +01:00
if ( ! empty ( $moreforfilter )) {
print '<div class="liste_titre liste_titre_bydiv centpercent">' ;
print $moreforfilter ;
print '</div>' ;
}
$varpage = empty ( $contextpage ) ? $_SERVER [ " PHP_SELF " ] : $contextpage ;
$selectedfields = $form -> multiSelectArrayWithCheckbox ( 'selectedfields' , $arrayfields , $varpage );
if ( $massactionbutton ) {
$selectedfields .= $form -> showCheckAddButtons ( 'checkforselect' , 1 ); // This also change content of $arrayfields
}
print '<div class="div-table-responsive">' ;
print '<table class="tagtable liste' . ( $moreforfilter ? " listwithfilterbefore " : " " ) . '">' . " \n " ;
// Fields title search
print '<tr class="liste_titre_filter">' ;
// Ref
if ( ! empty ( $arrayfields [ 'e.ref' ][ 'checked' ])) {
print '<td class="liste_titre">' ;
print '<input class="flat" size="6" type="text" name="search_ref_exp" value="' . $search_ref_exp . '">' ;
print '</td>' ;
}
// Ref customer
if ( ! empty ( $arrayfields [ 'e.ref_customer' ][ 'checked' ])) {
print '<td class="liste_titre">' ;
print '<input class="flat" size="6" type="text" name="search_ref_customer" value="' . $search_ref_customer . '">' ;
print '</td>' ;
}
// Thirdparty
if ( ! empty ( $arrayfields [ 's.nom' ][ 'checked' ])) {
print '<td class="liste_titre left">' ;
print '<input class="flat" type="text" size="8" name="search_company" value="' . dol_escape_htmltag ( $search_company ) . '">' ;
print '</td>' ;
}
// Town
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>' ;
}
// Zip
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>' ;
}
// State
if ( ! empty ( $arrayfields [ 'state.nom' ][ 'checked' ])) {
print '<td class="liste_titre">' ;
print '<input class="flat" size="4" type="text" name="search_state" value="' . dol_escape_htmltag ( $search_state ) . '">' ;
print '</td>' ;
}
// Country
if ( ! empty ( $arrayfields [ 'country.code_iso' ][ 'checked' ])) {
print '<td class="liste_titre center">' ;
print $form -> select_country ( $search_country , 'search_country' , '' , 0 , 'minwidth100imp maxwidth100' );
print '</td>' ;
}
// Company type
if ( ! empty ( $arrayfields [ 'typent.code' ][ 'checked' ])) {
print '<td class="liste_titre maxwidthonsmartphone center">' ;
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 );
print '</td>' ;
}
// Weight
if ( ! empty ( $arrayfields [ 'e.weight' ][ 'checked' ])) {
print '<td class="liste_titre maxwidthonsmartphone center">' ;
print '</td>' ;
}
// Date delivery planned
if ( ! empty ( $arrayfields [ 'e.date_delivery' ][ 'checked' ])) {
print '<td class="liste_titre center">' ;
print '<div class="nowrap">' ;
print $form -> selectDate ( $search_datedelivery_start ? $search_datedelivery_start : - 1 , 'search_datedelivery_start' , 0 , 0 , 1 , '' , 1 , 0 , 0 , '' , '' , '' , '' , 1 , '' , $langs -> trans ( 'From' ));
print '</div>' ;
print '<div class="nowrap">' ;
print $form -> selectDate ( $search_datedelivery_end ? $search_datedelivery_end : - 1 , 'search_datedelivery_end' , 0 , 0 , 1 , '' , 1 , 0 , 0 , '' , '' , '' , '' , 1 , '' , $langs -> trans ( 'to' ));
print '</div>' ;
print '</td>' ;
}
2022-02-25 16:11:16 +01:00
if ( ! empty ( $arrayfields [ 'e.fk_shipping_method' ][ 'checked' ])) {
2021-08-04 17:47:40 +02:00
// Delivery method
print '<td class="liste_titre center">' ;
$shipment -> fetch_delivery_methods ();
print $form -> selectarray ( " search_shipping_method_id " , $shipment -> meths , $search_shipping_method_id , 1 , 0 , 0 , " " , 1 );
print " </td> \n " ;
}
2021-02-27 18:33:01 +01:00
// Tracking number
if ( ! empty ( $arrayfields [ 'e.tracking_number' ][ 'checked' ])) {
print '<td class="liste_titre center">' ;
print '<input class="flat" size="6" type="text" name="search_tracking" value="' . dol_escape_htmltag ( $search_tracking ) . '">' ;
print '</td>' ;
}
if ( ! empty ( $arrayfields [ 'l.ref' ][ 'checked' ])) {
// Delivery ref
print '<td class="liste_titre">' ;
print '<input class="flat" size="10" type="text" name="search_ref_liv" value="' . dol_escape_htmltag ( $search_ref_liv ) . '"' ;
print '</td>' ;
}
if ( ! empty ( $arrayfields [ 'l.date_delivery' ][ 'checked' ])) {
// Date received
print '<td class="liste_titre center">' ;
print '<div class="nowrap">' ;
print $form -> selectDate ( $search_datereceipt_start ? $search_datereceipt_start : - 1 , 'search_datereceipt_start' , 0 , 0 , 1 , '' , 1 , 0 , 0 , '' , '' , '' , '' , 1 , '' , $langs -> trans ( 'From' ));
print '</div>' ;
print '<div class="nowrap">' ;
print $form -> selectDate ( $search_datereceipt_end ? $search_datereceipt_end : - 1 , 'search_datereceipt_end' , 0 , 0 , 1 , '' , 1 , 0 , 0 , '' , '' , '' , '' , 1 , '' , $langs -> trans ( 'to' ));
print '</div>' ;
print '</td>' ;
}
// Extra fields
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_search_input.tpl.php' ;
// Fields from hook
$parameters = array ( 'arrayfields' => $arrayfields );
$reshook = $hookmanager -> executeHooks ( 'printFieldListOption' , $parameters ); // Note that $action and $object may have been modified by hook
print $hookmanager -> resPrint ;
// Date creation
if ( ! empty ( $arrayfields [ 'e.datec' ][ 'checked' ])) {
print '<td class="liste_titre">' ;
print '</td>' ;
}
// Date modification
if ( ! empty ( $arrayfields [ 'e.tms' ][ 'checked' ])) {
print '<td class="liste_titre">' ;
print '</td>' ;
}
// Status
if ( ! empty ( $arrayfields [ 'e.fk_statut' ][ 'checked' ])) {
print '<td class="liste_titre maxwidthonsmartphone right">' ;
print $form -> selectarray ( 'search_status' , array ( '0' => $langs -> trans ( 'StatusSendingDraftShort' ), '1' => $langs -> trans ( 'StatusSendingValidatedShort' ), '2' => $langs -> trans ( 'StatusSendingProcessedShort' )), $search_status , 1 );
print '</td>' ;
}
// Status billed
if ( ! empty ( $arrayfields [ 'e.billed' ][ 'checked' ])) {
print '<td class="liste_titre maxwidthonsmartphone center">' ;
print $form -> selectyesno ( 'search_billed' , $search_billed , 1 , 0 , 1 );
print '</td>' ;
}
// Action column
print '<td class="liste_titre middle">' ;
$searchpicto = $form -> showFilterAndCheckAddButtons ( 0 );
print $searchpicto ;
print '</td>' ;
print " </tr> \n " ;
print '<tr class="liste_titre">' ;
if ( ! empty ( $arrayfields [ 'e.ref' ][ 'checked' ])) {
print_liste_field_titre ( $arrayfields [ 'e.ref' ][ 'label' ], $_SERVER [ " PHP_SELF " ], " e.ref " , " " , $param , '' , $sortfield , $sortorder );
}
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 );
}
if ( ! empty ( $arrayfields [ 's.nom' ][ 'checked' ])) {
print_liste_field_titre ( $arrayfields [ 's.nom' ][ 'label' ], $_SERVER [ " PHP_SELF " ], " s.nom " , " " , $param , '' , $sortfield , $sortorder , 'left ' );
}
if ( ! empty ( $arrayfields [ 's.town' ][ 'checked' ])) {
print_liste_field_titre ( $arrayfields [ 's.town' ][ 'label' ], $_SERVER [ " PHP_SELF " ], 's.town' , '' , $param , '' , $sortfield , $sortorder );
}
if ( ! empty ( $arrayfields [ 's.zip' ][ 'checked' ])) {
print_liste_field_titre ( $arrayfields [ 's.zip' ][ 'label' ], $_SERVER [ " PHP_SELF " ], 's.zip' , '' , $param , '' , $sortfield , $sortorder );
}
if ( ! empty ( $arrayfields [ 'state.nom' ][ 'checked' ])) {
print_liste_field_titre ( $arrayfields [ 'state.nom' ][ 'label' ], $_SERVER [ " PHP_SELF " ], " state.nom " , " " , $param , '' , $sortfield , $sortorder );
}
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 ' );
}
if ( ! empty ( $arrayfields [ 'typent.code' ][ 'checked' ])) {
print_liste_field_titre ( $arrayfields [ 'typent.code' ][ 'label' ], $_SERVER [ " PHP_SELF " ], " typent.code " , " " , $param , '' , $sortfield , $sortorder , 'center ' );
}
if ( ! empty ( $arrayfields [ 'e.weight' ][ 'checked' ])) {
print_liste_field_titre ( $arrayfields [ 'e.weight' ][ 'label' ], $_SERVER [ " PHP_SELF " ], " e.weight " , " " , $param , '' , $sortfield , $sortorder , 'center ' );
}
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 ' );
}
2022-02-25 16:11:16 +01:00
if ( ! empty ( $arrayfields [ 'e.fk_shipping_method' ][ 'checked' ])) {
print_liste_field_titre ( $arrayfields [ 'e.fk_shipping_method' ][ 'label' ], $_SERVER [ " PHP_SELF " ], " e.fk_shipping_method " , " " , $param , '' , $sortfield , $sortorder , 'center ' );
2021-08-04 17:47:40 +02:00
}
2021-02-27 18:33:01 +01:00
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 ' );
}
if ( ! empty ( $arrayfields [ 'l.ref' ][ 'checked' ])) {
print_liste_field_titre ( $arrayfields [ 'l.ref' ][ 'label' ], $_SERVER [ " PHP_SELF " ], " l.ref " , " " , $param , '' , $sortfield , $sortorder );
}
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 ' );
}
// Extra fields
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_search_title.tpl.php' ;
// Hook fields
$parameters = array ( 'arrayfields' => $arrayfields , 'param' => $param , 'sortfield' => $sortfield , 'sortorder' => $sortorder );
$reshook = $hookmanager -> executeHooks ( 'printFieldListTitle' , $parameters ); // Note that $action and $object may have been modified by hook
print $hookmanager -> resPrint ;
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 ' );
}
if ( ! empty ( $arrayfields [ 'e.tms' ][ 'checked' ])) {
print_liste_field_titre ( $arrayfields [ 'e.tms' ][ 'label' ], $_SERVER [ " PHP_SELF " ], " e.tms " , " " , $param , '' , $sortfield , $sortorder , 'center nowrap ' );
}
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 ' );
}
if ( ! empty ( $arrayfields [ 'e.billed' ][ 'checked' ])) {
print_liste_field_titre ( $arrayfields [ 'e.billed' ][ 'label' ], $_SERVER [ " PHP_SELF " ], " e.billed " , " " , $param , '' , $sortfield , $sortorder , 'center ' );
}
print_liste_field_titre ( $selectedfields , $_SERVER [ " PHP_SELF " ], " " , '' , '' , '' , $sortfield , $sortorder , 'center maxwidthsearch ' );
print " </tr> \n " ;
$typenArray = $formcompany -> typent_array ( 1 );
$i = 0 ;
$totalarray = array ();
2021-12-01 15:24:25 +01:00
$totalarray [ 'nbfield' ] = 0 ;
2021-02-27 18:33:01 +01:00
while ( $i < min ( $num , $limit )) {
$obj = $db -> fetch_object ( $resql );
$shipment -> id = $obj -> rowid ;
$shipment -> ref = $obj -> ref ;
2021-08-04 17:47:40 +02:00
$shipment -> shipping_method_id = $obj -> fk_shipping_method ;
2021-02-27 18:33:01 +01:00
$companystatic -> id = $obj -> socid ;
$companystatic -> ref = $obj -> name ;
$companystatic -> name = $obj -> name ;
$object = new Expedition ( $db );
$object -> fetch ( $obj -> rowid );
print '<tr class="oddeven">' ;
2010-04-21 10:53:55 +02:00
2016-04-08 01:00:02 +02:00
// Ref
2021-02-25 22:38:35 +01:00
if ( ! empty ( $arrayfields [ 'e.ref' ][ 'checked' ])) {
2021-09-19 21:13:27 +02:00
print '<td class="nowraponall">' ;
2021-02-27 18:33:01 +01:00
print $shipment -> getNomUrl ( 1 );
print " </td> \n " ;
if ( ! $i ) {
$totalarray [ 'nbfield' ] ++ ;
}
2016-10-29 14:45:54 +02:00
}
2021-02-27 18:33:01 +01:00
2016-10-29 14:45:54 +02:00
// Ref customer
2021-02-25 22:38:35 +01:00
if ( ! empty ( $arrayfields [ 'e.ref_customer' ][ 'checked' ])) {
2021-02-27 18:33:01 +01:00
print " <td> " ;
print $obj -> ref_customer ;
print " </td> \n " ;
if ( ! $i ) {
$totalarray [ 'nbfield' ] ++ ;
}
2016-04-08 01:00:02 +02:00
}
2021-02-27 18:33:01 +01:00
// Third party
2021-02-25 22:38:35 +01:00
if ( ! empty ( $arrayfields [ 's.nom' ][ 'checked' ])) {
2021-09-19 21:13:27 +02:00
print '<td class="tdoverflowmax150">' ;
2021-02-27 18:33:01 +01:00
print $companystatic -> getNomUrl ( 1 );
2017-10-13 13:28:26 +02:00
print '</td>' ;
2021-02-27 18:33:01 +01:00
if ( ! $i ) {
$totalarray [ 'nbfield' ] ++ ;
}
2016-04-08 01:00:02 +02:00
}
// Town
2021-02-25 22:38:35 +01:00
if ( ! empty ( $arrayfields [ 's.town' ][ 'checked' ])) {
2021-02-27 18:33:01 +01:00
print '<td class="nocellnopadd">' ;
print $obj -> town ;
print '</td>' ;
if ( ! $i ) {
$totalarray [ 'nbfield' ] ++ ;
}
2021-02-25 22:38:35 +01:00
}
2016-04-08 01:00:02 +02:00
// Zip
2021-02-25 22:38:35 +01:00
if ( ! empty ( $arrayfields [ 's.zip' ][ 'checked' ])) {
2021-09-19 21:18:30 +02:00
print '<td class="nocellnopadd center">' ;
2021-02-27 18:33:01 +01:00
print $obj -> zip ;
print '</td>' ;
if ( ! $i ) {
$totalarray [ 'nbfield' ] ++ ;
}
2021-02-25 22:38:35 +01:00
}
2016-04-08 01:00:02 +02:00
// State
2021-02-25 22:38:35 +01:00
if ( ! empty ( $arrayfields [ 'state.nom' ][ 'checked' ])) {
2021-09-19 21:18:30 +02:00
print '<td class="center">' . $obj -> state_name . " </td> \n " ;
2021-02-27 18:33:01 +01:00
if ( ! $i ) {
$totalarray [ 'nbfield' ] ++ ;
}
2017-10-13 13:28:26 +02:00
}
// Country
2021-02-25 22:38:35 +01:00
if ( ! empty ( $arrayfields [ 'country.code_iso' ][ 'checked' ])) {
2021-02-27 18:33:01 +01:00
print '<td class="center">' ;
$tmparray = getCountry ( $obj -> fk_pays , 'all' );
print $tmparray [ 'label' ];
2017-10-13 13:28:26 +02:00
print '</td>' ;
2021-02-27 18:33:01 +01:00
if ( ! $i ) {
$totalarray [ 'nbfield' ] ++ ;
}
2017-10-13 13:28:26 +02:00
}
2021-02-27 18:33:01 +01:00
// Type ent
2021-02-25 22:38:35 +01:00
if ( ! empty ( $arrayfields [ 'typent.code' ][ 'checked' ])) {
2021-02-27 18:33:01 +01:00
print '<td class="center">' ;
if ( isset ( $typenArray [ $obj -> typent_code ])) {
print $typenArray [ $obj -> typent_code ];
}
2017-10-13 13:28:26 +02:00
print '</td>' ;
2021-02-27 18:33:01 +01:00
if ( ! $i ) {
$totalarray [ 'nbfield' ] ++ ;
}
2017-10-13 13:28:26 +02:00
}
2020-04-04 12:46:02 +02:00
// Weight
2021-02-25 22:38:35 +01:00
if ( ! empty ( $arrayfields [ 'e.weight' ][ 'checked' ])) {
2021-02-27 18:33:01 +01:00
print '<td class="center">' ;
if ( empty ( $object -> trueWeight )) {
$tmparray = $object -> getTotalWeightVolume ();
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' );
print $form -> textwithpicto ( '' , $langs -> trans ( 'EstimatedWeight' ), 1 );
} else {
print $object -> trueWeight ;
print ( $object -> trueWeight && $object -> weight_units != '' ) ? ' ' . measuringUnitString ( 0 , " weight " , $object -> weight_units ) : '' ;
}
2020-04-04 12:46:02 +02:00
print '</td>' ;
2021-02-27 18:33:01 +01:00
if ( ! $i ) {
$totalarray [ 'nbfield' ] ++ ;
}
2020-04-04 12:46:02 +02:00
}
2021-02-27 18:33:01 +01:00
// Date delivery planed
2021-02-25 22:38:35 +01:00
if ( ! empty ( $arrayfields [ 'e.date_delivery' ][ 'checked' ])) {
2021-02-27 18:33:01 +01:00
print '<td class="center">' ;
print dol_print_date ( $db -> jdate ( $obj -> delivery_date ), " dayhour " );
print " </td> \n " ;
2016-04-08 01:00:02 +02:00
}
2022-02-25 16:11:16 +01:00
if ( ! empty ( $arrayfields [ 'e.fk_shipping_method' ][ 'checked' ])) {
2021-08-04 17:47:40 +02:00
// Get code using getLabelFromKey
$code = $langs -> getLabelFromKey ( $db , $shipment -> shipping_method_id , 'c_shipment_mode' , 'rowid' , 'code' );
print '<td class="center">' ;
2021-08-04 17:50:59 +02:00
if ( $shipment -> shipping_method_id > 0 ) print $langs -> trans ( " SendingMethod " . strtoupper ( $code ));
2021-08-04 17:47:40 +02:00
print '</td>' ;
}
2020-05-19 10:34:55 +02:00
// Tracking number
2021-02-25 22:38:35 +01:00
if ( ! empty ( $arrayfields [ 'e.tracking_number' ][ 'checked' ])) {
2021-08-04 17:47:40 +02:00
$shipment -> getUrlTrackingStatus ( $obj -> tracking_number );
print '<td class="center">' . $shipment -> tracking_url . " </td> \n " ;
//print $form->editfieldval("TrackingNumber", 'tracking_number', $obj->tracking_url, $obj, $user->rights->expedition->creer, 'string', $obj->tracking_number);
2021-02-27 18:33:01 +01:00
if ( ! $i ) {
$totalarray [ 'nbfield' ] ++ ;
}
2016-04-08 01:00:02 +02:00
}
2021-02-27 18:33:01 +01:00
if ( ! empty ( $arrayfields [ 'l.ref' ][ 'checked' ]) || ! empty ( $arrayfields [ 'l.date_delivery' ][ 'checked' ])) {
$shipment -> fetchObjectLinked ( $shipment -> id , $shipment -> element );
$receiving = '' ;
if ( is_array ( $shipment -> linkedObjects [ 'delivery' ]) && count ( $shipment -> linkedObjects [ 'delivery' ]) > 0 ) {
$receiving = reset ( $shipment -> linkedObjects [ 'delivery' ]);
}
if ( ! empty ( $arrayfields [ 'l.ref' ][ 'checked' ])) {
// Ref
print '<td>' ;
print ! empty ( $receiving ) ? $receiving -> getNomUrl ( $db ) : '' ;
print '</td>' ;
}
if ( ! empty ( $arrayfields [ 'l.date_delivery' ][ 'checked' ])) {
// Date received
print '<td class="center">' ;
print dol_print_date ( $db -> jdate ( $obj -> date_reception ), " day " );
print '</td>' . " \n " ;
}
2014-07-25 16:31:41 +02:00
}
2017-11-27 15:24:29 +01:00
2021-02-27 18:33:01 +01:00
// Extra fields
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_list_print_fields.tpl.php' ;
2016-04-08 01:00:02 +02:00
// Fields from hook
2021-02-27 18:33:01 +01:00
$parameters = array ( 'arrayfields' => $arrayfields , 'obj' => $obj , 'i' => $i , 'totalarray' =>& $totalarray );
$reshook = $hookmanager -> executeHooks ( 'printFieldListValue' , $parameters ); // Note that $action and $object may have been modified by hook
2016-04-08 01:00:02 +02:00
print $hookmanager -> resPrint ;
// Date creation
2021-02-25 22:38:35 +01:00
if ( ! empty ( $arrayfields [ 'e.datec' ][ 'checked' ])) {
2021-02-27 18:33:01 +01:00
print '<td class="center nowrap">' ;
print dol_print_date ( $db -> jdate ( $obj -> date_creation ), 'dayhour' , 'tzuser' );
2017-10-13 13:28:26 +02:00
print '</td>' ;
2021-02-27 18:33:01 +01:00
if ( ! $i ) {
$totalarray [ 'nbfield' ] ++ ;
}
2016-04-08 01:00:02 +02:00
}
// Date modification
2021-02-25 22:38:35 +01:00
if ( ! empty ( $arrayfields [ 'e.tms' ][ 'checked' ])) {
2021-02-27 18:33:01 +01:00
print '<td class="center nowrap">' ;
print dol_print_date ( $db -> jdate ( $obj -> date_update ), 'dayhour' , 'tzuser' );
2017-10-13 13:28:26 +02:00
print '</td>' ;
2021-02-27 18:33:01 +01:00
if ( ! $i ) {
$totalarray [ 'nbfield' ] ++ ;
}
2016-04-08 01:00:02 +02:00
}
2015-06-30 01:34:17 +02:00
// Status
2021-02-25 22:38:35 +01:00
if ( ! empty ( $arrayfields [ 'e.fk_statut' ][ 'checked' ])) {
2021-02-27 18:33:01 +01:00
print '<td class="right nowrap">' . $shipment -> LibStatut ( $obj -> fk_statut , 5 ) . '</td>' ;
if ( ! $i ) {
$totalarray [ 'nbfield' ] ++ ;
}
2016-04-08 01:00:02 +02:00
}
2021-02-27 18:33:01 +01:00
// Billed
2021-02-25 22:38:35 +01:00
if ( ! empty ( $arrayfields [ 'e.billed' ][ 'checked' ])) {
2021-02-27 18:33:01 +01:00
print '<td class="center">' . yn ( $obj -> billed ) . '</td>' ;
if ( ! $i ) {
$totalarray [ 'nbfield' ] ++ ;
}
2017-08-02 17:15:51 +02:00
}
2014-10-04 17:20:17 +02:00
2021-02-27 18:33:01 +01:00
// Action column
print '<td class="nowrap" align="center">' ;
if ( $massactionbutton || $massaction ) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
$selected = 0 ;
if ( in_array ( $obj -> rowid , $arrayofselected )) {
$selected = 1 ;
}
print '<input id="cb' . $obj -> rowid . '" class="flat checkforselect" type="checkbox" name="toselect[]" value="' . $obj -> rowid . '"' . ( $selected ? ' checked="checked"' : '' ) . '>' ;
2021-02-25 22:38:35 +01:00
}
2021-02-27 18:33:01 +01:00
print '</td>' ;
if ( ! $i ) {
$totalarray [ 'nbfield' ] ++ ;
2021-02-25 22:38:35 +01:00
}
2017-06-19 14:31:08 +02:00
2021-02-27 18:33:01 +01:00
print " </tr> \n " ;
2010-04-21 10:53:55 +02:00
2021-02-27 18:33:01 +01:00
$i ++ ;
}
2017-08-02 17:15:51 +02:00
2021-02-27 18:33:01 +01:00
// If no record found
if ( $num == 0 ) {
$colspan = 1 ;
foreach ( $arrayfields as $key => $val ) {
if ( ! empty ( $val [ 'checked' ])) {
$colspan ++ ;
2020-04-05 02:44:59 +02:00
}
2010-04-21 10:53:55 +02:00
}
2021-02-27 18:33:01 +01:00
print '<tr><td colspan="' . $colspan . '" class="opacitymedium">' . $langs -> trans ( " NoRecordFound " ) . '</td></tr>' ;
}
2010-04-21 10:53:55 +02:00
2021-02-27 18:33:01 +01:00
$db -> free ( $resql );
2019-03-28 17:27:30 +01:00
2021-02-27 18:33:01 +01:00
$parameters = array ( 'arrayfields' => $arrayfields , 'totalarray' => $totalarray , 'sql' => $sql );
$reshook = $hookmanager -> executeHooks ( 'printFieldListFooter' , $parameters ); // Note that $action and $object may have been modified by hook
print $hookmanager -> resPrint ;
2019-08-14 17:04:13 +02:00
2021-02-27 18:33:01 +01:00
print " </table> " ;
print " </div> " ;
print '</form>' ;
2019-08-14 17:04:13 +02:00
2021-02-27 18:33:01 +01:00
$hidegeneratedfilelistifempty = 1 ;
if ( $massaction == 'builddoc' || $action == 'remove_file' || $show_files ) {
$hidegeneratedfilelistifempty = 0 ;
}
2019-08-14 17:04:13 +02:00
2021-02-27 18:33:01 +01:00
// Show list of available documents
$urlsource = $_SERVER [ 'PHP_SELF' ] . '?sortfield=' . $sortfield . '&sortorder=' . $sortorder ;
$urlsource .= str_replace ( '&' , '&' , $param );
2019-08-14 17:04:13 +02:00
2021-02-27 18:33:01 +01:00
$filedir = $diroutputmassaction ;
$genallowed = $user -> rights -> expedition -> lire ;
$delallowed = $user -> rights -> expedition -> creer ;
$title = '' ;
print $formfile -> showdocuments ( 'massfilesarea_sendings' , '' , $filedir , $urlsource , 0 , $delallowed , '' , 1 , 1 , 0 , 48 , 1 , $param , $title , '' , '' , '' , null , $hidegeneratedfilelistifempty );
2003-11-13 18:36:45 +01:00
2018-08-02 14:03:50 +02:00
// End of page
2011-08-27 16:24:16 +02:00
llxFooter ();
2015-12-11 19:37:12 +01:00
$db -> close ();