36require
'../main.inc.php';
37require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
38require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
39require_once DOL_DOCUMENT_ROOT.
'/core/class/discount.class.php';
40require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
41require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
42require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
43if (isModEnabled(
'margin')) {
44 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmargin.class.php';
46require_once DOL_DOCUMENT_ROOT.
'/commande/class/commande.class.php';
47require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
48require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
49require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
52$langs->loadLangs(array(
"orders",
'sendings',
'deliveries',
'companies',
'compta',
'bills',
'stocks',
'products'));
54$action =
GETPOST(
'action',
'aZ09');
55$massaction =
GETPOST(
'massaction',
'alpha');
56$show_files =
GETPOST(
'show_files',
'int');
57$confirm =
GETPOST(
'confirm',
'alpha');
58$toselect =
GETPOST(
'toselect',
'array');
59$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'orderlistdet';
60$productobuy =
GETPOST(
'productobuy',
'alpha');
61$productonly =
GETPOST(
'productonly',
'alpha');
62$disablelinefree =
GETPOST(
'disablelinefree',
'alpha');
64$search_datecloture_start =
GETPOST(
'search_datecloture_start',
'int');
65if (empty($search_datecloture_start)) {
66 $search_datecloture_start =
dol_mktime(0, 0, 0,
GETPOST(
'search_datecloture_startmonth',
'int'),
GETPOST(
'search_datecloture_startday',
'int'),
GETPOST(
'search_datecloture_startyear',
'int'));
68$search_datecloture_end =
GETPOST(
'search_datecloture_end',
'int');
69if (empty($search_datecloture_end)) {
70 $search_datecloture_end =
dol_mktime(23, 59, 59,
GETPOST(
'search_datecloture_endmonth',
'int'),
GETPOST(
'search_datecloture_endday',
'int'),
GETPOST(
'search_datecloture_endyear',
'int'));
72$search_dateorder_start =
dol_mktime(0, 0, 0,
GETPOST(
'search_dateorder_start_month',
'int'),
GETPOST(
'search_dateorder_start_day',
'int'),
GETPOST(
'search_dateorder_start_year',
'int'));
73$search_dateorder_end =
dol_mktime(23, 59, 59,
GETPOST(
'search_dateorder_end_month',
'int'),
GETPOST(
'search_dateorder_end_day',
'int'),
GETPOST(
'search_dateorder_end_year',
'int'));
74$search_datedelivery_start =
dol_mktime(0, 0, 0,
GETPOST(
'search_datedelivery_start_month',
'int'),
GETPOST(
'search_datedelivery_start_day',
'int'),
GETPOST(
'search_datedelivery_start_year',
'int'));
75$search_datedelivery_end =
dol_mktime(23, 59, 59,
GETPOST(
'search_datedelivery_end_month',
'int'),
GETPOST(
'search_datedelivery_end_day',
'int'),
GETPOST(
'search_datedelivery_end_year',
'int'));
76$search_product_category =
GETPOST(
'search_product_category',
'int');
79$search_refProduct =
GETPOST(
'search_refProduct',
'alpha');
80$search_descProduct =
GETPOST(
'search_descProduct',
'alpha');
82$search_ref =
GETPOST(
'search_ref',
'alpha') !=
'' ?
GETPOST(
'search_ref',
'alpha') :
GETPOST(
'sref',
'alpha');
83$search_ref_customer =
GETPOST(
'search_ref_customer',
'alpha');
84$search_company =
GETPOST(
'search_company',
'alpha');
85$search_company_alias =
GETPOST(
'search_company_alias',
'alpha');
86$search_town =
GETPOST(
'search_town',
'alpha');
87$search_zip =
GETPOST(
'search_zip',
'alpha');
88$search_state =
GETPOST(
"search_state",
'alpha');
89$search_country =
GETPOST(
"search_country",
'int');
90$search_type_thirdparty =
GETPOST(
"search_type_thirdparty",
'int');
91$sall = trim((
GETPOST(
'search_all',
'alphanohtml') !=
'') ?
GETPOST(
'search_all',
'alphanohtml') :
GETPOST(
'sall',
'alphanohtml'));
92$socid =
GETPOST(
'socid',
'int');
93$search_user =
GETPOST(
'search_user',
'int');
94$search_sale =
GETPOST(
'search_sale',
'int');
95$search_total_ht =
GETPOST(
'search_total_ht',
'alpha');
96$search_total_vat =
GETPOST(
'search_total_vat',
'alpha');
97$search_total_ttc =
GETPOST(
'search_total_ttc',
'alpha');
98$search_warehouse =
GETPOST(
'search_warehouse',
'int');
99$search_multicurrency_code =
GETPOST(
'search_multicurrency_code',
'alpha');
100$search_multicurrency_tx =
GETPOST(
'search_multicurrency_tx',
'alpha');
101$search_multicurrency_montant_ht =
GETPOST(
'search_multicurrency_montant_ht',
'alpha');
102$search_multicurrency_montant_vat =
GETPOST(
'search_multicurrency_montant_vat',
'alpha');
103$search_multicurrency_montant_ttc =
GETPOST(
'search_multicurrency_montant_ttc',
'alpha');
104$search_login =
GETPOST(
'search_login',
'alpha');
105$search_categ_cus =
GETPOST(
"search_categ_cus",
'int');
106$optioncss =
GETPOST(
'optioncss',
'alpha');
107$search_billed = GETPOSTISSET(
'search_billed') ?
GETPOST(
'search_billed',
'int') :
GETPOST(
'billed',
'int');
108$search_status =
GETPOST(
'search_status',
'int');
109$search_btn =
GETPOST(
'button_search',
'alpha');
110$search_remove_btn =
GETPOST(
'button_removefilter',
'alpha');
111$search_project_ref =
GETPOST(
'search_project_ref',
'alpha');
112$search_project =
GETPOST(
'search_project',
'alpha');
113$search_shippable =
GETPOST(
'search_shippable',
'aZ09');
114$search_fk_cond_reglement =
GETPOST(
"search_fk_cond_reglement",
'int');
115$search_fk_shipping_method =
GETPOST(
"search_fk_shipping_method",
'int');
116$search_fk_mode_reglement =
GETPOST(
"search_fk_mode_reglement",
'int');
117$search_fk_input_reason =
GETPOST(
"search_fk_input_reason",
'int');
122 $socid = $user->socid;
126$diroutputmassaction = $conf->commande->multidir_output[$conf->entity].
'/temp/massgeneration/'.$user->id;
129$limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
130$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
131$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
132$page = GETPOSTISSET(
'pageplusone') ? (
GETPOST(
'pageplusone') - 1) :
GETPOST(
"page",
'int');
133if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
136$offset = $limit * $page;
137$pageprev = $page - 1;
138$pagenext = $page + 1;
140 $sortfield =
'pr.ref';
146$show_shippable_command =
GETPOST(
'show_shippable_command',
'aZ09');
150$hookmanager->initHooks(array(
'orderlistdetail'));
154$extrafields->fetch_name_optionals_label($object->table_element);
155$search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
158$fieldstosearchall = array(
160 'c.ref_client'=>
'RefCustomerOrder',
161 'pd.description'=>
'Description',
162 's.nom'=>
"ThirdParty",
163 's.name_alias'=>
"AliasNameShort",
166 'c.note_public'=>
'NotePublic',
168if (empty($user->socid)) {
169 $fieldstosearchall[
"c.note_private"] =
"NotePrivate";
172$checkedtypetiers = 0;
175 'pr.ref'=> array(
'label'=>
'ProductRef',
'checked'=>1,
'position'=>1),
176 'pr.desc'=> array(
'label'=>
'ProductDescription',
'checked'=>-1,
'position'=>1),
177 'cdet.qty'=> array(
'label'=>
'QtyOrdered',
'checked'=>1,
'position'=>1),
178 'c.ref'=>array(
'label'=>
"Ref",
'checked'=>1,
'position'=>5),
179 'c.ref_client'=>array(
'label'=>
"RefCustomerOrder",
'checked'=>-1,
'position'=>10),
180 'p.ref'=>array(
'label'=>
"ProjectRef",
'checked'=>-1,
'enabled'=>(empty($conf->project->enabled) ? 0 : 1),
'position'=>20),
181 'p.title'=>array(
'label'=>
"ProjectLabel",
'checked'=>0,
'enabled'=>(empty($conf->project->enabled) ? 0 : 1),
'position'=>25),
182 's.nom'=>array(
'label'=>
"ThirdParty",
'checked'=>1,
'position'=>30),
183 's.name_alias'=>array(
'label'=>
"AliasNameShort",
'checked'=>-1,
'position'=>31),
184 's.town'=>array(
'label'=>
"Town",
'checked'=>-1,
'position'=>35),
185 's.zip'=>array(
'label'=>
"Zip",
'checked'=>-1,
'position'=>40),
186 'state.nom'=>array(
'label'=>
"StateShort",
'checked'=>0,
'position'=>45),
187 'country.code_iso'=>array(
'label'=>
"Country",
'checked'=>0,
'position'=>50),
188 'typent.code'=>array(
'label'=>
"ThirdPartyType",
'checked'=>$checkedtypetiers,
'position'=>55),
189 'c.date_commande'=>array(
'label'=>
"OrderDateShort",
'checked'=>1,
'position'=>60),
190 'c.date_delivery'=>array(
'label'=>
"DateDeliveryPlanned",
'checked'=>1,
'enabled'=>empty($conf->global->ORDER_DISABLE_DELIVERY_DATE),
'position'=>65),
191 'c.fk_shipping_method'=>array(
'label'=>
"SendingMethod",
'checked'=>-1,
'position'=>66 ,
'enabled'=>isModEnabled(
'expedition')),
192 'c.fk_cond_reglement'=>array(
'label'=>
"PaymentConditionsShort",
'checked'=>-1,
'position'=>67),
193 'c.fk_mode_reglement'=>array(
'label'=>
"PaymentMode",
'checked'=>-1,
'position'=>68),
194 'c.fk_input_reason'=>array(
'label'=>
"Channel",
'checked'=>-1,
'position'=>69),
195 'cdet.total_ht'=>array(
'label'=>
"AmountHT",
'checked'=>1,
'position'=>75),
196 'c.total_vat'=>array(
'label'=>
"AmountVAT",
'checked'=>0,
'position'=>80),
197 'cdet.total_ttc'=>array(
'label'=>
"AmountTTC",
'checked'=>0,
'position'=>85),
198 'c.multicurrency_code'=>array(
'label'=>
'Currency',
'checked'=>0,
'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1),
'position'=>90),
199 'c.multicurrency_tx'=>array(
'label'=>
'CurrencyRate',
'checked'=>0,
'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1),
'position'=>95),
200 'c.multicurrency_total_ht'=>array(
'label'=>
'MulticurrencyAmountHT',
'checked'=>0,
'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1),
'position'=>100),
201 'c.multicurrency_total_vat'=>array(
'label'=>
'MulticurrencyAmountVAT',
'checked'=>0,
'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1),
'position'=>105),
202 'c.multicurrency_total_ttc'=>array(
'label'=>
'MulticurrencyAmountTTC',
'checked'=>0,
'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1),
'position'=>110),
203 'c.fk_warehouse'=>array(
'label'=>
'Warehouse',
'checked'=>0,
'enabled'=>(!isModEnabled(
'stock') && empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER) ? 0 : 1),
'position'=>110),
204 'u.login'=>array(
'label'=>
"Author",
'checked'=>1,
'position'=>115),
205 'sale_representative'=>array(
'label'=>
"SaleRepresentativesOfThirdParty",
'checked'=>0,
'position'=>116),
206 'total_pa' => array(
'label' => (
getDolGlobalString(
'MARGIN_TYPE') ==
'1' ?
'BuyingPrice' :
'CostPrice'),
'checked' => 0,
'position' => 300,
'enabled' => (!isModEnabled(
'margin') || !$user->rights->margins->liretous ? 0 : 1)),
207 'total_margin' => array(
'label' =>
'Margin',
'checked' => 0,
'position' => 301,
'enabled' => (!isModEnabled(
'margin') || !$user->rights->margins->liretous ? 0 : 1)),
208 'total_margin_rate' => array(
'label' =>
'MarginRate',
'checked' => 0,
'position' => 302,
'enabled' => (!isModEnabled(
'margin') || !$user->rights->margins->liretous || empty($conf->global->DISPLAY_MARGIN_RATES) ? 0 : 1)),
209 'total_mark_rate' => array(
'label' =>
'MarkRate',
'checked' => 0,
'position' => 303,
'enabled' => (!isModEnabled(
'margin') || !$user->rights->margins->liretous || empty($conf->global->DISPLAY_MARK_RATES) ? 0 : 1)),
210 'c.datec'=>array(
'label'=>
"DateCreation",
'checked'=>0,
'position'=>120),
211 'c.tms'=>array(
'label'=>
"DateModificationShort",
'checked'=>0,
'position'=>125),
212 'c.date_cloture'=>array(
'label'=>
"DateClosing",
'checked'=>0,
'position'=>130),
213 'c.note_public'=>array(
'label'=>
'NotePublic',
'checked'=>0,
'enabled'=>(empty($conf->global->MAIN_LIST_ALLOW_PUBLIC_NOTES)),
'position'=>135),
214 'c.note_private'=>array(
'label'=>
'NotePrivate',
'checked'=>0,
'enabled'=>(empty($conf->global->MAIN_LIST_ALLOW_PRIVATE_NOTES)),
'position'=>140),
215 'shippable'=>array(
'label'=>
"Shippable",
'checked'=>1,
'enabled'=>(isModEnabled(
'expedition')),
'position'=>990),
216 'c.facture'=>array(
'label'=>
"Billed",
'checked'=>1,
'enabled'=>(empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)),
'position'=>995),
217 'c.import_key' =>array(
'type'=>
'varchar(14)',
'label'=>
'ImportId',
'enabled'=>1,
'visible'=>-2,
'position'=>999),
218 'c.fk_statut'=>array(
'label'=>
"Status",
'checked'=>1,
'position'=>1000)
222include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
233if (
GETPOST(
'cancel',
'alpha')) {
234 $action =
'list'; $massaction =
'';
236if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend' && $massaction !=
'confirm_createbills') {
240$parameters = array(
'socid'=>$socid);
241$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
246if (empty($reshook)) {
248 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
251 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
254 $disablelinefree =
'';
258 $search_product_category =
'';
259 $search_refProduct =
'';
260 $search_descProduct =
'';
262 $search_ref_customer =
'';
263 $search_company =
'';
264 $search_company_alias =
'';
269 $search_country =
'';
270 $search_type_thirdparty =
'';
271 $search_total_ht =
'';
272 $search_total_vat =
'';
273 $search_total_ttc =
'';
274 $search_warehouse =
'';
275 $search_multicurrency_code =
'';
276 $search_multicurrency_tx =
'';
277 $search_multicurrency_montant_ht =
'';
278 $search_multicurrency_montant_vat =
'';
279 $search_multicurrency_montant_ttc =
'';
281 $search_dateorder_start =
'';
282 $search_dateorder_end =
'';
283 $search_datedelivery_start =
'';
284 $search_datedelivery_end =
'';
285 $search_project_ref =
'';
286 $search_project =
'';
290 $search_array_options = array();
291 $search_categ_cus = 0;
292 $search_datecloture_start =
'';
293 $search_datecloture_end =
'';
294 $search_fk_cond_reglement =
'';
295 $search_fk_shipping_method =
'';
296 $search_fk_mode_reglement =
'';
297 $search_fk_input_reason =
'';
299 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
300 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
305 $objectclass =
'Commande';
306 $objectlabel =
'Orders';
307 $permissiontoread = $user->rights->commande->lire;
308 $permissiontoadd = $user->rights->commande->creer;
309 $permissiontodelete = $user->rights->commande->supprimer;
310 if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) {
311 $permissiontovalidate = $user->rights->commande->order_advance->validate;
312 $permissiontoclose = $user->rights->commande->order_advance->close;
313 $permissiontocancel = $user->rights->commande->order_advance->annuler;
314 $permissiontosendbymail = $user->rights->commande->order_advance->send;
316 $permissiontovalidate = $user->rights->commande->creer;
317 $permissiontoclose = $user->rights->commande->creer;
318 $permissiontocancel = $user->rights->commande->creer;
319 $permissiontosendbymail = $user->rights->commande->creer;
321 $uploaddir = $conf->commande->multidir_output[$conf->entity];
322 $triggersendname =
'ORDER_SENTBYMAIL';
323 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
337$form =
new Form($db);
341if (isModEnabled(
'margin')) {
344$companystatic =
new Societe($db);
346$projectstatic =
new Project($db);
348$title = $langs->trans(
"Orders");
349$help_url =
"EN:Module_Customers_Orders|FR:Module_Commandes_Clients|ES:Módulo_Pedidos_de_clientes";
353if ($sall || $search_product_category > 0 || $search_user > 0) {
354 $sql =
'SELECT DISTINCT';
356$sql .=
' s.rowid as socid, s.nom as name, s.name_alias as alias, s.email, s.phone, s.fax, s.address, s.town, s.zip, s.fk_pays, s.client, s.code_client,';
357$sql .=
" typent.code as typent_code,";
358$sql .=
" state.code_departement as state_code, state.nom as state_name,";
359$sql .=
" country.code as country_code,";
360$sql .=
' c.rowid as c_rowid, c.ref, c.ref_client, c.fk_user_author,';
361$sql .=
' c.fk_multicurrency, c.multicurrency_code, c.multicurrency_tx, c.multicurrency_total_ht, c.multicurrency_total_tva as multicurrency_total_vat, c.multicurrency_total_ttc,';
362$sql .=
' c.total_ht as c_total_ht, c.total_tva as c_total_tva, c.total_ttc as c_total_ttc, c.fk_warehouse as warehouse,';
363$sql .=
' c.date_valid, c.date_commande, c.note_public, c.note_private, c.date_livraison as date_delivery, c.fk_statut, c.facture as billed,';
364$sql .=
' c.date_creation as date_creation, c.tms as date_update, c.date_cloture as date_cloture,';
365$sql .=
' p.rowid as project_id, p.ref as project_ref, p.title as project_label,';
366$sql .=
' u.login, u.lastname, u.firstname, u.email as user_email, u.statut as user_statut, u.entity, u.photo, u.office_phone, u.office_fax, u.user_mobile, u.job, u.gender,';
367$sql .=
' c.fk_cond_reglement,c.deposit_percent,c.fk_mode_reglement,c.fk_shipping_method,';
368$sql .=
' c.fk_input_reason, c.import_key';
371$sql .=
', cdet.rowid, cdet.description, cdet.qty, cdet.product_type, cdet.fk_product, cdet.total_ht, cdet.total_tva, cdet.total_ttc, ';
372$sql .=
' pr.rowid as product_rowid, pr.ref as product_ref, pr.label as product_label, pr.barcode as product_barcode, pr.tobatch as product_batch, pr.tosell as product_status, pr.tobuy as product_status_buy';
374if (($search_categ_cus > 0) || ($search_categ_cus == -2)) {
375 $sql .=
", cc.fk_categorie, cc.fk_soc";
378if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
379 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) {
380 $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
384$parameters = array();
385$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters);
386$sql .= $hookmanager->resPrint;
387$sql .=
' FROM '.MAIN_DB_PREFIX.
'societe as s';
388$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as country on (country.rowid = s.fk_pays)";
389$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_typent as typent on (typent.id = s.fk_typent)";
390$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_departements as state on (state.rowid = s.fk_departement)";
391if (($search_categ_cus > 0) || ($search_categ_cus == -2)) {
392 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
"categorie_societe as cc ON s.rowid = cc.fk_soc";
396$sql .=
', '.MAIN_DB_PREFIX.
'commandedet as cdet';
397$sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'commande as c ON cdet.fk_commande=c.rowid';
398$sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'product as pr ON pr.rowid=cdet.fk_product';
400if (!empty($extrafields->attributes[$object->table_element][
'label']) && is_array($extrafields->attributes[$object->table_element][
'label']) && count($extrafields->attributes[$object->table_element][
'label'])) {
401 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"commande_extrafields as ef on (c.rowid = ef.fk_object)";
403if ($sall || $search_product_category > 0) {
404 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'commandedet as pd ON c.rowid=pd.fk_commande';
406if ($search_product_category > 0) {
407 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'categorie_product as cp ON cp.fk_product=pd.fk_product';
409$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"projet as p ON p.rowid = c.fk_projet";
410$sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'user as u ON c.fk_user_author = u.rowid';
413if ($search_sale > 0 || (empty($user->rights->societe->client->voir) && !$socid)) {
414 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
416if ($search_user > 0) {
417 $sql .=
", ".MAIN_DB_PREFIX.
"element_contact as ec";
418 $sql .=
", ".MAIN_DB_PREFIX.
"c_type_contact as tc";
422$parameters = array();
423$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object);
424$sql .= $hookmanager->resPrint;
426$sql .=
' WHERE c.fk_soc = s.rowid';
427$sql .=
' AND c.entity IN ('.getEntity(
'commande').
')';
428$sql .=
' AND cdet.product_type <> 9';
430if (!empty($productobuy)) {
431 $sql .=
" AND pr.tobuy = 1";
433if (!empty($productonly)) {
434 $sql .=
" AND (cdet.product_type = 0 OR cdet.product_type = 1)";
436if (!empty($disablelinefree)) {
437 $sql .=
" AND cdet.fk_product IS NOT NULL";
439if ($search_product_category > 0) {
440 $sql .=
" AND cp.fk_categorie = ".((int) $search_product_category);
443 $sql .=
' AND s.rowid = '.((int) $socid);
445if (empty($user->rights->societe->client->voir) && !$socid) {
446 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
448if ($search_refProduct) {
451if ($search_descProduct) {
458if ($search_ref_customer) {
464if ($search_billed !=
'' && $search_billed >= 0) {
465 $sql .=
' AND c.facture = '.((int) $search_billed);
467if ($search_status <>
'') {
468 if ($search_status <= 3 && $search_status >= -1) {
469 if ($search_status == 1 && !isModEnabled(
'expedition')) {
470 $sql .=
' AND c.fk_statut IN (1,2)';
472 $sql .=
' AND c.fk_statut = '.((int) $search_status);
475 if ($search_status == -2) {
477 $sql .=
" AND ((c.fk_statut IN (1,2)) OR (c.fk_statut = 3 AND c.facture = 0))";
479 if ($search_status == -3) {
482 $sql .=
' AND ((c.fk_statut IN (1,2)) OR (c.fk_statut = 3 AND c.facture = 0))';
484 if ($search_status == -4) {
485 $sql .=
' AND (c.fk_statut IN (1,2))';
489if ($search_datecloture_start) {
490 $sql .=
" AND c.date_cloture >= '".$db->idate($search_datecloture_start).
"'";
492if ($search_datecloture_end) {
493 $sql .=
" AND c.date_cloture <= '".$db->idate($search_datecloture_end).
"'";
495if ($search_dateorder_start) {
496 $sql .=
" AND c.date_commande >= '".$db->idate($search_dateorder_start).
"'";
498if ($search_dateorder_end) {
499 $sql .=
" AND c.date_commande <= '".$db->idate($search_dateorder_end).
"'";
501if ($search_datedelivery_start) {
502 $sql .=
" AND c.date_livraison >= '".$db->idate($search_datedelivery_start).
"'";
504if ($search_datedelivery_end) {
505 $sql .=
" AND c.date_livraison <= '".$db->idate($search_datedelivery_end).
"'";
516if ($search_country) {
517 $sql .=
" AND s.fk_pays IN (".$db->sanitize($search_country).
')';
519if ($search_type_thirdparty && $search_type_thirdparty !=
'-1') {
520 $sql .=
" AND s.fk_typent IN (".$db->sanitize($search_type_thirdparty).
')';
522if ($search_company) {
525if ($search_company_alias) {
528if ($search_sale > 0) {
529 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $search_sale);
531if ($search_user > 0) {
532 $sql .=
" AND ec.fk_c_type_contact = tc.rowid AND tc.element='commande' AND tc.source='internal' AND ec.element_id = c.rowid AND ec.fk_socpeople = ".((int) $search_user);
534if ($search_total_ht !=
'') {
537if ($search_total_vat !=
'') {
540if ($search_total_ttc !=
'') {
543if ($search_warehouse !=
'' && $search_warehouse > 0) {
546if ($search_multicurrency_code !=
'') {
547 $sql .=
" AND c.multicurrency_code = '".$db->escape($search_multicurrency_code).
"'";
549if ($search_multicurrency_tx !=
'') {
550 $sql .=
natural_search(
'c.multicurrency_tx', $search_multicurrency_tx, 1);
552if ($search_multicurrency_montant_ht !=
'') {
553 $sql .=
natural_search(
'c.multicurrency_total_ht', $search_multicurrency_montant_ht, 1);
555if ($search_multicurrency_montant_vat !=
'') {
556 $sql .=
natural_search(
'c.multicurrency_total_tva', $search_multicurrency_montant_vat, 1);
558if ($search_multicurrency_montant_ttc !=
'') {
559 $sql .=
natural_search(
'c.multicurrency_total_ttc', $search_multicurrency_montant_ttc, 1);
562 $sql .=
natural_search(array(
"u.login",
"u.firstname",
"u.lastname"), $search_login);
564if ($search_project_ref !=
'') {
567if ($search_project !=
'') {
570if ($search_categ_cus > 0) {
571 $sql .=
" AND cc.fk_categorie = ".((int) $search_categ_cus);
573if ($search_categ_cus == -2) {
574 $sql .=
" AND cc.fk_categorie IS NULL";
576if ($search_fk_cond_reglement > 0) {
577 $sql .=
" AND c.fk_cond_reglement = ".((int) $search_fk_cond_reglement);
579if ($search_fk_shipping_method > 0) {
580 $sql .=
" AND c.fk_shipping_method = ".((int) $search_fk_shipping_method);
582if ($search_fk_mode_reglement > 0) {
583 $sql .=
" AND c.fk_mode_reglement = ".((int) $search_fk_mode_reglement);
585if ($search_fk_input_reason > 0) {
586 $sql .=
" AND c.fk_input_reason = ".((int) $search_fk_input_reason);
590include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
592$parameters = array();
593$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters);
594$sql .= $hookmanager->resPrint;
597$parameters = array();
598$reshook = $hookmanager->executeHooks(
'printFieldListHaving', $parameters, $object);
599$sql .= empty($hookmanager->resPrint) ?
"" :
" HAVING 1=1 ".$hookmanager->resPrint;
601$sql .= $db->order($sortfield, $sortorder);
604$nbtotalofrecords =
'';
606 $result = $db->query($sql);
607 $nbtotalofrecords = $db->num_rows($result);
609 if (($page * $limit) > $nbtotalofrecords) {
615$sql .= $db->plimit($limit + 1, $offset);
618$resql = $db->query($sql);
623 $title = $langs->trans(
'ListOrderLigne').
' - '.$soc->name;
624 if (empty($search_company)) {
625 $search_company = $soc->name;
628 $title = $langs->trans(
'ListOrderLigne');
630 if (strval($search_status) ==
'0') {
631 $title .=
' - '.$langs->trans(
'StatusOrderDraftShort');
633 if ($search_status == 1) {
634 $title .=
' - '.$langs->trans(
'StatusOrderValidatedShort');
636 if ($search_status == 2) {
637 $title .=
' - '.$langs->trans(
'StatusOrderSentShort');
639 if ($search_status == 3) {
640 $title .=
' - '.$langs->trans(
'StatusOrderToBillShort');
642 if ($search_status == -1) {
643 $title .=
' - '.$langs->trans(
'StatusOrderCanceledShort');
645 if ($search_status == -2) {
646 $title .=
' - '.$langs->trans(
'StatusOrderToProcessShort');
648 if ($search_status == -3) {
649 $title .=
' - '.$langs->trans(
'StatusOrderValidated').
', '.(!isModEnabled(
'expedition') ?
'' : $langs->trans(
"StatusOrderSent").
', ').$langs->trans(
'StatusOrderToBill');
651 if ($search_status == -4) {
652 $title .=
' - '.$langs->trans(
"StatusOrderValidatedShort").
'+'.$langs->trans(
"StatusOrderSentShort");
655 $num = $db->num_rows($resql);
657 $arrayofselected = is_array($toselect) ? $toselect : array();
659 if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $sall) {
660 $obj = $db->fetch_object($resql);
662 header(
"Location: ".DOL_URL_ROOT.
'/commande/card.php?id='.$id);
670 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
671 $param .=
'&contextpage='.urlencode($contextpage);
673 if ($limit > 0 && $limit != $conf->liste_limit) {
674 $param .=
'&limit='.((int) $limit);
677 $param .=
'&sall='.urlencode($sall);
680 $param .=
'&socid='.urlencode($socid);
682 if ($search_status !=
'') {
683 $param .=
'&search_status='.urlencode($search_status);
685 if ($search_datecloture_start) {
686 $param .=
'&search_datecloture_startday='.dol_print_date($search_datecloture_start,
'%d').
'&search_datecloture_startmonth='.
dol_print_date($search_datecloture_start,
'%m').
'&search_datecloture_startyear='.
dol_print_date($search_datecloture_start,
'%Y');
688 if ($search_datecloture_end) {
689 $param .=
'&search_datecloture_endday='.dol_print_date($search_datecloture_end,
'%d').
'&search_datecloture_endmonth='.
dol_print_date($search_datecloture_end,
'%m').
'&search_datecloture_endyear='.
dol_print_date($search_datecloture_end,
'%Y');
691 if ($search_dateorder_start) {
692 $param .=
'&search_dateorder_start_day='.dol_print_date($search_dateorder_start,
'%d').
'&search_dateorder_start_month='.
dol_print_date($search_dateorder_start,
'%m').
'&search_dateorder_start_year='.
dol_print_date($search_dateorder_start,
'%Y');
694 if ($search_dateorder_end) {
695 $param .=
'&search_dateorder_end_day='.dol_print_date($search_dateorder_end,
'%d').
'&search_dateorder_end_month='.
dol_print_date($search_dateorder_end,
'%m').
'&search_dateorder_end_year='.
dol_print_date($search_dateorder_end,
'%Y');
697 if ($search_datedelivery_start) {
698 $param .=
'&search_datedelivery_start_day='.dol_print_date($search_datedelivery_start,
'%d').
'&search_datedelivery_start_month='.
dol_print_date($search_datedelivery_start,
'%m').
'&search_datedelivery_start_year='.
dol_print_date($search_datedelivery_start,
'%Y');
700 if ($search_datedelivery_end) {
701 $param .=
'&search_datedelivery_end_day='.dol_print_date($search_datedelivery_end,
'%d').
'&search_datedelivery_end_month='.
dol_print_date($search_datedelivery_end,
'%m').
'&search_datedelivery_end_year='.
dol_print_date($search_datedelivery_end,
'%Y');
704 $param .=
'&search_ref='.urlencode($search_ref);
706 if ($search_company) {
707 $param .=
'&search_company='.urlencode($search_company);
709 if ($search_company_alias) {
710 $param .=
'&search_company_alias='.urlencode($search_company_alias);
712 if ($search_ref_customer) {
713 $param .=
'&search_ref_customer='.urlencode($search_ref_customer);
715 if ($search_user > 0) {
716 $param .=
'&search_user='.urlencode($search_user);
718 if ($search_sale > 0) {
719 $param .=
'&search_sale='.urlencode($search_sale);
721 if ($search_total_ht !=
'') {
722 $param .=
'&search_total_ht='.urlencode($search_total_ht);
724 if ($search_total_vat !=
'') {
725 $param .=
'&search_total_vat='.urlencode($search_total_vat);
727 if ($search_total_ttc !=
'') {
728 $param .=
'&search_total_ttc='.urlencode($search_total_ttc);
730 if ($search_warehouse !=
'') {
731 $param .=
'&search_warehouse='.urlencode($search_warehouse);
734 $param .=
'&search_login='.urlencode($search_login);
736 if ($search_multicurrency_code !=
'') {
737 $param .=
'&search_multicurrency_code='.urlencode($search_multicurrency_code);
739 if ($search_multicurrency_tx !=
'') {
740 $param .=
'&search_multicurrency_tx='.urlencode($search_multicurrency_tx);
742 if ($search_multicurrency_montant_ht !=
'') {
743 $param .=
'&search_multicurrency_montant_ht='.urlencode($search_multicurrency_montant_ht);
745 if ($search_multicurrency_montant_vat !=
'') {
746 $param .=
'&search_multicurrency_montant_vat='.urlencode($search_multicurrency_montant_vat);
748 if ($search_multicurrency_montant_ttc !=
'') {
749 $param .=
'&search_multicurrency_montant_ttc='.urlencode($search_multicurrency_montant_ttc);
751 if ($search_project_ref >= 0) {
752 $param .=
"&search_project_ref=".urlencode($search_project_ref);
754 if ($search_town !=
'') {
755 $param .=
'&search_town='.urlencode($search_town);
757 if ($search_zip !=
'') {
758 $param .=
'&search_zip='.urlencode($search_zip);
760 if ($search_state !=
'') {
761 $param .=
'&search_state='.urlencode($search_state);
763 if ($search_country !=
'') {
764 $param .=
'&search_country='.urlencode($search_country);
766 if ($search_type_thirdparty && $search_type_thirdparty !=
'-1') {
767 $param .=
'&search_type_thirdparty='.urlencode($search_type_thirdparty);
769 if ($search_product_category !=
'') {
770 $param .=
'&search_product_category='.urlencode($search_product_category);
772 if (($search_categ_cus > 0) || ($search_categ_cus == -2)) {
773 $param .=
'&search_categ_cus='.urlencode($search_categ_cus);
776 $param .=
'&show_files='.urlencode($show_files);
778 if ($optioncss !=
'') {
779 $param .=
'&optioncss='.urlencode($optioncss);
781 if ($search_billed !=
'') {
782 $param .=
'&search_billed='.urlencode($search_billed);
784 if ($search_fk_cond_reglement > 0) {
785 $param .=
'&search_fk_cond_reglement='.urlencode($search_fk_cond_reglement);
787 if ($search_fk_shipping_method > 0) {
788 $param .=
'&search_fk_shipping_method='.urlencode($search_fk_shipping_method);
790 if ($search_fk_mode_reglement > 0) {
791 $param .=
'&search_fk_mode_reglement='.urlencode($search_fk_mode_reglement);
793 if ($search_fk_input_reason > 0) {
794 $param .=
'&search_fk_input_reason='.urlencode($search_fk_input_reason);
796 if (!empty($productobuy)) {
797 $param .=
'&productobuy='.urlencode($productobuy);
799 if (!empty($productonly)) {
800 $param .=
'&productonly='.urlencode($productonly);
802 if (!empty($disablelinefree)) {
803 $param .=
'&disablelinefree='.urlencode($disablelinefree);
807 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
810 $parameters = array();
811 $reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object);
812 $param .= $hookmanager->resPrint;
815 $arrayofmassactions = array(
818 $massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
820 $url = DOL_URL_ROOT.
'/commande/card.php?action=create';
821 if (!empty($socid)) {
822 $url .=
'&socid='.$socid;
827 print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">';
828 if ($optioncss !=
'') {
829 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
831 print
'<input type="hidden" name="token" value="'.newToken().
'">';
832 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
833 print
'<input type="hidden" name="action" value="list">';
834 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
835 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
836 print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
837 print
'<input type="hidden" name="search_status" value="'.$search_status.
'">';
838 print
'<input type="hidden" name="socid" value="'.$socid.
'">';
840 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'order', 0, $newcardbutton,
'', $limit, 0, 0, 1);
842 $topicmail =
"SendOrderRef";
843 $modelmail =
"order_send";
845 $trackid =
'ord'.$object->id;
846 include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
849 foreach ($fieldstosearchall as $key => $val) {
850 $fieldstosearchall[$key] = $langs->trans($val);
852 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $sall).join(
', ', $fieldstosearchall).
'</div>';
857 $moreforfilter .=
'<input type="checkbox" name="productobuy"'.(!empty($productobuy)?
'value="productobuychecked" checked':
'' ).
'><label for="productobuy">'.$langs->trans(
"productobuy").
'</label>';
858 $moreforfilter .=
'<input type="checkbox" name="productonly"'.(!empty($productonly)?
'value="productonlychecked" checked':
'' ).
'><label for="productonly">'.$langs->trans(
"productonly").
'</label>';
859 $moreforfilter .=
'<input type="checkbox" name="disablelinefree"'.(!empty($disablelinefree)?
'value="disablelinefreechecked" checked':
'' ).
'><label for="disablelinefree">'.$langs->trans(
"disablelinefree").
'</label>';
860 $moreforfilter .=
'<br>';
863 if ($user->rights->user->user->lire) {
864 $langs->load(
"commercial");
865 $moreforfilter .=
'<div class="divsearchfield">';
866 $tmptitle = $langs->trans(
'ThirdPartiesOfSaleRepresentative');
867 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale,
'search_sale', $user, 0, $tmptitle,
'maxwidth250 widthcentpercentminusx');
868 $moreforfilter .=
'</div>';
871 if ($user->rights->user->user->lire) {
872 $moreforfilter .=
'<div class="divsearchfield">';
873 $tmptitle = $langs->trans(
'LinkedToSpecificUsers');
874 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$form->select_dolusers($search_user,
'search_user', $tmptitle,
'', 0,
'',
'', 0, 0, 0,
'', 0,
'',
'maxwidth250 widthcentpercentminusx');
875 $moreforfilter .=
'</div>';
878 if (isModEnabled(
"categorie") && $user->hasRight(
'categorie',
'lire') && ($user->hasRight(
'produit',
'lire') || $user->hasRight(
'service',
'lire'))) {
879 include_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
880 $moreforfilter .=
'<div class="divsearchfield">';
881 $tmptitle = $langs->trans(
'IncludingProductWithTag');
882 $cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT,
null,
'parent',
null,
null, 1);
883 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"').$form->selectarray(
'search_product_category', $cate_arbo, $search_product_category, $tmptitle, 0, 0,
'', 0, 0, 0, 0,
'maxwidth300 widthcentpercentminusx', 1);
884 $moreforfilter .=
'</div>';
886 if (isModEnabled(
"categorie") && $user->hasRight(
'categorie',
'lire')) {
887 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
888 $moreforfilter .=
'<div class="divsearchfield">';
889 $tmptitle = $langs->trans(
'CustomersProspectsCategoriesShort');
890 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"').$formother->select_categories(
'customer', $search_categ_cus,
'search_categ_cus', 1, $tmptitle,
'maxwidth300 widthcentpercentminusx');
891 $moreforfilter .=
'</div>';
893 if (isModEnabled(
'stock') && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER)) {
894 require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
896 $moreforfilter .=
'<div class="divsearchfield">';
897 $tmptitle = $langs->trans(
'Warehouse');
898 $moreforfilter .=
img_picto($tmptitle,
'stock',
'class="pictofixedwidth"').$formproduct->selectWarehouses($search_warehouse,
'search_warehouse',
'', 1, 0, 0, $tmptitle, 0, 0, array(),
'maxwidth250 widthcentpercentminusx');
899 $moreforfilter .=
'</div>';
903 $parameters = array();
904 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters);
905 if (empty($reshook)) {
906 $moreforfilter .= $hookmanager->resPrint;
908 $moreforfilter = $hookmanager->resPrint;
911 if (!empty($moreforfilter)) {
912 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
913 print $moreforfilter;
917 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
918 $selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN',
''));
919 $selectedfields .= $form->showCheckAddButtons(
'checkforselect', 1);
921 if (
GETPOST(
'autoselectall',
'int')) {
922 $selectedfields .=
'<script>';
923 $selectedfields .=
' $(document).ready(function() {';
924 $selectedfields .=
' console.log("Autoclick on checkforselects");';
925 $selectedfields .=
' $("#checkforselects").click();';
926 $selectedfields .=
' $("#massaction").val("createbills").change();';
927 $selectedfields .=
' });';
928 $selectedfields .=
'</script>';
931 print
'<div class="div-table-responsive">';
932 print
'<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
934 print
'<tr class="liste_titre_filter">';
937 if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
938 print
'<td class="liste_titre" align="middle">';
939 $searchpicto = $form->showFilterButtons(
'left');
945 if (!empty($arrayfields[
'pr.ref'][
'checked'])) {
946 print
'<td class="liste_titre">';
947 print
'<input class="flat" size="6" type="text" name="search_refProduct" value="'.dol_escape_htmltag($search_refProduct).
'">';
951 if (!empty($arrayfields[
'pr.desc'][
'checked'])) {
952 print
'<td class="liste_titre">';
953 print
'<input class="flat" size="6" type="text" name="search_descProduct" value="'.dol_escape_htmltag($search_descProduct).
'">';
957 if (!empty($arrayfields[
'cdet.qty'][
'checked'])) {
958 print
'<td class="liste_titre"></td>';
962 if (!empty($arrayfields[
'c.ref'][
'checked'])) {
963 print
'<td class="liste_titre">';
964 print
'<input class="flat" size="6" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
968 if (!empty($arrayfields[
'c.ref_client'][
'checked'])) {
969 print
'<td class="liste_titre" align="left">';
970 print
'<input class="flat" type="text" size="6" name="search_ref_customer" value="'.dol_escape_htmltag($search_ref_customer).
'">';
974 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
975 print
'<td class="liste_titre"><input type="text" class="flat" size="6" name="search_project_ref" value="'.dol_escape_htmltag($search_project_ref).
'"></td>';
978 if (!empty($arrayfields[
'p.title'][
'checked'])) {
979 print
'<td class="liste_titre"><input type="text" class="flat" size="6" name="search_project" value="'.dol_escape_htmltag($search_project).
'"></td>';
982 if (!empty($arrayfields[
's.nom'][
'checked'])) {
983 print
'<td class="liste_titre" align="left">';
984 print
'<input class="flat maxwidth100" type="text" name="search_company" value="'.dol_escape_htmltag($search_company).
'">';
988 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
989 print
'<td class="liste_titre" align="left">';
990 print
'<input class="flat maxwidth100" type="text" name="search_company_alias" value="'.dol_escape_htmltag($search_company_alias).
'">';
994 if (!empty($arrayfields[
's.town'][
'checked'])) {
995 print
'<td class="liste_titre"><input class="flat" type="text" size="4" name="search_town" value="'.dol_escape_htmltag($search_town).
'"></td>';
998 if (!empty($arrayfields[
's.zip'][
'checked'])) {
999 print
'<td class="liste_titre"><input class="flat" type="text" size="4" name="search_zip" value="'.dol_escape_htmltag($search_zip).
'"></td>';
1002 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1003 print
'<td class="liste_titre">';
1004 print
'<input class="flat" size="4" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).
'">';
1008 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1009 print
'<td class="liste_titre" align="center">';
1010 print $form->select_country($search_country,
'search_country',
'', 0,
'minwidth100imp maxwidth100');
1014 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1015 print
'<td class="liste_titre maxwidthonsmartphone" align="center">';
1016 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);
1020 if (!empty($arrayfields[
'c.date_commande'][
'checked'])) {
1021 print
'<td class="liste_titre center">';
1022 print
'<div class="nowrap">';
1023 print $form->selectDate($search_dateorder_start ? $search_dateorder_start : -1,
'search_dateorder_start_', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1025 print
'<div class="nowrap">';
1026 print $form->selectDate($search_dateorder_end ? $search_dateorder_end : -1,
'search_dateorder_end_', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1030 if (!empty($arrayfields[
'c.date_delivery'][
'checked'])) {
1031 print
'<td class="liste_titre center">';
1032 print
'<div class="nowrap">';
1033 print $form->selectDate($search_datedelivery_start ? $search_datedelivery_start : -1,
'search_datedelivery_start_', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1035 print
'<div class="nowrap">';
1036 print $form->selectDate($search_datedelivery_end ? $search_datedelivery_end : -1,
'search_datedelivery_end_', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1041 if (!empty($arrayfields[
'c.fk_shipping_method'][
'checked'])) {
1042 print
'<td class="liste_titre">';
1043 $form->selectShippingMethod($search_fk_shipping_method,
'search_fk_shipping_method',
'', 1,
'', 1);
1047 if (!empty($arrayfields[
'c.fk_cond_reglement'][
'checked'])) {
1048 print
'<td class="liste_titre">';
1049 $form->select_conditions_paiements($search_fk_cond_reglement,
'search_fk_cond_reglement', 1, 1, 1);
1053 if (!empty($arrayfields[
'c.fk_mode_reglement'][
'checked'])) {
1054 print
'<td class="liste_titre">';
1055 $form->select_types_paiements($search_fk_mode_reglement,
'search_fk_mode_reglement',
'', 0, 1, 1, 0, -1);
1059 if (!empty($arrayfields[
'c.fk_input_reason'][
'checked'])) {
1060 print
'<td class="liste_titre">';
1061 $form->selectInputReason($search_fk_input_reason,
'search_fk_input_reason',
'', 1,
'', 1);
1064 if (!empty($arrayfields[
'cdet.total_ht'][
'checked'])) {
1066 print
'<td class="liste_titre right">';
1067 print
'<input class="flat" type="text" size="4" name="search_total_ht" value="'.dol_escape_htmltag($search_total_ht).
'">';
1070 if (!empty($arrayfields[
'c.total_vat'][
'checked'])) {
1072 print
'<td class="liste_titre right">';
1073 print
'<input class="flat" type="text" size="4" name="search_total_vat" value="'.dol_escape_htmltag($search_total_vat).
'">';
1076 if (!empty($arrayfields[
'cdet.total_ttc'][
'checked'])) {
1078 print
'<td class="liste_titre right">';
1079 print
'<input class="flat" type="text" size="5" name="search_total_ttc" value="'.$search_total_ttc.
'">';
1082 if (!empty($arrayfields[
'c.fk_warehouse'][
'checked'])) {
1084 print
'<td class="liste_titre right"></td>';
1086 if (!empty($arrayfields[
'c.multicurrency_code'][
'checked'])) {
1088 print
'<td class="liste_titre">';
1089 print $form->selectMultiCurrency($search_multicurrency_code,
'search_multicurrency_code', 1);
1092 if (!empty($arrayfields[
'c.multicurrency_tx'][
'checked'])) {
1094 print
'<td class="liste_titre">';
1095 print
'<input class="flat" type="text" size="4" name="search_multicurrency_tx" value="'.dol_escape_htmltag($search_multicurrency_tx).
'">';
1098 if (!empty($arrayfields[
'c.multicurrency_total_ht'][
'checked'])) {
1100 print
'<td class="liste_titre right">';
1101 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ht" value="'.dol_escape_htmltag($search_multicurrency_montant_ht).
'">';
1104 if (!empty($arrayfields[
'c.multicurrency_total_vat'][
'checked'])) {
1106 print
'<td class="liste_titre right">';
1107 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_vat" value="'.dol_escape_htmltag($search_multicurrency_montant_vat).
'">';
1110 if (!empty($arrayfields[
'c.multicurrency_total_ttc'][
'checked'])) {
1112 print
'<td class="liste_titre right">';
1113 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ttc" value="'.dol_escape_htmltag($search_multicurrency_montant_ttc).
'">';
1116 if (!empty($arrayfields[
'u.login'][
'checked'])) {
1118 print
'<td class="liste_titre" align="center">';
1119 print
'<input class="flat" size="4" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).
'">';
1122 if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
1123 print
'<td class="liste_titre"></td>';
1125 if (!empty($arrayfields[
'total_pa'][
'checked'])) {
1126 print
'<td class="liste_titre right">';
1129 if (!empty($arrayfields[
'total_margin'][
'checked'])) {
1130 print
'<td class="liste_titre right">';
1133 if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
1134 print
'<td class="liste_titre right">';
1137 if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
1138 print
'<td class="liste_titre right">';
1142 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
1144 $parameters = array(
'arrayfields'=>$arrayfields);
1145 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters);
1146 print $hookmanager->resPrint;
1148 if (!empty($arrayfields[
'c.datec'][
'checked'])) {
1149 print
'<td class="liste_titre">';
1153 if (!empty($arrayfields[
'c.tms'][
'checked'])) {
1154 print
'<td class="liste_titre">';
1158 if (!empty($arrayfields[
'c.date_cloture'][
'checked'])) {
1159 print
'<td class="liste_titre center">';
1160 print
'<div class="nowrap">';
1161 print $form->selectDate($search_datecloture_start ? $search_datecloture_start : -1,
'search_datecloture_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1163 print
'<div class="nowrap">';
1164 print $form->selectDate($search_datecloture_end ? $search_datecloture_end : -1,
'search_datecloture_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1169 if (!empty($arrayfields[
'c.note_public'][
'checked'])) {
1170 print
'<td class="liste_titre">';
1174 if (!empty($arrayfields[
'c.note_private'][
'checked'])) {
1175 print
'<td class="liste_titre">';
1179 if (!empty($arrayfields[
'shippable'][
'checked'])) {
1180 print
'<td class="liste_titre maxwidthonsmartphone" align="center">';
1182 if (!empty($conf->global->ORDER_SHIPABLE_STATUS_DISABLED_BY_DEFAULT)) {
1183 print
'<input type="checkbox" name="show_shippable_command" value="1"'.($show_shippable_command ?
' checked' :
'').
'>';
1184 print $langs->trans(
'ShowShippableStatus');
1186 $show_shippable_command = 1;
1191 if (!empty($arrayfields[
'c.facture'][
'checked'])) {
1192 print
'<td class="liste_titre maxwidthonsmartphone" align="center">';
1193 print $form->selectyesno(
'search_billed', $search_billed, 1, 0, 1, 1);
1197 if (!empty($arrayfields[
'c.import_key'][
'checked'])) {
1198 print
'<td class="liste_titre maxwidthonsmartphone" align="center">';
1202 if (!empty($arrayfields[
'c.fk_statut'][
'checked'])) {
1203 print
'<td class="liste_titre maxwidthonsmartphone center">';
1204 $liststatus = array(
1209 -3=>$langs->trans(
"StatusOrderValidatedShort").
'+'.$langs->trans(
"StatusOrderSentShort").
'+'.$langs->trans(
"StatusOrderDelivered"),
1210 -2=>$langs->trans(
"StatusOrderValidatedShort").
'+'.$langs->trans(
"StatusOrderSentShort"),
1213 print $form->selectarray(
'search_status', $liststatus, $search_status, -5, 0, 0,
'', 0, 0, 0,
'',
'maxwidth125', 1);
1217 if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
1218 print
'<td class="liste_titre" align="middle">';
1219 $searchpicto = $form->showFilterButtons();
1226 print
'<tr class="liste_titre">';
1228 if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
1229 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'', $param,
'', $sortfield, $sortorder,
'maxwidthsearch center ');
1233 if (!empty($arrayfields[
'pr.ref'][
'checked'])) {
1234 print_liste_field_titre($arrayfields[
'pr.ref'][
'label'], $_SERVER[
"PHP_SELF"],
'pr.ref',
'', $param,
'', $sortfield, $sortorder);
1236 if (!empty($arrayfields[
'pr.desc'][
'checked'])) {
1237 print_liste_field_titre($arrayfields[
'pr.desc'][
'label'], $_SERVER[
"PHP_SELF"],
'pr.desc',
'', $param,
'', $sortfield, $sortorder);
1239 if (!empty($arrayfields[
'cdet.qty'][
'checked'])) {
1240 print_liste_field_titre($arrayfields[
'cdet.qty'][
'label'], $_SERVER[
"PHP_SELF"],
'cdet.qty',
'', $param,
'', $sortfield, $sortorder);
1243 if (!empty($arrayfields[
'c.ref'][
'checked'])) {
1244 print_liste_field_titre($arrayfields[
'c.ref'][
'label'], $_SERVER[
"PHP_SELF"],
'c.ref',
'', $param,
'', $sortfield, $sortorder);
1246 if (!empty($arrayfields[
'c.ref_client'][
'checked'])) {
1247 print_liste_field_titre($arrayfields[
'c.ref_client'][
'label'], $_SERVER[
"PHP_SELF"],
'c.ref_client',
'', $param,
'', $sortfield, $sortorder);
1249 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1250 print_liste_field_titre($arrayfields[
'p.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"p.ref",
"", $param,
'', $sortfield, $sortorder);
1252 if (!empty($arrayfields[
'p.title'][
'checked'])) {
1253 print_liste_field_titre($arrayfields[
'p.title'][
'label'], $_SERVER[
"PHP_SELF"],
"p.title",
"", $param,
'', $sortfield, $sortorder);
1255 if (!empty($arrayfields[
's.nom'][
'checked'])) {
1256 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
"PHP_SELF"],
's.nom',
'', $param,
'', $sortfield, $sortorder);
1258 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1259 print_liste_field_titre($arrayfields[
's.name_alias'][
'label'], $_SERVER[
"PHP_SELF"],
's.name_alias',
'', $param,
'', $sortfield, $sortorder);
1261 if (!empty($arrayfields[
's.town'][
'checked'])) {
1262 print_liste_field_titre($arrayfields[
's.town'][
'label'], $_SERVER[
"PHP_SELF"],
's.town',
'', $param,
'', $sortfield, $sortorder);
1264 if (!empty($arrayfields[
's.zip'][
'checked'])) {
1265 print_liste_field_titre($arrayfields[
's.zip'][
'label'], $_SERVER[
"PHP_SELF"],
's.zip',
'', $param,
'', $sortfield, $sortorder);
1267 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1268 print_liste_field_titre($arrayfields[
'state.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"state.nom",
"", $param,
'', $sortfield, $sortorder);
1270 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1271 print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'], $_SERVER[
"PHP_SELF"],
"country.code_iso",
"", $param,
'', $sortfield, $sortorder,
'center ');
1273 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1274 print_liste_field_titre($arrayfields[
'typent.code'][
'label'], $_SERVER[
"PHP_SELF"],
"typent.code",
"", $param,
'', $sortfield, $sortorder,
'center ');
1276 if (!empty($arrayfields[
'c.date_commande'][
'checked'])) {
1277 print_liste_field_titre($arrayfields[
'c.date_commande'][
'label'], $_SERVER[
"PHP_SELF"],
'c.date_commande',
'', $param,
'', $sortfield, $sortorder,
'center ');
1279 if (!empty($arrayfields[
'c.date_delivery'][
'checked'])) {
1280 print_liste_field_titre($arrayfields[
'c.date_delivery'][
'label'], $_SERVER[
"PHP_SELF"],
'c.date_livraison',
'', $param,
'', $sortfield, $sortorder,
'center ');
1282 if (!empty($arrayfields[
'c.fk_shipping_method'][
'checked'])) {
1283 print_liste_field_titre($arrayfields[
'c.fk_shipping_method'][
'label'], $_SERVER[
"PHP_SELF"],
"c.fk_shipping_method",
"", $param,
'', $sortfield, $sortorder);
1285 if (!empty($arrayfields[
'c.fk_cond_reglement'][
'checked'])) {
1286 print_liste_field_titre($arrayfields[
'c.fk_cond_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"c.fk_cond_reglement",
"", $param,
'', $sortfield, $sortorder);
1288 if (!empty($arrayfields[
'c.fk_mode_reglement'][
'checked'])) {
1289 print_liste_field_titre($arrayfields[
'c.fk_mode_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"c.fk_mode_reglement",
"", $param,
'', $sortfield, $sortorder);
1291 if (!empty($arrayfields[
'c.fk_input_reason'][
'checked'])) {
1292 print_liste_field_titre($arrayfields[
'c.fk_input_reason'][
'label'], $_SERVER[
"PHP_SELF"],
"c.fk_input_reason",
"", $param,
'', $sortfield, $sortorder);
1294 if (!empty($arrayfields[
'cdet.total_ht'][
'checked'])) {
1295 print_liste_field_titre($arrayfields[
'cdet.total_ht'][
'label'], $_SERVER[
"PHP_SELF"],
'cdet.total_ht',
'', $param,
'', $sortfield, $sortorder,
'right ');
1297 if (!empty($arrayfields[
'c.total_vat'][
'checked'])) {
1298 print_liste_field_titre($arrayfields[
'c.total_vat'][
'label'], $_SERVER[
"PHP_SELF"],
'cdet.total_tva',
'', $param,
'', $sortfield, $sortorder,
'right ');
1300 if (!empty($arrayfields[
'cdet.total_ttc'][
'checked'])) {
1301 print_liste_field_titre($arrayfields[
'cdet.total_ttc'][
'label'], $_SERVER[
"PHP_SELF"],
'cdet.total_ttc',
'', $param,
'', $sortfield, $sortorder,
'right ');
1303 if (!empty($arrayfields[
'c.fk_warehouse'][
'checked'])) {
1304 print_liste_field_titre($arrayfields[
'c.fk_warehouse'][
'label'],
"",
'',
'', $param,
'', $sortfield, $sortorder);
1306 if (!empty($arrayfields[
'c.multicurrency_code'][
'checked'])) {
1307 print_liste_field_titre($arrayfields[
'c.multicurrency_code'][
'label'], $_SERVER[
'PHP_SELF'],
'c.multicurrency_code',
'', $param,
'', $sortfield, $sortorder);
1309 if (!empty($arrayfields[
'c.multicurrency_tx'][
'checked'])) {
1310 print_liste_field_titre($arrayfields[
'c.multicurrency_tx'][
'label'], $_SERVER[
'PHP_SELF'],
'c.multicurrency_tx',
'', $param,
'', $sortfield, $sortorder);
1312 if (!empty($arrayfields[
'c.multicurrency_total_ht'][
'checked'])) {
1313 print_liste_field_titre($arrayfields[
'c.multicurrency_total_ht'][
'label'], $_SERVER[
'PHP_SELF'],
'c.multicurrency_total_ht',
'', $param,
'class="right"', $sortfield, $sortorder);
1315 if (!empty($arrayfields[
'c.multicurrency_total_vat'][
'checked'])) {
1316 print_liste_field_titre($arrayfields[
'c.multicurrency_total_vat'][
'label'], $_SERVER[
'PHP_SELF'],
'c.multicurrency_total_tva',
'', $param,
'class="right"', $sortfield, $sortorder);
1318 if (!empty($arrayfields[
'c.multicurrency_total_ttc'][
'checked'])) {
1319 print_liste_field_titre($arrayfields[
'c.multicurrency_total_ttc'][
'label'], $_SERVER[
'PHP_SELF'],
'c.multicurrency_total_ttc',
'', $param,
'class="right"', $sortfield, $sortorder);
1321 if (!empty($arrayfields[
'u.login'][
'checked'])) {
1322 print_liste_field_titre($arrayfields[
'u.login'][
'label'], $_SERVER[
"PHP_SELF"],
'u.login',
'', $param,
'align="center"', $sortfield, $sortorder);
1324 if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
1325 print_liste_field_titre($arrayfields[
'sale_representative'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"",
"$param",
'', $sortfield, $sortorder);
1327 if (!empty($arrayfields[
'total_pa'][
'checked'])) {
1328 print_liste_field_titre($arrayfields[
'total_pa'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1330 if (!empty($arrayfields[
'total_margin'][
'checked'])) {
1331 print_liste_field_titre($arrayfields[
'total_margin'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1333 if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
1334 print_liste_field_titre($arrayfields[
'total_margin_rate'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1336 if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
1337 print_liste_field_titre($arrayfields[
'total_mark_rate'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1340 $totalarray = array(
1343 'cdet.total_ht' => 0,
1344 'cdet.total_tva' => 0,
1345 'cdet.total_ttc' => 0,
1350 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1352 $parameters = array(
1353 'arrayfields' => $arrayfields,
1355 'sortfield' => $sortfield,
1356 'sortorder' => $sortorder,
1357 'totalarray' => &$totalarray,
1359 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters);
1360 print $hookmanager->resPrint;
1361 if (!empty($arrayfields[
'c.datec'][
'checked'])) {
1362 print_liste_field_titre($arrayfields[
'c.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"c.date_creation",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1364 if (!empty($arrayfields[
'c.tms'][
'checked'])) {
1365 print_liste_field_titre($arrayfields[
'c.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"c.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1367 if (!empty($arrayfields[
'c.date_cloture'][
'checked'])) {
1368 print_liste_field_titre($arrayfields[
'c.date_cloture'][
'label'], $_SERVER[
"PHP_SELF"],
"c.date_cloture",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1370 if (!empty($arrayfields[
'c.note_public'][
'checked'])) {
1371 print_liste_field_titre($arrayfields[
'c.note_public'][
'label'], $_SERVER[
"PHP_SELF"],
"c.note_public",
"", $param,
'', $sortfield, $sortorder,
'right ');
1373 if (!empty($arrayfields[
'c.note_private'][
'checked'])) {
1374 print_liste_field_titre($arrayfields[
'c.note_private'][
'label'], $_SERVER[
"PHP_SELF"],
"c.note_private",
"", $param,
'', $sortfield, $sortorder,
'right ');
1376 if (!empty($arrayfields[
'shippable'][
'checked'])) {
1377 print_liste_field_titre($arrayfields[
'shippable'][
'label'], $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'center ');
1379 if (!empty($arrayfields[
'c.facture'][
'checked'])) {
1380 print_liste_field_titre($arrayfields[
'c.facture'][
'label'], $_SERVER[
"PHP_SELF"],
'c.facture',
'', $param,
'', $sortfield, $sortorder,
'center ');
1382 if (!empty($arrayfields[
'c.import_key'][
'checked'])) {
1383 print_liste_field_titre($arrayfields[
'c.import_key'][
'label'], $_SERVER[
"PHP_SELF"],
"c.import_key",
"", $param,
'', $sortfield, $sortorder,
'center ');
1385 if (!empty($arrayfields[
'c.fk_statut'][
'checked'])) {
1386 print_liste_field_titre($arrayfields[
'c.fk_statut'][
'label'], $_SERVER[
"PHP_SELF"],
"c.fk_statut",
"", $param,
'', $sortfield, $sortorder,
'center ');
1388 if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
1389 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'', $param,
'', $sortfield, $sortorder,
'maxwidthsearch center ');
1395 $productstat_cache = array();
1396 $productstat_cachevirtual = array();
1397 $getNomUrl_cache = array();
1399 $generic_commande =
new Commande($db);
1400 $generic_product =
new Product($db);
1401 $userstatic =
new User($db);
1404 $with_margin_info =
false;
1405 if (isModEnabled(
'margin') && (
1406 !empty($arrayfields[
'total_pa'][
'checked'])
1407 || !empty($arrayfields[
'total_margin'][
'checked'])
1408 || !empty($arrayfields[
'total_margin_rate'][
'checked'])
1409 || !empty($arrayfields[
'total_mark_rate'][
'checked'])
1412 $with_margin_info =
true;
1421 $totalarray = array();
1422 $totalarray[
'nbfield'] = 0;
1423 $totalarray[
'val'][
'cdet.total_tva'] = 0;
1424 $totalarray[
'val'][
'cdet.total_ttc'] = 0;
1425 $imaxinloop = ($limit ? min($num, $limit) : $num);
1426 while ($i < $imaxinloop) {
1427 $obj = $db->fetch_object($resql);
1437 $oldref = $obj->product_ref;
1439 if ($oldref != $obj->product_ref && $sortfield ==
'pr.ref') {
1441 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
1442 $oldref = $obj->product_ref;
1445 $companystatic->id = $obj->socid;
1446 $companystatic->name = $obj->name;
1447 $companystatic->name_alias = $obj->alias;
1448 $companystatic->client = $obj->client;
1449 $companystatic->code_client = $obj->code_client;
1450 $companystatic->email = $obj->email;
1451 $companystatic->phone = $obj->phone;
1452 $companystatic->address = $obj->address;
1453 $companystatic->zip = $obj->zip;
1454 $companystatic->town = $obj->town;
1455 $companystatic->country_code = $obj->country_code;
1456 if (!isset($getNomUrl_cache[$obj->socid])) {
1457 $getNomUrl_cache[$obj->socid] = $companystatic->getNomUrl(1,
'customer');
1460 $generic_commande->id = $obj->c_rowid;
1461 $generic_commande->ref = $obj->ref;
1462 $generic_commande->statut = $obj->fk_statut;
1463 $generic_commande->billed = $obj->billed;
1464 $generic_commande->date = $db->jdate($obj->date_commande);
1465 $generic_commande->date_livraison = $db->jdate($obj->date_delivery);
1466 $generic_commande->delivery_date = $db->jdate($obj->date_delivery);
1467 $generic_commande->ref_client = $obj->ref_client;
1468 $generic_commande->total_ht = $obj->c_total_ht;
1469 $generic_commande->total_tva = $obj->c_total_tva;
1470 $generic_commande->total_ttc = $obj->c_total_ttc;
1471 $generic_commande->note_public = $obj->note_public;
1472 $generic_commande->note_private = $obj->note_private;
1474 $projectstatic->id = $obj->project_id;
1475 $projectstatic->ref = $obj->project_ref;
1476 $projectstatic->title = $obj->project_label;
1478 $marginInfo = array();
1479 if ($with_margin_info ===
true) {
1480 $generic_commande->fetch_lines();
1481 $marginInfo = $formmargin->getMarginInfosArray($generic_commande);
1482 $total_ht += $obj->total_ht;
1483 $total_margin += $marginInfo[
'total_margin'];
1486 print
'<tr class="oddeven">';
1489 if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
1490 print
'<td class="nowrap center">';
1491 if ($massactionbutton || $massaction) {
1493 if (in_array($obj->rowid, $arrayofselected)) {
1496 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1500 $totalarray[
'nbfield']++;
1506 if (!empty($arrayfields[
'pr.ref'][
'checked'])) {
1507 if (!empty($obj->product_rowid)) {
1508 $generic_product->id = $obj->product_rowid;
1509 $generic_product->ref = $obj->product_ref;
1510 $generic_product->label = $obj->product_label;
1511 $generic_product->status = $obj->product_status;
1512 $generic_product->status_buy = $obj->product_status_buy;
1513 $generic_product->status_batch = $obj->product_batch;
1514 $generic_product->barcode = $obj->product_barcode;
1515 print
'<td class="nowrap tdoverflowmax200">'.$generic_product->getNomUrl(1).
'</td>';
1517 print
'<td class="nowrap tdoverflowmax200">Ligne libre</td>';
1520 $totalarray[
'nbfield']++;
1524 if (!empty($arrayfields[
'pr.desc'][
'checked'])) {
1526 !empty($obj->product_label) ? $labelproduct = $obj->product_label : $labelproduct = $obj->description;
1527 print
'<td class="nowrap tdoverflowmax200">aa';
1532 $totalarray[
'nbfield']++;
1536 if (!empty($arrayfields[
'cdet.qty'][
'checked'])) {
1537 print
'<td class="nowrap right">'.$obj->qty.
'</td>';
1538 if (isset($totalarray[
'val'][
'cdet.qty'])) {
1539 $totalarray[
'val'][
'cdet.qty'] += $obj->qty;
1541 $totalarray[
'val'][
'cdet.qty'] = $obj->qty;
1544 $totalarray[
'nbfield']++;
1547 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'cdet.qty';
1552 if (!empty($arrayfields[
'c.ref'][
'checked'])) {
1553 print
'<td class="nowraponall">';
1554 print $generic_commande->getNomUrl(1, ($search_status != 2 ? 0 : $obj->fk_statut), 0, 0, 0, 1, 1);
1557 $filedir = $conf->commande->multidir_output[$conf->entity].
'/'.
dol_sanitizeFileName($obj->ref);
1558 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid;
1559 print $formfile->getDocumentsLink($generic_commande->element, $filename, $filedir);
1563 $totalarray[
'nbfield']++;
1568 if (!empty($arrayfields[
'c.ref_client'][
'checked'])) {
1569 print
'<td class="nowrap tdoverflowmax200">'.$obj->ref_client.
'</td>';
1571 $totalarray[
'nbfield']++;
1576 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1577 print
'<td class="nowrap">';
1578 if ($obj->project_id > 0) {
1579 print $projectstatic->getNomUrl(1);
1583 $totalarray[
'nbfield']++;
1588 if (!empty($arrayfields[
'p.title'][
'checked'])) {
1589 print
'<td class="nowrap">';
1590 if ($obj->project_id > 0) {
1591 print $projectstatic->title;
1595 $totalarray[
'nbfield']++;
1600 if (!empty($arrayfields[
's.nom'][
'checked'])) {
1601 print
'<td class="tdoverflowmax200">';
1602 print $getNomUrl_cache[$obj->socid];
1605 if (isModEnabled(
'facture') && !empty($conf->global->ORDER_BILLING_ALL_CUSTOMER)) {
1606 if ($user->hasRight(
'facture',
'creer')) {
1607 if (($obj->fk_statut > 0 && $obj->fk_statut < 3) || ($obj->fk_statut == 3 && $obj->billed == 0)) {
1608 print
' <a href="'.DOL_URL_ROOT.
'/commande/list.php?socid='.$companystatic->id.
'&search_billed=0&autoselectall=1">';
1609 print
img_picto($langs->trans(
"CreateInvoiceForThisCustomer").
' : '.$companystatic->name,
'object_bill',
'hideonsmartphone').
'</a>';
1615 $totalarray[
'nbfield']++;
1619 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1620 print
'<td class="nocellnopadd">';
1624 $totalarray[
'nbfield']++;
1628 if (!empty($arrayfields[
's.town'][
'checked'])) {
1629 print
'<td class="nocellnopadd">';
1633 $totalarray[
'nbfield']++;
1637 if (!empty($arrayfields[
's.zip'][
'checked'])) {
1638 print
'<td class="nocellnopadd">';
1642 $totalarray[
'nbfield']++;
1646 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1647 print
"<td>".$obj->state_name.
"</td>\n";
1649 $totalarray[
'nbfield']++;
1653 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1654 print
'<td class="center">';
1655 $tmparray =
getCountry($obj->fk_pays,
'all');
1656 print $tmparray[
'label'];
1659 $totalarray[
'nbfield']++;
1663 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1664 print
'<td class="center">';
1665 if (empty($typenArray)) {
1666 $typenArray = $formcompany->typent_array(1);
1668 print $typenArray[$obj->typent_code];
1671 $totalarray[
'nbfield']++;
1676 if (!empty($arrayfields[
'c.date_commande'][
'checked'])) {
1677 print
'<td class="center">';
1680 if ($generic_commande->hasDelay()) {
1681 print
img_picto($langs->trans(
"Late").
' : '.$generic_commande->showDelay(),
"warning");
1685 $totalarray[
'nbfield']++;
1689 if (!empty($arrayfields[
'c.date_delivery'][
'checked'])) {
1690 print
'<td class="center">';
1691 print
dol_print_date($db->jdate($obj->date_delivery),
'dayhour');
1694 $totalarray[
'nbfield']++;
1698 if (!empty($arrayfields[
'c.fk_shipping_method'][
'checked'])) {
1700 $form->formSelectShippingMethod(
'', $obj->fk_shipping_method,
'none', 1);
1703 $totalarray[
'nbfield']++;
1707 if (!empty($arrayfields[
'c.fk_cond_reglement'][
'checked'])) {
1709 $form->form_conditions_reglement($_SERVER[
'PHP_SELF'], $obj->fk_cond_reglement,
'none', 0,
'', 1, $obj->deposit_percent);
1712 $totalarray[
'nbfield']++;
1716 if (!empty($arrayfields[
'c.fk_mode_reglement'][
'checked'])) {
1718 $form->form_modes_reglement($_SERVER[
'PHP_SELF'], $obj->fk_mode_reglement,
'none',
'', -1);
1721 $totalarray[
'nbfield']++;
1725 if (!empty($arrayfields[
'c.fk_input_reason'][
'checked'])) {
1727 $form->formInputReason($_SERVER[
'PHP_SELF'], $obj->fk_input_reason,
'none',
'');
1730 $totalarray[
'nbfield']++;
1734 if (!empty($arrayfields[
'cdet.total_ht'][
'checked'])) {
1735 print
'<td class="nowrap right"><span class="amount">'.price($obj->total_ht).
"</span></td>\n";
1737 $totalarray[
'nbfield']++;
1740 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'cdet.total_ht';
1742 if (isset($totalarray[
'val'][
'cdet.total_ht'])) {
1743 $totalarray[
'val'][
'cdet.total_ht'] += $obj->total_ht;
1745 $totalarray[
'val'][
'cdet.total_ht'] = $obj->total_ht;
1749 if (!empty($arrayfields[
'c.total_vat'][
'checked'])) {
1750 print
'<td class="nowrap right"><span class="amount">'.price($obj->total_tva).
"</span></td>\n";
1752 $totalarray[
'nbfield']++;
1755 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'cdet.total_tva';
1757 $totalarray[
'val'][
'cdet.total_tva'] += $obj->total_tva;
1760 if (!empty($arrayfields[
'cdet.total_ttc'][
'checked'])) {
1761 print
'<td class="nowrap right"><span class="amount">'.price($obj->total_ttc).
"</span></td>\n";
1763 $totalarray[
'nbfield']++;
1766 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'cdet.total_ttc';
1768 $totalarray[
'val'][
'cdet.total_ttc'] += $obj->total_ttc;
1771 if (!empty($arrayfields[
'c.fk_warehouse'][
'checked'])) {
1772 print
'<td class="nowrap">';
1773 if ($obj->warehouse > 0) {
1774 print
img_picto(
'',
'stock',
'class="paddingrightonly"');
1776 $formproduct->formSelectWarehouses($_SERVER[
'PHP_SELF'], $obj->warehouse,
'none');
1779 $totalarray[
'nbfield']++;
1783 if (!empty($arrayfields[
'c.multicurrency_code'][
'checked'])) {
1784 print
'<td class="nowrap">'.$obj->multicurrency_code.
' - '.$langs->trans(
'Currency'.$obj->multicurrency_code).
"</td>\n";
1786 $totalarray[
'nbfield']++;
1791 if (!empty($arrayfields[
'c.multicurrency_tx'][
'checked'])) {
1792 print
'<td class="nowrap">';
1793 $form->form_multicurrency_rate($_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid, $obj->multicurrency_tx,
'none', $obj->multicurrency_code);
1796 $totalarray[
'nbfield']++;
1800 if (!empty($arrayfields[
'c.multicurrency_total_ht'][
'checked'])) {
1801 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ht).
"</span></td>\n";
1803 $totalarray[
'nbfield']++;
1807 if (!empty($arrayfields[
'c.multicurrency_total_vat'][
'checked'])) {
1808 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_vat).
"</span></td>\n";
1810 $totalarray[
'nbfield']++;
1814 if (!empty($arrayfields[
'c.multicurrency_total_ttc'][
'checked'])) {
1815 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ttc).
"</span></td>\n";
1817 $totalarray[
'nbfield']++;
1821 $userstatic->id = $obj->fk_user_author;
1822 $userstatic->login = $obj->login;
1823 $userstatic->lastname = $obj->lastname;
1824 $userstatic->firstname = $obj->firstname;
1825 $userstatic->email = $obj->user_email;
1826 $userstatic->statut = $obj->user_statut;
1827 $userstatic->entity = $obj->entity;
1828 $userstatic->photo = $obj->photo;
1829 $userstatic->office_phone = $obj->office_phone;
1830 $userstatic->office_fax = $obj->office_fax;
1831 $userstatic->user_mobile = $obj->user_mobile;
1832 $userstatic->job = $obj->job;
1833 $userstatic->gender = $obj->gender;
1836 if (!empty($arrayfields[
'u.login'][
'checked'])) {
1837 print
'<td class="tdoverflowmax200">';
1838 if ($userstatic->id) {
1839 print $userstatic->getNomUrl(-1);
1845 $totalarray[
'nbfield']++;
1849 if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
1852 if ($obj->socid > 0) {
1853 $listsalesrepresentatives = $companystatic->getSalesRepresentatives($user);
1854 if ($listsalesrepresentatives < 0) {
1857 $nbofsalesrepresentative = count($listsalesrepresentatives);
1858 if ($nbofsalesrepresentative > 6) {
1860 print $nbofsalesrepresentative;
1861 } elseif ($nbofsalesrepresentative > 0) {
1863 foreach ($listsalesrepresentatives as $val) {
1864 $userstatic->id = $val[
'id'];
1865 $userstatic->lastname = $val[
'lastname'];
1866 $userstatic->firstname = $val[
'firstname'];
1867 $userstatic->email = $val[
'email'];
1868 $userstatic->statut = $val[
'statut'];
1869 $userstatic->entity = $val[
'entity'];
1870 $userstatic->photo = $val[
'photo'];
1871 $userstatic->login = $val[
'login'];
1872 $userstatic->office_phone = $val[
'office_phone'];
1873 $userstatic->office_fax = $val[
'office_fax'];
1874 $userstatic->user_mobile = $val[
'user_mobile'];
1875 $userstatic->job = $val[
'job'];
1876 $userstatic->gender = $val[
'gender'];
1878 print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1,
'', 0, 0, 12) : $userstatic->getNomUrl(-2);
1880 if ($j < $nbofsalesrepresentative) {
1892 $totalarray[
'nbfield']++;
1897 if (!empty($arrayfields[
'total_pa'][
'checked'])) {
1898 print
'<td class="right nowrap">'.price($marginInfo[
'pa_total']).
'</td>';
1900 $totalarray[
'nbfield']++;
1904 if (!empty($arrayfields[
'total_margin'][
'checked'])) {
1905 print
'<td class="right nowrap">'.price($marginInfo[
'total_margin']).
'</td>';
1907 $totalarray[
'nbfield']++;
1910 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'total_margin';
1912 $totalarray[
'val'][
'total_margin'] += $marginInfo[
'total_margin'];
1915 if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
1916 print
'<td class="right nowrap">'.(($marginInfo[
'total_margin_rate'] ==
'') ?
'' :
price($marginInfo[
'total_margin_rate'], null, null, null, null, 2).
'%').
'</td>';
1918 $totalarray[
'nbfield']++;
1922 if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
1923 print
'<td class="right nowrap">'.(($marginInfo[
'total_mark_rate'] ==
'') ?
'' :
price($marginInfo[
'total_mark_rate'], null, null, null, null, 2).
'%').
'</td>';
1925 $totalarray[
'nbfield']++;
1928 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'total_mark_rate';
1930 if ($i >= $imaxinloop - 1) {
1931 if (!empty($total_ht)) {
1932 $totalarray[
'val'][
'total_mark_rate'] =
price2num($total_margin * 100 / $total_ht,
'MT');
1934 $totalarray[
'val'][
'total_mark_rate'] =
'';
1940 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
1942 $parameters = array(
'arrayfields'=>$arrayfields,
'obj'=>$obj,
'i'=>$i,
'totalarray'=>&$totalarray);
1943 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
1944 print $hookmanager->resPrint;
1947 if (!empty($arrayfields[
'c.datec'][
'checked'])) {
1948 print
'<td align="center" class="nowrap">';
1949 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuser');
1952 $totalarray[
'nbfield']++;
1957 if (!empty($arrayfields[
'c.tms'][
'checked'])) {
1958 print
'<td align="center" class="nowrap">';
1959 print
dol_print_date($db->jdate($obj->date_update),
'dayhour',
'tzuser');
1962 $totalarray[
'nbfield']++;
1967 if (!empty($arrayfields[
'c.date_cloture'][
'checked'])) {
1968 print
'<td align="center" class="nowrap">';
1969 print
dol_print_date($db->jdate($obj->date_cloture),
'dayhour',
'tzuser');
1972 $totalarray[
'nbfield']++;
1977 if (!empty($arrayfields[
'c.note_public'][
'checked'])) {
1978 print
'<td class="center">';
1982 $totalarray[
'nbfield']++;
1987 if (!empty($arrayfields[
'c.note_private'][
'checked'])) {
1988 print
'<td class="center">';
1992 $totalarray[
'nbfield']++;
1997 if (!empty($arrayfields[
'shippable'][
'checked'])) {
1998 print
'<td class="center">';
1999 if (!empty($show_shippable_command) && isModEnabled(
'stock')) {
2000 if (($obj->fk_statut > $generic_commande::STATUS_DRAFT) && ($obj->fk_statut < $generic_commande::STATUS_CLOSED)) {
2001 $generic_commande->loadExpeditions();
2003 if (isset($generic_commande->expeditions[$obj->rowid])) {
2004 $reliquat = $obj->qty - $generic_commande->expeditions[$obj->rowid];
2006 $reliquat = $obj->qty;
2008 if ($obj->product_type == 0 && $obj->fk_product > 0) {
2010 $generic_product->id = $obj->fk_product;
2013 if (empty($productstat_cache[$obj->fk_product])) {
2014 $generic_product->load_stock(
'nobatch');
2015 $productstat_cache[$obj->fk_product][
'stock_reel'] = $generic_product->stock_reel;
2016 $productstat_cachevirtual[$obj->fk_product][
'stock_reel'] = $generic_product->stock_theorique;
2018 $generic_product->stock_reel = $productstat_cache[$obj->fk_product][
'stock_reel'];
2019 $generic_product->stock_theorique = $productstat_cachevirtual[$obj->fk_product][
'stock_reel'] = $generic_product->stock_theorique;
2022 if ($reliquat > $generic_product->stock_reel) {
2025 if (empty($conf->global->SHIPPABLE_ORDER_ICON_IN_LIST)) {
2026 $text_info .= $reliquat.
' x '.$obj->product_ref.
' '.
dol_trunc($obj->product_label, 20);
2027 $text_info .=
' - '.$langs->trans(
"Stock").
': <span class="'.($generic_product->stock_reel > 0 ?
'ok' :
'error').
'">'.$generic_product->stock_reel.
'</span>';
2028 $text_info .=
' - '.$langs->trans(
"VirtualStock").
': <span class="'.($generic_product->stock_theorique > 0 ?
'ok' :
'error').
'">'.$generic_product->stock_theorique.
'</span>';
2029 $text_info .= ($reliquat != $obj->qty ?
' <span class="opacitymedium">('.$langs->trans(
"QtyInOtherShipments").
' '.($obj->qty - $reliquat).
')</span>' :
'');
2030 $text_info .=
'<br>';
2037 $stock_order_supplier = 0;
2038 if (!empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT) || !empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE)) {
2039 if (isModEnabled(
'commande')) {
2040 if (empty($productstat_cache[$obj->fk_product][
'stats_order_customer'])) {
2041 $generic_product->load_stats_commande(0,
'1,2');
2042 $productstat_cache[$obj->fk_product][
'stats_order_customer'] = $generic_product->stats_commande[
'qty'];
2044 $generic_product->stats_commande[
'qty'] = $productstat_cache[$obj->fk_product][
'stats_order_customer'];
2046 $stock_order = $generic_product->stats_commande[
'qty'];
2048 if (isModEnabled(
'supplier_order')) {
2049 if (empty($productstat_cache[$obj->fk_product][
'stats_order_supplier'])) {
2050 $generic_product->load_stats_commande_fournisseur(0,
'3');
2051 $productstat_cache[$obj->fk_product][
'stats_order_supplier'] = $generic_product->stats_commande_fournisseur[
'qty'];
2053 $generic_product->stats_commande_fournisseur[
'qty'] = $productstat_cache[$obj->fk_product][
'stats_order_supplier'];
2055 $stock_order_supplier = $generic_product->stats_commande_fournisseur[
'qty'];
2058 $text_info .= $reliquat.
' x '.$obj->product_ref.
' '.
dol_trunc($obj->product_label, 20);
2059 $text_stock_reel = $generic_product->stock_reel.
'/'.$stock_order;
2060 if ($stock_order > $generic_product->stock_reel && !($generic_product->stock_reel < $obj->qty)) {
2062 $text_warning .=
'<span class="warning">'.$langs->trans(
'Available').
' : '.$text_stock_reel.
'</span>';
2064 if ($reliquat > $generic_product->stock_reel) {
2065 $text_info .=
'<span class="warning">'.$langs->trans(
'Available').
' : '.$text_stock_reel.
'</span>';
2067 $text_info .=
'<span class="ok">'.$langs->trans(
'Available').
' : '.$text_stock_reel.
'</span>';
2069 if (isModEnabled(
'supplier_order')) {
2070 $text_info .=
' '.$langs->trans(
'SupplierOrder').
' : '.$stock_order_supplier;
2072 $text_info .= ($reliquat != $obj->qty ?
' <span class="opacitymedium">('.$langs->trans(
"QtyInOtherShipments").
' '.($obj->qty - $reliquat).
')</span>' :
'');
2073 $text_info .=
'<br>';
2076 if ($notshippable == 0) {
2077 $text_icon =
img_picto(
'',
'dolly',
'',
false, 0, 0,
'',
'green paddingleft');
2078 $text_info = $text_icon.
' '.$langs->trans(
'Shippable').
'<br>'.$text_info;
2080 $text_icon =
img_picto(
'',
'dolly',
'',
false, 0, 0,
'',
'error paddingleft');
2081 $text_info = $text_icon.
' '.$langs->trans(
'NonShippable').
'<br>'.$text_info;
2086 print $form->textwithtooltip(
'', $text_info, 2, 1, $text_icon,
'', 2);
2089 print $form->textwithtooltip(
'', $langs->trans(
'NotEnoughForAllOrders').
'<br>'.$text_warning, 2, 1,
img_picto(
'',
'error'),
'', 2);
2094 $totalarray[
'nbfield']++;
2099 if (!empty($arrayfields[
'c.facture'][
'checked'])) {
2100 print
'<td class="center">'.yn($obj->billed).
'</td>';
2102 $totalarray[
'nbfield']++;
2106 if (!empty($arrayfields[
'c.import_key'][
'checked'])) {
2107 print
'<td class="nowrap center">'.$obj->import_key.
'</td>';
2109 $totalarray[
'nbfield']++;
2113 if (!empty($arrayfields[
'c.fk_statut'][
'checked'])) {
2114 print
'<td class="nowrap center">'.$generic_commande->LibStatut($obj->fk_statut, $obj->billed, 5, 1).
'</td>';
2116 $totalarray[
'nbfield']++;
2121 if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
2122 print
'<td class="nowrap center">';
2123 if ($massactionbutton || $massaction) {
2125 if (in_array($obj->rowid, $arrayofselected)) {
2128 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
2132 $totalarray[
'nbfield']++;
2139 $total += $obj->total_ht;
2140 $subtotal += $obj->total_ht;
2145 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
2150 foreach ($arrayfields as $key => $val) {
2151 if (!empty($val[
'checked'])) {
2155 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
2160 $parameters = array(
'arrayfields'=>$arrayfields,
'sql'=>$sql);
2161 $reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters);
2162 print $hookmanager->resPrint;
2164 print
'</table>'.
"\n";
2167 print
'</form>'.
"\n";
2169 $hidegeneratedfilelistifempty = 1;
2170 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
2171 $hidegeneratedfilelistifempty = 0;
2175 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
2176 $urlsource .= str_replace(
'&',
'&', $param);
2178 $filedir = $diroutputmassaction;
2179 $genallowed = $permissiontoread;
2180 $delallowed = $permissiontoadd;
2182 print $formfile->showdocuments(
'massfilesarea_orders',
'', $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 customers orders.
const STATUS_SHIPMENTONPROCESS
Shipment on process.
const STATUS_CLOSED
Closed (Sent, billed or not)
const STATUS_CANCELED
Canceled status.
const STATUS_DRAFT
Draft status.
const STATUS_VALIDATED
Validated status.
Class to manage products or services.
Class to manage projects.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage Dolibarr users.
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...
dolGetFirstLineOfText($text, $nboflines=1, $charset='UTF-8')
Return first line of text.
dol_string_nohtmltag($stringtoclean, $removelinefeed=1, $pagecodeto='UTF-8', $strip_tags=0, $removedoublespaces=1)
Clean a string from all HTML tags and entities.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
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...
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
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...
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.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
dol_trunc($string, $size=40, $trunc='right', $stringencoding='UTF-8', $nodot=0, $display=0)
Truncate a string to a particular length adding '…' if string larger than length.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
dolPrintHTML($s)
Return a string ready to be output on HTML page To use text inside an attribute, use can use only dol...
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.