36 require
'../main.inc.php';
37 require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
38 require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
39 require_once DOL_DOCUMENT_ROOT.
'/core/class/discount.class.php';
40 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
41 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
42 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
43 require_once DOL_DOCUMENT_ROOT.
'/commande/class/commande.class.php';
44 require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
45 require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
46 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
49 $langs->loadLangs(array(
"orders",
'sendings',
'deliveries',
'companies',
'compta',
'bills',
'stocks',
'products'));
51 $action =
GETPOST(
'action',
'aZ09');
52 $massaction =
GETPOST(
'massaction',
'alpha');
53 $show_files =
GETPOST(
'show_files',
'int');
54 $confirm =
GETPOST(
'confirm',
'alpha');
55 $toselect =
GETPOST(
'toselect',
'array');
56 $contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'orderlist';
58 $search_datecloture_start =
GETPOST(
'search_datecloture_start',
'int');
59 if (empty($search_datecloture_start)) $search_datecloture_start =
dol_mktime(0, 0, 0,
GETPOST(
'search_datecloture_startmonth',
'int'),
GETPOST(
'search_datecloture_startday',
'int'),
GETPOST(
'search_datecloture_startyear',
'int'));
60 $search_datecloture_end =
GETPOST(
'search_datecloture_end',
'int');
61 if (empty($search_datecloture_end)) $search_datecloture_end =
dol_mktime(23, 59, 59,
GETPOST(
'search_datecloture_endmonth',
'int'),
GETPOST(
'search_datecloture_endday',
'int'),
GETPOST(
'search_datecloture_endyear',
'int'));
62 $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'));
63 $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'));
64 $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'));
65 $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'));
66 $search_product_category =
GETPOST(
'search_product_category',
'int');
67 $search_ref =
GETPOST(
'search_ref',
'alpha') !=
'' ?
GETPOST(
'search_ref',
'alpha') :
GETPOST(
'sref',
'alpha');
68 $search_ref_customer =
GETPOST(
'search_ref_customer',
'alpha');
69 $search_company =
GETPOST(
'search_company',
'alpha');
70 $search_town =
GETPOST(
'search_town',
'alpha');
71 $search_zip =
GETPOST(
'search_zip',
'alpha');
72 $search_state =
GETPOST(
"search_state",
'alpha');
73 $search_country =
GETPOST(
"search_country",
'int');
74 $search_type_thirdparty =
GETPOST(
"search_type_thirdparty",
'int');
75 $sall = trim((
GETPOST(
'search_all',
'alphanohtml') !=
'') ?
GETPOST(
'search_all',
'alphanohtml') :
GETPOST(
'sall',
'alphanohtml'));
76 $socid =
GETPOST(
'socid',
'int');
77 $search_user =
GETPOST(
'search_user',
'int');
78 $search_sale =
GETPOST(
'search_sale',
'int');
79 $search_total_ht =
GETPOST(
'search_total_ht',
'alpha');
80 $search_total_vat =
GETPOST(
'search_total_vat',
'alpha');
81 $search_total_ttc =
GETPOST(
'search_total_ttc',
'alpha');
82 $search_warehouse =
GETPOST(
'search_warehouse',
'int');
83 $search_multicurrency_code =
GETPOST(
'search_multicurrency_code',
'alpha');
84 $search_multicurrency_tx =
GETPOST(
'search_multicurrency_tx',
'alpha');
85 $search_multicurrency_montant_ht =
GETPOST(
'search_multicurrency_montant_ht',
'alpha');
86 $search_multicurrency_montant_vat =
GETPOST(
'search_multicurrency_montant_vat',
'alpha');
87 $search_multicurrency_montant_ttc =
GETPOST(
'search_multicurrency_montant_ttc',
'alpha');
88 $search_login =
GETPOST(
'search_login',
'alpha');
89 $search_categ_cus =
GETPOST(
"search_categ_cus",
'int');
90 $optioncss =
GETPOST(
'optioncss',
'alpha');
92 $search_status =
GETPOST(
'search_status',
'int');
93 $search_btn =
GETPOST(
'button_search',
'alpha');
94 $search_remove_btn =
GETPOST(
'button_removefilter',
'alpha');
95 $search_project_ref =
GETPOST(
'search_project_ref',
'alpha');
96 $search_project =
GETPOST(
'search_project',
'alpha');
97 $search_shippable =
GETPOST(
'search_shippable',
'aZ09');
102 if ($user->socid) $socid = $user->socid;
105 $diroutputmassaction = $conf->commande->multidir_output[$conf->entity].
'/temp/massgeneration/'.$user->id;
108 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
109 $sortfield =
GETPOST(
"sortfield",
'alpha');
110 $sortorder =
GETPOST(
"sortorder",
'alpha');
112 if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) { $page = 0; }
113 $offset = $limit * $page;
114 $pageprev = $page - 1;
115 $pagenext = $page + 1;
116 if (!$sortfield) $sortfield =
'c.ref';
117 if (!$sortorder) $sortorder =
'DESC';
119 $show_shippable_command =
GETPOST(
'show_shippable_command',
'aZ09');
123 $hookmanager->initHooks(array(
'orderlist'));
127 $extrafields->fetch_name_optionals_label($object->table_element);
128 $search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
131 $fieldstosearchall = array(
133 'c.ref_client'=>
'RefCustomerOrder',
134 'pd.description'=>
'Description',
135 's.nom'=>
"ThirdParty",
136 's.name_alias'=>
"AliasNameShort",
139 'c.note_public'=>
'NotePublic',
141 if (empty($user->socid)) $fieldstosearchall[
"c.note_private"] =
"NotePrivate";
143 $checkedtypetiers = 0;
144 $arrayfields = array(
145 'c.ref'=>array(
'label'=>
"Ref",
'checked'=>1,
'position'=>5),
146 'c.ref_client'=>array(
'label'=>
"RefCustomerOrder",
'checked'=>-1,
'position'=>10),
147 'p.ref'=>array(
'label'=>
"ProjectRef",
'checked'=>1,
'enabled'=>(empty($conf->projet->enabled) ? 0 : 1),
'position'=>20),
148 'p.title'=>array(
'label'=>
"ProjectLabel",
'checked'=>0,
'enabled'=>(empty($conf->projet->enabled) ? 0 : 1),
'position'=>25),
149 's.nom'=>array(
'label'=>
"ThirdParty",
'checked'=>1,
'position'=>30),
150 's.town'=>array(
'label'=>
"Town",
'checked'=>1,
'position'=>35),
151 's.zip'=>array(
'label'=>
"Zip",
'checked'=>1,
'position'=>40),
152 'state.nom'=>array(
'label'=>
"StateShort",
'checked'=>0,
'position'=>45),
153 'country.code_iso'=>array(
'label'=>
"Country",
'checked'=>0,
'position'=>50),
154 'typent.code'=>array(
'label'=>
"ThirdPartyType",
'checked'=>$checkedtypetiers,
'position'=>55),
155 'c.date_commande'=>array(
'label'=>
"OrderDateShort",
'checked'=>1,
'position'=>60),
156 'c.date_delivery'=>array(
'label'=>
"DateDeliveryPlanned",
'checked'=>1,
'enabled'=>empty($conf->global->ORDER_DISABLE_DELIVERY_DATE),
'position'=>65),
157 'c.total_ht'=>array(
'label'=>
"AmountHT",
'checked'=>1,
'position'=>75),
158 'c.total_vat'=>array(
'label'=>
"AmountVAT",
'checked'=>0,
'position'=>80),
159 'c.total_ttc'=>array(
'label'=>
"AmountTTC",
'checked'=>0,
'position'=>85),
160 'c.multicurrency_code'=>array(
'label'=>
'Currency',
'checked'=>0,
'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1),
'position'=>90),
161 'c.multicurrency_tx'=>array(
'label'=>
'CurrencyRate',
'checked'=>0,
'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1),
'position'=>95),
162 'c.multicurrency_total_ht'=>array(
'label'=>
'MulticurrencyAmountHT',
'checked'=>0,
'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1),
'position'=>100),
163 'c.multicurrency_total_vat'=>array(
'label'=>
'MulticurrencyAmountVAT',
'checked'=>0,
'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1),
'position'=>105),
164 'c.multicurrency_total_ttc'=>array(
'label'=>
'MulticurrencyAmountTTC',
'checked'=>0,
'enabled'=>(empty($conf->multicurrency->enabled) ? 0 : 1),
'position'=>110),
165 'u.login'=>array(
'label'=>
"Author",
'checked'=>1,
'position'=>10,
'position'=>115),
166 'c.datec'=>array(
'label'=>
"DateCreation",
'checked'=>0,
'position'=>500,
'position'=>120),
167 'c.tms'=>array(
'label'=>
"DateModificationShort",
'checked'=>0,
'position'=>500,
'position'=>125),
168 'c.date_cloture'=>array(
'label'=>
"DateClosing",
'checked'=>0,
'position'=>500,
'position'=>130),
169 'c.note_public'=>array(
'label'=>
'NotePublic',
'checked'=>0,
'position'=>510,
'enabled'=>(empty($conf->global->MAIN_LIST_ALLOW_PUBLIC_NOTES)),
'position'=>135),
170 'c.note_private'=>array(
'label'=>
'NotePrivate',
'checked'=>0,
'position'=>511,
'enabled'=>(empty($conf->global->MAIN_LIST_ALLOW_PRIVATE_NOTES)),
'position'=>140),
171 'c.facture'=>array(
'label'=>
"Billed",
'checked'=>1,
'position'=>990,
'enabled'=>(empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)),
'position'=>145),
172 'shippable'=>array(
'label'=>
"Shippable",
'checked'=>1,
'position'=>995,
'enabled'=>(!empty($conf->expedition->enabled)),
'position'=>150),
173 'c.fk_statut'=>array(
'label'=>
"Status",
'checked'=>1,
'position'=>1000,
'position'=>155)
176 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
187 if (
GETPOST(
'cancel',
'alpha')) { $action =
'list'; $massaction =
''; }
188 if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend' && $massaction !=
'confirm_createbills') { $massaction =
''; }
190 $parameters = array(
'socid'=>$socid);
191 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
192 if ($reshook < 0)
setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
197 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
200 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha'))
205 $search_product_category =
'';
207 $search_ref_customer =
'';
208 $search_company =
'';
213 $search_country =
'';
214 $search_type_thirdparty =
'';
215 $search_total_ht =
'';
216 $search_total_vat =
'';
217 $search_total_ttc =
'';
218 $search_warehouse =
'';
219 $search_multicurrency_code =
'';
220 $search_multicurrency_tx =
'';
221 $search_multicurrency_montant_ht =
'';
222 $search_multicurrency_montant_vat =
'';
223 $search_multicurrency_montant_ttc =
'';
225 $search_dateorder_start =
'';
226 $search_dateorder_end =
'';
227 $search_datedelivery_start =
'';
228 $search_datedelivery_end =
'';
229 $search_project_ref =
'';
230 $search_project =
'';
234 $search_array_options = array();
235 $search_categ_cus = 0;
236 $search_datecloture_start =
'';
237 $search_datecloture_end =
'';
239 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
240 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha'))
246 $objectclass =
'Commande';
247 $objectlabel =
'Orders';
248 $permissiontoread = $user->rights->commande->lire;
249 $permissiontodelete = $user->rights->commande->supprimer;
250 $uploaddir = $conf->commande->multidir_output[$conf->entity];
251 $triggersendname =
'ORDER_SENTBYMAIL';
252 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
262 $form =
new Form($db);
265 $companystatic =
new Societe($db);
267 $projectstatic =
new Project($db);
269 $title = $langs->trans(
"Orders");
270 $help_url =
"EN:Module_Customers_Orders|FR:Module_Commandes_Clients|ES:Módulo_Pedidos_de_clientes";
274 if ($sall || $search_product_category > 0 || $search_user > 0) $sql =
'SELECT DISTINCT';
275 $sql .=
' s.rowid as socid, s.nom as name, s.email, s.town, s.zip, s.fk_pays, s.client, s.code_client,';
276 $sql .=
" typent.code as typent_code,";
277 $sql .=
" state.code_departement as state_code, state.nom as state_name,";
278 $sql .=
' c.rowid, c.ref, c.total_ht, c.tva as total_tva, c.total_ttc, c.ref_client, c.fk_user_author,';
279 $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,';
280 $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,';
281 $sql .=
' c.date_creation as date_creation, c.tms as date_update, c.date_cloture as date_cloture,';
282 $sql .=
" p.rowid as project_id, p.ref as project_ref, p.title as project_label,";
284 if ($search_categ_cus) $sql .=
", cc.fk_categorie, cc.fk_soc";
286 if (!empty($extrafields->attributes[$object->table_element][
'label']))
287 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
' as options_'.$key :
'');
289 $parameters = array();
290 $reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters);
291 $sql .= $hookmanager->resPrint;
292 $sql .=
' FROM '.MAIN_DB_PREFIX.
'societe as s';
293 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as country on (country.rowid = s.fk_pays)";
294 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_typent as typent on (typent.id = s.fk_typent)";
295 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_departements as state on (state.rowid = s.fk_departement)";
296 if (!empty($search_categ_cus)) $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
"categorie_societe as cc ON s.rowid = cc.fk_soc";
297 $sql .=
', '.MAIN_DB_PREFIX.
'commande as c';
298 if (is_array($extrafields->attributes[$object->table_element][
'label']) && count($extrafields->attributes[$object->table_element][
'label'])) $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"commande_extrafields as ef on (c.rowid = ef.fk_object)";
299 if ($sall || $search_product_category > 0) $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'commandedet as pd ON c.rowid=pd.fk_commande';
300 if ($search_product_category > 0) $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'categorie_product as cp ON cp.fk_product=pd.fk_product';
301 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"projet as p ON p.rowid = c.fk_projet";
302 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'user as u ON c.fk_user_author = u.rowid';
305 if ($search_sale > 0 || (!$user->rights->societe->client->voir && !$socid)) $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
306 if ($search_user > 0)
308 $sql .=
", ".MAIN_DB_PREFIX.
"element_contact as ec";
309 $sql .=
", ".MAIN_DB_PREFIX.
"c_type_contact as tc";
311 $sql .=
' WHERE c.fk_soc = s.rowid';
312 $sql .=
' AND c.entity IN ('.getEntity(
'commande').
')';
313 if ($search_product_category > 0) $sql .=
" AND cp.fk_categorie = ".$search_product_category;
314 if ($socid > 0) $sql .=
' AND s.rowid = '.$socid;
315 if (!$user->rights->societe->client->voir && !$socid) $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
317 if ($search_ref_customer) $sql .=
natural_search(
'c.ref_client', $search_ref_customer);
318 if ($sall) $sql .=
natural_search(array_keys($fieldstosearchall), $sall);
319 if ($search_billed !=
'' && $search_billed >= 0) $sql .=
' AND c.facture = '.$search_billed;
320 if ($search_status <>
'')
322 if ($search_status < 4 && $search_status > -3)
324 if ($search_status == 1 && empty($conf->expedition->enabled)) $sql .=
' AND c.fk_statut IN (1,2)';
325 else $sql .=
' AND c.fk_statut = '.$search_status;
327 if ($search_status == 4)
329 $sql .=
' AND c.facture = 1';
331 if ($search_status == -2)
334 $sql .=
" AND ((c.fk_statut IN (1,2)) OR (c.fk_statut = 3 AND c.facture = 0))";
336 if ($search_status == -3)
340 $sql .=
' AND ((c.fk_statut IN (1,2)) OR (c.fk_statut = 3 AND c.facture = 0))';
344 if ($search_datecloture_start) $sql .=
" AND c.date_cloture >= '".$db->idate($search_datecloture_start).
"'";
345 if ($search_datecloture_end) $sql .=
" AND c.date_cloture <= '".$db->idate($search_datecloture_end).
"'";
346 if ($search_dateorder_start) $sql .=
" AND c.date_commande >= '".$db->idate($search_dateorder_start).
"'";
347 if ($search_dateorder_end) $sql .=
" AND c.date_commande <= '".$db->idate($search_dateorder_end).
"'";
348 if ($search_datedelivery_start) $sql .=
" AND c.date_livraison >= '".$db->idate($search_datedelivery_start).
"'";
349 if ($search_datedelivery_end) $sql .=
" AND c.date_livraison <= '".$db->idate($search_datedelivery_end).
"'";
352 if ($search_state) $sql .=
natural_search(
"state.nom", $search_state);
353 if ($search_country) $sql .=
" AND s.fk_pays IN (".$search_country.
')';
354 if ($search_type_thirdparty) $sql .=
" AND s.fk_typent IN (".$search_type_thirdparty.
')';
355 if ($search_company) $sql .=
natural_search(
's.nom', $search_company);
356 if ($search_sale > 0) $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".$search_sale;
357 if ($search_user > 0) $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 = ".$search_user;
358 if ($search_total_ht !=
'') $sql .=
natural_search(
'c.total_ht', $search_total_ht, 1);
359 if ($search_total_vat !=
'') $sql .=
natural_search(
'c.tva', $search_total_vat, 1);
360 if ($search_total_ttc !=
'') $sql .=
natural_search(
'c.total_ttc', $search_total_ttc, 1);
361 if ($search_warehouse !=
'' && $search_warehouse !=
'-1') $sql .=
natural_search(
'c.fk_warehouse', $search_warehouse, 1);
362 if ($search_multicurrency_code !=
'') $sql .=
' AND c.multicurrency_code = "'.$db->escape($search_multicurrency_code).
'"';
363 if ($search_multicurrency_tx !=
'') $sql .=
natural_search(
'c.multicurrency_tx', $search_multicurrency_tx, 1);
364 if ($search_multicurrency_montant_ht !=
'') $sql .=
natural_search(
'c.multicurrency_total_ht', $search_multicurrency_montant_ht, 1);
365 if ($search_multicurrency_montant_vat !=
'') $sql .=
natural_search(
'c.multicurrency_total_tva', $search_multicurrency_montant_vat, 1);
366 if ($search_multicurrency_montant_ttc !=
'') $sql .=
natural_search(
'c.multicurrency_total_ttc', $search_multicurrency_montant_ttc, 1);
367 if ($search_login) $sql .=
natural_search(
"u.login", $search_login);
368 if ($search_project_ref !=
'') $sql .=
natural_search(
"p.ref", $search_project_ref);
369 if ($search_project !=
'') $sql .=
natural_search(
"p.title", $search_project);
370 if ($search_categ_cus > 0) $sql .=
" AND cc.fk_categorie = ".$db->escape($search_categ_cus);
371 if ($search_categ_cus == -2) $sql .=
" AND cc.fk_categorie IS NULL";
374 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
376 $parameters = array();
377 $reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters);
378 $sql .= $hookmanager->resPrint;
380 $sql .= $db->order($sortfield, $sortorder);
383 $nbtotalofrecords =
'';
384 if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
386 $result = $db->query($sql);
387 $nbtotalofrecords = $db->num_rows($result);
389 if (($page * $limit) > $nbtotalofrecords)
396 $sql .= $db->plimit($limit + 1, $offset);
399 $resql = $db->query($sql);
406 $title = $langs->trans(
'ListOfOrders').
' - '.$soc->name;
407 if (empty($search_company)) $search_company = $soc->name;
409 $title = $langs->trans(
'ListOfOrders');
411 if (strval($search_status) ==
'0')
412 $title .=
' - '.$langs->trans(
'StatusOrderDraftShort');
413 if ($search_status == 1)
414 $title .=
' - '.$langs->trans(
'StatusOrderValidatedShort');
415 if ($search_status == 2)
416 $title .=
' - '.$langs->trans(
'StatusOrderSentShort');
417 if ($search_status == 3)
418 $title .=
' - '.$langs->trans(
'StatusOrderToBillShort');
419 if ($search_status == 4)
420 $title .=
' - '.$langs->trans(
'StatusOrderProcessedShort');
421 if ($search_status == -1)
422 $title .=
' - '.$langs->trans(
'StatusOrderCanceledShort');
423 if ($search_status == -2)
424 $title .=
' - '.$langs->trans(
'StatusOrderToProcessShort');
425 if ($search_status == -3)
426 $title .=
' - '.$langs->trans(
'StatusOrderValidated').
', '.(empty($conf->expedition->enabled) ?
'' : $langs->trans(
"StatusOrderSent").
', ').$langs->trans(
'StatusOrderToBill');
428 $num = $db->num_rows(
$resql);
430 $arrayofselected = is_array($toselect) ? $toselect : array();
432 if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $sall)
434 $obj = $db->fetch_object(
$resql);
436 header(
"Location: ".DOL_URL_ROOT.
'/commande/card.php?id='.$id);
444 if (!empty($contextpage) && $contextpage !=
$_SERVER[
"PHP_SELF"]) $param .=
'&contextpage='.urlencode($contextpage);
445 if ($limit > 0 && $limit != $conf->liste_limit) $param .=
'&limit='.urlencode($limit);
446 if ($sall) $param .=
'&sall='.urlencode($sall);
447 if ($socid > 0) $param .=
'&socid='.urlencode($socid);
448 if ($search_status !=
'') $param .=
'&search_status='.urlencode($search_status);
449 if ($search_datecloture_start) $param .=
'&search_datecloture_start='.urlencode($search_datecloture_start);
450 if ($search_datecloture_end) $param .=
'&search_datecloture_end='.urlencode($search_datecloture_end);
451 if ($search_dateorder_start) $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');
452 if ($search_dateorder_end) $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');
453 if ($search_datedelivery_start) $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');
454 if ($search_datedelivery_end) $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');
455 if ($search_ref) $param .=
'&search_ref='.urlencode($search_ref);
456 if ($search_company) $param .=
'&search_company='.urlencode($search_company);
457 if ($search_ref_customer) $param .=
'&search_ref_customer='.urlencode($search_ref_customer);
458 if ($search_user > 0) $param .=
'&search_user='.urlencode($search_user);
459 if ($search_sale > 0) $param .=
'&search_sale='.urlencode($search_sale);
460 if ($search_total_ht !=
'') $param .=
'&search_total_ht='.urlencode($search_total_ht);
461 if ($search_total_vat !=
'') $param .=
'&search_total_vat='.urlencode($search_total_vat);
462 if ($search_total_ttc !=
'') $param .=
'&search_total_ttc='.urlencode($search_total_ttc);
463 if ($search_warehouse !=
'') $param .=
'&search_warehouse='.urlencode($search_warehouse);
464 if ($search_login) $param .=
'&search_login='.urlencode($search_login);
465 if ($search_multicurrency_code !=
'') $param .=
'&search_multicurrency_code='.urlencode($search_multicurrency_code);
466 if ($search_multicurrency_tx !=
'') $param .=
'&search_multicurrency_tx='.urlencode($search_multicurrency_tx);
467 if ($search_multicurrency_montant_ht !=
'') $param .=
'&search_multicurrency_montant_ht='.urlencode($search_multicurrency_montant_ht);
468 if ($search_multicurrency_montant_vat !=
'') $param .=
'&search_multicurrency_montant_vat='.urlencode($search_multicurrency_montant_vat);
469 if ($search_multicurrency_montant_ttc !=
'') $param .=
'&search_multicurrency_montant_ttc='.urlencode($search_multicurrency_montant_ttc);
470 if ($search_project_ref >= 0) $param .=
"&search_project_ref=".urlencode($search_project_ref);
471 if ($search_town !=
'') $param .=
'&search_town='.urlencode($search_town);
472 if ($search_zip !=
'') $param .=
'&search_zip='.urlencode($search_zip);
473 if ($search_state !=
'') $param .=
'&search_state='.urlencode($search_state);
474 if ($search_country !=
'') $param .=
'&search_country='.urlencode($search_country);
475 if ($search_type_thirdparty !=
'') $param .=
'&search_type_thirdparty='.urlencode($search_type_thirdparty);
476 if ($search_product_category !=
'') $param .=
'&search_product_category='.urlencode($search_product_category);
477 if ($search_categ_cus > 0) $param .=
'&search_categ_cus='.urlencode($search_categ_cus);
478 if ($show_files) $param .=
'&show_files='.urlencode($show_files);
479 if ($optioncss !=
'') $param .=
'&optioncss='.urlencode($optioncss);
480 if ($search_billed !=
'') $param .=
'&search_billed='.urlencode($search_billed);
483 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
486 $arrayofmassactions = array(
487 'generate_doc'=>$langs->trans(
"ReGeneratePDF"),
488 'builddoc'=>$langs->trans(
"PDFMerge"),
489 'cancelorders'=>$langs->trans(
"Cancel"),
490 'presend'=>$langs->trans(
"SendByMail"),
492 if ($user->rights->facture->creer) $arrayofmassactions[
'createbills'] = $langs->trans(
"CreateInvoiceForThisCustomer");
493 if ($user->rights->commande->supprimer) $arrayofmassactions[
'predelete'] =
'<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans(
"Delete");
494 if (in_array($massaction, array(
'presend',
'predelete',
'createbills'))) $arrayofmassactions = array();
495 $massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
497 $url = DOL_URL_ROOT.
'/commande/card.php?action=create';
498 if (!empty($socid)) $url .=
'&socid='.$socid;
499 $newcardbutton =
dolGetButtonTitle($langs->trans(
'NewOrder'),
'',
'fa fa-plus-circle', $url,
'', $contextpage ==
'orderlist' && $user->rights->commande->creer);
502 print '<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">';
503 if ($optioncss !=
'')
print '<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
504 print '<input type="hidden" name="token" value="'.newToken().
'">';
505 print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
506 print '<input type="hidden" name="action" value="list">';
507 print '<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
508 print '<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
509 print '<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
510 print '<input type="hidden" name="search_status" value="'.$search_status.
'">';
511 print '<input type="hidden" name="socid" value="'.$socid.
'">';
513 print_barre_liste($title, $page,
$_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'order', 0, $newcardbutton,
'', $limit, 0, 0, 1);
515 $topicmail =
"SendOrderRef";
516 $modelmail =
"order_send";
518 $trackid =
'ord'.$object->id;
519 include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
521 if ($massaction ==
'createbills')
524 print '<input type="hidden" name="massaction" value="confirm_createbills">';
526 print '<table class="noborder" width="100%" >';
528 print '<td class="titlefield">';
529 print $langs->trans(
'DateInvoice');
532 print $form->selectDate(
'',
'',
'',
'',
'',
'', 1, 1);
537 print $langs->trans(
'CreateOneBillByThird');
540 print $form->selectyesno(
'createbills_onebythird',
'', 1);
545 print $langs->trans(
'ValidateInvoices');
548 if (!empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_BILL))
550 print $form->selectyesno(
'validate_invoices', 0, 1, 1);
551 print ' ('.$langs->trans(
"AutoValidationNotPossibleWhenStockIsDecreasedOnInvoiceValidation").
')';
553 print $form->selectyesno(
'validate_invoices', 0, 1);
555 if (!empty($conf->workflow->enabled) && !empty($conf->global->WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER))
print ' <span class="opacitymedium">'.$langs->trans(
"IfValidateInvoiceIsNoOrderStayUnbilled").
'</span>';
556 else print ' <span class="opacitymedium">'.$langs->trans(
"OptionToSetOrderBilledNotEnabled").
'</span>';
562 print '<div class="center">';
563 print '<input type="submit" class="button" id="createbills" name="createbills" value="'.$langs->trans(
'CreateInvoiceForThisCustomer').
'"> ';
564 print '<input type="submit" class="button button-cancel" id="cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
571 foreach ($fieldstosearchall as $key => $val) $fieldstosearchall[$key] = $langs->trans($val);
572 print '<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $sall).join(
', ', $fieldstosearchall).
'</div>';
578 if ($user->rights->societe->client->voir || $socid)
580 $langs->load(
"commercial");
581 $moreforfilter .=
'<div class="divsearchfield">';
582 $moreforfilter .= $langs->trans(
'ThirdPartiesOfSaleRepresentative').
': ';
583 $moreforfilter .= $formother->select_salesrepresentatives($search_sale,
'search_sale', $user, 0, 1,
'maxwidth200');
584 $moreforfilter .=
'</div>';
587 if ($user->rights->user->user->lire)
589 $moreforfilter .=
'<div class="divsearchfield">';
590 $moreforfilter .= $langs->trans(
'LinkedToSpecificUsers').
': ';
591 $moreforfilter .= $form->select_dolusers($search_user,
'search_user', 1,
'', 0,
'',
'', 0, 0, 0,
'', 0,
'',
'maxwidth200');
592 $moreforfilter .=
'</div>';
595 if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire && ($user->rights->produit->lire || $user->rights->service->lire))
597 include_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
598 $moreforfilter .=
'<div class="divsearchfield">';
599 $moreforfilter .= $langs->trans(
'IncludingProductWithTag').
': ';
600 $cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT, null,
'parent', null, null, 1);
601 $moreforfilter .= $form->selectarray(
'search_product_category', $cate_arbo, $search_product_category, 1, 0, 0,
'', 0, 0, 0, 0,
'maxwidth300', 1);
602 $moreforfilter .=
'</div>';
604 if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire)
606 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
607 $moreforfilter .=
'<div class="divsearchfield">';
608 $moreforfilter .= $langs->trans(
'CustomersProspectsCategoriesShort').
': ';
609 $moreforfilter .= $formother->select_categories(
'customer', $search_categ_cus,
'search_categ_cus', 1);
610 $moreforfilter .=
'</div>';
612 if (!empty($conf->expedition->enabled) && !empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER)) {
613 require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
615 $moreforfilter .=
'<div class="divsearchfield">';
616 $moreforfilter .= $langs->trans(
'Warehouse').
': ';
617 $moreforfilter .= $formproduct->selectWarehouses($search_warehouse,
'search_warehouse',
'', 1);
618 $moreforfilter .=
'</div>';
620 $parameters = array();
621 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters);
622 if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint;
623 else $moreforfilter = $hookmanager->resPrint;
625 if (!empty($moreforfilter))
627 print '<div class="liste_titre liste_titre_bydiv centpercent">';
628 print $moreforfilter;
632 $varpage = empty($contextpage) ?
$_SERVER[
"PHP_SELF"] : $contextpage;
633 $selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
634 $selectedfields .= $form->showCheckAddButtons(
'checkforselect', 1);
636 if (
GETPOST(
'autoselectall',
'int')) {
637 $selectedfields .=
'<script>';
638 $selectedfields .=
' $(document).ready(function() {';
639 $selectedfields .=
' console.log("Autoclick on checkforselects");';
640 $selectedfields .=
' $("#checkforselects").click();';
641 $selectedfields .=
' $("#massaction").val("createbills").change();';
642 $selectedfields .=
' });';
643 $selectedfields .=
'</script>';
646 print '<div class="div-table-responsive">';
647 print '<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
649 print '<tr class="liste_titre_filter">';
651 if (!empty($arrayfields[
'c.ref'][
'checked']))
653 print
'<td class="liste_titre">';
654 print
'<input class="flat" size="6" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
658 if (!empty($arrayfields[
'c.ref_client'][
'checked']))
660 print
'<td class="liste_titre" align="left">';
661 print
'<input class="flat" type="text" size="6" name="search_ref_customer" value="'.dol_escape_htmltag($search_ref_customer).
'">';
665 if (!empty($arrayfields[
'p.ref'][
'checked']))
667 print
'<td class="liste_titre"><input type="text" class="flat" size="6" name="search_project_ref" value="'.dol_escape_htmltag($search_project_ref).
'"></td>';
670 if (!empty($arrayfields[
'p.title'][
'checked']))
672 print
'<td class="liste_titre"><input type="text" class="flat" size="6" name="search_project" value="'.dol_escape_htmltag($search_project).
'"></td>';
675 if (!empty($arrayfields[
's.nom'][
'checked']))
677 print
'<td class="liste_titre" align="left">';
678 print
'<input class="flat maxwidth100" type="text" name="search_company" value="'.dol_escape_htmltag($search_company).
'">';
682 if (!empty($arrayfields[
's.town'][
'checked'])) print
'<td class="liste_titre"><input class="flat" type="text" size="4" name="search_town" value="'.dol_escape_htmltag($search_town).
'"></td>';
684 if (!empty($arrayfields[
's.zip'][
'checked'])) print
'<td class="liste_titre"><input class="flat" type="text" size="4" name="search_zip" value="'.dol_escape_htmltag($search_zip).
'"></td>';
686 if (!empty($arrayfields[
'state.nom'][
'checked']))
688 print
'<td class="liste_titre">';
689 print
'<input class="flat" size="4" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).
'">';
693 if (!empty($arrayfields[
'country.code_iso'][
'checked']))
695 print
'<td class="liste_titre" align="center">';
696 print $form->select_country($search_country,
'search_country',
'', 0,
'minwidth100imp maxwidth100');
700 if (!empty($arrayfields[
'typent.code'][
'checked']))
702 print
'<td class="liste_titre maxwidthonsmartphone" align="center">';
703 print $form->selectarray(
"search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 0, 0, 0,
'', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ?
'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT));
707 if (!empty($arrayfields[
'c.date_commande'][
'checked']))
709 print
'<td class="liste_titre center">';
710 print
'<div class="nowrap">';
711 print $form->selectDate($search_dateorder_start ? $search_dateorder_start : -1,
'search_dateorder_start_', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
713 print
'<div class="nowrap">';
714 print $form->selectDate($search_dateorder_end ? $search_dateorder_end : -1,
'search_dateorder_end_', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
718 if (!empty($arrayfields[
'c.date_delivery'][
'checked']))
720 print
'<td class="liste_titre center">';
721 print
'<div class="nowrap">';
722 print $form->selectDate($search_datedelivery_start ? $search_datedelivery_start : -1,
'search_datedelivery_start_', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
724 print
'<div class="nowrap">';
725 print $form->selectDate($search_datedelivery_end ? $search_datedelivery_end : -1,
'search_datedelivery_end_', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
729 if (!empty($arrayfields[
'c.total_ht'][
'checked']))
732 print
'<td class="liste_titre right">';
733 print
'<input class="flat" type="text" size="4" name="search_total_ht" value="'.dol_escape_htmltag($search_total_ht).
'">';
736 if (!empty($arrayfields[
'c.total_vat'][
'checked']))
739 print
'<td class="liste_titre right">';
740 print
'<input class="flat" type="text" size="4" name="search_total_vat" value="'.dol_escape_htmltag($search_total_vat).
'">';
743 if (!empty($arrayfields[
'c.total_ttc'][
'checked']))
746 print
'<td class="liste_titre right">';
747 print
'<input class="flat" type="text" size="5" name="search_total_ttc" value="'.$search_total_ttc.
'">';
750 if (!empty($arrayfields[
'c.multicurrency_code'][
'checked']))
753 print
'<td class="liste_titre">';
754 print $form->selectMultiCurrency($search_multicurrency_code,
'search_multicurrency_code', 1);
757 if (!empty($arrayfields[
'c.multicurrency_tx'][
'checked']))
760 print
'<td class="liste_titre">';
761 print
'<input class="flat" type="text" size="4" name="search_multicurrency_tx" value="'.dol_escape_htmltag($search_multicurrency_tx).
'">';
764 if (!empty($arrayfields[
'c.multicurrency_total_ht'][
'checked']))
767 print
'<td class="liste_titre right">';
768 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ht" value="'.dol_escape_htmltag($search_multicurrency_montant_ht).
'">';
771 if (!empty($arrayfields[
'c.multicurrency_total_vat'][
'checked']))
774 print
'<td class="liste_titre right">';
775 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_vat" value="'.dol_escape_htmltag($search_multicurrency_montant_vat).
'">';
778 if (!empty($arrayfields[
'c.multicurrency_total_ttc'][
'checked']))
781 print
'<td class="liste_titre right">';
782 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ttc" value="'.dol_escape_htmltag($search_multicurrency_montant_ttc).
'">';
785 if (!empty($arrayfields[
'u.login'][
'checked']))
788 print
'<td class="liste_titre" align="center">';
789 print
'<input class="flat" size="4" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).
'">';
793 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
795 $parameters = array(
'arrayfields'=>$arrayfields);
796 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters);
797 print $hookmanager->resPrint;
799 if (!empty($arrayfields[
'c.datec'][
'checked']))
801 print
'<td class="liste_titre">';
805 if (!empty($arrayfields[
'c.tms'][
'checked']))
807 print
'<td class="liste_titre">';
811 if (!empty($arrayfields[
'c.date_cloture'][
'checked']))
813 print
'<td class="liste_titre center">';
814 print
'<div class="nowrap">';
815 print $form->selectDate($search_datecloture_start ? $search_datecloture_start : -1,
'search_datecloture_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
817 print
'<div class="nowrap">';
818 print $form->selectDate($search_datecloture_end ? $search_datecloture_end : -1,
'search_datecloture_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
823 if (!empty($arrayfields[
'c.note_public'][
'checked']))
825 print
'<td class="liste_titre">';
829 if (!empty($arrayfields[
'c.note_private'][
'checked']))
831 print
'<td class="liste_titre">';
835 if (!empty($arrayfields[
'shippable'][
'checked']))
837 print
'<td class="liste_titre maxwidthonsmartphone" align="center">';
839 if (!empty($conf->global->ORDER_SHIPABLE_STATUS_DISABLED_BY_DEFAULT)) {
840 print
'<input type="checkbox" name="show_shippable_command" value="1"'.($show_shippable_command ?
' checked' :
'').
'>';
841 print $langs->trans(
'ShowShippableStatus');
843 $show_shippable_command = 1;
848 if (!empty($arrayfields[
'c.facture'][
'checked']))
850 print
'<td class="liste_titre maxwidthonsmartphone" align="center">';
851 print $form->selectyesno(
'search_billed', $search_billed, 1, 0, 1, 1);
855 if (!empty($arrayfields[
'c.fk_statut'][
'checked']))
857 print
'<td class="liste_titre maxwidthonsmartphone center">';
863 -3=>$langs->trans(
"StatusOrderValidatedShort").
'+'.$langs->trans(
"StatusOrderSentShort").
'+'.$langs->trans(
"StatusOrderDelivered"),
866 print $form->selectarray(
'search_status', $liststatus, $search_status, -4, 0, 0,
'', 0, 0, 0,
'',
'maxwidth100', 1);
870 print
'<td class="liste_titre" align="middle">';
871 $searchpicto = $form->showFilterButtons();
878 print
'<tr class="liste_titre">';
879 if (!empty($arrayfields[
'c.ref'][
'checked']))
print_liste_field_titre($arrayfields[
'c.ref'][
'label'],
$_SERVER[
"PHP_SELF"],
'c.ref',
'', $param,
'', $sortfield, $sortorder);
880 if (!empty($arrayfields[
'c.ref_client'][
'checked']))
print_liste_field_titre($arrayfields[
'c.ref_client'][
'label'],
$_SERVER[
"PHP_SELF"],
'c.ref_client',
'', $param,
'', $sortfield, $sortorder);
881 if (!empty($arrayfields[
'p.ref'][
'checked']))
print_liste_field_titre($arrayfields[
'p.ref'][
'label'],
$_SERVER[
"PHP_SELF"],
"p.ref",
"", $param,
'', $sortfield, $sortorder);
882 if (!empty($arrayfields[
'p.title'][
'checked']))
print_liste_field_titre($arrayfields[
'p.title'][
'label'],
$_SERVER[
"PHP_SELF"],
"p.title",
"", $param,
'', $sortfield, $sortorder);
883 if (!empty($arrayfields[
's.nom'][
'checked']))
print_liste_field_titre($arrayfields[
's.nom'][
'label'],
$_SERVER[
"PHP_SELF"],
's.nom',
'', $param,
'', $sortfield, $sortorder);
884 if (!empty($arrayfields[
's.town'][
'checked']))
print_liste_field_titre($arrayfields[
's.town'][
'label'],
$_SERVER[
"PHP_SELF"],
's.town',
'', $param,
'', $sortfield, $sortorder);
885 if (!empty($arrayfields[
's.zip'][
'checked']))
print_liste_field_titre($arrayfields[
's.zip'][
'label'],
$_SERVER[
"PHP_SELF"],
's.zip',
'', $param,
'', $sortfield, $sortorder);
886 if (!empty($arrayfields[
'state.nom'][
'checked']))
print_liste_field_titre($arrayfields[
'state.nom'][
'label'],
$_SERVER[
"PHP_SELF"],
"state.nom",
"", $param,
'', $sortfield, $sortorder);
887 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 ');
888 if (!empty($arrayfields[
'typent.code'][
'checked']))
print_liste_field_titre($arrayfields[
'typent.code'][
'label'],
$_SERVER[
"PHP_SELF"],
"typent.code",
"", $param,
'', $sortfield, $sortorder,
'center ');
889 if (!empty($arrayfields[
'c.date_commande'][
'checked']))
print_liste_field_titre($arrayfields[
'c.date_commande'][
'label'],
$_SERVER[
"PHP_SELF"],
'c.date_commande',
'', $param,
'', $sortfield, $sortorder,
'center ');
890 if (!empty($arrayfields[
'c.date_delivery'][
'checked']))
print_liste_field_titre($arrayfields[
'c.date_delivery'][
'label'],
$_SERVER[
"PHP_SELF"],
'c.date_livraison',
'', $param,
'', $sortfield, $sortorder,
'center ');
891 if (!empty($arrayfields[
'c.total_ht'][
'checked']))
print_liste_field_titre($arrayfields[
'c.total_ht'][
'label'],
$_SERVER[
"PHP_SELF"],
'c.total_ht',
'', $param,
'', $sortfield, $sortorder,
'right ');
892 if (!empty($arrayfields[
'c.total_vat'][
'checked']))
print_liste_field_titre($arrayfields[
'c.total_vat'][
'label'],
$_SERVER[
"PHP_SELF"],
'c.tva',
'', $param,
'', $sortfield, $sortorder,
'right ');
893 if (!empty($arrayfields[
'c.total_ttc'][
'checked']))
print_liste_field_titre($arrayfields[
'c.total_ttc'][
'label'],
$_SERVER[
"PHP_SELF"],
'c.total_ttc',
'', $param,
'', $sortfield, $sortorder,
'right ');
894 if (!empty($arrayfields[
'c.multicurrency_code'][
'checked']))
print_liste_field_titre($arrayfields[
'c.multicurrency_code'][
'label'],
$_SERVER[
'PHP_SELF'],
'c.multicurrency_code',
'', $param,
'', $sortfield, $sortorder);
895 if (!empty($arrayfields[
'c.multicurrency_tx'][
'checked']))
print_liste_field_titre($arrayfields[
'c.multicurrency_tx'][
'label'],
$_SERVER[
'PHP_SELF'],
'c.multicurrency_tx',
'', $param,
'', $sortfield, $sortorder);
896 if (!empty($arrayfields[
'c.multicurrency_total_ht'][
'checked']))
print_liste_field_titre($arrayfields[
'c.multicurrency_total_ht'][
'label'],
$_SERVER[
'PHP_SELF'],
'c.multicurrency_total_ht',
'', $param,
'class="right"', $sortfield, $sortorder);
897 if (!empty($arrayfields[
'c.multicurrency_total_vat'][
'checked']))
print_liste_field_titre($arrayfields[
'c.multicurrency_total_vat'][
'label'],
$_SERVER[
'PHP_SELF'],
'c.multicurrency_total_tva',
'', $param,
'class="right"', $sortfield, $sortorder);
898 if (!empty($arrayfields[
'c.multicurrency_total_ttc'][
'checked']))
print_liste_field_titre($arrayfields[
'c.multicurrency_total_ttc'][
'label'],
$_SERVER[
'PHP_SELF'],
'c.multicurrency_total_ttc',
'', $param,
'class="right"', $sortfield, $sortorder);
899 if (!empty($arrayfields[
'u.login'][
'checked']))
print_liste_field_titre($arrayfields[
'u.login'][
'label'],
$_SERVER[
"PHP_SELF"],
'u.login',
'', $param,
'align="center"', $sortfield, $sortorder);
902 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
904 $parameters = array(
'arrayfields'=>$arrayfields,
'param'=>$param,
'sortfield'=>$sortfield,
'sortorder'=>$sortorder);
905 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters);
906 print $hookmanager->resPrint;
907 if (!empty($arrayfields[
'c.datec'][
'checked']))
print_liste_field_titre($arrayfields[
'c.datec'][
'label'],
$_SERVER[
"PHP_SELF"],
"c.date_creation",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
908 if (!empty($arrayfields[
'c.tms'][
'checked']))
print_liste_field_titre($arrayfields[
'c.tms'][
'label'],
$_SERVER[
"PHP_SELF"],
"c.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
909 if (!empty($arrayfields[
'c.date_cloture'][
'checked']))
print_liste_field_titre($arrayfields[
'c.date_cloture'][
'label'],
$_SERVER[
"PHP_SELF"],
"c.date_cloture",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
910 if (!empty($arrayfields[
'c.note_public'][
'checked']))
print_liste_field_titre($arrayfields[
'c.note_public'][
'label'],
$_SERVER[
"PHP_SELF"],
"c.note_public",
"", $param,
'', $sortfield, $sortorder,
'right ');
911 if (!empty($arrayfields[
'c.note_private'][
'checked']))
print_liste_field_titre($arrayfields[
'c.note_private'][
'label'],
$_SERVER[
"PHP_SELF"],
"c.note_private",
"", $param,
'', $sortfield, $sortorder,
'right ');
912 if (!empty($arrayfields[
'shippable'][
'checked']))
print_liste_field_titre($arrayfields[
'shippable'][
'label'],
$_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'center ');
913 if (!empty($arrayfields[
'c.facture'][
'checked']))
print_liste_field_titre($arrayfields[
'c.facture'][
'label'],
$_SERVER[
"PHP_SELF"],
'c.facture',
'', $param,
'', $sortfield, $sortorder,
'center ');
914 if (!empty($arrayfields[
'c.fk_statut'][
'checked']))
print_liste_field_titre($arrayfields[
'c.fk_statut'][
'label'],
$_SERVER[
"PHP_SELF"],
"c.fk_statut",
"", $param,
'', $sortfield, $sortorder,
'center ');
920 $productstat_cache = array();
921 $productstat_cachevirtual = array();
922 $getNomUrl_cache = array();
924 $generic_commande =
new Commande($db);
925 $generic_product =
new Product($db);
926 $userstatic =
new User($db);
928 $totalarray = array();
929 while ($i < min($num, $limit))
931 $obj = $db->fetch_object(
$resql);
939 $companystatic->id = $obj->socid;
940 $companystatic->code_client = $obj->code_client;
941 $companystatic->name = $obj->name;
942 $companystatic->client = $obj->client;
943 $companystatic->email = $obj->email;
944 if (!isset($getNomUrl_cache[$obj->socid])) {
945 $getNomUrl_cache[$obj->socid] = $companystatic->getNomUrl(1,
'customer');
948 $generic_commande->id = $obj->rowid;
949 $generic_commande->ref = $obj->ref;
950 $generic_commande->statut = $obj->fk_statut;
951 $generic_commande->billed = $obj->billed;
952 $generic_commande->date = $db->jdate($obj->date_commande);
953 $generic_commande->date_livraison = $db->jdate($obj->date_delivery);
954 $generic_commande->delivery_date = $db->jdate($obj->date_delivery);
955 $generic_commande->ref_client = $obj->ref_client;
956 $generic_commande->total_ht = $obj->total_ht;
957 $generic_commande->total_tva = $obj->total_tva;
958 $generic_commande->total_ttc = $obj->total_ttc;
959 $generic_commande->note_public = $obj->note_public;
960 $generic_commande->note_private = $obj->note_private;
962 $projectstatic->id = $obj->project_id;
963 $projectstatic->ref = $obj->project_ref;
964 $projectstatic->title = $obj->project_label;
966 print
'<tr class="oddeven">';
969 if (!empty($arrayfields[
'c.ref'][
'checked']))
971 print
'<td class="nowraponall">';
972 print $generic_commande->getNomUrl(1, ($search_status != 2 ? 0 : $obj->fk_statut), 0, 0, 0, 1, 1);
975 if ($generic_commande->hasDelay()) {
976 print
img_picto($langs->trans(
"Late").
' : '.$generic_commande->showDelay(),
"warning");
981 $urlsource =
$_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid;
982 print $formfile->getDocumentsLink($generic_commande->element, $filename, $filedir);
985 if (!$i) $totalarray[
'nbfield']++;
989 if (!empty($arrayfields[
'c.ref_client'][
'checked']))
991 print
'<td class="nowrap tdoverflowmax200">'.$obj->ref_client.
'</td>';
992 if (!$i) $totalarray[
'nbfield']++;
996 if (!empty($arrayfields[
'p.ref'][
'checked']))
998 print
'<td class="nowrap">';
999 if ($obj->project_id > 0)
1001 print $projectstatic->getNomUrl(1);
1004 if (!$i) $totalarray[
'nbfield']++;
1008 if (!empty($arrayfields[
'p.title'][
'checked']))
1010 print
'<td class="nowrap">';
1011 if ($obj->project_id > 0)
1013 print $projectstatic->title;
1016 if (!$i) $totalarray[
'nbfield']++;
1020 if (!empty($arrayfields[
's.nom'][
'checked']))
1022 print
'<td class="tdoverflowmax200">';
1023 print $getNomUrl_cache[$obj->socid];
1026 if (!empty($conf->facture->enabled) && !empty($conf->global->ORDER_BILLING_ALL_CUSTOMER))
1028 if ($user->rights->facture->creer)
1030 if (($obj->fk_statut > 0 && $obj->fk_statut < 3) || ($obj->fk_statut == 3 && $obj->billed == 0))
1032 print
' <a href="'.DOL_URL_ROOT.
'/commande/list.php?socid='.$companystatic->id.
'&search_billed=0&autoselectall=1">';
1033 print
img_picto($langs->trans(
"CreateInvoiceForThisCustomer").
' : '.$companystatic->name,
'object_bill',
'hideonsmartphone').
'</a>';
1038 if (!$i) $totalarray[
'nbfield']++;
1041 if (!empty($arrayfields[
's.town'][
'checked']))
1043 print
'<td class="nocellnopadd">';
1046 if (!$i) $totalarray[
'nbfield']++;
1049 if (!empty($arrayfields[
's.zip'][
'checked']))
1051 print
'<td class="nocellnopadd">';
1054 if (!$i) $totalarray[
'nbfield']++;
1057 if (!empty($arrayfields[
'state.nom'][
'checked']))
1059 print
"<td>".$obj->state_name.
"</td>\n";
1060 if (!$i) $totalarray[
'nbfield']++;
1063 if (!empty($arrayfields[
'country.code_iso'][
'checked']))
1065 print
'<td class="center">';
1066 $tmparray =
getCountry($obj->fk_pays,
'all');
1067 print $tmparray[
'label'];
1069 if (!$i) $totalarray[
'nbfield']++;
1072 if (!empty($arrayfields[
'typent.code'][
'checked']))
1074 print
'<td class="center">';
1075 if (empty($typenArray)) $typenArray = $formcompany->typent_array(1);
1076 print $typenArray[$obj->typent_code];
1078 if (!$i) $totalarray[
'nbfield']++;
1082 if (!empty($arrayfields[
'c.date_commande'][
'checked']))
1084 print
'<td class="center">';
1087 if (!$i) $totalarray[
'nbfield']++;
1090 if (!empty($arrayfields[
'c.date_delivery'][
'checked']))
1092 print
'<td class="center">';
1093 print
dol_print_date($db->jdate($obj->date_delivery),
'dayhour');
1095 if (!$i) $totalarray[
'nbfield']++;
1098 if (!empty($arrayfields[
'c.total_ht'][
'checked']))
1100 print
'<td class="nowrap right">'.price($obj->total_ht).
"</td>\n";
1101 if (!$i) $totalarray[
'nbfield']++;
1102 if (!$i) $totalarray[
'pos'][$totalarray[
'nbfield']] =
'c.total_ht';
1103 $totalarray[
'val'][
'c.total_ht'] += $obj->total_ht;
1106 if (!empty($arrayfields[
'c.total_vat'][
'checked']))
1108 print
'<td class="nowrap right">'.price($obj->total_tva).
"</td>\n";
1109 if (!$i) $totalarray[
'nbfield']++;
1110 if (!$i) $totalarray[
'pos'][$totalarray[
'nbfield']] =
'c.total_tva';
1111 $totalarray[
'val'][
'c.total_tva'] += $obj->total_tva;
1114 if (!empty($arrayfields[
'c.total_ttc'][
'checked']))
1116 print
'<td class="nowrap right">'.price($obj->total_ttc).
"</td>\n";
1117 if (!$i) $totalarray[
'nbfield']++;
1118 if (!$i) $totalarray[
'pos'][$totalarray[
'nbfield']] =
'c.total_ttc';
1119 $totalarray[
'val'][
'c.total_ttc'] += $obj->total_ttc;
1123 if (!empty($arrayfields[
'c.multicurrency_code'][
'checked']))
1125 print
'<td class="nowrap">'.$obj->multicurrency_code.
' - '.$langs->trans(
'Currency'.$obj->multicurrency_code).
"</td>\n";
1126 if (!$i) $totalarray[
'nbfield']++;
1130 if (!empty($arrayfields[
'c.multicurrency_tx'][
'checked']))
1132 print
'<td class="nowrap">';
1133 $form->form_multicurrency_rate(
$_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid, $obj->multicurrency_tx,
'none', $obj->multicurrency_code);
1135 if (!$i) $totalarray[
'nbfield']++;
1138 if (!empty($arrayfields[
'c.multicurrency_total_ht'][
'checked']))
1140 print
'<td class="right nowrap">'.price($obj->multicurrency_total_ht).
"</td>\n";
1141 if (!$i) $totalarray[
'nbfield']++;
1144 if (!empty($arrayfields[
'c.multicurrency_total_vat'][
'checked']))
1146 print
'<td class="right nowrap">'.price($obj->multicurrency_total_vat).
"</td>\n";
1147 if (!$i) $totalarray[
'nbfield']++;
1150 if (!empty($arrayfields[
'c.multicurrency_total_ttc'][
'checked']))
1152 print
'<td class="right nowrap">'.price($obj->multicurrency_total_ttc).
"</td>\n";
1153 if (!$i) $totalarray[
'nbfield']++;
1156 $userstatic->id = $obj->fk_user_author;
1157 $userstatic->login = $obj->login;
1160 if (!empty($arrayfields[
'u.login'][
'checked']))
1162 print
'<td align="center">';
1163 if ($userstatic->id) print $userstatic->getLoginUrl(1);
1164 else print
' ';
1166 if (!$i) $totalarray[
'nbfield']++;
1170 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
1172 $parameters = array(
'arrayfields'=>$arrayfields,
'obj'=>$obj,
'i'=>$i,
'totalarray'=>&$totalarray);
1173 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters);
1174 print $hookmanager->resPrint;
1177 if (!empty($arrayfields[
'c.datec'][
'checked']))
1179 print
'<td align="center" class="nowrap">';
1180 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuser');
1182 if (!$i) $totalarray[
'nbfield']++;
1186 if (!empty($arrayfields[
'c.tms'][
'checked']))
1188 print
'<td align="center" class="nowrap">';
1189 print
dol_print_date($db->jdate($obj->date_update),
'dayhour',
'tzuser');
1191 if (!$i) $totalarray[
'nbfield']++;
1195 if (!empty($arrayfields[
'c.date_cloture'][
'checked']))
1197 print
'<td align="center" class="nowrap">';
1198 print
dol_print_date($db->jdate($obj->date_cloture),
'dayhour',
'tzuser');
1200 if (!$i) $totalarray[
'nbfield']++;
1204 if (!empty($arrayfields[
'c.note_public'][
'checked']))
1206 print
'<td align="center" class="nowrap">';
1209 if (!$i) $totalarray[
'nbfield']++;
1213 if (!empty($arrayfields[
'c.note_private'][
'checked']))
1215 print
'<td align="center" class="nowrap">';
1218 if (!$i) $totalarray[
'nbfield']++;
1222 if (!empty($arrayfields[
'shippable'][
'checked']))
1224 print
'<td class="center">';
1225 if (!empty($show_shippable_command) && !empty($conf->stock->enabled)) {
1226 if (($obj->fk_statut > $generic_commande::STATUS_DRAFT) && ($obj->fk_statut < $generic_commande::STATUS_CLOSED)) {
1227 $generic_commande->getLinesArray();
1229 $numlines = count($generic_commande->lines);
1230 for ($lig = 0; $lig < $numlines; $lig++) {
1231 if ($generic_commande->lines[$lig]->product_type == 0 && $generic_commande->lines[$lig]->fk_product > 0)
1234 $generic_product->id = $generic_commande->lines[$lig]->fk_product;
1237 if (empty($productstat_cache[$generic_commande->lines[$lig]->fk_product])) {
1238 $generic_product->load_stock(
'nobatch');
1239 $productstat_cache[$generic_commande->lines[$lig]->fk_product][
'stock_reel'] = $generic_product->stock_reel;
1240 $productstat_cachevirtual[$generic_commande->lines[$lig]->fk_product][
'stock_reel'] = $generic_product->stock_theorique;
1242 $generic_product->stock_reel = $productstat_cache[$generic_commande->lines[$lig]->fk_product][
'stock_reel'];
1243 $generic_product->stock_theorique = $productstat_cachevirtual[$generic_commande->lines[$lig]->fk_product][
'stock_reel'] = $generic_product->stock_theorique;
1246 if (empty($conf->global->SHIPPABLE_ORDER_ICON_IN_LIST))
1248 $text_info .= $generic_commande->lines[$lig]->qty.
' X '.$generic_commande->lines[$lig]->product_ref.
' '.
dol_trunc($generic_commande->lines[$lig]->product_label, 25);
1249 $text_info .=
' - '.$langs->trans(
"Stock").
': <span class="'.($generic_product->stock_reel > 0 ?
'ok' :
'error').
'">'.$generic_product->stock_reel.
'</span>';
1250 $text_info .=
' - '.$langs->trans(
"VirtualStock").
': <span class="'.($generic_product->stock_theorique > 0 ?
'ok' :
'error').
'">'.$generic_product->stock_theorique.
'</span>';
1251 $text_info .=
'<br>';
1253 if ($generic_commande->lines[$lig]->qty > $generic_product->stock_reel) {
1262 $stock_order_supplier = 0;
1263 if (!empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT) || !empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE))
1265 if (!empty($conf->commande->enabled)) {
1266 if (empty($productstat_cache[$generic_commande->lines[$lig]->fk_product][
'stats_order_customer'])) {
1267 $generic_product->load_stats_commande(0,
'1,2');
1268 $productstat_cache[$generic_commande->lines[$lig]->fk_product][
'stats_order_customer'] = $generic_product->stats_commande[
'qty'];
1270 $generic_product->stats_commande[
'qty'] = $productstat_cache[$generic_commande->lines[$lig]->fk_product][
'stats_order_customer'];
1272 $stock_order = $generic_product->stats_commande[
'qty'];
1274 if (!empty($conf->fournisseur->enabled)) {
1275 if (empty($productstat_cache[$generic_commande->lines[$lig]->fk_product][
'stats_order_supplier'])) {
1276 $generic_product->load_stats_commande_fournisseur(0,
'3');
1277 $productstat_cache[$generic_commande->lines[$lig]->fk_product][
'stats_order_supplier'] = $generic_product->stats_commande_fournisseur[
'qty'];
1279 $generic_product->stats_commande_fournisseur[
'qty'] = $productstat_cache[$generic_commande->lines[$lig]->fk_product][
'stats_order_supplier'];
1281 $stock_order_supplier = $generic_product->stats_commande_fournisseur[
'qty'];
1284 $text_info .= $generic_commande->lines[$lig]->qty.
' X '.$generic_commande->lines[$lig]->ref.
' '.
dol_trunc($generic_commande->lines[$lig]->product_label, 25);
1285 $text_stock_reel = $generic_product->stock_reel.
'/'.$stock_order;
1286 if ($stock_order > $generic_product->stock_reel && !($generic_product->stock_reel < $generic_commande->lines[$lig]->qty)) {
1288 $text_warning .=
'<span class="warning">'.$langs->trans(
'Available').
' : '.$text_stock_reel.
'</span>';
1290 if ($generic_product->stock_reel < $generic_commande->lines[$lig]->qty) {
1292 $text_info .=
'<span class="warning">'.$langs->trans(
'Available').
' : '.$text_stock_reel.
'</span>';
1294 $text_info .=
'<span class="ok">'.$langs->trans(
'Available').
' : '.$text_stock_reel.
'</span>';
1296 if (!empty($conf->fournisseur->enabled)) {
1297 $text_info .=
' '.$langs->trans(
'SupplierOrder').
' : '.$stock_order_supplier.
'<br>';
1299 $text_info .=
'<br>';
1304 if ($notshippable == 0) {
1305 $text_icon =
img_picto(
'',
'dolly',
'',
false, 0, 0,
'',
'green paddingleft');
1306 $text_info = $langs->trans(
'Shippable').
'<br>'.$text_info;
1308 $text_icon =
img_picto(
'',
'dolly',
'',
false, 0, 0,
'',
'error paddingleft');
1309 $text_info = $langs->trans(
'NonShippable').
'<br>'.$text_info;
1314 print $form->textwithtooltip(
'', $text_info, 2, 1, $text_icon,
'', 2);
1317 print $form->textwithtooltip(
'', $langs->trans(
'NotEnoughForAllOrders').
'<br>'.$text_warning, 2, 1,
img_picto(
'',
'error'),
'', 2);
1324 if (!empty($arrayfields[
'c.facture'][
'checked']))
1326 print
'<td class="center">'.yn($obj->billed).
'</td>';
1327 if (!$i) $totalarray[
'nbfield']++;
1331 if (!empty($arrayfields[
'c.fk_statut'][
'checked']))
1333 print
'<td class="nowrap center">'.$generic_commande->LibStatut($obj->fk_statut, $obj->billed, 5, 1).
'</td>';
1334 if (!$i) $totalarray[
'nbfield']++;
1338 print
'<td class="nowrap center">';
1339 if ($massactionbutton || $massaction)
1342 if (in_array($obj->rowid, $arrayofselected)) $selected = 1;
1343 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1346 if (!$i) $totalarray[
'nbfield']++;
1350 $total += $obj->total_ht;
1351 $subtotal += $obj->total_ht;
1356 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
1360 $parameters = array(
'arrayfields'=>$arrayfields,
'sql'=>$sql);
1361 $reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters);
1362 print $hookmanager->resPrint;
1364 print
'</table>'.
"\n";
1367 print
'</form>'.
"\n";
1369 $hidegeneratedfilelistifempty = 1;
1370 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) $hidegeneratedfilelistifempty = 0;
1373 $urlsource =
$_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
1374 $urlsource .= str_replace(
'&',
'&', $param);
1376 $filedir = $diroutputmassaction;
1377 $genallowed = $user->rights->commande->lire;
1378 $delallowed = $user->rights->commande->creer;
1380 print $formfile->showdocuments(
'massfilesarea_orders',
'', $filedir, $urlsource, 0, $delallowed,
'', 1, 1, 0, 48, 1, $param, $title,
'',
'',
'', null, $hidegeneratedfilelistifempty);
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
const STATUS_CLOSED
Closed (Sent, billed or not)
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm= 'auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
dolGetButtonTitle($label, $helpText= '', $iconClass= 'fa fa-file', $url= '', $id= '', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
Class to manage products or services.
dol_now($mode= 'auto')
Return date for now.
Class to manage Dolibarr users.
const STATUS_SHIPMENTONPROCESS
Shipment on process.
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
print_barre_liste($titre, $page, $file, $options= '', $sortfield= '', $sortorder= '', $morehtmlcenter= '', $num=-1, $totalnboflines= '', $picto= 'generic', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow= '')
Print a title with navigation controls for pagination.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname.
Class to manage third parties objects (customers, suppliers, prospects...)
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
Class to manage projects.
img_picto($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt= '', $morecss= '', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
Class to manage customers orders.
const STATUS_DRAFT
Draft status.
restrictedArea($user, $features, $objectid=0, $tableandshare= '', $feature2= '', $dbt_keyfield= 'fk_soc', $dbt_select= 'rowid', $isdraft=0)
Check permissions of a user to show a page and an object.
natural_search($fields, $value, $mode=0, $nofirstand=0)
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
dol_sanitizeFileName($str, $newstr= '_', $unaccent=1)
Clean a string to use it as a file name.
print $_SERVER["PHP_SELF"]
Edit parameters.
const STATUS_VALIDATED
Validated status.
dol_sort_array(&$array, $index, $order= 'asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by second index function, which produces ascending (default) or descending output...
print
Draft customers invoices.
dol_print_date($time, $format= '', $tzoutput= 'auto', $outputlangs= '', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) if(!empty($conf->don->enabled)&&$user->rights->don->lire) if(!empty($conf->tax->enabled)&&$user->rights->tax->charges->lire) if(!empty($conf->facture->enabled)&&!empty($conf->commande->enabled)&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
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.
if(!defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN'
Draft customers invoices.
getCountry($searchkey, $withcode= '', $dbtouse=0, $outputlangs= '', $entconv=1, $searchlabel= '')
Return country label, code or id from an id, code or label.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $keepmoretags= '', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields...
const STATUS_CANCELED
Canceled status.