38require
'../main.inc.php';
39require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
40require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
41require_once DOL_DOCUMENT_ROOT.
'/core/class/discount.class.php';
42require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
43require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
44require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
45if (isModEnabled(
'margin')) {
46 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmargin.class.php';
48require_once DOL_DOCUMENT_ROOT.
'/commande/class/commande.class.php';
49require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
50require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
51require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
53if (isModEnabled(
'category')) {
54 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcategory.class.php';
55 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
67$langs->loadLangs(array(
"orders",
'sendings',
'deliveries',
'companies',
'compta',
'bills',
'stocks',
'products'));
69$action =
GETPOST(
'action',
'aZ09');
70$massaction =
GETPOST(
'massaction',
'alpha');
72$confirm =
GETPOST(
'confirm',
'alpha');
73$toselect =
GETPOST(
'toselect',
'array');
74$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'orderlistdet';
75$optioncss =
GETPOST(
'optioncss',
'alpha');
77$productobuy =
GETPOST(
'productobuy',
'alpha');
78$productonly =
GETPOST(
'productonly',
'alpha');
79$disablelinefree =
GETPOST(
'disablelinefree',
'alpha');
81$search_datecloture_start =
GETPOSTINT(
'search_datecloture_start');
82if (empty($search_datecloture_start)) {
85$search_datecloture_end =
GETPOSTINT(
'search_datecloture_end');
86if (empty($search_datecloture_end)) {
94$search_product_category_array = array();
95if (isModEnabled(
'category')) {
96 $search_product_category_array =
GETPOST(
"search_category_".Categorie::TYPE_PRODUCT.
"_list",
"array");
97 $searchCategoryProductOperator = 0;
98 if (GETPOSTISSET(
'formfilteraction')) {
99 $searchCategoryProductOperator =
GETPOSTINT(
'search_category_product_operator');
108$search_id =
GETPOST(
'search_id',
'alpha');
109$search_refProduct =
GETPOST(
'search_refProduct',
'alpha');
110$search_descProduct =
GETPOST(
'search_descProduct',
'alpha');
112$search_ref =
GETPOST(
'search_ref',
'alpha') !=
'' ?
GETPOST(
'search_ref',
'alpha') :
GETPOST(
'sref',
'alpha');
113$search_ref_customer =
GETPOST(
'search_ref_customer',
'alpha');
114$search_company =
GETPOST(
'search_company',
'alpha');
115$search_company_alias =
GETPOST(
'search_company_alias',
'alpha');
116$search_town =
GETPOST(
'search_town',
'alpha');
117$search_zip =
GETPOST(
'search_zip',
'alpha');
118$search_state =
GETPOST(
"search_state",
'alpha');
119$search_country =
GETPOST(
"search_country",
'aZ09');
120$search_type_thirdparty =
GETPOST(
"search_type_thirdparty",
'intcomma');
121$search_all = trim(
GETPOST(
'search_all',
'alphanohtml'));
122$search_user =
GETPOST(
'search_user',
'intcomma');
123$search_sale =
GETPOST(
'search_sale',
'intcomma');
124$search_total_ht =
GETPOST(
'search_total_ht',
'alpha');
125$search_total_vat =
GETPOST(
'search_total_vat',
'alpha');
126$search_total_ttc =
GETPOST(
'search_total_ttc',
'alpha');
127$search_warehouse =
GETPOST(
'search_warehouse',
'intcomma');
128$search_multicurrency_code =
GETPOST(
'search_multicurrency_code',
'alpha');
129$search_multicurrency_tx =
GETPOST(
'search_multicurrency_tx',
'alpha');
130$search_multicurrency_montant_ht =
GETPOST(
'search_multicurrency_montant_ht',
'alpha');
131$search_multicurrency_montant_vat =
GETPOST(
'search_multicurrency_montant_vat',
'alpha');
132$search_multicurrency_montant_ttc =
GETPOST(
'search_multicurrency_montant_ttc',
'alpha');
133$search_login =
GETPOST(
'search_login',
'alpha');
134$search_categ_cus =
GETPOST(
"search_categ_cus",
'intcomma');
135$search_billed =
GETPOST(
'search_billed',
'intcomma') ?
GETPOST(
'search_billed',
'intcomma') :
GETPOST(
'billed',
'intcomma');
136$search_status =
GETPOST(
'search_status',
'intcomma');
137$search_project_ref =
GETPOST(
'search_project_ref',
'alpha');
138$search_project =
GETPOST(
'search_project',
'alpha');
139$search_shippable =
GETPOST(
'search_shippable',
'aZ09');
140$search_fk_cond_reglement =
GETPOSTINT(
"search_fk_cond_reglement");
141$search_fk_shipping_method =
GETPOSTINT(
"search_fk_shipping_method");
142$search_fk_mode_reglement =
GETPOSTINT(
"search_fk_mode_reglement");
143$search_fk_input_reason =
GETPOSTINT(
"search_fk_input_reason");
145$diroutputmassaction =
$conf->commande->multidir_output[
$conf->entity].
'/temp/massgeneration/'.$user->id;
149$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
150$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
152if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
155$offset = $limit * $page;
156$pageprev = $page - 1;
157$pagenext = $page + 1;
159 $sortfield =
'pr.ref';
165$show_shippable_command =
GETPOST(
'show_shippable_command',
'aZ09');
169$hookmanager->initHooks(array(
'orderlistdetail'));
173$extrafields->fetch_name_optionals_label(
$object->table_element);
174$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
177$fieldstosearchall = array(
179 'c.ref_client' =>
'RefCustomerOrder',
180 'cdet.description' =>
'Description',
181 's.nom' =>
"ThirdParty",
182 's.name_alias' =>
"AliasNameShort",
185 'c.note_public' =>
'NotePublic',
187if (empty($user->socid)) {
188 $fieldstosearchall[
"c.note_private"] =
"NotePrivate";
191$checkedtypetiers = 0;
194 'rowid' => array(
'label' =>
'TechnicalID',
'checked' => 1,
'position' => 1,
'enabled' => (
getDolGlobalInt(
'MAIN_SHOW_TECHNICAL_ID') ? 1 : 0)),
195 'pr.ref' => array(
'label' =>
'ProductRef',
'checked' => 1,
'position' => 1),
196 'pr.desc' => array(
'label' =>
'ProductDescription',
'checked' => -1,
'position' => 1),
197 'cdet.qty' => array(
'label' =>
'QtyOrdered',
'checked' => 1,
'position' => 1),
198 'c.ref' => array(
'label' =>
"Ref",
'checked' => 1,
'position' => 5),
199 'c.ref_client' => array(
'label' =>
"RefCustomerOrder",
'checked' => -1,
'position' => 10),
200 'p.ref' => array(
'label' =>
"ProjectRef",
'checked' => -1,
'enabled' => (empty(
$conf->project->enabled) ? 0 : 1),
'position' => 20),
201 'p.title' => array(
'label' =>
"ProjectLabel",
'checked' => 0,
'enabled' => (empty(
$conf->project->enabled) ? 0 : 1),
'position' => 25),
202 's.nom' => array(
'label' =>
"ThirdParty",
'checked' => 1,
'position' => 30),
203 's.name_alias' => array(
'label' =>
"AliasNameShort",
'checked' => -1,
'position' => 31),
204 's.town' => array(
'label' =>
"Town",
'checked' => -1,
'position' => 35),
205 's.zip' => array(
'label' =>
"Zip",
'checked' => -1,
'position' => 40),
206 'state.nom' => array(
'label' =>
"StateShort",
'checked' => 0,
'position' => 45),
207 'country.code_iso' => array(
'label' =>
"Country",
'checked' => 0,
'position' => 50),
208 'typent.code' => array(
'label' =>
"ThirdPartyType",
'checked' => $checkedtypetiers,
'position' => 55),
209 'c.date_commande' => array(
'label' =>
"OrderDateShort",
'checked' => 1,
'position' => 60),
210 'c.date_delivery' => array(
'label' =>
"DateDeliveryPlanned",
'checked' => 1,
'enabled' => !
getDolGlobalString(
'ORDER_DISABLE_DELIVERY_DATE'),
'position' => 65),
211 'c.fk_shipping_method' => array(
'label' =>
"SendingMethod",
'checked' => -1,
'position' => 66 ,
'enabled' => isModEnabled(
'shipping')),
212 'c.fk_cond_reglement' => array(
'label' =>
"PaymentConditionsShort",
'checked' => -1,
'position' => 67),
213 'c.fk_mode_reglement' => array(
'label' =>
"PaymentMode",
'checked' => -1,
'position' => 68),
214 'c.fk_input_reason' => array(
'label' =>
"Channel",
'checked' => -1,
'position' => 69),
215 'cdet.total_ht' => array(
'label' =>
"AmountHT",
'checked' => 1,
'position' => 75),
216 'c.total_vat' => array(
'label' =>
"AmountVAT",
'checked' => 0,
'position' => 80),
217 'cdet.total_ttc' => array(
'label' =>
"AmountTTC",
'checked' => 0,
'position' => 85),
218 'c.multicurrency_code' => array(
'label' =>
'Currency',
'checked' => 0,
'enabled' => (empty(
$conf->multicurrency->enabled) ? 0 : 1),
'position' => 90),
219 'c.multicurrency_tx' => array(
'label' =>
'CurrencyRate',
'checked' => 0,
'enabled' => (empty(
$conf->multicurrency->enabled) ? 0 : 1),
'position' => 95),
220 'c.multicurrency_total_ht' => array(
'label' =>
'MulticurrencyAmountHT',
'checked' => 0,
'enabled' => (empty(
$conf->multicurrency->enabled) ? 0 : 1),
'position' => 100),
221 'c.multicurrency_total_vat' => array(
'label' =>
'MulticurrencyAmountVAT',
'checked' => 0,
'enabled' => (empty(
$conf->multicurrency->enabled) ? 0 : 1),
'position' => 105),
222 'c.multicurrency_total_ttc' => array(
'label' =>
'MulticurrencyAmountTTC',
'checked' => 0,
'enabled' => (empty(
$conf->multicurrency->enabled) ? 0 : 1),
'position' => 110),
223 'c.fk_warehouse' => array(
'label' =>
'Warehouse',
'checked' => 0,
'enabled' => (!isModEnabled(
'stock') && !
getDolGlobalString(
'WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER') ? 0 : 1),
'position' => 110),
224 'u.login' => array(
'label' =>
"Author",
'checked' => 1,
'position' => 115),
225 'sale_representative' => array(
'label' =>
"SaleRepresentativesOfThirdParty",
'checked' => 0,
'position' => 116),
226 'total_pa' => array(
'label' => (
getDolGlobalString(
'MARGIN_TYPE') ==
'1' ?
'BuyingPrice' :
'CostPrice'),
'checked' => 0,
'position' => 300,
'enabled' => (!isModEnabled(
'margin') || !$user->hasRight(
'margins',
'liretous') ? 0 : 1)),
227 'total_margin' => array(
'label' =>
'Margin',
'checked' => 0,
'position' => 301,
'enabled' => (!isModEnabled(
'margin') || !$user->hasRight(
'margins',
'liretous') ? 0 : 1)),
228 'total_margin_rate' => array(
'label' =>
'MarginRate',
'checked' => 0,
'position' => 302,
'enabled' => (!isModEnabled(
'margin') || !$user->hasRight(
'margins',
'liretous') || !
getDolGlobalString(
'DISPLAY_MARGIN_RATES') ? 0 : 1)),
229 'total_mark_rate' => array(
'label' =>
'MarkRate',
'checked' => 0,
'position' => 303,
'enabled' => (!isModEnabled(
'margin') || !$user->hasRight(
'margins',
'liretous') || !
getDolGlobalString(
'DISPLAY_MARK_RATES') ? 0 : 1)),
230 'c.datec' => array(
'label' =>
"DateCreation",
'checked' => 0,
'position' => 120),
231 'c.tms' => array(
'label' =>
"DateModificationShort",
'checked' => 0,
'position' => 125),
232 'c.date_cloture' => array(
'label' =>
"DateClosing",
'checked' => 0,
'position' => 130),
233 'c.note_public' => array(
'label' =>
'NotePublic',
'checked' => 0,
'enabled' => (!
getDolGlobalString(
'MAIN_LIST_ALLOW_PUBLIC_NOTES')),
'position' => 135),
234 'c.note_private' => array(
'label' =>
'NotePrivate',
'checked' => 0,
'enabled' => (!
getDolGlobalString(
'MAIN_LIST_ALLOW_PRIVATE_NOTES')),
'position' => 140),
235 'shippable' => array(
'label' =>
"Shippable",
'checked' => 1,
'enabled' => (isModEnabled(
'shipping')),
'position' => 990),
236 'c.facture' => array(
'label' =>
"Billed",
'checked' => 1,
'enabled' => (!
getDolGlobalString(
'WORKFLOW_BILL_ON_SHIPMENT')),
'position' => 995),
237 'c.import_key' => array(
'type' =>
'varchar(14)',
'label' =>
'ImportId',
'enabled' => 1,
'visible' => -2,
'position' => 999),
238 'c.fk_statut' => array(
'label' =>
"Status",
'checked' => 1,
'position' => 1000)
242include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
246'@phan-var-force array<string,array{label:string,checked?:int<0,1>,position?:int,help?:string}> $arrayfields';
248if (!$user->hasRight(
'societe',
'client',
'voir')) {
249 $search_sale = $user->id;
255 $socid = $user->socid;
259$permissiontoread =
false;
265if (
GETPOST(
'cancel',
'alpha')) {
269if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend' && $massaction !=
'confirm_createbills') {
273$parameters = array(
'socid' => $socid);
274$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
279if (empty($reshook)) {
281 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
284 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
287 $disablelinefree =
'';
291 $search_product_category_array = array();
292 $searchCategoryProductOperator = 0;
294 $search_refProduct =
'';
295 $search_descProduct =
'';
297 $search_ref_customer =
'';
298 $search_company =
'';
299 $search_company_alias =
'';
304 $search_country =
'';
305 $search_type_thirdparty =
'';
306 $search_total_ht =
'';
307 $search_total_vat =
'';
308 $search_total_ttc =
'';
309 $search_warehouse =
'';
310 $search_multicurrency_code =
'';
311 $search_multicurrency_tx =
'';
312 $search_multicurrency_montant_ht =
'';
313 $search_multicurrency_montant_vat =
'';
314 $search_multicurrency_montant_ttc =
'';
316 $search_dateorder_start =
'';
317 $search_dateorder_end =
'';
318 $search_datedelivery_start =
'';
319 $search_datedelivery_end =
'';
320 $search_project_ref =
'';
321 $search_project =
'';
325 $search_array_options = array();
326 $search_categ_cus = 0;
327 $search_datecloture_start =
'';
328 $search_datecloture_end =
'';
329 $search_fk_cond_reglement =
'';
330 $search_fk_shipping_method =
'';
331 $search_fk_mode_reglement =
'';
332 $search_fk_input_reason =
'';
334 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
335 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
340 $objectclass =
'Commande';
341 $objectlabel =
'Orders';
342 $permissiontoread = $user->hasRight(
"commande",
"lire");
343 $permissiontoadd = $user->hasRight(
"commande",
"creer");
344 $permissiontodelete = $user->hasRight(
"commande",
"supprimer");
345 $permissiontoexport = $user->hasRight(
"commande",
"commande",
"export");
347 $permissiontovalidate = $user->hasRight(
"commande",
"order_advance",
"validate");
348 $permissiontoclose = $user->hasRight(
"commande",
"order_advance",
"close");
349 $permissiontocancel = $user->hasRight(
"commande",
"order_advance",
"annuler");
350 $permissiontosendbymail = $user->hasRight(
"commande",
"order_advance",
"send");
352 $permissiontovalidate = $user->hasRight(
"commande",
"creer");
353 $permissiontoclose = $user->hasRight(
"commande",
"creer");
354 $permissiontocancel = $user->hasRight(
"commande",
"creer");
355 $permissiontosendbymail = $user->hasRight(
"commande",
"creer");
357 $uploaddir =
$conf->commande->multidir_output[
$conf->entity];
358 $triggersendname =
'ORDER_SENTBYMAIL';
359 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
373$form =
new Form($db);
377if (isModEnabled(
'margin')) {
380$companystatic =
new Societe($db);
382$projectstatic =
new Project($db);
384$title = $langs->trans(
"Orders");
385$help_url =
"EN:Module_Customers_Orders|FR:Module_Commandes_Clients|ES:Módulo_Pedidos_de_clientes";
389if ($search_all || $search_product_category_array > 0 || $search_user > 0) {
390 $sql =
'SELECT DISTINCT';
392$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,';
393$sql .=
" typent.code as typent_code,";
394$sql .=
" state.code_departement as state_code, state.nom as state_name,";
395$sql .=
" country.code as country_code,";
396$sql .=
' c.rowid as c_rowid, c.ref, c.ref_client, c.fk_user_author,';
397$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,';
398$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,';
399$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,';
400$sql .=
' c.date_creation as date_creation, c.tms as date_modification, c.date_cloture as date_cloture,';
401$sql .=
' p.rowid as project_id, p.ref as project_ref, p.title as project_label,';
402$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,';
403$sql .=
' c.fk_cond_reglement,c.deposit_percent,c.fk_mode_reglement,c.fk_shipping_method,';
404$sql .=
' c.fk_input_reason, c.import_key,';
406$sql .=
' cdet.rowid, cdet.description, cdet.qty, cdet.product_type, cdet.fk_product, cdet.total_ht, cdet.total_tva, cdet.total_ttc,';
407$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';
409if (($search_categ_cus > 0) || ($search_categ_cus == -2)) {
410 $sql .=
", cc.fk_categorie, cc.fk_soc";
413if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
414 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
415 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
419$parameters = array();
420$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters);
421$sql .= $hookmanager->resPrint;
422$sql .=
' FROM '.MAIN_DB_PREFIX.
'societe as s';
423$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as country on (country.rowid = s.fk_pays)";
424$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_typent as typent on (typent.id = s.fk_typent)";
425$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_departements as state on (state.rowid = s.fk_departement)";
426if (($search_categ_cus > 0) || ($search_categ_cus == -2)) {
427 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
"categorie_societe as cc ON s.rowid = cc.fk_soc";
431$sql .=
', '.MAIN_DB_PREFIX.
'commandedet as cdet';
432$sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'commande as c ON cdet.fk_commande=c.rowid';
433$sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'product as pr ON pr.rowid=cdet.fk_product';
435if (!empty($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
436 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"commande_extrafields as ef on (c.rowid = ef.fk_object)";
438$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"projet as p ON p.rowid = c.fk_projet";
439$sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'user as u ON c.fk_user_author = u.rowid';
440if ($search_user > 0) {
441 $sql .=
", ".MAIN_DB_PREFIX.
"element_contact as ec";
442 $sql .=
", ".MAIN_DB_PREFIX.
"c_type_contact as tc";
445$parameters = array();
446$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object);
447$sql .= $hookmanager->resPrint;
449$sql .=
' WHERE c.fk_soc = s.rowid';
450$sql .=
' AND c.entity IN ('.getEntity(
'commande').
')';
451$sql .=
' AND cdet.product_type <> 9';
453if (!empty($productobuy)) {
454 $sql .=
" AND pr.tobuy = 1";
456if (!empty($productonly)) {
457 $sql .=
" AND (cdet.product_type = 0 OR cdet.product_type = 1)";
459if (!empty($disablelinefree)) {
460 $sql .=
" AND cdet.fk_product IS NOT NULL";
463 $sql .=
' AND s.rowid = '.((int) $socid);
468if ($search_refProduct) {
471if ($search_descProduct) {
472 $sql .=
natural_search(array(
'pr.label',
'cdet.description'), $search_descProduct);
477if ($search_ref_customer) {
481 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
483if ($search_billed !=
'' && $search_billed >= 0) {
484 $sql .=
' AND c.facture = '.((int) $search_billed);
486if ($search_status !=
'') {
487 if ($search_status <= 3 && $search_status >= -1) {
488 if ($search_status == 1 && !isModEnabled(
'shipping')) {
489 $sql .=
' AND c.fk_statut IN (1,2)';
491 $sql .=
' AND c.fk_statut = '.((int) $search_status);
494 if ($search_status == -2) {
496 $sql .=
" AND c.fk_statut IN (1,2)";
498 if ($search_status == -3) {
501 $sql .=
' AND c.fk_statut IN (1,2,3)';
505if ($search_datecloture_start) {
506 $sql .=
" AND c.date_cloture >= '".$db->idate($search_datecloture_start).
"'";
508if ($search_datecloture_end) {
509 $sql .=
" AND c.date_cloture <= '".$db->idate($search_datecloture_end).
"'";
511if ($search_dateorder_start) {
512 $sql .=
" AND c.date_commande >= '".$db->idate($search_dateorder_start).
"'";
514if ($search_dateorder_end) {
515 $sql .=
" AND c.date_commande <= '".$db->idate($search_dateorder_end).
"'";
517if ($search_datedelivery_start) {
518 $sql .=
" AND c.date_livraison >= '".$db->idate($search_datedelivery_start).
"'";
520if ($search_datedelivery_end) {
521 $sql .=
" AND c.date_livraison <= '".$db->idate($search_datedelivery_end).
"'";
532if ($search_country) {
533 $sql .=
" AND s.fk_pays IN (".$db->sanitize($search_country).
')';
535if ($search_type_thirdparty && $search_type_thirdparty !=
'-1') {
536 $sql .=
" AND s.fk_typent IN (".$db->sanitize($search_type_thirdparty).
')';
538if ($search_company) {
541if ($search_company_alias) {
544if ($search_user > 0) {
545 $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);
547if ($search_total_ht !=
'') {
550if ($search_total_vat !=
'') {
553if ($search_total_ttc !=
'') {
556if ($search_warehouse !=
'' && $search_warehouse > 0) {
559if ($search_multicurrency_code !=
'') {
560 $sql .=
" AND c.multicurrency_code = '".$db->escape($search_multicurrency_code).
"'";
562if ($search_multicurrency_tx !=
'') {
563 $sql .=
natural_search(
'c.multicurrency_tx', $search_multicurrency_tx, 1);
565if ($search_multicurrency_montant_ht !=
'') {
566 $sql .=
natural_search(
'c.multicurrency_total_ht', $search_multicurrency_montant_ht, 1);
568if ($search_multicurrency_montant_vat !=
'') {
569 $sql .=
natural_search(
'c.multicurrency_total_tva', $search_multicurrency_montant_vat, 1);
571if ($search_multicurrency_montant_ttc !=
'') {
572 $sql .=
natural_search(
'c.multicurrency_total_ttc', $search_multicurrency_montant_ttc, 1);
575 $sql .=
natural_search(array(
"u.login",
"u.firstname",
"u.lastname"), $search_login);
577if ($search_project_ref !=
'') {
580if ($search_project !=
'') {
583if ($search_categ_cus > 0) {
584 $sql .=
" AND cc.fk_categorie = ".((int) $search_categ_cus);
586if ($search_categ_cus == -2) {
587 $sql .=
" AND cc.fk_categorie IS NULL";
589if ($search_fk_cond_reglement > 0) {
590 $sql .=
" AND c.fk_cond_reglement = ".((int) $search_fk_cond_reglement);
592if ($search_fk_shipping_method > 0) {
593 $sql .=
" AND c.fk_shipping_method = ".((int) $search_fk_shipping_method);
595if ($search_fk_mode_reglement > 0) {
596 $sql .=
" AND c.fk_mode_reglement = ".((int) $search_fk_mode_reglement);
598if ($search_fk_input_reason > 0) {
599 $sql .=
" AND c.fk_input_reason = ".((int) $search_fk_input_reason);
602if ($search_sale && $search_sale !=
'-1') {
603 if ($search_sale == -2) {
604 $sql .=
" AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = c.fk_soc)";
605 } elseif ($search_sale > 0) {
606 $sql .=
" AND EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = c.fk_soc AND sc.fk_user = ".((int) $search_sale).
")";
610$searchCategoryProductList = $search_product_category_array;
611if (!empty($searchCategoryProductList)) {
612 $searchCategoryProjectSqlList = array();
613 $listofcategoryid =
'';
614 foreach ($searchCategoryProductList as $searchCategoryProject) {
615 if (intval($searchCategoryProject) == -2) {
616 $searchCategoryProjectSqlList[] =
"NOT EXISTS (SELECT cp.fk_product FROM ".MAIN_DB_PREFIX.
"categorie_product as cp WHERE cdet.fk_product = cp.fk_product)";
617 } elseif (intval($searchCategoryProject) > 0) {
618 if ($searchCategoryProductOperator == 0) {
619 $searchCategoryProjectSqlList[] =
" EXISTS (SELECT cp.fk_product FROM ".MAIN_DB_PREFIX.
"categorie_product as cp WHERE cdet.fk_product = cp.fk_product AND cp.fk_categorie = ".((int) $searchCategoryProject).
")";
621 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryProject);
625 if ($listofcategoryid) {
626 $searchCategoryProjectSqlList[] =
" EXISTS (SELECT cp.fk_product FROM ".MAIN_DB_PREFIX.
"categorie_product as cp WHERE cdet.fk_product = cp.fk_product AND cp.fk_categorie IN (".$db->sanitize($listofcategoryid).
"))";
628 if ($searchCategoryProductOperator == 1) {
629 if (!empty($searchCategoryProjectSqlList)) {
630 $sql .=
" AND (".implode(
' OR ', $searchCategoryProjectSqlList).
")";
633 if (!empty($searchCategoryProjectSqlList)) {
634 $sql .=
" AND (".implode(
' AND ', $searchCategoryProjectSqlList).
")";
640include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
643$parameters = array();
644$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters);
645$sql .= $hookmanager->resPrint;
648$parameters = array();
649$reshook = $hookmanager->executeHooks(
'printFieldListHaving', $parameters, $object);
650$sql .= empty($hookmanager->resPrint) ?
"" :
" HAVING 1=1 ".$hookmanager->resPrint;
652$sql .= $db->order($sortfield, $sortorder);
655$nbtotalofrecords =
'';
657 $result = $db->query($sql);
658 $nbtotalofrecords = $db->num_rows($result);
660 if (($page * $limit) > $nbtotalofrecords) {
666$sql .= $db->plimit($limit + 1, $offset);
669$resql = $db->query($sql);
674 $title = $langs->trans(
'ListOrderLigne').
' - '.$soc->name;
675 if (empty($search_company)) {
676 $search_company = $soc->name;
679 $title = $langs->trans(
'ListOrderLigne');
681 if (strval($search_status) ==
'0') {
682 $title .=
' - '.$langs->trans(
'StatusOrderDraftShort');
684 if ($search_status == 1) {
685 $title .=
' - '.$langs->trans(
'StatusOrderValidatedShort');
687 if ($search_status == 2) {
688 $title .=
' - '.$langs->trans(
'StatusOrderSentShort');
690 if ($search_status == 3) {
691 $title .=
' - '.$langs->trans(
'StatusOrderToBillShort');
693 if ($search_status == -1) {
694 $title .=
' - '.$langs->trans(
'StatusOrderCanceledShort');
696 if ($search_status == -2) {
697 $title .=
' - '.$langs->trans(
'StatusOrderToProcessShort');
699 if ($search_status == -3) {
700 $title .=
' - '.$langs->trans(
'StatusOrderValidated').
', '.(!isModEnabled(
'shipping') ?
'' : $langs->trans(
"StatusOrderSent").
', ').$langs->trans(
'StatusOrderToBill');
703 $num = $db->num_rows($resql);
705 $arrayofselected = is_array($toselect) ? $toselect : array();
707 if ($num == 1 &&
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all) {
708 $obj = $db->fetch_object($resql);
710 header(
"Location: ".DOL_URL_ROOT.
'/commande/card.php?id='.$id);
714 llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-commande page-list_det');
718 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
719 $param .=
'&contextpage='.urlencode($contextpage);
721 if ($limit > 0 && $limit !=
$conf->liste_limit) {
722 $param .=
'&limit='.((int) $limit);
725 $param .=
'&search_all='.urlencode($search_all);
728 $param .=
'&socid='.urlencode((
string) ($socid));
731 $param .=
'&search_id='.urlencode($search_id);
734 if ($search_refProduct) {
735 $param .=
'&search_refProduct='.urlencode($search_refProduct);
737 if ($search_descProduct) {
738 $param .=
'&search_descProduct='.urlencode($search_descProduct);
740 if ($search_status !=
'') {
741 $param .=
'&search_status='.urlencode($search_status);
743 if ($search_datecloture_start) {
744 $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');
746 if ($search_datecloture_end) {
747 $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');
749 if ($search_dateorder_start) {
750 $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');
752 if ($search_dateorder_end) {
753 $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');
755 if ($search_datedelivery_start) {
756 $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');
758 if ($search_datedelivery_end) {
759 $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');
762 $param .=
'&search_ref='.urlencode($search_ref);
764 if ($search_company) {
765 $param .=
'&search_company='.urlencode($search_company);
767 if ($search_company_alias) {
768 $param .=
'&search_company_alias='.urlencode($search_company_alias);
770 if ($search_ref_customer) {
771 $param .=
'&search_ref_customer='.urlencode($search_ref_customer);
773 if ($search_user > 0) {
774 $param .=
'&search_user='.urlencode((
string) ($search_user));
776 if ($search_sale > 0) {
777 $param .=
'&search_sale='.urlencode($search_sale);
779 if ($search_total_ht !=
'') {
780 $param .=
'&search_total_ht='.urlencode($search_total_ht);
782 if ($search_total_vat !=
'') {
783 $param .=
'&search_total_vat='.urlencode($search_total_vat);
785 if ($search_total_ttc !=
'') {
786 $param .=
'&search_total_ttc='.urlencode($search_total_ttc);
788 if ($search_warehouse !=
'') {
789 $param .=
'&search_warehouse='.urlencode((
string) ($search_warehouse));
792 $param .=
'&search_login='.urlencode($search_login);
794 if ($search_multicurrency_code !=
'') {
795 $param .=
'&search_multicurrency_code='.urlencode($search_multicurrency_code);
797 if ($search_multicurrency_tx !=
'') {
798 $param .=
'&search_multicurrency_tx='.urlencode($search_multicurrency_tx);
800 if ($search_multicurrency_montant_ht !=
'') {
801 $param .=
'&search_multicurrency_montant_ht='.urlencode($search_multicurrency_montant_ht);
803 if ($search_multicurrency_montant_vat !=
'') {
804 $param .=
'&search_multicurrency_montant_vat='.urlencode($search_multicurrency_montant_vat);
806 if ($search_multicurrency_montant_ttc !=
'') {
807 $param .=
'&search_multicurrency_montant_ttc='.urlencode($search_multicurrency_montant_ttc);
809 if ($search_project_ref >= 0) {
810 $param .=
"&search_project_ref=".urlencode($search_project_ref);
812 if ($search_town !=
'') {
813 $param .=
'&search_town='.urlencode($search_town);
815 if ($search_zip !=
'') {
816 $param .=
'&search_zip='.urlencode($search_zip);
818 if ($search_state !=
'') {
819 $param .=
'&search_state='.urlencode($search_state);
821 if ($search_country !=
'') {
822 $param .=
'&search_country='.urlencode((
string) ($search_country));
824 if ($search_type_thirdparty && $search_type_thirdparty !=
'-1') {
825 $param .=
'&search_type_thirdparty='.urlencode((
string) ($search_type_thirdparty));
827 if (!empty($search_product_category_array)) {
828 foreach ($search_product_category_array as $tmpval) {
829 $param .=
'&search_categegory_product_list[]='.urlencode($tmpval);
832 if (($search_categ_cus > 0) || ($search_categ_cus == -2)) {
833 $param .=
'&search_categ_cus='.urlencode((
string) ($search_categ_cus));
836 $param .=
'&show_files='.urlencode((
string) ($show_files));
838 if ($optioncss !=
'') {
839 $param .=
'&optioncss='.urlencode($optioncss);
841 if ($search_billed !=
'') {
842 $param .=
'&search_billed='.urlencode($search_billed);
844 if ($search_fk_cond_reglement > 0) {
845 $param .=
'&search_fk_cond_reglement='.urlencode((
string) ($search_fk_cond_reglement));
847 if ($search_fk_shipping_method > 0) {
848 $param .=
'&search_fk_shipping_method='.urlencode((
string) ($search_fk_shipping_method));
850 if ($search_fk_mode_reglement > 0) {
851 $param .=
'&search_fk_mode_reglement='.urlencode((
string) ($search_fk_mode_reglement));
853 if ($search_fk_input_reason > 0) {
854 $param .=
'&search_fk_input_reason='.urlencode((
string) ($search_fk_input_reason));
856 if (!empty($productobuy)) {
857 $param .=
'&productobuy='.urlencode($productobuy);
859 if (!empty($productonly)) {
860 $param .=
'&productonly='.urlencode($productonly);
862 if (!empty($disablelinefree)) {
863 $param .=
'&disablelinefree='.urlencode($disablelinefree);
867 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
870 $parameters = array(
'param' => &$param);
871 $reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object);
872 $param .= $hookmanager->resPrint;
875 $arrayofmassactions = array(
882 $massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
884 $url = DOL_URL_ROOT.
'/commande/card.php?action=create';
885 if (!empty($socid)) {
886 $url .=
'&socid='.$socid;
891 print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">';
892 if ($optioncss !=
'') {
893 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
895 print
'<input type="hidden" name="token" value="'.newToken().
'">';
896 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
897 print
'<input type="hidden" name="action" value="list">';
898 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
899 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
900 print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
901 print
'<input type="hidden" name="search_status" value="'.$search_status.
'">';
902 print
'<input type="hidden" name="socid" value="'.$socid.
'">';
904 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'order', 0, $newcardbutton,
'', $limit, 0, 0, 1);
906 $topicmail =
"SendOrderRef";
907 $modelmail =
"order_send";
909 $trackid =
'ord'.$object->id;
910 include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
913 foreach ($fieldstosearchall as $key => $val) {
914 $fieldstosearchall[$key] = $langs->trans($val);
916 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>';
921 $moreforfilter .=
'<div class="divsearchfield">';
922 $moreforfilter .=
'<input type="checkbox" id="productobuy" name="productobuy"'.(!empty($productobuy) ?
'value="productobuychecked" checked' :
'').
'><label for="productobuy">'.$langs->trans(
"productobuy").
'</label>';
923 $moreforfilter .=
'</div>';
924 $moreforfilter .=
'<div class="divsearchfield">';
925 $moreforfilter .=
'<input type="checkbox" id="productonly" name="productonly"'.(!empty($productonly) ?
'value="productonlychecked" checked' :
'').
'><label for="productonly">'.$langs->trans(
"productonly").
'</label>';
926 $moreforfilter .=
'</div>';
927 $moreforfilter .=
'<div class="divsearchfield">';
928 $moreforfilter .=
'<input type="checkbox" id="disablelinefree" name="disablelinefree"'.(!empty($disablelinefree) ?
'value="disablelinefreechecked" checked' :
'').
'><label for="disablelinefree">'.$langs->trans(
"disablelinefree").
'</label>';
929 $moreforfilter .=
'</div><br>';
932 if ($user->hasRight(
'user',
'user',
'lire')) {
933 $langs->load(
"commercial");
934 $moreforfilter .=
'<div class="divsearchfield">';
935 $tmptitle = $langs->trans(
'ThirdPartiesOfSaleRepresentative');
936 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale,
'search_sale', $user, 0, $tmptitle,
'maxwidth250 widthcentpercentminusx');
937 $moreforfilter .=
'</div>';
940 if ($user->hasRight(
'user',
'user',
'lire')) {
941 $moreforfilter .=
'<div class="divsearchfield">';
942 $tmptitle = $langs->trans(
'LinkedToSpecificUsers');
943 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$form->select_dolusers($search_user,
'search_user', $tmptitle,
'', 0,
'',
'', 0, 0, 0,
'', 0,
'',
'maxwidth250 widthcentpercentminusx');
944 $moreforfilter .=
'</div>';
947 if (isModEnabled(
"category") && $user->hasRight(
'categorie',
'lire') && ($user->hasRight(
'produit',
'lire') || $user->hasRight(
'service',
'lire'))) {
949 $moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_PRODUCT, $search_product_category_array,
'minwidth300imp minwidth300', $searchCategoryProductOperator ? $searchCategoryProductOperator : 0);
951 if (isModEnabled(
"category") && $user->hasRight(
'categorie',
'lire')) {
952 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
953 $moreforfilter .=
'<div class="divsearchfield">';
954 $tmptitle = $langs->trans(
'CustomersProspectsCategoriesShort');
955 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"').$formother->select_categories(
'customer', $search_categ_cus,
'search_categ_cus', 1, $tmptitle,
'maxwidth300 widthcentpercentminusx');
956 $moreforfilter .=
'</div>';
958 if (isModEnabled(
'stock') &&
getDolGlobalString(
'WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER')) {
959 require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
961 $moreforfilter .=
'<div class="divsearchfield">';
962 $tmptitle = $langs->trans(
'Warehouse');
963 $moreforfilter .=
img_picto($tmptitle,
'stock',
'class="pictofixedwidth"').$formproduct->selectWarehouses($search_warehouse,
'search_warehouse',
'', 1, 0, 0, $tmptitle, 0, 0, array(),
'maxwidth250 widthcentpercentminusx');
964 $moreforfilter .=
'</div>';
968 $parameters = array();
969 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
970 if (empty($reshook)) {
971 $moreforfilter .= $hookmanager->resPrint;
973 $moreforfilter = $hookmanager->resPrint;
976 if (!empty($moreforfilter)) {
977 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
978 print $moreforfilter;
982 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
983 $selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
984 $selectedfields .= $form->showCheckAddButtons(
'checkforselect', 1);
987 $selectedfields .=
'<script>';
988 $selectedfields .=
' $(document).ready(function() {';
989 $selectedfields .=
' console.log("Autoclick on checkforselects");';
990 $selectedfields .=
' $("#checkforselects").click();';
991 $selectedfields .=
' $("#massaction").val("createbills").change();';
992 $selectedfields .=
' });';
993 $selectedfields .=
'</script>';
996 print
'<div class="div-table-responsive">';
997 print
'<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
999 print
'<tr class="liste_titre_filter">';
1003 print
'<td class="liste_titre" align="middle">';
1004 $searchpicto = $form->showFilterButtons(
'left');
1009 if (!empty($arrayfields[
'rowid'][
'checked'])) {
1010 print
'<td class="liste_titre" data-key="id">';
1011 print
'<input class="flat searchstring" type="text" name="search_id" size="1" value="'.dol_escape_htmltag($search_id).
'">';
1015 if (!empty($arrayfields[
'pr.ref'][
'checked'])) {
1016 print
'<td class="liste_titre">';
1017 print
'<input class="flat" size="6" type="text" name="search_refProduct" value="'.dol_escape_htmltag($search_refProduct).
'">';
1021 if (!empty($arrayfields[
'pr.desc'][
'checked'])) {
1022 print
'<td class="liste_titre">';
1023 print
'<input class="flat" size="6" type="text" name="search_descProduct" value="'.dol_escape_htmltag($search_descProduct).
'">';
1027 if (!empty($arrayfields[
'cdet.qty'][
'checked'])) {
1028 print
'<td class="liste_titre"></td>';
1032 if (!empty($arrayfields[
'c.ref'][
'checked'])) {
1033 print
'<td class="liste_titre">';
1034 print
'<input class="flat" size="6" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
1038 if (!empty($arrayfields[
'c.ref_client'][
'checked'])) {
1039 print
'<td class="liste_titre" align="left">';
1040 print
'<input class="flat" type="text" size="6" name="search_ref_customer" value="'.dol_escape_htmltag($search_ref_customer).
'">';
1044 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1045 print
'<td class="liste_titre"><input type="text" class="flat" size="6" name="search_project_ref" value="'.dol_escape_htmltag($search_project_ref).
'"></td>';
1048 if (!empty($arrayfields[
'p.title'][
'checked'])) {
1049 print
'<td class="liste_titre"><input type="text" class="flat" size="6" name="search_project" value="'.dol_escape_htmltag($search_project).
'"></td>';
1052 if (!empty($arrayfields[
's.nom'][
'checked'])) {
1053 print
'<td class="liste_titre" align="left">';
1054 print
'<input class="flat maxwidth100" type="text" name="search_company" value="'.dol_escape_htmltag($search_company).
'">';
1058 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1059 print
'<td class="liste_titre" align="left">';
1060 print
'<input class="flat maxwidth100" type="text" name="search_company_alias" value="'.dol_escape_htmltag($search_company_alias).
'">';
1064 if (!empty($arrayfields[
's.town'][
'checked'])) {
1065 print
'<td class="liste_titre"><input class="flat" type="text" size="4" name="search_town" value="'.dol_escape_htmltag($search_town).
'"></td>';
1068 if (!empty($arrayfields[
's.zip'][
'checked'])) {
1069 print
'<td class="liste_titre"><input class="flat" type="text" size="4" name="search_zip" value="'.dol_escape_htmltag($search_zip).
'"></td>';
1072 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1073 print
'<td class="liste_titre">';
1074 print
'<input class="flat" size="4" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).
'">';
1078 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1079 print
'<td class="liste_titre" align="center">';
1080 print $form->select_country($search_country,
'search_country',
'', 0,
'minwidth100imp maxwidth100');
1084 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1085 print
'<td class="liste_titre maxwidthonsmartphone" align="center">';
1086 print $form->selectarray(
"search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 1, 0, 0,
'', 0, 0, 0, (!
getDolGlobalString(
'SOCIETE_SORT_ON_TYPEENT') ?
'ASC' :
$conf->global->SOCIETE_SORT_ON_TYPEENT),
'', 1);
1090 if (!empty($arrayfields[
'c.date_commande'][
'checked'])) {
1091 print
'<td class="liste_titre center">';
1092 print
'<div class="nowrapfordate">';
1093 print $form->selectDate($search_dateorder_start ? $search_dateorder_start : -1,
'search_dateorder_start_', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1095 print
'<div class="nowrapfordate">';
1096 print $form->selectDate($search_dateorder_end ? $search_dateorder_end : -1,
'search_dateorder_end_', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1100 if (!empty($arrayfields[
'c.date_delivery'][
'checked'])) {
1101 print
'<td class="liste_titre center">';
1102 print
'<div class="nowrapfordate">';
1103 print $form->selectDate($search_datedelivery_start ? $search_datedelivery_start : -1,
'search_datedelivery_start_', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1105 print
'<div class="nowrapfordate">';
1106 print $form->selectDate($search_datedelivery_end ? $search_datedelivery_end : -1,
'search_datedelivery_end_', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1111 if (!empty($arrayfields[
'c.fk_shipping_method'][
'checked'])) {
1112 print
'<td class="liste_titre">';
1113 $form->selectShippingMethod($search_fk_shipping_method,
'search_fk_shipping_method',
'', 1,
'', 1);
1117 if (!empty($arrayfields[
'c.fk_cond_reglement'][
'checked'])) {
1118 print
'<td class="liste_titre">';
1119 print $form->getSelectConditionsPaiements($search_fk_cond_reglement,
'search_fk_cond_reglement', 1, 1, 1);
1123 if (!empty($arrayfields[
'c.fk_mode_reglement'][
'checked'])) {
1124 print
'<td class="liste_titre">';
1125 $form->select_types_paiements($search_fk_mode_reglement,
'search_fk_mode_reglement',
'', 0, 1, 1, 0, -1);
1129 if (!empty($arrayfields[
'c.fk_input_reason'][
'checked'])) {
1130 print
'<td class="liste_titre">';
1131 $form->selectInputReason($search_fk_input_reason,
'search_fk_input_reason',
'', 1,
'', 1);
1134 if (!empty($arrayfields[
'cdet.total_ht'][
'checked'])) {
1136 print
'<td class="liste_titre right">';
1137 print
'<input class="flat" type="text" size="4" name="search_total_ht" value="'.dol_escape_htmltag($search_total_ht).
'">';
1140 if (!empty($arrayfields[
'c.total_vat'][
'checked'])) {
1142 print
'<td class="liste_titre right">';
1143 print
'<input class="flat" type="text" size="4" name="search_total_vat" value="'.dol_escape_htmltag($search_total_vat).
'">';
1146 if (!empty($arrayfields[
'cdet.total_ttc'][
'checked'])) {
1148 print
'<td class="liste_titre right">';
1149 print
'<input class="flat" type="text" size="5" name="search_total_ttc" value="'.$search_total_ttc.
'">';
1152 if (!empty($arrayfields[
'c.fk_warehouse'][
'checked'])) {
1154 print
'<td class="liste_titre right"></td>';
1156 if (!empty($arrayfields[
'c.multicurrency_code'][
'checked'])) {
1158 print
'<td class="liste_titre">';
1159 print $form->selectMultiCurrency($search_multicurrency_code,
'search_multicurrency_code', 1);
1162 if (!empty($arrayfields[
'c.multicurrency_tx'][
'checked'])) {
1164 print
'<td class="liste_titre">';
1165 print
'<input class="flat" type="text" size="4" name="search_multicurrency_tx" value="'.dol_escape_htmltag($search_multicurrency_tx).
'">';
1168 if (!empty($arrayfields[
'c.multicurrency_total_ht'][
'checked'])) {
1170 print
'<td class="liste_titre right">';
1171 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ht" value="'.dol_escape_htmltag($search_multicurrency_montant_ht).
'">';
1174 if (!empty($arrayfields[
'c.multicurrency_total_vat'][
'checked'])) {
1176 print
'<td class="liste_titre right">';
1177 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_vat" value="'.dol_escape_htmltag($search_multicurrency_montant_vat).
'">';
1180 if (!empty($arrayfields[
'c.multicurrency_total_ttc'][
'checked'])) {
1182 print
'<td class="liste_titre right">';
1183 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ttc" value="'.dol_escape_htmltag($search_multicurrency_montant_ttc).
'">';
1186 if (!empty($arrayfields[
'u.login'][
'checked'])) {
1188 print
'<td class="liste_titre" align="center">';
1189 print
'<input class="flat" size="4" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).
'">';
1192 if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
1193 print
'<td class="liste_titre"></td>';
1195 if (!empty($arrayfields[
'total_pa'][
'checked'])) {
1196 print
'<td class="liste_titre right">';
1199 if (!empty($arrayfields[
'total_margin'][
'checked'])) {
1200 print
'<td class="liste_titre right">';
1203 if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
1204 print
'<td class="liste_titre right">';
1207 if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
1208 print
'<td class="liste_titre right">';
1212 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
1214 $parameters = array(
'arrayfields' => $arrayfields);
1215 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters);
1216 print $hookmanager->resPrint;
1218 if (!empty($arrayfields[
'c.datec'][
'checked'])) {
1219 print
'<td class="liste_titre">';
1223 if (!empty($arrayfields[
'c.tms'][
'checked'])) {
1224 print
'<td class="liste_titre">';
1228 if (!empty($arrayfields[
'c.date_cloture'][
'checked'])) {
1229 print
'<td class="liste_titre center">';
1230 print
'<div class="nowrapfordate">';
1231 print $form->selectDate($search_datecloture_start ? $search_datecloture_start : -1,
'search_datecloture_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1233 print
'<div class="nowrapfordate">';
1234 print $form->selectDate($search_datecloture_end ? $search_datecloture_end : -1,
'search_datecloture_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1239 if (!empty($arrayfields[
'c.note_public'][
'checked'])) {
1240 print
'<td class="liste_titre">';
1244 if (!empty($arrayfields[
'c.note_private'][
'checked'])) {
1245 print
'<td class="liste_titre">';
1249 if (!empty($arrayfields[
'shippable'][
'checked'])) {
1250 print
'<td class="liste_titre maxwidthonsmartphone" align="center">';
1253 print
'<input type="checkbox" name="show_shippable_command" value="1"'.($show_shippable_command ?
' checked' :
'').
'>';
1254 print $langs->trans(
'ShowShippableStatus');
1256 $show_shippable_command = 1;
1261 if (!empty($arrayfields[
'c.facture'][
'checked'])) {
1262 print
'<td class="liste_titre maxwidthonsmartphone" align="center">';
1263 print $form->selectyesno(
'search_billed', $search_billed, 1, 0, 1, 1);
1267 if (!empty($arrayfields[
'c.import_key'][
'checked'])) {
1268 print
'<td class="liste_titre maxwidthonsmartphone" align="center">';
1272 if (!empty($arrayfields[
'c.fk_statut'][
'checked'])) {
1273 print
'<td class="liste_titre maxwidthonsmartphone center">';
1274 $liststatus = array(
1278 -2 => $langs->trans(
"StatusOrderValidatedShort").
'+'.$langs->trans(
"StatusOrderSentShort"),
1279 -3 => $langs->trans(
"StatusOrderValidatedShort").
'+'.$langs->trans(
"StatusOrderSentShort").
'+'.$langs->trans(
"StatusOrderDelivered"),
1284 print $form->selectarray(
'search_status', $liststatus, $search_status, -5, 0, 0,
'', 0, 0, 0,
'',
'maxwidth125', 1);
1289 print
'<td class="liste_titre" align="middle">';
1290 $searchpicto = $form->showFilterButtons();
1297 print
'<tr class="liste_titre">';
1300 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'', $param,
'', $sortfield, $sortorder,
'maxwidthsearch center ');
1304 if (!empty($arrayfields[
'rowid'][
'checked'])) {
1306 print_liste_field_titre($arrayfields[
'rowid'][
'label'], $_SERVER[
"PHP_SELF"],
'rowid',
'', $param,
'', $sortfield, $sortorder);
1307 '@phan-var-force array<string,array{label:string,checked?:int<0,1>,position?:int,help?:string}> $arrayfields';
1309 if (!empty($arrayfields[
'pr.ref'][
'checked'])) {
1310 print_liste_field_titre($arrayfields[
'pr.ref'][
'label'], $_SERVER[
"PHP_SELF"],
'pr.ref',
'', $param,
'', $sortfield, $sortorder);
1312 if (!empty($arrayfields[
'pr.desc'][
'checked'])) {
1313 print_liste_field_titre($arrayfields[
'pr.desc'][
'label'], $_SERVER[
"PHP_SELF"],
'pr.desc',
'', $param,
'', $sortfield, $sortorder);
1315 if (!empty($arrayfields[
'cdet.qty'][
'checked'])) {
1316 print_liste_field_titre($arrayfields[
'cdet.qty'][
'label'], $_SERVER[
"PHP_SELF"],
'cdet.qty',
'', $param,
'', $sortfield, $sortorder);
1319 if (!empty($arrayfields[
'c.ref'][
'checked'])) {
1320 print_liste_field_titre($arrayfields[
'c.ref'][
'label'], $_SERVER[
"PHP_SELF"],
'c.ref',
'', $param,
'', $sortfield, $sortorder);
1322 if (!empty($arrayfields[
'c.ref_client'][
'checked'])) {
1323 print_liste_field_titre($arrayfields[
'c.ref_client'][
'label'], $_SERVER[
"PHP_SELF"],
'c.ref_client',
'', $param,
'', $sortfield, $sortorder);
1325 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1326 print_liste_field_titre($arrayfields[
'p.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"p.ref",
"", $param,
'', $sortfield, $sortorder);
1328 if (!empty($arrayfields[
'p.title'][
'checked'])) {
1329 print_liste_field_titre($arrayfields[
'p.title'][
'label'], $_SERVER[
"PHP_SELF"],
"p.title",
"", $param,
'', $sortfield, $sortorder);
1331 if (!empty($arrayfields[
's.nom'][
'checked'])) {
1332 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
"PHP_SELF"],
's.nom',
'', $param,
'', $sortfield, $sortorder);
1334 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1335 print_liste_field_titre($arrayfields[
's.name_alias'][
'label'], $_SERVER[
"PHP_SELF"],
's.name_alias',
'', $param,
'', $sortfield, $sortorder);
1337 if (!empty($arrayfields[
's.town'][
'checked'])) {
1338 print_liste_field_titre($arrayfields[
's.town'][
'label'], $_SERVER[
"PHP_SELF"],
's.town',
'', $param,
'', $sortfield, $sortorder);
1340 if (!empty($arrayfields[
's.zip'][
'checked'])) {
1341 print_liste_field_titre($arrayfields[
's.zip'][
'label'], $_SERVER[
"PHP_SELF"],
's.zip',
'', $param,
'', $sortfield, $sortorder);
1343 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1344 print_liste_field_titre($arrayfields[
'state.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"state.nom",
"", $param,
'', $sortfield, $sortorder);
1346 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1347 print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'], $_SERVER[
"PHP_SELF"],
"country.code_iso",
"", $param,
'', $sortfield, $sortorder,
'center ');
1349 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1350 print_liste_field_titre($arrayfields[
'typent.code'][
'label'], $_SERVER[
"PHP_SELF"],
"typent.code",
"", $param,
'', $sortfield, $sortorder,
'center ');
1352 if (!empty($arrayfields[
'c.date_commande'][
'checked'])) {
1353 print_liste_field_titre($arrayfields[
'c.date_commande'][
'label'], $_SERVER[
"PHP_SELF"],
'c.date_commande',
'', $param,
'', $sortfield, $sortorder,
'center ');
1355 if (!empty($arrayfields[
'c.date_delivery'][
'checked'])) {
1356 print_liste_field_titre($arrayfields[
'c.date_delivery'][
'label'], $_SERVER[
"PHP_SELF"],
'c.date_livraison',
'', $param,
'', $sortfield, $sortorder,
'center ');
1358 if (!empty($arrayfields[
'c.fk_shipping_method'][
'checked'])) {
1359 print_liste_field_titre($arrayfields[
'c.fk_shipping_method'][
'label'], $_SERVER[
"PHP_SELF"],
"c.fk_shipping_method",
"", $param,
'', $sortfield, $sortorder);
1361 if (!empty($arrayfields[
'c.fk_cond_reglement'][
'checked'])) {
1362 print_liste_field_titre($arrayfields[
'c.fk_cond_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"c.fk_cond_reglement",
"", $param,
'', $sortfield, $sortorder);
1364 if (!empty($arrayfields[
'c.fk_mode_reglement'][
'checked'])) {
1365 print_liste_field_titre($arrayfields[
'c.fk_mode_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"c.fk_mode_reglement",
"", $param,
'', $sortfield, $sortorder);
1367 if (!empty($arrayfields[
'c.fk_input_reason'][
'checked'])) {
1368 print_liste_field_titre($arrayfields[
'c.fk_input_reason'][
'label'], $_SERVER[
"PHP_SELF"],
"c.fk_input_reason",
"", $param,
'', $sortfield, $sortorder);
1370 if (!empty($arrayfields[
'cdet.total_ht'][
'checked'])) {
1371 print_liste_field_titre($arrayfields[
'cdet.total_ht'][
'label'], $_SERVER[
"PHP_SELF"],
'cdet.total_ht',
'', $param,
'', $sortfield, $sortorder,
'right ');
1373 if (!empty($arrayfields[
'c.total_vat'][
'checked'])) {
1374 print_liste_field_titre($arrayfields[
'c.total_vat'][
'label'], $_SERVER[
"PHP_SELF"],
'cdet.total_tva',
'', $param,
'', $sortfield, $sortorder,
'right ');
1376 if (!empty($arrayfields[
'cdet.total_ttc'][
'checked'])) {
1377 print_liste_field_titre($arrayfields[
'cdet.total_ttc'][
'label'], $_SERVER[
"PHP_SELF"],
'cdet.total_ttc',
'', $param,
'', $sortfield, $sortorder,
'right ');
1379 if (!empty($arrayfields[
'c.fk_warehouse'][
'checked'])) {
1380 print_liste_field_titre($arrayfields[
'c.fk_warehouse'][
'label'],
"",
'',
'', $param,
'', $sortfield, $sortorder);
1382 if (!empty($arrayfields[
'c.multicurrency_code'][
'checked'])) {
1383 print_liste_field_titre($arrayfields[
'c.multicurrency_code'][
'label'], $_SERVER[
'PHP_SELF'],
'c.multicurrency_code',
'', $param,
'', $sortfield, $sortorder);
1385 if (!empty($arrayfields[
'c.multicurrency_tx'][
'checked'])) {
1386 print_liste_field_titre($arrayfields[
'c.multicurrency_tx'][
'label'], $_SERVER[
'PHP_SELF'],
'c.multicurrency_tx',
'', $param,
'', $sortfield, $sortorder);
1388 if (!empty($arrayfields[
'c.multicurrency_total_ht'][
'checked'])) {
1389 print_liste_field_titre($arrayfields[
'c.multicurrency_total_ht'][
'label'], $_SERVER[
'PHP_SELF'],
'c.multicurrency_total_ht',
'', $param,
'class="right"', $sortfield, $sortorder);
1391 if (!empty($arrayfields[
'c.multicurrency_total_vat'][
'checked'])) {
1392 print_liste_field_titre($arrayfields[
'c.multicurrency_total_vat'][
'label'], $_SERVER[
'PHP_SELF'],
'c.multicurrency_total_tva',
'', $param,
'class="right"', $sortfield, $sortorder);
1394 if (!empty($arrayfields[
'c.multicurrency_total_ttc'][
'checked'])) {
1395 print_liste_field_titre($arrayfields[
'c.multicurrency_total_ttc'][
'label'], $_SERVER[
'PHP_SELF'],
'c.multicurrency_total_ttc',
'', $param,
'class="right"', $sortfield, $sortorder);
1397 if (!empty($arrayfields[
'u.login'][
'checked'])) {
1398 print_liste_field_titre($arrayfields[
'u.login'][
'label'], $_SERVER[
"PHP_SELF"],
'u.login',
'', $param,
'align="center"', $sortfield, $sortorder);
1400 if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
1401 print_liste_field_titre($arrayfields[
'sale_representative'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"",
"$param",
'', $sortfield, $sortorder);
1403 if (!empty($arrayfields[
'total_pa'][
'checked'])) {
1404 print_liste_field_titre($arrayfields[
'total_pa'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1406 if (!empty($arrayfields[
'total_margin'][
'checked'])) {
1407 print_liste_field_titre($arrayfields[
'total_margin'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1409 if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
1410 print_liste_field_titre($arrayfields[
'total_margin_rate'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1412 if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
1413 print_liste_field_titre($arrayfields[
'total_mark_rate'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1416 $totalarray = array(
1419 'cdet.total_ht' => 0,
1420 'cdet.total_tva' => 0,
1421 'cdet.total_ttc' => 0,
1426 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1428 $parameters = array(
1429 'arrayfields' => $arrayfields,
1431 'sortfield' => $sortfield,
1432 'sortorder' => $sortorder,
1433 'totalarray' => &$totalarray,
1435 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters);
1436 print $hookmanager->resPrint;
1437 if (!empty($arrayfields[
'c.datec'][
'checked'])) {
1438 print_liste_field_titre($arrayfields[
'c.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"c.date_creation",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1440 if (!empty($arrayfields[
'c.tms'][
'checked'])) {
1441 print_liste_field_titre($arrayfields[
'c.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"c.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1443 if (!empty($arrayfields[
'c.date_cloture'][
'checked'])) {
1444 print_liste_field_titre($arrayfields[
'c.date_cloture'][
'label'], $_SERVER[
"PHP_SELF"],
"c.date_cloture",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1446 if (!empty($arrayfields[
'c.note_public'][
'checked'])) {
1447 print_liste_field_titre($arrayfields[
'c.note_public'][
'label'], $_SERVER[
"PHP_SELF"],
"c.note_public",
"", $param,
'', $sortfield, $sortorder,
'right ');
1449 if (!empty($arrayfields[
'c.note_private'][
'checked'])) {
1450 print_liste_field_titre($arrayfields[
'c.note_private'][
'label'], $_SERVER[
"PHP_SELF"],
"c.note_private",
"", $param,
'', $sortfield, $sortorder,
'right ');
1452 if (!empty($arrayfields[
'shippable'][
'checked'])) {
1453 print_liste_field_titre($arrayfields[
'shippable'][
'label'], $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'center ');
1455 if (!empty($arrayfields[
'c.facture'][
'checked'])) {
1456 print_liste_field_titre($arrayfields[
'c.facture'][
'label'], $_SERVER[
"PHP_SELF"],
'c.facture',
'', $param,
'', $sortfield, $sortorder,
'center ');
1458 if (!empty($arrayfields[
'c.import_key'][
'checked'])) {
1459 print_liste_field_titre($arrayfields[
'c.import_key'][
'label'], $_SERVER[
"PHP_SELF"],
"c.import_key",
"", $param,
'', $sortfield, $sortorder,
'center ');
1461 if (!empty($arrayfields[
'c.fk_statut'][
'checked'])) {
1462 print_liste_field_titre($arrayfields[
'c.fk_statut'][
'label'], $_SERVER[
"PHP_SELF"],
"c.fk_statut",
"", $param,
'', $sortfield, $sortorder,
'center ');
1465 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'', $param,
'', $sortfield, $sortorder,
'maxwidthsearch center ');
1471 $productstat_cache = array();
1472 '@phan-var-force array<int,array{stats_order_customer?:float|int,stats_order_supplier?:float|int}> $product_sdtat_cache';
1473 $productstat_cachevirtual = array();
1474 $getNomUrl_cache = array();
1476 $generic_commande =
new Commande($db);
1477 $generic_product =
new Product($db);
1478 $userstatic =
new User($db);
1481 $with_margin_info =
false;
1482 if (isModEnabled(
'margin') && (
1483 !empty($arrayfields[
'total_pa'][
'checked'])
1484 || !empty($arrayfields[
'total_margin'][
'checked'])
1485 || !empty($arrayfields[
'total_margin_rate'][
'checked'])
1486 || !empty($arrayfields[
'total_mark_rate'][
'checked'])
1489 $with_margin_info =
true;
1499 $totalarray = array();
1500 $totalarray[
'nbfield'] = 0;
1501 $subtotalarray = array();
1502 $subtotalarray[
'nbfield'] = 0;
1503 $totalarray[
'val'][
'cdet.total_tva'] = 0;
1504 $totalarray[
'val'][
'cdet.total_ttc'] = 0;
1505 $imaxinloop = ($limit ? min($num, $limit) : $num);
1506 while ($i < $imaxinloop) {
1507 $obj = $db->fetch_object($resql);
1517 $oldref = $obj->product_ref;
1519 if ($oldref != $obj->product_ref && $sortfield ==
'pr.ref') {
1520 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_subtotal.tpl.php';
1521 $oldref = $obj->product_ref;
1524 $companystatic->id = $obj->socid;
1525 $companystatic->name = $obj->name;
1526 $companystatic->name_alias = $obj->alias;
1527 $companystatic->client = $obj->client;
1528 $companystatic->code_client = $obj->code_client;
1529 $companystatic->email = $obj->email;
1530 $companystatic->phone = $obj->phone;
1531 $companystatic->address = $obj->address;
1532 $companystatic->zip = $obj->zip;
1533 $companystatic->town = $obj->town;
1534 $companystatic->country_code = $obj->country_code;
1535 if (!isset($getNomUrl_cache[$obj->socid])) {
1536 $getNomUrl_cache[$obj->socid] = $companystatic->getNomUrl(1,
'customer');
1539 $generic_commande->id = $obj->c_rowid;
1540 $generic_commande->ref = $obj->ref;
1541 $generic_commande->statut = $obj->fk_statut;
1542 $generic_commande->billed = $obj->billed;
1543 $generic_commande->date = $db->jdate($obj->date_commande);
1544 $generic_commande->delivery_date = $db->jdate($obj->date_delivery);
1545 $generic_commande->ref_client = $obj->ref_client;
1546 $generic_commande->total_ht = $obj->c_total_ht;
1547 $generic_commande->total_tva = $obj->c_total_tva;
1548 $generic_commande->total_ttc = $obj->c_total_ttc;
1549 $generic_commande->note_public = $obj->note_public;
1550 $generic_commande->note_private = $obj->note_private;
1552 $projectstatic->id = $obj->project_id;
1553 $projectstatic->ref = $obj->project_ref;
1554 $projectstatic->title = $obj->project_label;
1556 $marginInfo = array();
1557 if ($with_margin_info) {
1558 $generic_commande->fetch_lines();
1559 $marginInfo = $formmargin->getMarginInfosArray($generic_commande);
1560 $total_ht += $obj->total_ht;
1561 $total_margin += $marginInfo[
'total_margin'];
1564 print
'<tr class="oddeven">';
1568 print
'<td class="nowrap center">';
1569 if ($massactionbutton || $massaction) {
1571 if (in_array($obj->rowid, $arrayofselected)) {
1574 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1578 $totalarray[
'nbfield']++;
1584 if (!empty($arrayfields[
'rowid'][
'checked'])) {
1585 print
'<td class="nowrap right">'.$obj->rowid.
'</td>';
1587 $totalarray[
'nbfield']++;
1592 if (!empty($arrayfields[
'pr.ref'][
'checked'])) {
1593 if (!empty($obj->product_rowid)) {
1594 $generic_product->id = $obj->product_rowid;
1595 $generic_product->ref = $obj->product_ref;
1596 $generic_product->label = $obj->product_label;
1597 $generic_product->status = $obj->product_status;
1598 $generic_product->status_buy = $obj->product_status_buy;
1599 $generic_product->status_batch = $obj->product_batch;
1600 $generic_product->barcode = $obj->product_barcode;
1601 print
'<td class="nowrap tdoverflowmax200">'.$generic_product->getNomUrl(1).
'</td>';
1603 print
'<td class="nowrap tdoverflowmax200">Ligne libre</td>';
1606 $totalarray[
'nbfield']++;
1610 if (!empty($arrayfields[
'pr.desc'][
'checked'])) {
1612 !empty($obj->product_label) ? $labelproduct = $obj->product_label : $labelproduct = $obj->description;
1613 print
'<td class="nowrap tdoverflowmax200">';
1618 $totalarray[
'nbfield']++;
1622 if (!empty($arrayfields[
'cdet.qty'][
'checked'])) {
1623 print
'<td class="nowrap right">'.$obj->qty.
'</td>';
1624 if (isset($totalarray[
'val'][
'cdet.qty']) || isset($subtotalarray[
'val'][
'cdet.qty'])) {
1625 $totalarray[
'val'][
'cdet.qty'] += $obj->qty;
1626 $subtotalarray[
'val'][
'cdet.qty'] += $obj->qty;
1628 $totalarray[
'val'][
'cdet.qty'] = $obj->qty;
1629 $subtotalarray[
'val'][
'cdet.qty'] = $obj->qty;
1632 $totalarray[
'nbfield']++;
1635 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'cdet.qty';
1636 $totalarray[
'pos'][$subtotalarray[
'nbfield']] =
'cdet.qty';
1641 if (!empty($arrayfields[
'c.ref'][
'checked'])) {
1642 print
'<td class="nowraponall">';
1643 print $generic_commande->getNomUrl(1, ($search_status != 2 ? 0 : $obj->fk_statut), 0, 0, 0, 1, 1);
1647 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid;
1648 print $formfile->getDocumentsLink($generic_commande->element, $filename, $filedir);
1652 $totalarray[
'nbfield']++;
1657 if (!empty($arrayfields[
'c.ref_client'][
'checked'])) {
1658 print
'<td class="nowrap tdoverflowmax200">'.$obj->ref_client.
'</td>';
1660 $totalarray[
'nbfield']++;
1665 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1666 print
'<td class="nowrap">';
1667 if ($obj->project_id > 0) {
1668 print $projectstatic->getNomUrl(1);
1672 $totalarray[
'nbfield']++;
1677 if (!empty($arrayfields[
'p.title'][
'checked'])) {
1678 print
'<td class="nowrap">';
1679 if ($obj->project_id > 0) {
1680 print $projectstatic->title;
1684 $totalarray[
'nbfield']++;
1689 if (!empty($arrayfields[
's.nom'][
'checked'])) {
1690 print
'<td class="tdoverflowmax150">';
1691 print $getNomUrl_cache[$obj->socid];
1695 if ($user->hasRight(
'facture',
'creer')) {
1696 if (($obj->fk_statut > 0 && $obj->fk_statut < 3) || ($obj->fk_statut == 3 && $obj->billed == 0)) {
1697 print
' <a href="'.DOL_URL_ROOT.
'/commande/list.php?socid='.$companystatic->id.
'&search_billed=0&autoselectall=1">';
1698 print
img_picto($langs->trans(
"CreateInvoiceForThisCustomer").
' : '.$companystatic->name,
'object_bill',
'hideonsmartphone').
'</a>';
1704 $totalarray[
'nbfield']++;
1708 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1709 print
'<td class="nocellnopadd">';
1713 $totalarray[
'nbfield']++;
1717 if (!empty($arrayfields[
's.town'][
'checked'])) {
1718 print
'<td class="nocellnopadd">';
1722 $totalarray[
'nbfield']++;
1726 if (!empty($arrayfields[
's.zip'][
'checked'])) {
1727 print
'<td class="nocellnopadd">';
1731 $totalarray[
'nbfield']++;
1735 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1736 print
"<td>".$obj->state_name.
"</td>\n";
1738 $totalarray[
'nbfield']++;
1742 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1743 print
'<td class="center">';
1744 $tmparray =
getCountry($obj->fk_pays,
'all');
1745 print $tmparray[
'label'];
1748 $totalarray[
'nbfield']++;
1752 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1753 print
'<td class="center">';
1754 if (empty($typenArray)) {
1755 $typenArray = $formcompany->typent_array(1);
1757 print $typenArray[$obj->typent_code];
1760 $totalarray[
'nbfield']++;
1765 if (!empty($arrayfields[
'c.date_commande'][
'checked'])) {
1766 print
'<td class="center">';
1769 if ($generic_commande->hasDelay()) {
1770 print
img_picto($langs->trans(
"Late").
' : '.$generic_commande->showDelay(),
"warning");
1774 $totalarray[
'nbfield']++;
1778 if (!empty($arrayfields[
'c.date_delivery'][
'checked'])) {
1779 print
'<td class="center" title="'.$langs->trans($arrayfields[
'c.date_delivery'][
'label']).
': '.
dol_print_date($db->jdate($obj->date_delivery),
'dayhour').
'">';
1783 $totalarray[
'nbfield']++;
1787 if (!empty($arrayfields[
'c.fk_shipping_method'][
'checked'])) {
1789 $form->formSelectShippingMethod(
'', $obj->fk_shipping_method,
'none', 1);
1792 $totalarray[
'nbfield']++;
1796 if (!empty($arrayfields[
'c.fk_cond_reglement'][
'checked'])) {
1798 $form->form_conditions_reglement($_SERVER[
'PHP_SELF'], $obj->fk_cond_reglement,
'none', 0,
'', 1, $obj->deposit_percent);
1801 $totalarray[
'nbfield']++;
1805 if (!empty($arrayfields[
'c.fk_mode_reglement'][
'checked'])) {
1807 $form->form_modes_reglement($_SERVER[
'PHP_SELF'], $obj->fk_mode_reglement,
'none',
'', -1);
1810 $totalarray[
'nbfield']++;
1814 if (!empty($arrayfields[
'c.fk_input_reason'][
'checked'])) {
1816 $form->formInputReason($_SERVER[
'PHP_SELF'], $obj->fk_input_reason,
'none', 0);
1819 $totalarray[
'nbfield']++;
1823 if (!empty($arrayfields[
'cdet.total_ht'][
'checked'])) {
1824 print
'<td class="nowrap right"><span class="amount">'.price($obj->total_ht).
"</span></td>\n";
1826 $totalarray[
'nbfield']++;
1829 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'cdet.total_ht';
1830 $totalarray[
'pos'][$subtotalarray[
'nbfield']] =
'cdet.total_ht';
1832 if (isset($totalarray[
'val'][
'cdet.total_ht']) || isset($subtotalarray[
'val'][
'cdet.total_ht'])) {
1833 $totalarray[
'val'][
'cdet.total_ht'] += $obj->total_ht;
1834 $subtotalarray[
'val'][
'cdet.total_ht'] += $obj->total_ht;
1836 $totalarray[
'val'][
'cdet.total_ht'] = $obj->total_ht;
1837 $subtotalarray[
'val'][
'cdet.total_ht'] = $obj->total_ht;
1841 if (!empty($arrayfields[
'c.total_vat'][
'checked'])) {
1842 print
'<td class="nowrap right"><span class="amount">'.price($obj->total_tva).
"</span></td>\n";
1844 $totalarray[
'nbfield']++;
1847 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'cdet.total_tva';
1848 $totalarray[
'pos'][$subtotalarray[
'nbfield']] =
'cdet.total_tva';
1850 $totalarray[
'val'][
'cdet.total_tva'] += $obj->total_tva;
1851 $subtotalarray[
'val'][
'cdet.total_tva'] += $obj->total_tva;
1854 if (!empty($arrayfields[
'cdet.total_ttc'][
'checked'])) {
1855 print
'<td class="nowrap right"><span class="amount">'.price($obj->total_ttc).
"</span></td>\n";
1857 $totalarray[
'nbfield']++;
1860 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'cdet.total_ttc';
1861 $subtotalarray[
'pos'][$totalarray[
'nbfield']] =
'cdet.total_ttc';
1863 $totalarray[
'val'][
'cdet.total_ttc'] += $obj->total_ttc;
1864 $subtotalarray[
'val'][
'cdet.total_ttc'] += $obj->total_ttc;
1867 if (!empty($arrayfields[
'c.fk_warehouse'][
'checked'])) {
1868 print
'<td class="nowrap">';
1869 if ($obj->warehouse > 0) {
1870 print
img_picto(
'',
'stock',
'class="paddingrightonly"');
1872 $formproduct->formSelectWarehouses($_SERVER[
'PHP_SELF'], $obj->warehouse,
'none');
1875 $totalarray[
'nbfield']++;
1879 if (!empty($arrayfields[
'c.multicurrency_code'][
'checked'])) {
1880 print
'<td class="nowrap">'.$obj->multicurrency_code.
' - '.$langs->trans(
'Currency'.$obj->multicurrency_code).
"</td>\n";
1882 $totalarray[
'nbfield']++;
1887 if (!empty($arrayfields[
'c.multicurrency_tx'][
'checked'])) {
1888 print
'<td class="nowrap">';
1889 $form->form_multicurrency_rate($_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid, $obj->multicurrency_tx,
'none', $obj->multicurrency_code);
1892 $totalarray[
'nbfield']++;
1896 if (!empty($arrayfields[
'c.multicurrency_total_ht'][
'checked'])) {
1897 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ht).
"</span></td>\n";
1899 $totalarray[
'nbfield']++;
1903 if (!empty($arrayfields[
'c.multicurrency_total_vat'][
'checked'])) {
1904 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_vat).
"</span></td>\n";
1906 $totalarray[
'nbfield']++;
1910 if (!empty($arrayfields[
'c.multicurrency_total_ttc'][
'checked'])) {
1911 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ttc).
"</span></td>\n";
1913 $totalarray[
'nbfield']++;
1917 $userstatic->id = $obj->fk_user_author;
1918 $userstatic->login = $obj->login;
1919 $userstatic->lastname = $obj->lastname;
1920 $userstatic->firstname = $obj->firstname;
1921 $userstatic->email = $obj->user_email;
1922 $userstatic->status = $obj->user_statut;
1923 $userstatic->entity = $obj->entity;
1924 $userstatic->photo = $obj->photo;
1925 $userstatic->office_phone = $obj->office_phone;
1926 $userstatic->office_fax = $obj->office_fax;
1927 $userstatic->user_mobile = $obj->user_mobile;
1928 $userstatic->job = $obj->job;
1929 $userstatic->gender = $obj->gender;
1932 if (!empty($arrayfields[
'u.login'][
'checked'])) {
1933 print
'<td class="tdoverflowmax200">';
1934 if ($userstatic->id) {
1935 print $userstatic->getNomUrl(-1);
1941 $totalarray[
'nbfield']++;
1945 if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
1948 if ($obj->socid > 0) {
1949 $listsalesrepresentatives = $companystatic->getSalesRepresentatives($user);
1950 if ($listsalesrepresentatives < 0) {
1953 $nbofsalesrepresentative = count($listsalesrepresentatives);
1954 if ($nbofsalesrepresentative > 6) {
1956 print $nbofsalesrepresentative;
1957 } elseif ($nbofsalesrepresentative > 0) {
1959 foreach ($listsalesrepresentatives as $val) {
1960 $userstatic->id = $val[
'id'];
1961 $userstatic->lastname = $val[
'lastname'];
1962 $userstatic->firstname = $val[
'firstname'];
1963 $userstatic->email = $val[
'email'];
1964 $userstatic->status = $val[
'statut'];
1965 $userstatic->entity = $val[
'entity'];
1966 $userstatic->photo = $val[
'photo'];
1967 $userstatic->login = $val[
'login'];
1968 $userstatic->office_phone = $val[
'office_phone'];
1969 $userstatic->office_fax = $val[
'office_fax'];
1970 $userstatic->user_mobile = $val[
'user_mobile'];
1971 $userstatic->job = $val[
'job'];
1972 $userstatic->gender = $val[
'gender'];
1974 print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1,
'', 0, 0, 12) : $userstatic->getNomUrl(-2);
1976 if ($j < $nbofsalesrepresentative) {
1988 $totalarray[
'nbfield']++;
1993 if (!empty($arrayfields[
'total_pa'][
'checked'])) {
1994 print
'<td class="right nowrap">'.price($marginInfo[
'pa_total']).
'</td>';
1996 $totalarray[
'nbfield']++;
2000 if (!empty($arrayfields[
'total_margin'][
'checked'])) {
2001 print
'<td class="right nowrap">'.price($marginInfo[
'total_margin']).
'</td>';
2003 $totalarray[
'nbfield']++;
2006 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'total_margin';
2007 $totalarray[
'pos'][$subtotalarray[
'nbfield']] =
'total_margin';
2009 $totalarray[
'val'][
'total_margin'] += $marginInfo[
'total_margin'];
2010 $subtotalarray[
'val'][
'total_margin'] += $marginInfo[
'total_margin'];
2013 if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
2014 print
'<td class="right nowrap">'.(($marginInfo[
'total_margin_rate'] ==
'') ?
'' :
price($marginInfo[
'total_margin_rate'], 0,
'', 0, 0, 2).
'%').
'</td>';
2016 $totalarray[
'nbfield']++;
2020 if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
2021 print
'<td class="right nowrap">'.(($marginInfo[
'total_mark_rate'] ==
'') ?
'' :
price($marginInfo[
'total_mark_rate'], 0,
'', 0, 0, 2).
'%').
'</td>';
2023 $totalarray[
'nbfield']++;
2026 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'total_mark_rate';
2027 $totalarray[
'pos'][$subtotalarray[
'nbfield']] =
'total_mark_rate';
2029 if ($i >= $imaxinloop - 1) {
2030 if (!empty($total_ht)) {
2031 $totalarray[
'val'][
'total_mark_rate'] =
price2num($total_margin * 100 / $total_ht,
'MT');
2032 $subtotalarray[
'val'][
'total_mark_rate'] =
price2num($total_margin * 100 / $total_ht,
'MT');
2034 $totalarray[
'val'][
'total_mark_rate'] =
'';
2035 $subtotalarray[
'val'][
'total_mark_rate'] =
'';
2041 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
2043 $parameters = array(
'arrayfields' => $arrayfields,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
2044 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
2045 print $hookmanager->resPrint;
2048 if (!empty($arrayfields[
'c.datec'][
'checked'])) {
2049 print
'<td align="center" class="nowrap">';
2050 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuser');
2053 $totalarray[
'nbfield']++;
2058 if (!empty($arrayfields[
'c.tms'][
'checked'])) {
2059 print
'<td align="center" class="nowrap">';
2060 print
dol_print_date($db->jdate($obj->date_modification),
'dayhour',
'tzuser');
2063 $totalarray[
'nbfield']++;
2068 if (!empty($arrayfields[
'c.date_cloture'][
'checked'])) {
2069 print
'<td align="center" class="nowrap">';
2070 print
dol_print_date($db->jdate($obj->date_cloture),
'dayhour',
'tzuser');
2073 $totalarray[
'nbfield']++;
2078 if (!empty($arrayfields[
'c.note_public'][
'checked'])) {
2079 print
'<td class="sensiblehtmlcontent center">';
2083 $totalarray[
'nbfield']++;
2088 if (!empty($arrayfields[
'c.note_private'][
'checked'])) {
2089 print
'<td class="center">';
2093 $totalarray[
'nbfield']++;
2098 if (!empty($arrayfields[
'shippable'][
'checked'])) {
2099 print
'<td class="center">';
2100 if (!empty($show_shippable_command) && isModEnabled(
'stock')) {
2102 if (($obj->fk_statut > $generic_commande::STATUS_DRAFT) && ($obj->fk_statut < $generic_commande::STATUS_CLOSED)) {
2103 $generic_commande->loadExpeditions();
2105 if (isset($generic_commande->expeditions[$obj->rowid])) {
2106 $reliquat = $obj->qty - $generic_commande->expeditions[$obj->rowid];
2108 $reliquat = $obj->qty;
2110 if ($obj->product_type == 0 && $obj->fk_product > 0) {
2112 $generic_product->id = $obj->fk_product;
2115 if (empty($productstat_cache[$obj->fk_product])) {
2116 $generic_product->load_stock(
'nobatch');
2117 $productstat_cache[$obj->fk_product][
'stock_reel'] = $generic_product->stock_reel;
2118 $productstat_cachevirtual[$obj->fk_product][
'stock_reel'] = $generic_product->stock_theorique;
2120 $generic_product->stock_reel = $productstat_cache[$obj->fk_product][
'stock_reel'];
2121 $generic_product->stock_theorique = $productstat_cachevirtual[$obj->fk_product][
'stock_reel'];
2124 if ($reliquat > $generic_product->stock_reel) {
2128 $text_info .= $reliquat.
' x '.$obj->product_ref.
' '.
dol_trunc($obj->product_label, 20);
2129 $text_info .=
' - '.$langs->trans(
"Stock").
': <span class="'.($generic_product->stock_reel > 0 ?
'ok' :
'error').
'">'.$generic_product->stock_reel.
'</span>';
2130 $text_info .=
' - '.$langs->trans(
"VirtualStock").
': <span class="'.($generic_product->stock_theorique > 0 ?
'ok' :
'error').
'">'.$generic_product->stock_theorique.
'</span>';
2131 $text_info .= ($reliquat != $obj->qty ?
' <span class="opacitymedium">('.$langs->trans(
"QtyInOtherShipments").
' '.($obj->qty - $reliquat).
')</span>' :
'');
2132 $text_info .=
'<br>';
2139 $stock_order_supplier = 0;
2141 if (isModEnabled(
'order')) {
2142 if (empty($productstat_cache[$obj->fk_product][
'stats_order_customer'])) {
2143 $generic_product->load_stats_commande(0,
'1,2');
2144 $productstat_cache[$obj->fk_product][
'stats_order_customer'] = $generic_product->stats_commande[
'qty'];
2146 $generic_product->stats_commande[
'qty'] = $productstat_cache[$obj->fk_product][
'stats_order_customer'];
2148 $stock_order = $generic_product->stats_commande[
'qty'];
2150 if (isModEnabled(
'supplier_order')) {
2151 if (empty($productstat_cache[$obj->fk_product][
'stats_order_supplier'])) {
2152 $generic_product->load_stats_commande_fournisseur(0,
'3');
2153 $productstat_cache[$obj->fk_product][
'stats_order_supplier'] = $generic_product->stats_commande_fournisseur[
'qty'];
2155 $generic_product->stats_commande_fournisseur[
'qty'] = $productstat_cache[$obj->fk_product][
'stats_order_supplier'];
2157 $stock_order_supplier = $generic_product->stats_commande_fournisseur[
'qty'];
2160 $text_info .= $reliquat.
' x '.$obj->product_ref.
' '.
dol_trunc($obj->product_label, 20);
2161 $text_stock_reel = $generic_product->stock_reel.
'/'.$stock_order;
2162 if ($stock_order > $generic_product->stock_reel && !($generic_product->stock_reel < $obj->qty)) {
2164 $text_warning .=
'<span class="warning">'.$langs->trans(
'Available').
' : '.$text_stock_reel.
'</span>';
2166 if ($reliquat > $generic_product->stock_reel) {
2167 $text_info .=
'<span class="warning">'.$langs->trans(
'Available').
' : '.$text_stock_reel.
'</span>';
2169 $text_info .=
'<span class="ok">'.$langs->trans(
'Available').
' : '.$text_stock_reel.
'</span>';
2171 if (isModEnabled(
'supplier_order')) {
2172 $text_info .=
' '.$langs->trans(
'SupplierOrder').
' : '.$stock_order_supplier;
2174 $text_info .= ($reliquat != $obj->qty ?
' <span class="opacitymedium">('.$langs->trans(
"QtyInOtherShipments").
' '.($obj->qty - $reliquat).
')</span>' :
'');
2175 $text_info .=
'<br>';
2178 if ($notshippable == 0) {
2179 $text_icon =
img_picto(
'',
'dolly',
'', 0, 0, 0,
'',
'green paddingleft');
2180 $text_info = $text_icon.
' '.$langs->trans(
'Shippable').
'<br>'.$text_info;
2182 $text_icon =
img_picto(
'',
'dolly',
'', 0, 0, 0,
'',
'error paddingleft');
2183 $text_info = $text_icon.
' '.$langs->trans(
'NonShippable').
'<br>'.$text_info;
2188 print $form->textwithtooltip(
'', $text_info, 2, 1, $text_icon,
'', 2);
2191 print $form->textwithtooltip(
'', $langs->trans(
'NotEnoughForAllOrders').
'<br>'.$text_warning, 2, 1,
img_picto(
'',
'error'),
'', 2);
2196 $totalarray[
'nbfield']++;
2201 if (!empty($arrayfields[
'c.facture'][
'checked'])) {
2202 print
'<td class="center">';
2204 print
yn($obj->billed, $langs->trans(
"Billed"));
2208 $totalarray[
'nbfield']++;
2212 if (!empty($arrayfields[
'c.import_key'][
'checked'])) {
2213 print
'<td class="nowrap center">'.$obj->import_key.
'</td>';
2215 $totalarray[
'nbfield']++;
2219 if (!empty($arrayfields[
'c.fk_statut'][
'checked'])) {
2220 print
'<td class="nowrap center">'.$generic_commande->LibStatut($obj->fk_statut, $obj->billed, 5, 1).
'</td>';
2222 $totalarray[
'nbfield']++;
2228 print
'<td class="nowrap center">';
2229 if ($massactionbutton || $massaction) {
2231 if (in_array($obj->rowid, $arrayofselected)) {
2234 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
2238 $totalarray[
'nbfield']++;
2244 $total += $obj->total_ht;
2245 $subtotal += $obj->total_ht;
2248 if ($sortfield ==
'pr.ref') {
2249 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_subtotal.tpl.php';
2252 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
2257 foreach ($arrayfields as $key => $val) {
2258 if (!empty($val[
'checked'])) {
2262 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
2267 $parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
2268 $reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters);
2269 print $hookmanager->resPrint;
2271 print
'</table>'.
"\n";
2274 print
'</form>'.
"\n";
2276 $hidegeneratedfilelistifempty = 1;
2277 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
2278 $hidegeneratedfilelistifempty = 0;
2282 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
2283 $urlsource .= str_replace(
'&',
'&', $param);
2285 $filedir = $diroutputmassaction;
2286 $genallowed = $permissiontoread;
2287 $delallowed = $permissiontoadd;
2289 print $formfile->showdocuments(
'massfilesarea_orders',
'', $filedir, $urlsource, 0, $delallowed,
'', 1, 1, 0, 48, 1, $param, $title,
'',
'',
'',
null, $hidegeneratedfilelistifempty);
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
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=null, $outputlangs=null, $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 information (by default a local PHP server timestamp) Rep...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $selectlimitsuffix=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dolGetFirstLineOfText($text, $nboflines=1, $charset='UTF-8')
Return first line of text.
dolPrintHTML($s, $allowiframe=0)
Return a string (that can be on several lines) ready to be output on a HTML page.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
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_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by the value of a given key, which produces ascending (default) or descending out...
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
yn($yesno, $format=1, $color=0)
Return yes or no in current language.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_error($db=null, $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.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0)
Clean a string to use it as a file name.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
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.