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)) OR (c.fk_statut = 3 AND c.facture = 0))";
498 if ($search_status == -3) {
501 $sql .=
' AND ((c.fk_statut IN (1,2)) OR (c.fk_statut = 3 AND c.facture = 0))';
503 if ($search_status == -4) {
504 $sql .=
' AND (c.fk_statut IN (1,2))';
508if ($search_datecloture_start) {
509 $sql .=
" AND c.date_cloture >= '".$db->idate($search_datecloture_start).
"'";
511if ($search_datecloture_end) {
512 $sql .=
" AND c.date_cloture <= '".$db->idate($search_datecloture_end).
"'";
514if ($search_dateorder_start) {
515 $sql .=
" AND c.date_commande >= '".$db->idate($search_dateorder_start).
"'";
517if ($search_dateorder_end) {
518 $sql .=
" AND c.date_commande <= '".$db->idate($search_dateorder_end).
"'";
520if ($search_datedelivery_start) {
521 $sql .=
" AND c.date_livraison >= '".$db->idate($search_datedelivery_start).
"'";
523if ($search_datedelivery_end) {
524 $sql .=
" AND c.date_livraison <= '".$db->idate($search_datedelivery_end).
"'";
535if ($search_country) {
536 $sql .=
" AND s.fk_pays IN (".$db->sanitize($search_country).
')';
538if ($search_type_thirdparty && $search_type_thirdparty !=
'-1') {
539 $sql .=
" AND s.fk_typent IN (".$db->sanitize($search_type_thirdparty).
')';
541if ($search_company) {
544if ($search_company_alias) {
547if ($search_user > 0) {
548 $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);
550if ($search_total_ht !=
'') {
553if ($search_total_vat !=
'') {
556if ($search_total_ttc !=
'') {
559if ($search_warehouse !=
'' && $search_warehouse > 0) {
562if ($search_multicurrency_code !=
'') {
563 $sql .=
" AND c.multicurrency_code = '".$db->escape($search_multicurrency_code).
"'";
565if ($search_multicurrency_tx !=
'') {
566 $sql .=
natural_search(
'c.multicurrency_tx', $search_multicurrency_tx, 1);
568if ($search_multicurrency_montant_ht !=
'') {
569 $sql .=
natural_search(
'c.multicurrency_total_ht', $search_multicurrency_montant_ht, 1);
571if ($search_multicurrency_montant_vat !=
'') {
572 $sql .=
natural_search(
'c.multicurrency_total_tva', $search_multicurrency_montant_vat, 1);
574if ($search_multicurrency_montant_ttc !=
'') {
575 $sql .=
natural_search(
'c.multicurrency_total_ttc', $search_multicurrency_montant_ttc, 1);
578 $sql .=
natural_search(array(
"u.login",
"u.firstname",
"u.lastname"), $search_login);
580if ($search_project_ref !=
'') {
583if ($search_project !=
'') {
586if ($search_categ_cus > 0) {
587 $sql .=
" AND cc.fk_categorie = ".((int) $search_categ_cus);
589if ($search_categ_cus == -2) {
590 $sql .=
" AND cc.fk_categorie IS NULL";
592if ($search_fk_cond_reglement > 0) {
593 $sql .=
" AND c.fk_cond_reglement = ".((int) $search_fk_cond_reglement);
595if ($search_fk_shipping_method > 0) {
596 $sql .=
" AND c.fk_shipping_method = ".((int) $search_fk_shipping_method);
598if ($search_fk_mode_reglement > 0) {
599 $sql .=
" AND c.fk_mode_reglement = ".((int) $search_fk_mode_reglement);
601if ($search_fk_input_reason > 0) {
602 $sql .=
" AND c.fk_input_reason = ".((int) $search_fk_input_reason);
605if ($search_sale && $search_sale !=
'-1') {
606 if ($search_sale == -2) {
607 $sql .=
" AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = c.fk_soc)";
608 } elseif ($search_sale > 0) {
609 $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).
")";
613$searchCategoryProductList = $search_product_category_array;
614if (!empty($searchCategoryProductList)) {
615 $searchCategoryProjectSqlList = array();
616 $listofcategoryid =
'';
617 foreach ($searchCategoryProductList as $searchCategoryProject) {
618 if (intval($searchCategoryProject) == -2) {
619 $searchCategoryProjectSqlList[] =
"NOT EXISTS (SELECT cp.fk_product FROM ".MAIN_DB_PREFIX.
"categorie_product as cp WHERE cdet.fk_product = cp.fk_product)";
620 } elseif (intval($searchCategoryProject) > 0) {
621 if ($searchCategoryProductOperator == 0) {
622 $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).
")";
624 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryProject);
628 if ($listofcategoryid) {
629 $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).
"))";
631 if ($searchCategoryProductOperator == 1) {
632 if (!empty($searchCategoryProjectSqlList)) {
633 $sql .=
" AND (".implode(
' OR ', $searchCategoryProjectSqlList).
")";
636 if (!empty($searchCategoryProjectSqlList)) {
637 $sql .=
" AND (".implode(
' AND ', $searchCategoryProjectSqlList).
")";
643include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
646$parameters = array();
647$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters);
648$sql .= $hookmanager->resPrint;
651$parameters = array();
652$reshook = $hookmanager->executeHooks(
'printFieldListHaving', $parameters, $object);
653$sql .= empty($hookmanager->resPrint) ?
"" :
" HAVING 1=1 ".$hookmanager->resPrint;
655$sql .= $db->order($sortfield, $sortorder);
658$nbtotalofrecords =
'';
660 $result = $db->query($sql);
661 $nbtotalofrecords = $db->num_rows($result);
663 if (($page * $limit) > $nbtotalofrecords) {
669$sql .= $db->plimit($limit + 1, $offset);
672$resql = $db->query($sql);
677 $title = $langs->trans(
'ListOrderLigne').
' - '.$soc->name;
678 if (empty($search_company)) {
679 $search_company = $soc->name;
682 $title = $langs->trans(
'ListOrderLigne');
684 if (strval($search_status) ==
'0') {
685 $title .=
' - '.$langs->trans(
'StatusOrderDraftShort');
687 if ($search_status == 1) {
688 $title .=
' - '.$langs->trans(
'StatusOrderValidatedShort');
690 if ($search_status == 2) {
691 $title .=
' - '.$langs->trans(
'StatusOrderSentShort');
693 if ($search_status == 3) {
694 $title .=
' - '.$langs->trans(
'StatusOrderToBillShort');
696 if ($search_status == -1) {
697 $title .=
' - '.$langs->trans(
'StatusOrderCanceledShort');
699 if ($search_status == -2) {
700 $title .=
' - '.$langs->trans(
'StatusOrderToProcessShort');
702 if ($search_status == -3) {
703 $title .=
' - '.$langs->trans(
'StatusOrderValidated').
', '.(!isModEnabled(
'shipping') ?
'' : $langs->trans(
"StatusOrderSent").
', ').$langs->trans(
'StatusOrderToBill');
705 if ($search_status == -4) {
706 $title .=
' - '.$langs->trans(
"StatusOrderValidatedShort").
'+'.$langs->trans(
"StatusOrderSentShort");
709 $num = $db->num_rows($resql);
711 $arrayofselected = is_array($toselect) ? $toselect : array();
713 if ($num == 1 &&
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all) {
714 $obj = $db->fetch_object($resql);
716 header(
"Location: ".DOL_URL_ROOT.
'/commande/card.php?id='.$id);
720 llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-commande page-list_det');
724 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
725 $param .=
'&contextpage='.urlencode($contextpage);
727 if ($limit > 0 && $limit !=
$conf->liste_limit) {
728 $param .=
'&limit='.((int) $limit);
731 $param .=
'&search_all='.urlencode($search_all);
734 $param .=
'&socid='.urlencode((
string) ($socid));
737 $param .=
'&search_id='.urlencode($search_id);
740 if ($search_refProduct) {
741 $param .=
'&search_refProduct='.urlencode($search_refProduct);
743 if ($search_descProduct) {
744 $param .=
'&search_descProduct='.urlencode($search_descProduct);
746 if ($search_status !=
'') {
747 $param .=
'&search_status='.urlencode($search_status);
749 if ($search_datecloture_start) {
750 $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');
752 if ($search_datecloture_end) {
753 $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');
755 if ($search_dateorder_start) {
756 $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');
758 if ($search_dateorder_end) {
759 $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');
761 if ($search_datedelivery_start) {
762 $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');
764 if ($search_datedelivery_end) {
765 $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');
768 $param .=
'&search_ref='.urlencode($search_ref);
770 if ($search_company) {
771 $param .=
'&search_company='.urlencode($search_company);
773 if ($search_company_alias) {
774 $param .=
'&search_company_alias='.urlencode($search_company_alias);
776 if ($search_ref_customer) {
777 $param .=
'&search_ref_customer='.urlencode($search_ref_customer);
779 if ($search_user > 0) {
780 $param .=
'&search_user='.urlencode((
string) ($search_user));
782 if ($search_sale > 0) {
783 $param .=
'&search_sale='.urlencode($search_sale);
785 if ($search_total_ht !=
'') {
786 $param .=
'&search_total_ht='.urlencode($search_total_ht);
788 if ($search_total_vat !=
'') {
789 $param .=
'&search_total_vat='.urlencode($search_total_vat);
791 if ($search_total_ttc !=
'') {
792 $param .=
'&search_total_ttc='.urlencode($search_total_ttc);
794 if ($search_warehouse !=
'') {
795 $param .=
'&search_warehouse='.urlencode((
string) ($search_warehouse));
798 $param .=
'&search_login='.urlencode($search_login);
800 if ($search_multicurrency_code !=
'') {
801 $param .=
'&search_multicurrency_code='.urlencode($search_multicurrency_code);
803 if ($search_multicurrency_tx !=
'') {
804 $param .=
'&search_multicurrency_tx='.urlencode($search_multicurrency_tx);
806 if ($search_multicurrency_montant_ht !=
'') {
807 $param .=
'&search_multicurrency_montant_ht='.urlencode($search_multicurrency_montant_ht);
809 if ($search_multicurrency_montant_vat !=
'') {
810 $param .=
'&search_multicurrency_montant_vat='.urlencode($search_multicurrency_montant_vat);
812 if ($search_multicurrency_montant_ttc !=
'') {
813 $param .=
'&search_multicurrency_montant_ttc='.urlencode($search_multicurrency_montant_ttc);
815 if ($search_project_ref >= 0) {
816 $param .=
"&search_project_ref=".urlencode($search_project_ref);
818 if ($search_town !=
'') {
819 $param .=
'&search_town='.urlencode($search_town);
821 if ($search_zip !=
'') {
822 $param .=
'&search_zip='.urlencode($search_zip);
824 if ($search_state !=
'') {
825 $param .=
'&search_state='.urlencode($search_state);
827 if ($search_country !=
'') {
828 $param .=
'&search_country='.urlencode((
string) ($search_country));
830 if ($search_type_thirdparty && $search_type_thirdparty !=
'-1') {
831 $param .=
'&search_type_thirdparty='.urlencode((
string) ($search_type_thirdparty));
833 if (!empty($search_product_category_array)) {
834 foreach ($search_product_category_array as $tmpval) {
835 $param .=
'&search_categegory_product_list[]='.urlencode($tmpval);
838 if (($search_categ_cus > 0) || ($search_categ_cus == -2)) {
839 $param .=
'&search_categ_cus='.urlencode((
string) ($search_categ_cus));
842 $param .=
'&show_files='.urlencode((
string) ($show_files));
844 if ($optioncss !=
'') {
845 $param .=
'&optioncss='.urlencode($optioncss);
847 if ($search_billed !=
'') {
848 $param .=
'&search_billed='.urlencode($search_billed);
850 if ($search_fk_cond_reglement > 0) {
851 $param .=
'&search_fk_cond_reglement='.urlencode((
string) ($search_fk_cond_reglement));
853 if ($search_fk_shipping_method > 0) {
854 $param .=
'&search_fk_shipping_method='.urlencode((
string) ($search_fk_shipping_method));
856 if ($search_fk_mode_reglement > 0) {
857 $param .=
'&search_fk_mode_reglement='.urlencode((
string) ($search_fk_mode_reglement));
859 if ($search_fk_input_reason > 0) {
860 $param .=
'&search_fk_input_reason='.urlencode((
string) ($search_fk_input_reason));
862 if (!empty($productobuy)) {
863 $param .=
'&productobuy='.urlencode($productobuy);
865 if (!empty($productonly)) {
866 $param .=
'&productonly='.urlencode($productonly);
868 if (!empty($disablelinefree)) {
869 $param .=
'&disablelinefree='.urlencode($disablelinefree);
873 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
876 $parameters = array(
'param' => &$param);
877 $reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object);
878 $param .= $hookmanager->resPrint;
881 $arrayofmassactions = array(
888 $massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
890 $url = DOL_URL_ROOT.
'/commande/card.php?action=create';
891 if (!empty($socid)) {
892 $url .=
'&socid='.$socid;
897 print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">';
898 if ($optioncss !=
'') {
899 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
901 print
'<input type="hidden" name="token" value="'.newToken().
'">';
902 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
903 print
'<input type="hidden" name="action" value="list">';
904 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
905 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
906 print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
907 print
'<input type="hidden" name="search_status" value="'.$search_status.
'">';
908 print
'<input type="hidden" name="socid" value="'.$socid.
'">';
910 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'order', 0, $newcardbutton,
'', $limit, 0, 0, 1);
912 $topicmail =
"SendOrderRef";
913 $modelmail =
"order_send";
915 $trackid =
'ord'.$object->id;
916 include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
919 foreach ($fieldstosearchall as $key => $val) {
920 $fieldstosearchall[$key] = $langs->trans($val);
922 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>';
927 $moreforfilter .=
'<div class="divsearchfield">';
928 $moreforfilter .=
'<input type="checkbox" id="productobuy" name="productobuy"'.(!empty($productobuy) ?
'value="productobuychecked" checked' :
'').
'><label for="productobuy">'.$langs->trans(
"productobuy").
'</label>';
929 $moreforfilter .=
'</div>';
930 $moreforfilter .=
'<div class="divsearchfield">';
931 $moreforfilter .=
'<input type="checkbox" id="productonly" name="productonly"'.(!empty($productonly) ?
'value="productonlychecked" checked' :
'').
'><label for="productonly">'.$langs->trans(
"productonly").
'</label>';
932 $moreforfilter .=
'</div>';
933 $moreforfilter .=
'<div class="divsearchfield">';
934 $moreforfilter .=
'<input type="checkbox" id="disablelinefree" name="disablelinefree"'.(!empty($disablelinefree) ?
'value="disablelinefreechecked" checked' :
'').
'><label for="disablelinefree">'.$langs->trans(
"disablelinefree").
'</label>';
935 $moreforfilter .=
'</div><br>';
938 if ($user->hasRight(
'user',
'user',
'lire')) {
939 $langs->load(
"commercial");
940 $moreforfilter .=
'<div class="divsearchfield">';
941 $tmptitle = $langs->trans(
'ThirdPartiesOfSaleRepresentative');
942 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale,
'search_sale', $user, 0, $tmptitle,
'maxwidth250 widthcentpercentminusx');
943 $moreforfilter .=
'</div>';
946 if ($user->hasRight(
'user',
'user',
'lire')) {
947 $moreforfilter .=
'<div class="divsearchfield">';
948 $tmptitle = $langs->trans(
'LinkedToSpecificUsers');
949 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$form->select_dolusers($search_user,
'search_user', $tmptitle,
'', 0,
'',
'', 0, 0, 0,
'', 0,
'',
'maxwidth250 widthcentpercentminusx');
950 $moreforfilter .=
'</div>';
953 if (isModEnabled(
"category") && $user->hasRight(
'categorie',
'lire') && ($user->hasRight(
'produit',
'lire') || $user->hasRight(
'service',
'lire'))) {
955 $moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_PRODUCT, $search_product_category_array,
'minwidth300imp minwidth300', $searchCategoryProductOperator ? $searchCategoryProductOperator : 0);
957 if (isModEnabled(
"category") && $user->hasRight(
'categorie',
'lire')) {
958 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
959 $moreforfilter .=
'<div class="divsearchfield">';
960 $tmptitle = $langs->trans(
'CustomersProspectsCategoriesShort');
961 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"').$formother->select_categories(
'customer', $search_categ_cus,
'search_categ_cus', 1, $tmptitle,
'maxwidth300 widthcentpercentminusx');
962 $moreforfilter .=
'</div>';
964 if (isModEnabled(
'stock') &&
getDolGlobalString(
'WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER')) {
965 require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
967 $moreforfilter .=
'<div class="divsearchfield">';
968 $tmptitle = $langs->trans(
'Warehouse');
969 $moreforfilter .=
img_picto($tmptitle,
'stock',
'class="pictofixedwidth"').$formproduct->selectWarehouses($search_warehouse,
'search_warehouse',
'', 1, 0, 0, $tmptitle, 0, 0, array(),
'maxwidth250 widthcentpercentminusx');
970 $moreforfilter .=
'</div>';
974 $parameters = array();
975 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
976 if (empty($reshook)) {
977 $moreforfilter .= $hookmanager->resPrint;
979 $moreforfilter = $hookmanager->resPrint;
982 if (!empty($moreforfilter)) {
983 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
984 print $moreforfilter;
988 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
989 $selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
990 $selectedfields .= $form->showCheckAddButtons(
'checkforselect', 1);
993 $selectedfields .=
'<script>';
994 $selectedfields .=
' $(document).ready(function() {';
995 $selectedfields .=
' console.log("Autoclick on checkforselects");';
996 $selectedfields .=
' $("#checkforselects").click();';
997 $selectedfields .=
' $("#massaction").val("createbills").change();';
998 $selectedfields .=
' });';
999 $selectedfields .=
'</script>';
1002 print
'<div class="div-table-responsive">';
1003 print
'<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
1005 print
'<tr class="liste_titre_filter">';
1009 print
'<td class="liste_titre" align="middle">';
1010 $searchpicto = $form->showFilterButtons(
'left');
1015 if (!empty($arrayfields[
'rowid'][
'checked'])) {
1016 print
'<td class="liste_titre" data-key="id">';
1017 print
'<input class="flat searchstring" type="text" name="search_id" size="1" value="'.dol_escape_htmltag($search_id).
'">';
1021 if (!empty($arrayfields[
'pr.ref'][
'checked'])) {
1022 print
'<td class="liste_titre">';
1023 print
'<input class="flat" size="6" type="text" name="search_refProduct" value="'.dol_escape_htmltag($search_refProduct).
'">';
1027 if (!empty($arrayfields[
'pr.desc'][
'checked'])) {
1028 print
'<td class="liste_titre">';
1029 print
'<input class="flat" size="6" type="text" name="search_descProduct" value="'.dol_escape_htmltag($search_descProduct).
'">';
1033 if (!empty($arrayfields[
'cdet.qty'][
'checked'])) {
1034 print
'<td class="liste_titre"></td>';
1038 if (!empty($arrayfields[
'c.ref'][
'checked'])) {
1039 print
'<td class="liste_titre">';
1040 print
'<input class="flat" size="6" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
1044 if (!empty($arrayfields[
'c.ref_client'][
'checked'])) {
1045 print
'<td class="liste_titre" align="left">';
1046 print
'<input class="flat" type="text" size="6" name="search_ref_customer" value="'.dol_escape_htmltag($search_ref_customer).
'">';
1050 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1051 print
'<td class="liste_titre"><input type="text" class="flat" size="6" name="search_project_ref" value="'.dol_escape_htmltag($search_project_ref).
'"></td>';
1054 if (!empty($arrayfields[
'p.title'][
'checked'])) {
1055 print
'<td class="liste_titre"><input type="text" class="flat" size="6" name="search_project" value="'.dol_escape_htmltag($search_project).
'"></td>';
1058 if (!empty($arrayfields[
's.nom'][
'checked'])) {
1059 print
'<td class="liste_titre" align="left">';
1060 print
'<input class="flat maxwidth100" type="text" name="search_company" value="'.dol_escape_htmltag($search_company).
'">';
1064 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1065 print
'<td class="liste_titre" align="left">';
1066 print
'<input class="flat maxwidth100" type="text" name="search_company_alias" value="'.dol_escape_htmltag($search_company_alias).
'">';
1070 if (!empty($arrayfields[
's.town'][
'checked'])) {
1071 print
'<td class="liste_titre"><input class="flat" type="text" size="4" name="search_town" value="'.dol_escape_htmltag($search_town).
'"></td>';
1074 if (!empty($arrayfields[
's.zip'][
'checked'])) {
1075 print
'<td class="liste_titre"><input class="flat" type="text" size="4" name="search_zip" value="'.dol_escape_htmltag($search_zip).
'"></td>';
1078 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1079 print
'<td class="liste_titre">';
1080 print
'<input class="flat" size="4" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).
'">';
1084 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1085 print
'<td class="liste_titre" align="center">';
1086 print $form->select_country($search_country,
'search_country',
'', 0,
'minwidth100imp maxwidth100');
1090 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1091 print
'<td class="liste_titre maxwidthonsmartphone" align="center">';
1092 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);
1096 if (!empty($arrayfields[
'c.date_commande'][
'checked'])) {
1097 print
'<td class="liste_titre center">';
1098 print
'<div class="nowrapfordate">';
1099 print $form->selectDate($search_dateorder_start ? $search_dateorder_start : -1,
'search_dateorder_start_', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1101 print
'<div class="nowrapfordate">';
1102 print $form->selectDate($search_dateorder_end ? $search_dateorder_end : -1,
'search_dateorder_end_', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1106 if (!empty($arrayfields[
'c.date_delivery'][
'checked'])) {
1107 print
'<td class="liste_titre center">';
1108 print
'<div class="nowrapfordate">';
1109 print $form->selectDate($search_datedelivery_start ? $search_datedelivery_start : -1,
'search_datedelivery_start_', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1111 print
'<div class="nowrapfordate">';
1112 print $form->selectDate($search_datedelivery_end ? $search_datedelivery_end : -1,
'search_datedelivery_end_', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1117 if (!empty($arrayfields[
'c.fk_shipping_method'][
'checked'])) {
1118 print
'<td class="liste_titre">';
1119 $form->selectShippingMethod($search_fk_shipping_method,
'search_fk_shipping_method',
'', 1,
'', 1);
1123 if (!empty($arrayfields[
'c.fk_cond_reglement'][
'checked'])) {
1124 print
'<td class="liste_titre">';
1125 print $form->getSelectConditionsPaiements($search_fk_cond_reglement,
'search_fk_cond_reglement', 1, 1, 1);
1129 if (!empty($arrayfields[
'c.fk_mode_reglement'][
'checked'])) {
1130 print
'<td class="liste_titre">';
1131 $form->select_types_paiements($search_fk_mode_reglement,
'search_fk_mode_reglement',
'', 0, 1, 1, 0, -1);
1135 if (!empty($arrayfields[
'c.fk_input_reason'][
'checked'])) {
1136 print
'<td class="liste_titre">';
1137 $form->selectInputReason($search_fk_input_reason,
'search_fk_input_reason',
'', 1,
'', 1);
1140 if (!empty($arrayfields[
'cdet.total_ht'][
'checked'])) {
1142 print
'<td class="liste_titre right">';
1143 print
'<input class="flat" type="text" size="4" name="search_total_ht" value="'.dol_escape_htmltag($search_total_ht).
'">';
1146 if (!empty($arrayfields[
'c.total_vat'][
'checked'])) {
1148 print
'<td class="liste_titre right">';
1149 print
'<input class="flat" type="text" size="4" name="search_total_vat" value="'.dol_escape_htmltag($search_total_vat).
'">';
1152 if (!empty($arrayfields[
'cdet.total_ttc'][
'checked'])) {
1154 print
'<td class="liste_titre right">';
1155 print
'<input class="flat" type="text" size="5" name="search_total_ttc" value="'.$search_total_ttc.
'">';
1158 if (!empty($arrayfields[
'c.fk_warehouse'][
'checked'])) {
1160 print
'<td class="liste_titre right"></td>';
1162 if (!empty($arrayfields[
'c.multicurrency_code'][
'checked'])) {
1164 print
'<td class="liste_titre">';
1165 print $form->selectMultiCurrency($search_multicurrency_code,
'search_multicurrency_code', 1);
1168 if (!empty($arrayfields[
'c.multicurrency_tx'][
'checked'])) {
1170 print
'<td class="liste_titre">';
1171 print
'<input class="flat" type="text" size="4" name="search_multicurrency_tx" value="'.dol_escape_htmltag($search_multicurrency_tx).
'">';
1174 if (!empty($arrayfields[
'c.multicurrency_total_ht'][
'checked'])) {
1176 print
'<td class="liste_titre right">';
1177 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ht" value="'.dol_escape_htmltag($search_multicurrency_montant_ht).
'">';
1180 if (!empty($arrayfields[
'c.multicurrency_total_vat'][
'checked'])) {
1182 print
'<td class="liste_titre right">';
1183 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_vat" value="'.dol_escape_htmltag($search_multicurrency_montant_vat).
'">';
1186 if (!empty($arrayfields[
'c.multicurrency_total_ttc'][
'checked'])) {
1188 print
'<td class="liste_titre right">';
1189 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ttc" value="'.dol_escape_htmltag($search_multicurrency_montant_ttc).
'">';
1192 if (!empty($arrayfields[
'u.login'][
'checked'])) {
1194 print
'<td class="liste_titre" align="center">';
1195 print
'<input class="flat" size="4" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).
'">';
1198 if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
1199 print
'<td class="liste_titre"></td>';
1201 if (!empty($arrayfields[
'total_pa'][
'checked'])) {
1202 print
'<td class="liste_titre right">';
1205 if (!empty($arrayfields[
'total_margin'][
'checked'])) {
1206 print
'<td class="liste_titre right">';
1209 if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
1210 print
'<td class="liste_titre right">';
1213 if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
1214 print
'<td class="liste_titre right">';
1218 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
1220 $parameters = array(
'arrayfields' => $arrayfields);
1221 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters);
1222 print $hookmanager->resPrint;
1224 if (!empty($arrayfields[
'c.datec'][
'checked'])) {
1225 print
'<td class="liste_titre">';
1229 if (!empty($arrayfields[
'c.tms'][
'checked'])) {
1230 print
'<td class="liste_titre">';
1234 if (!empty($arrayfields[
'c.date_cloture'][
'checked'])) {
1235 print
'<td class="liste_titre center">';
1236 print
'<div class="nowrapfordate">';
1237 print $form->selectDate($search_datecloture_start ? $search_datecloture_start : -1,
'search_datecloture_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1239 print
'<div class="nowrapfordate">';
1240 print $form->selectDate($search_datecloture_end ? $search_datecloture_end : -1,
'search_datecloture_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1245 if (!empty($arrayfields[
'c.note_public'][
'checked'])) {
1246 print
'<td class="liste_titre">';
1250 if (!empty($arrayfields[
'c.note_private'][
'checked'])) {
1251 print
'<td class="liste_titre">';
1255 if (!empty($arrayfields[
'shippable'][
'checked'])) {
1256 print
'<td class="liste_titre maxwidthonsmartphone" align="center">';
1259 print
'<input type="checkbox" name="show_shippable_command" value="1"'.($show_shippable_command ?
' checked' :
'').
'>';
1260 print $langs->trans(
'ShowShippableStatus');
1262 $show_shippable_command = 1;
1267 if (!empty($arrayfields[
'c.facture'][
'checked'])) {
1268 print
'<td class="liste_titre maxwidthonsmartphone" align="center">';
1269 print $form->selectyesno(
'search_billed', $search_billed, 1, 0, 1, 1);
1273 if (!empty($arrayfields[
'c.import_key'][
'checked'])) {
1274 print
'<td class="liste_titre maxwidthonsmartphone" align="center">';
1278 if (!empty($arrayfields[
'c.fk_statut'][
'checked'])) {
1279 print
'<td class="liste_titre maxwidthonsmartphone center">';
1280 $liststatus = array(
1284 -2 => $langs->trans(
"StatusOrderValidatedShort").
'+'.$langs->trans(
"StatusOrderSentShort"),
1285 -3 => $langs->trans(
"StatusOrderValidatedShort").
'+'.$langs->trans(
"StatusOrderSentShort").
'+'.$langs->trans(
"StatusOrderDelivered"),
1290 print $form->selectarray(
'search_status', $liststatus, $search_status, -5, 0, 0,
'', 0, 0, 0,
'',
'maxwidth125', 1);
1295 print
'<td class="liste_titre" align="middle">';
1296 $searchpicto = $form->showFilterButtons();
1303 print
'<tr class="liste_titre">';
1306 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'', $param,
'', $sortfield, $sortorder,
'maxwidthsearch center ');
1310 if (!empty($arrayfields[
'rowid'][
'checked'])) {
1312 print_liste_field_titre($arrayfields[
'rowid'][
'label'], $_SERVER[
"PHP_SELF"],
'rowid',
'', $param,
'', $sortfield, $sortorder);
1313 '@phan-var-force array<string,array{label:string,checked?:int<0,1>,position?:int,help?:string}> $arrayfields';
1315 if (!empty($arrayfields[
'pr.ref'][
'checked'])) {
1316 print_liste_field_titre($arrayfields[
'pr.ref'][
'label'], $_SERVER[
"PHP_SELF"],
'pr.ref',
'', $param,
'', $sortfield, $sortorder);
1318 if (!empty($arrayfields[
'pr.desc'][
'checked'])) {
1319 print_liste_field_titre($arrayfields[
'pr.desc'][
'label'], $_SERVER[
"PHP_SELF"],
'pr.desc',
'', $param,
'', $sortfield, $sortorder);
1321 if (!empty($arrayfields[
'cdet.qty'][
'checked'])) {
1322 print_liste_field_titre($arrayfields[
'cdet.qty'][
'label'], $_SERVER[
"PHP_SELF"],
'cdet.qty',
'', $param,
'', $sortfield, $sortorder);
1325 if (!empty($arrayfields[
'c.ref'][
'checked'])) {
1326 print_liste_field_titre($arrayfields[
'c.ref'][
'label'], $_SERVER[
"PHP_SELF"],
'c.ref',
'', $param,
'', $sortfield, $sortorder);
1328 if (!empty($arrayfields[
'c.ref_client'][
'checked'])) {
1329 print_liste_field_titre($arrayfields[
'c.ref_client'][
'label'], $_SERVER[
"PHP_SELF"],
'c.ref_client',
'', $param,
'', $sortfield, $sortorder);
1331 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1332 print_liste_field_titre($arrayfields[
'p.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"p.ref",
"", $param,
'', $sortfield, $sortorder);
1334 if (!empty($arrayfields[
'p.title'][
'checked'])) {
1335 print_liste_field_titre($arrayfields[
'p.title'][
'label'], $_SERVER[
"PHP_SELF"],
"p.title",
"", $param,
'', $sortfield, $sortorder);
1337 if (!empty($arrayfields[
's.nom'][
'checked'])) {
1338 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
"PHP_SELF"],
's.nom',
'', $param,
'', $sortfield, $sortorder);
1340 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1341 print_liste_field_titre($arrayfields[
's.name_alias'][
'label'], $_SERVER[
"PHP_SELF"],
's.name_alias',
'', $param,
'', $sortfield, $sortorder);
1343 if (!empty($arrayfields[
's.town'][
'checked'])) {
1344 print_liste_field_titre($arrayfields[
's.town'][
'label'], $_SERVER[
"PHP_SELF"],
's.town',
'', $param,
'', $sortfield, $sortorder);
1346 if (!empty($arrayfields[
's.zip'][
'checked'])) {
1347 print_liste_field_titre($arrayfields[
's.zip'][
'label'], $_SERVER[
"PHP_SELF"],
's.zip',
'', $param,
'', $sortfield, $sortorder);
1349 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1350 print_liste_field_titre($arrayfields[
'state.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"state.nom",
"", $param,
'', $sortfield, $sortorder);
1352 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1353 print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'], $_SERVER[
"PHP_SELF"],
"country.code_iso",
"", $param,
'', $sortfield, $sortorder,
'center ');
1355 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1356 print_liste_field_titre($arrayfields[
'typent.code'][
'label'], $_SERVER[
"PHP_SELF"],
"typent.code",
"", $param,
'', $sortfield, $sortorder,
'center ');
1358 if (!empty($arrayfields[
'c.date_commande'][
'checked'])) {
1359 print_liste_field_titre($arrayfields[
'c.date_commande'][
'label'], $_SERVER[
"PHP_SELF"],
'c.date_commande',
'', $param,
'', $sortfield, $sortorder,
'center ');
1361 if (!empty($arrayfields[
'c.date_delivery'][
'checked'])) {
1362 print_liste_field_titre($arrayfields[
'c.date_delivery'][
'label'], $_SERVER[
"PHP_SELF"],
'c.date_livraison',
'', $param,
'', $sortfield, $sortorder,
'center ');
1364 if (!empty($arrayfields[
'c.fk_shipping_method'][
'checked'])) {
1365 print_liste_field_titre($arrayfields[
'c.fk_shipping_method'][
'label'], $_SERVER[
"PHP_SELF"],
"c.fk_shipping_method",
"", $param,
'', $sortfield, $sortorder);
1367 if (!empty($arrayfields[
'c.fk_cond_reglement'][
'checked'])) {
1368 print_liste_field_titre($arrayfields[
'c.fk_cond_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"c.fk_cond_reglement",
"", $param,
'', $sortfield, $sortorder);
1370 if (!empty($arrayfields[
'c.fk_mode_reglement'][
'checked'])) {
1371 print_liste_field_titre($arrayfields[
'c.fk_mode_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"c.fk_mode_reglement",
"", $param,
'', $sortfield, $sortorder);
1373 if (!empty($arrayfields[
'c.fk_input_reason'][
'checked'])) {
1374 print_liste_field_titre($arrayfields[
'c.fk_input_reason'][
'label'], $_SERVER[
"PHP_SELF"],
"c.fk_input_reason",
"", $param,
'', $sortfield, $sortorder);
1376 if (!empty($arrayfields[
'cdet.total_ht'][
'checked'])) {
1377 print_liste_field_titre($arrayfields[
'cdet.total_ht'][
'label'], $_SERVER[
"PHP_SELF"],
'cdet.total_ht',
'', $param,
'', $sortfield, $sortorder,
'right ');
1379 if (!empty($arrayfields[
'c.total_vat'][
'checked'])) {
1380 print_liste_field_titre($arrayfields[
'c.total_vat'][
'label'], $_SERVER[
"PHP_SELF"],
'cdet.total_tva',
'', $param,
'', $sortfield, $sortorder,
'right ');
1382 if (!empty($arrayfields[
'cdet.total_ttc'][
'checked'])) {
1383 print_liste_field_titre($arrayfields[
'cdet.total_ttc'][
'label'], $_SERVER[
"PHP_SELF"],
'cdet.total_ttc',
'', $param,
'', $sortfield, $sortorder,
'right ');
1385 if (!empty($arrayfields[
'c.fk_warehouse'][
'checked'])) {
1386 print_liste_field_titre($arrayfields[
'c.fk_warehouse'][
'label'],
"",
'',
'', $param,
'', $sortfield, $sortorder);
1388 if (!empty($arrayfields[
'c.multicurrency_code'][
'checked'])) {
1389 print_liste_field_titre($arrayfields[
'c.multicurrency_code'][
'label'], $_SERVER[
'PHP_SELF'],
'c.multicurrency_code',
'', $param,
'', $sortfield, $sortorder);
1391 if (!empty($arrayfields[
'c.multicurrency_tx'][
'checked'])) {
1392 print_liste_field_titre($arrayfields[
'c.multicurrency_tx'][
'label'], $_SERVER[
'PHP_SELF'],
'c.multicurrency_tx',
'', $param,
'', $sortfield, $sortorder);
1394 if (!empty($arrayfields[
'c.multicurrency_total_ht'][
'checked'])) {
1395 print_liste_field_titre($arrayfields[
'c.multicurrency_total_ht'][
'label'], $_SERVER[
'PHP_SELF'],
'c.multicurrency_total_ht',
'', $param,
'class="right"', $sortfield, $sortorder);
1397 if (!empty($arrayfields[
'c.multicurrency_total_vat'][
'checked'])) {
1398 print_liste_field_titre($arrayfields[
'c.multicurrency_total_vat'][
'label'], $_SERVER[
'PHP_SELF'],
'c.multicurrency_total_tva',
'', $param,
'class="right"', $sortfield, $sortorder);
1400 if (!empty($arrayfields[
'c.multicurrency_total_ttc'][
'checked'])) {
1401 print_liste_field_titre($arrayfields[
'c.multicurrency_total_ttc'][
'label'], $_SERVER[
'PHP_SELF'],
'c.multicurrency_total_ttc',
'', $param,
'class="right"', $sortfield, $sortorder);
1403 if (!empty($arrayfields[
'u.login'][
'checked'])) {
1404 print_liste_field_titre($arrayfields[
'u.login'][
'label'], $_SERVER[
"PHP_SELF"],
'u.login',
'', $param,
'align="center"', $sortfield, $sortorder);
1406 if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
1407 print_liste_field_titre($arrayfields[
'sale_representative'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"",
"$param",
'', $sortfield, $sortorder);
1409 if (!empty($arrayfields[
'total_pa'][
'checked'])) {
1410 print_liste_field_titre($arrayfields[
'total_pa'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1412 if (!empty($arrayfields[
'total_margin'][
'checked'])) {
1413 print_liste_field_titre($arrayfields[
'total_margin'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1415 if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
1416 print_liste_field_titre($arrayfields[
'total_margin_rate'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1418 if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
1419 print_liste_field_titre($arrayfields[
'total_mark_rate'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1422 $totalarray = array(
1425 'cdet.total_ht' => 0,
1426 'cdet.total_tva' => 0,
1427 'cdet.total_ttc' => 0,
1432 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1434 $parameters = array(
1435 'arrayfields' => $arrayfields,
1437 'sortfield' => $sortfield,
1438 'sortorder' => $sortorder,
1439 'totalarray' => &$totalarray,
1441 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters);
1442 print $hookmanager->resPrint;
1443 if (!empty($arrayfields[
'c.datec'][
'checked'])) {
1444 print_liste_field_titre($arrayfields[
'c.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"c.date_creation",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1446 if (!empty($arrayfields[
'c.tms'][
'checked'])) {
1447 print_liste_field_titre($arrayfields[
'c.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"c.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1449 if (!empty($arrayfields[
'c.date_cloture'][
'checked'])) {
1450 print_liste_field_titre($arrayfields[
'c.date_cloture'][
'label'], $_SERVER[
"PHP_SELF"],
"c.date_cloture",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1452 if (!empty($arrayfields[
'c.note_public'][
'checked'])) {
1453 print_liste_field_titre($arrayfields[
'c.note_public'][
'label'], $_SERVER[
"PHP_SELF"],
"c.note_public",
"", $param,
'', $sortfield, $sortorder,
'right ');
1455 if (!empty($arrayfields[
'c.note_private'][
'checked'])) {
1456 print_liste_field_titre($arrayfields[
'c.note_private'][
'label'], $_SERVER[
"PHP_SELF"],
"c.note_private",
"", $param,
'', $sortfield, $sortorder,
'right ');
1458 if (!empty($arrayfields[
'shippable'][
'checked'])) {
1459 print_liste_field_titre($arrayfields[
'shippable'][
'label'], $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'center ');
1461 if (!empty($arrayfields[
'c.facture'][
'checked'])) {
1462 print_liste_field_titre($arrayfields[
'c.facture'][
'label'], $_SERVER[
"PHP_SELF"],
'c.facture',
'', $param,
'', $sortfield, $sortorder,
'center ');
1464 if (!empty($arrayfields[
'c.import_key'][
'checked'])) {
1465 print_liste_field_titre($arrayfields[
'c.import_key'][
'label'], $_SERVER[
"PHP_SELF"],
"c.import_key",
"", $param,
'', $sortfield, $sortorder,
'center ');
1467 if (!empty($arrayfields[
'c.fk_statut'][
'checked'])) {
1468 print_liste_field_titre($arrayfields[
'c.fk_statut'][
'label'], $_SERVER[
"PHP_SELF"],
"c.fk_statut",
"", $param,
'', $sortfield, $sortorder,
'center ');
1471 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'', $param,
'', $sortfield, $sortorder,
'maxwidthsearch center ');
1477 $productstat_cache = array();
1478 '@phan-var-force array<int,array{stats_order_customer?:float|int,stats_order_supplier?:float|int}> $product_sdtat_cache';
1479 $productstat_cachevirtual = array();
1480 $getNomUrl_cache = array();
1482 $generic_commande =
new Commande($db);
1483 $generic_product =
new Product($db);
1484 $userstatic =
new User($db);
1487 $with_margin_info =
false;
1488 if (isModEnabled(
'margin') && (
1489 !empty($arrayfields[
'total_pa'][
'checked'])
1490 || !empty($arrayfields[
'total_margin'][
'checked'])
1491 || !empty($arrayfields[
'total_margin_rate'][
'checked'])
1492 || !empty($arrayfields[
'total_mark_rate'][
'checked'])
1495 $with_margin_info =
true;
1505 $totalarray = array();
1506 $totalarray[
'nbfield'] = 0;
1507 $subtotalarray = array();
1508 $subtotalarray[
'nbfield'] = 0;
1509 $totalarray[
'val'][
'cdet.total_tva'] = 0;
1510 $totalarray[
'val'][
'cdet.total_ttc'] = 0;
1511 $imaxinloop = ($limit ? min($num, $limit) : $num);
1512 while ($i < $imaxinloop) {
1513 $obj = $db->fetch_object($resql);
1523 $oldref = $obj->product_ref;
1525 if ($oldref != $obj->product_ref && $sortfield ==
'pr.ref') {
1526 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_subtotal.tpl.php';
1527 $oldref = $obj->product_ref;
1530 $companystatic->id = $obj->socid;
1531 $companystatic->name = $obj->name;
1532 $companystatic->name_alias = $obj->alias;
1533 $companystatic->client = $obj->client;
1534 $companystatic->code_client = $obj->code_client;
1535 $companystatic->email = $obj->email;
1536 $companystatic->phone = $obj->phone;
1537 $companystatic->address = $obj->address;
1538 $companystatic->zip = $obj->zip;
1539 $companystatic->town = $obj->town;
1540 $companystatic->country_code = $obj->country_code;
1541 if (!isset($getNomUrl_cache[$obj->socid])) {
1542 $getNomUrl_cache[$obj->socid] = $companystatic->getNomUrl(1,
'customer');
1545 $generic_commande->id = $obj->c_rowid;
1546 $generic_commande->ref = $obj->ref;
1547 $generic_commande->statut = $obj->fk_statut;
1548 $generic_commande->billed = $obj->billed;
1549 $generic_commande->date = $db->jdate($obj->date_commande);
1550 $generic_commande->delivery_date = $db->jdate($obj->date_delivery);
1551 $generic_commande->ref_client = $obj->ref_client;
1552 $generic_commande->total_ht = $obj->c_total_ht;
1553 $generic_commande->total_tva = $obj->c_total_tva;
1554 $generic_commande->total_ttc = $obj->c_total_ttc;
1555 $generic_commande->note_public = $obj->note_public;
1556 $generic_commande->note_private = $obj->note_private;
1558 $projectstatic->id = $obj->project_id;
1559 $projectstatic->ref = $obj->project_ref;
1560 $projectstatic->title = $obj->project_label;
1562 $marginInfo = array();
1563 if ($with_margin_info) {
1564 $generic_commande->fetch_lines();
1565 $marginInfo = $formmargin->getMarginInfosArray($generic_commande);
1566 $total_ht += $obj->total_ht;
1567 $total_margin += $marginInfo[
'total_margin'];
1570 print
'<tr class="oddeven">';
1574 print
'<td class="nowrap center">';
1575 if ($massactionbutton || $massaction) {
1577 if (in_array($obj->rowid, $arrayofselected)) {
1580 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1584 $totalarray[
'nbfield']++;
1590 if (!empty($arrayfields[
'rowid'][
'checked'])) {
1591 print
'<td class="nowrap right">'.$obj->rowid.
'</td>';
1593 $totalarray[
'nbfield']++;
1598 if (!empty($arrayfields[
'pr.ref'][
'checked'])) {
1599 if (!empty($obj->product_rowid)) {
1600 $generic_product->id = $obj->product_rowid;
1601 $generic_product->ref = $obj->product_ref;
1602 $generic_product->label = $obj->product_label;
1603 $generic_product->status = $obj->product_status;
1604 $generic_product->status_buy = $obj->product_status_buy;
1605 $generic_product->status_batch = $obj->product_batch;
1606 $generic_product->barcode = $obj->product_barcode;
1607 print
'<td class="nowrap tdoverflowmax200">'.$generic_product->getNomUrl(1).
'</td>';
1609 print
'<td class="nowrap tdoverflowmax200">Ligne libre</td>';
1612 $totalarray[
'nbfield']++;
1616 if (!empty($arrayfields[
'pr.desc'][
'checked'])) {
1618 !empty($obj->product_label) ? $labelproduct = $obj->product_label : $labelproduct = $obj->description;
1619 print
'<td class="nowrap tdoverflowmax200">';
1624 $totalarray[
'nbfield']++;
1628 if (!empty($arrayfields[
'cdet.qty'][
'checked'])) {
1629 print
'<td class="nowrap right">'.$obj->qty.
'</td>';
1630 if (isset($totalarray[
'val'][
'cdet.qty']) || isset($subtotalarray[
'val'][
'cdet.qty'])) {
1631 $totalarray[
'val'][
'cdet.qty'] += $obj->qty;
1632 $subtotalarray[
'val'][
'cdet.qty'] += $obj->qty;
1634 $totalarray[
'val'][
'cdet.qty'] = $obj->qty;
1635 $subtotalarray[
'val'][
'cdet.qty'] = $obj->qty;
1638 $totalarray[
'nbfield']++;
1641 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'cdet.qty';
1642 $totalarray[
'pos'][$subtotalarray[
'nbfield']] =
'cdet.qty';
1647 if (!empty($arrayfields[
'c.ref'][
'checked'])) {
1648 print
'<td class="nowraponall">';
1649 print $generic_commande->getNomUrl(1, ($search_status != 2 ? 0 : $obj->fk_statut), 0, 0, 0, 1, 1);
1653 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid;
1654 print $formfile->getDocumentsLink($generic_commande->element, $filename, $filedir);
1658 $totalarray[
'nbfield']++;
1663 if (!empty($arrayfields[
'c.ref_client'][
'checked'])) {
1664 print
'<td class="nowrap tdoverflowmax200">'.$obj->ref_client.
'</td>';
1666 $totalarray[
'nbfield']++;
1671 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1672 print
'<td class="nowrap">';
1673 if ($obj->project_id > 0) {
1674 print $projectstatic->getNomUrl(1);
1678 $totalarray[
'nbfield']++;
1683 if (!empty($arrayfields[
'p.title'][
'checked'])) {
1684 print
'<td class="nowrap">';
1685 if ($obj->project_id > 0) {
1686 print $projectstatic->title;
1690 $totalarray[
'nbfield']++;
1695 if (!empty($arrayfields[
's.nom'][
'checked'])) {
1696 print
'<td class="tdoverflowmax150">';
1697 print $getNomUrl_cache[$obj->socid];
1701 if ($user->hasRight(
'facture',
'creer')) {
1702 if (($obj->fk_statut > 0 && $obj->fk_statut < 3) || ($obj->fk_statut == 3 && $obj->billed == 0)) {
1703 print
' <a href="'.DOL_URL_ROOT.
'/commande/list.php?socid='.$companystatic->id.
'&search_billed=0&autoselectall=1">';
1704 print
img_picto($langs->trans(
"CreateInvoiceForThisCustomer").
' : '.$companystatic->name,
'object_bill',
'hideonsmartphone').
'</a>';
1710 $totalarray[
'nbfield']++;
1714 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1715 print
'<td class="nocellnopadd">';
1719 $totalarray[
'nbfield']++;
1723 if (!empty($arrayfields[
's.town'][
'checked'])) {
1724 print
'<td class="nocellnopadd">';
1728 $totalarray[
'nbfield']++;
1732 if (!empty($arrayfields[
's.zip'][
'checked'])) {
1733 print
'<td class="nocellnopadd">';
1737 $totalarray[
'nbfield']++;
1741 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1742 print
"<td>".$obj->state_name.
"</td>\n";
1744 $totalarray[
'nbfield']++;
1748 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1749 print
'<td class="center">';
1750 $tmparray =
getCountry($obj->fk_pays,
'all');
1751 print $tmparray[
'label'];
1754 $totalarray[
'nbfield']++;
1758 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1759 print
'<td class="center">';
1760 if (empty($typenArray)) {
1761 $typenArray = $formcompany->typent_array(1);
1763 print $typenArray[$obj->typent_code];
1766 $totalarray[
'nbfield']++;
1771 if (!empty($arrayfields[
'c.date_commande'][
'checked'])) {
1772 print
'<td class="center">';
1775 if ($generic_commande->hasDelay()) {
1776 print
img_picto($langs->trans(
"Late").
' : '.$generic_commande->showDelay(),
"warning");
1780 $totalarray[
'nbfield']++;
1784 if (!empty($arrayfields[
'c.date_delivery'][
'checked'])) {
1785 print
'<td class="center" title="'.$langs->trans($arrayfields[
'c.date_delivery'][
'label']).
': '.
dol_print_date($db->jdate($obj->date_delivery),
'dayhour').
'">';
1789 $totalarray[
'nbfield']++;
1793 if (!empty($arrayfields[
'c.fk_shipping_method'][
'checked'])) {
1795 $form->formSelectShippingMethod(
'', $obj->fk_shipping_method,
'none', 1);
1798 $totalarray[
'nbfield']++;
1802 if (!empty($arrayfields[
'c.fk_cond_reglement'][
'checked'])) {
1804 $form->form_conditions_reglement($_SERVER[
'PHP_SELF'], $obj->fk_cond_reglement,
'none', 0,
'', 1, $obj->deposit_percent);
1807 $totalarray[
'nbfield']++;
1811 if (!empty($arrayfields[
'c.fk_mode_reglement'][
'checked'])) {
1813 $form->form_modes_reglement($_SERVER[
'PHP_SELF'], $obj->fk_mode_reglement,
'none',
'', -1);
1816 $totalarray[
'nbfield']++;
1820 if (!empty($arrayfields[
'c.fk_input_reason'][
'checked'])) {
1822 $form->formInputReason($_SERVER[
'PHP_SELF'], $obj->fk_input_reason,
'none', 0);
1825 $totalarray[
'nbfield']++;
1829 if (!empty($arrayfields[
'cdet.total_ht'][
'checked'])) {
1830 print
'<td class="nowrap right"><span class="amount">'.price($obj->total_ht).
"</span></td>\n";
1832 $totalarray[
'nbfield']++;
1835 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'cdet.total_ht';
1836 $totalarray[
'pos'][$subtotalarray[
'nbfield']] =
'cdet.total_ht';
1838 if (isset($totalarray[
'val'][
'cdet.total_ht']) || isset($subtotalarray[
'val'][
'cdet.total_ht'])) {
1839 $totalarray[
'val'][
'cdet.total_ht'] += $obj->total_ht;
1840 $subtotalarray[
'val'][
'cdet.total_ht'] += $obj->total_ht;
1842 $totalarray[
'val'][
'cdet.total_ht'] = $obj->total_ht;
1843 $subtotalarray[
'val'][
'cdet.total_ht'] = $obj->total_ht;
1847 if (!empty($arrayfields[
'c.total_vat'][
'checked'])) {
1848 print
'<td class="nowrap right"><span class="amount">'.price($obj->total_tva).
"</span></td>\n";
1850 $totalarray[
'nbfield']++;
1853 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'cdet.total_tva';
1854 $totalarray[
'pos'][$subtotalarray[
'nbfield']] =
'cdet.total_tva';
1856 $totalarray[
'val'][
'cdet.total_tva'] += $obj->total_tva;
1857 $subtotalarray[
'val'][
'cdet.total_tva'] += $obj->total_tva;
1860 if (!empty($arrayfields[
'cdet.total_ttc'][
'checked'])) {
1861 print
'<td class="nowrap right"><span class="amount">'.price($obj->total_ttc).
"</span></td>\n";
1863 $totalarray[
'nbfield']++;
1866 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'cdet.total_ttc';
1867 $subtotalarray[
'pos'][$totalarray[
'nbfield']] =
'cdet.total_ttc';
1869 $totalarray[
'val'][
'cdet.total_ttc'] += $obj->total_ttc;
1870 $subtotalarray[
'val'][
'cdet.total_ttc'] += $obj->total_ttc;
1873 if (!empty($arrayfields[
'c.fk_warehouse'][
'checked'])) {
1874 print
'<td class="nowrap">';
1875 if ($obj->warehouse > 0) {
1876 print
img_picto(
'',
'stock',
'class="paddingrightonly"');
1878 $formproduct->formSelectWarehouses($_SERVER[
'PHP_SELF'], $obj->warehouse,
'none');
1881 $totalarray[
'nbfield']++;
1885 if (!empty($arrayfields[
'c.multicurrency_code'][
'checked'])) {
1886 print
'<td class="nowrap">'.$obj->multicurrency_code.
' - '.$langs->trans(
'Currency'.$obj->multicurrency_code).
"</td>\n";
1888 $totalarray[
'nbfield']++;
1893 if (!empty($arrayfields[
'c.multicurrency_tx'][
'checked'])) {
1894 print
'<td class="nowrap">';
1895 $form->form_multicurrency_rate($_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid, $obj->multicurrency_tx,
'none', $obj->multicurrency_code);
1898 $totalarray[
'nbfield']++;
1902 if (!empty($arrayfields[
'c.multicurrency_total_ht'][
'checked'])) {
1903 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ht).
"</span></td>\n";
1905 $totalarray[
'nbfield']++;
1909 if (!empty($arrayfields[
'c.multicurrency_total_vat'][
'checked'])) {
1910 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_vat).
"</span></td>\n";
1912 $totalarray[
'nbfield']++;
1916 if (!empty($arrayfields[
'c.multicurrency_total_ttc'][
'checked'])) {
1917 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ttc).
"</span></td>\n";
1919 $totalarray[
'nbfield']++;
1923 $userstatic->id = $obj->fk_user_author;
1924 $userstatic->login = $obj->login;
1925 $userstatic->lastname = $obj->lastname;
1926 $userstatic->firstname = $obj->firstname;
1927 $userstatic->email = $obj->user_email;
1928 $userstatic->status = $obj->user_statut;
1929 $userstatic->entity = $obj->entity;
1930 $userstatic->photo = $obj->photo;
1931 $userstatic->office_phone = $obj->office_phone;
1932 $userstatic->office_fax = $obj->office_fax;
1933 $userstatic->user_mobile = $obj->user_mobile;
1934 $userstatic->job = $obj->job;
1935 $userstatic->gender = $obj->gender;
1938 if (!empty($arrayfields[
'u.login'][
'checked'])) {
1939 print
'<td class="tdoverflowmax200">';
1940 if ($userstatic->id) {
1941 print $userstatic->getNomUrl(-1);
1947 $totalarray[
'nbfield']++;
1951 if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
1954 if ($obj->socid > 0) {
1955 $listsalesrepresentatives = $companystatic->getSalesRepresentatives($user);
1956 if ($listsalesrepresentatives < 0) {
1959 $nbofsalesrepresentative = count($listsalesrepresentatives);
1960 if ($nbofsalesrepresentative > 6) {
1962 print $nbofsalesrepresentative;
1963 } elseif ($nbofsalesrepresentative > 0) {
1965 foreach ($listsalesrepresentatives as $val) {
1966 $userstatic->id = $val[
'id'];
1967 $userstatic->lastname = $val[
'lastname'];
1968 $userstatic->firstname = $val[
'firstname'];
1969 $userstatic->email = $val[
'email'];
1970 $userstatic->status = $val[
'statut'];
1971 $userstatic->entity = $val[
'entity'];
1972 $userstatic->photo = $val[
'photo'];
1973 $userstatic->login = $val[
'login'];
1974 $userstatic->office_phone = $val[
'office_phone'];
1975 $userstatic->office_fax = $val[
'office_fax'];
1976 $userstatic->user_mobile = $val[
'user_mobile'];
1977 $userstatic->job = $val[
'job'];
1978 $userstatic->gender = $val[
'gender'];
1980 print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1,
'', 0, 0, 12) : $userstatic->getNomUrl(-2);
1982 if ($j < $nbofsalesrepresentative) {
1994 $totalarray[
'nbfield']++;
1999 if (!empty($arrayfields[
'total_pa'][
'checked'])) {
2000 print
'<td class="right nowrap">'.price($marginInfo[
'pa_total']).
'</td>';
2002 $totalarray[
'nbfield']++;
2006 if (!empty($arrayfields[
'total_margin'][
'checked'])) {
2007 print
'<td class="right nowrap">'.price($marginInfo[
'total_margin']).
'</td>';
2009 $totalarray[
'nbfield']++;
2012 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'total_margin';
2013 $totalarray[
'pos'][$subtotalarray[
'nbfield']] =
'total_margin';
2015 $totalarray[
'val'][
'total_margin'] += $marginInfo[
'total_margin'];
2016 $subtotalarray[
'val'][
'total_margin'] += $marginInfo[
'total_margin'];
2019 if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
2020 print
'<td class="right nowrap">'.(($marginInfo[
'total_margin_rate'] ==
'') ?
'' :
price($marginInfo[
'total_margin_rate'], 0,
'', 0, 0, 2).
'%').
'</td>';
2022 $totalarray[
'nbfield']++;
2026 if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
2027 print
'<td class="right nowrap">'.(($marginInfo[
'total_mark_rate'] ==
'') ?
'' :
price($marginInfo[
'total_mark_rate'], 0,
'', 0, 0, 2).
'%').
'</td>';
2029 $totalarray[
'nbfield']++;
2032 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'total_mark_rate';
2033 $totalarray[
'pos'][$subtotalarray[
'nbfield']] =
'total_mark_rate';
2035 if ($i >= $imaxinloop - 1) {
2036 if (!empty($total_ht)) {
2037 $totalarray[
'val'][
'total_mark_rate'] =
price2num($total_margin * 100 / $total_ht,
'MT');
2038 $subtotalarray[
'val'][
'total_mark_rate'] =
price2num($total_margin * 100 / $total_ht,
'MT');
2040 $totalarray[
'val'][
'total_mark_rate'] =
'';
2041 $subtotalarray[
'val'][
'total_mark_rate'] =
'';
2047 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
2049 $parameters = array(
'arrayfields' => $arrayfields,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
2050 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
2051 print $hookmanager->resPrint;
2054 if (!empty($arrayfields[
'c.datec'][
'checked'])) {
2055 print
'<td align="center" class="nowrap">';
2056 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuser');
2059 $totalarray[
'nbfield']++;
2064 if (!empty($arrayfields[
'c.tms'][
'checked'])) {
2065 print
'<td align="center" class="nowrap">';
2066 print
dol_print_date($db->jdate($obj->date_modification),
'dayhour',
'tzuser');
2069 $totalarray[
'nbfield']++;
2074 if (!empty($arrayfields[
'c.date_cloture'][
'checked'])) {
2075 print
'<td align="center" class="nowrap">';
2076 print
dol_print_date($db->jdate($obj->date_cloture),
'dayhour',
'tzuser');
2079 $totalarray[
'nbfield']++;
2084 if (!empty($arrayfields[
'c.note_public'][
'checked'])) {
2085 print
'<td class="sensiblehtmlcontent center">';
2089 $totalarray[
'nbfield']++;
2094 if (!empty($arrayfields[
'c.note_private'][
'checked'])) {
2095 print
'<td class="center">';
2099 $totalarray[
'nbfield']++;
2104 if (!empty($arrayfields[
'shippable'][
'checked'])) {
2105 print
'<td class="center">';
2106 if (!empty($show_shippable_command) && isModEnabled(
'stock')) {
2108 if (($obj->fk_statut > $generic_commande::STATUS_DRAFT) && ($obj->fk_statut < $generic_commande::STATUS_CLOSED)) {
2109 $generic_commande->loadExpeditions();
2111 if (isset($generic_commande->expeditions[$obj->rowid])) {
2112 $reliquat = $obj->qty - $generic_commande->expeditions[$obj->rowid];
2114 $reliquat = $obj->qty;
2116 if ($obj->product_type == 0 && $obj->fk_product > 0) {
2118 $generic_product->id = $obj->fk_product;
2121 if (empty($productstat_cache[$obj->fk_product])) {
2122 $generic_product->load_stock(
'nobatch');
2123 $productstat_cache[$obj->fk_product][
'stock_reel'] = $generic_product->stock_reel;
2124 $productstat_cachevirtual[$obj->fk_product][
'stock_reel'] = $generic_product->stock_theorique;
2126 $generic_product->stock_reel = $productstat_cache[$obj->fk_product][
'stock_reel'];
2127 $generic_product->stock_theorique = $productstat_cachevirtual[$obj->fk_product][
'stock_reel'];
2130 if ($reliquat > $generic_product->stock_reel) {
2134 $text_info .= $reliquat.
' x '.$obj->product_ref.
' '.
dol_trunc($obj->product_label, 20);
2135 $text_info .=
' - '.$langs->trans(
"Stock").
': <span class="'.($generic_product->stock_reel > 0 ?
'ok' :
'error').
'">'.$generic_product->stock_reel.
'</span>';
2136 $text_info .=
' - '.$langs->trans(
"VirtualStock").
': <span class="'.($generic_product->stock_theorique > 0 ?
'ok' :
'error').
'">'.$generic_product->stock_theorique.
'</span>';
2137 $text_info .= ($reliquat != $obj->qty ?
' <span class="opacitymedium">('.$langs->trans(
"QtyInOtherShipments").
' '.($obj->qty - $reliquat).
')</span>' :
'');
2138 $text_info .=
'<br>';
2145 $stock_order_supplier = 0;
2147 if (isModEnabled(
'order')) {
2148 if (empty($productstat_cache[$obj->fk_product][
'stats_order_customer'])) {
2149 $generic_product->load_stats_commande(0,
'1,2');
2150 $productstat_cache[$obj->fk_product][
'stats_order_customer'] = $generic_product->stats_commande[
'qty'];
2152 $generic_product->stats_commande[
'qty'] = $productstat_cache[$obj->fk_product][
'stats_order_customer'];
2154 $stock_order = $generic_product->stats_commande[
'qty'];
2156 if (isModEnabled(
'supplier_order')) {
2157 if (empty($productstat_cache[$obj->fk_product][
'stats_order_supplier'])) {
2158 $generic_product->load_stats_commande_fournisseur(0,
'3');
2159 $productstat_cache[$obj->fk_product][
'stats_order_supplier'] = $generic_product->stats_commande_fournisseur[
'qty'];
2161 $generic_product->stats_commande_fournisseur[
'qty'] = $productstat_cache[$obj->fk_product][
'stats_order_supplier'];
2163 $stock_order_supplier = $generic_product->stats_commande_fournisseur[
'qty'];
2166 $text_info .= $reliquat.
' x '.$obj->product_ref.
' '.
dol_trunc($obj->product_label, 20);
2167 $text_stock_reel = $generic_product->stock_reel.
'/'.$stock_order;
2168 if ($stock_order > $generic_product->stock_reel && !($generic_product->stock_reel < $obj->qty)) {
2170 $text_warning .=
'<span class="warning">'.$langs->trans(
'Available').
' : '.$text_stock_reel.
'</span>';
2172 if ($reliquat > $generic_product->stock_reel) {
2173 $text_info .=
'<span class="warning">'.$langs->trans(
'Available').
' : '.$text_stock_reel.
'</span>';
2175 $text_info .=
'<span class="ok">'.$langs->trans(
'Available').
' : '.$text_stock_reel.
'</span>';
2177 if (isModEnabled(
'supplier_order')) {
2178 $text_info .=
' '.$langs->trans(
'SupplierOrder').
' : '.$stock_order_supplier;
2180 $text_info .= ($reliquat != $obj->qty ?
' <span class="opacitymedium">('.$langs->trans(
"QtyInOtherShipments").
' '.($obj->qty - $reliquat).
')</span>' :
'');
2181 $text_info .=
'<br>';
2184 if ($notshippable == 0) {
2185 $text_icon =
img_picto(
'',
'dolly',
'', 0, 0, 0,
'',
'green paddingleft');
2186 $text_info = $text_icon.
' '.$langs->trans(
'Shippable').
'<br>'.$text_info;
2188 $text_icon =
img_picto(
'',
'dolly',
'', 0, 0, 0,
'',
'error paddingleft');
2189 $text_info = $text_icon.
' '.$langs->trans(
'NonShippable').
'<br>'.$text_info;
2194 print $form->textwithtooltip(
'', $text_info, 2, 1, $text_icon,
'', 2);
2197 print $form->textwithtooltip(
'', $langs->trans(
'NotEnoughForAllOrders').
'<br>'.$text_warning, 2, 1,
img_picto(
'',
'error'),
'', 2);
2202 $totalarray[
'nbfield']++;
2207 if (!empty($arrayfields[
'c.facture'][
'checked'])) {
2208 print
'<td class="center">';
2210 print
yn($obj->billed, $langs->trans(
"Billed"));
2214 $totalarray[
'nbfield']++;
2218 if (!empty($arrayfields[
'c.import_key'][
'checked'])) {
2219 print
'<td class="nowrap center">'.$obj->import_key.
'</td>';
2221 $totalarray[
'nbfield']++;
2225 if (!empty($arrayfields[
'c.fk_statut'][
'checked'])) {
2226 print
'<td class="nowrap center">'.$generic_commande->LibStatut($obj->fk_statut, $obj->billed, 5, 1).
'</td>';
2228 $totalarray[
'nbfield']++;
2234 print
'<td class="nowrap center">';
2235 if ($massactionbutton || $massaction) {
2237 if (in_array($obj->rowid, $arrayofselected)) {
2240 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
2244 $totalarray[
'nbfield']++;
2250 $total += $obj->total_ht;
2251 $subtotal += $obj->total_ht;
2254 if ($sortfield ==
'pr.ref') {
2255 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_subtotal.tpl.php';
2258 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
2263 foreach ($arrayfields as $key => $val) {
2264 if (!empty($val[
'checked'])) {
2268 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
2273 $parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
2274 $reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters);
2275 print $hookmanager->resPrint;
2277 print
'</table>'.
"\n";
2280 print
'</form>'.
"\n";
2282 $hidegeneratedfilelistifempty = 1;
2283 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
2284 $hidegeneratedfilelistifempty = 0;
2288 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
2289 $urlsource .= str_replace(
'&',
'&', $param);
2291 $filedir = $diroutputmassaction;
2292 $genallowed = $permissiontoread;
2293 $delallowed = $permissiontoadd;
2295 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
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)
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_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
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.
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.