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';
59$langs->loadLangs(array(
"orders",
'sendings',
'deliveries',
'companies',
'compta',
'bills',
'stocks',
'products'));
61$action =
GETPOST(
'action',
'aZ09');
62$massaction =
GETPOST(
'massaction',
'alpha');
64$confirm =
GETPOST(
'confirm',
'alpha');
65$toselect =
GETPOST(
'toselect',
'array');
66$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'orderlistdet';
67$optioncss =
GETPOST(
'optioncss',
'alpha');
69$productobuy =
GETPOST(
'productobuy',
'alpha');
70$productonly =
GETPOST(
'productonly',
'alpha');
71$disablelinefree =
GETPOST(
'disablelinefree',
'alpha');
73$search_datecloture_start =
GETPOSTINT(
'search_datecloture_start');
74if (empty($search_datecloture_start)) {
77$search_datecloture_end =
GETPOSTINT(
'search_datecloture_end');
78if (empty($search_datecloture_end)) {
86if (isModEnabled(
'category')) {
87 $search_product_category_array =
GETPOST(
"search_category_".Categorie::TYPE_PRODUCT.
"_list",
"array");
88 $searchCategoryProductOperator = 0;
89 if (GETPOSTISSET(
'formfilteraction')) {
90 $searchCategoryProductOperator =
GETPOSTINT(
'search_category_product_operator');
99$search_id =
GETPOST(
'search_id',
'alpha');
100$search_refProduct =
GETPOST(
'search_refProduct',
'alpha');
101$search_descProduct =
GETPOST(
'search_descProduct',
'alpha');
103$search_ref =
GETPOST(
'search_ref',
'alpha') !=
'' ?
GETPOST(
'search_ref',
'alpha') :
GETPOST(
'sref',
'alpha');
104$search_ref_customer =
GETPOST(
'search_ref_customer',
'alpha');
105$search_company =
GETPOST(
'search_company',
'alpha');
106$search_company_alias =
GETPOST(
'search_company_alias',
'alpha');
107$search_town =
GETPOST(
'search_town',
'alpha');
108$search_zip =
GETPOST(
'search_zip',
'alpha');
109$search_state =
GETPOST(
"search_state",
'alpha');
110$search_country =
GETPOST(
"search_country",
'aZ09');
111$search_type_thirdparty =
GETPOST(
"search_type_thirdparty",
'intcomma');
112$search_all = trim((
GETPOST(
'search_all',
'alphanohtml') !=
'') ?
GETPOST(
'search_all',
'alphanohtml') :
GETPOST(
'sall',
'alphanohtml'));
113$search_user =
GETPOST(
'search_user',
'intcomma');
114$search_sale =
GETPOST(
'search_sale',
'intcomma');
115$search_total_ht =
GETPOST(
'search_total_ht',
'alpha');
116$search_total_vat =
GETPOST(
'search_total_vat',
'alpha');
117$search_total_ttc =
GETPOST(
'search_total_ttc',
'alpha');
118$search_warehouse =
GETPOST(
'search_warehouse',
'intcomma');
119$search_multicurrency_code =
GETPOST(
'search_multicurrency_code',
'alpha');
120$search_multicurrency_tx =
GETPOST(
'search_multicurrency_tx',
'alpha');
121$search_multicurrency_montant_ht =
GETPOST(
'search_multicurrency_montant_ht',
'alpha');
122$search_multicurrency_montant_vat =
GETPOST(
'search_multicurrency_montant_vat',
'alpha');
123$search_multicurrency_montant_ttc =
GETPOST(
'search_multicurrency_montant_ttc',
'alpha');
124$search_login =
GETPOST(
'search_login',
'alpha');
125$search_categ_cus =
GETPOST(
"search_categ_cus",
'intcomma');
126$search_billed =
GETPOST(
'search_billed',
'intcomma') ?
GETPOST(
'search_billed',
'intcomma') :
GETPOST(
'billed',
'intcomma');
127$search_status =
GETPOST(
'search_status',
'intcomma');
128$search_project_ref =
GETPOST(
'search_project_ref',
'alpha');
129$search_project =
GETPOST(
'search_project',
'alpha');
130$search_shippable =
GETPOST(
'search_shippable',
'aZ09');
131$search_fk_cond_reglement =
GETPOSTINT(
"search_fk_cond_reglement");
132$search_fk_shipping_method =
GETPOSTINT(
"search_fk_shipping_method");
133$search_fk_mode_reglement =
GETPOSTINT(
"search_fk_mode_reglement");
134$search_fk_input_reason =
GETPOSTINT(
"search_fk_input_reason");
136$diroutputmassaction = $conf->commande->multidir_output[$conf->entity].
'/temp/massgeneration/'.$user->id;
140$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
141$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
143if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
146$offset = $limit * $page;
147$pageprev = $page - 1;
148$pagenext = $page + 1;
150 $sortfield =
'pr.ref';
156$show_shippable_command =
GETPOST(
'show_shippable_command',
'aZ09');
160$hookmanager->initHooks(array(
'orderlistdetail'));
164$extrafields->fetch_name_optionals_label(
$object->table_element);
165$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
168$fieldstosearchall = array(
170 'c.ref_client' =>
'RefCustomerOrder',
171 'cdet.description' =>
'Description',
172 's.nom' =>
"ThirdParty",
173 's.name_alias' =>
"AliasNameShort",
176 'c.note_public' =>
'NotePublic',
178if (empty($user->socid)) {
179 $fieldstosearchall[
"c.note_private"] =
"NotePrivate";
182$checkedtypetiers = 0;
185 'rowid' => array(
'label' =>
'TechnicalID',
'checked' => 1,
'position' => 1,
'enabled' => (
getDolGlobalInt(
'MAIN_SHOW_TECHNICAL_ID') ? 1 : 0)),
186 'pr.ref' => array(
'label' =>
'ProductRef',
'checked' => 1,
'position' => 1),
187 'pr.desc' => array(
'label' =>
'ProductDescription',
'checked' => -1,
'position' => 1),
188 'cdet.qty' => array(
'label' =>
'QtyOrdered',
'checked' => 1,
'position' => 1),
189 'c.ref' => array(
'label' =>
"Ref",
'checked' => 1,
'position' => 5),
190 'c.ref_client' => array(
'label' =>
"RefCustomerOrder",
'checked' => -1,
'position' => 10),
191 'p.ref' => array(
'label' =>
"ProjectRef",
'checked' => -1,
'enabled' => (empty($conf->project->enabled) ? 0 : 1),
'position' => 20),
192 'p.title' => array(
'label' =>
"ProjectLabel",
'checked' => 0,
'enabled' => (empty($conf->project->enabled) ? 0 : 1),
'position' => 25),
193 's.nom' => array(
'label' =>
"ThirdParty",
'checked' => 1,
'position' => 30),
194 's.name_alias' => array(
'label' =>
"AliasNameShort",
'checked' => -1,
'position' => 31),
195 's.town' => array(
'label' =>
"Town",
'checked' => -1,
'position' => 35),
196 's.zip' => array(
'label' =>
"Zip",
'checked' => -1,
'position' => 40),
197 'state.nom' => array(
'label' =>
"StateShort",
'checked' => 0,
'position' => 45),
198 'country.code_iso' => array(
'label' =>
"Country",
'checked' => 0,
'position' => 50),
199 'typent.code' => array(
'label' =>
"ThirdPartyType",
'checked' => $checkedtypetiers,
'position' => 55),
200 'c.date_commande' => array(
'label' =>
"OrderDateShort",
'checked' => 1,
'position' => 60),
201 'c.date_delivery' => array(
'label' =>
"DateDeliveryPlanned",
'checked' => 1,
'enabled' => !
getDolGlobalString(
'ORDER_DISABLE_DELIVERY_DATE'),
'position' => 65),
202 'c.fk_shipping_method' => array(
'label' =>
"SendingMethod",
'checked' => -1,
'position' => 66 ,
'enabled' => isModEnabled(
'shipping')),
203 'c.fk_cond_reglement' => array(
'label' =>
"PaymentConditionsShort",
'checked' => -1,
'position' => 67),
204 'c.fk_mode_reglement' => array(
'label' =>
"PaymentMode",
'checked' => -1,
'position' => 68),
205 'c.fk_input_reason' => array(
'label' =>
"Channel",
'checked' => -1,
'position' => 69),
206 'cdet.total_ht' => array(
'label' =>
"AmountHT",
'checked' => 1,
'position' => 75),
207 'c.total_vat' => array(
'label' =>
"AmountVAT",
'checked' => 0,
'position' => 80),
208 'cdet.total_ttc' => array(
'label' =>
"AmountTTC",
'checked' => 0,
'position' => 85),
209 'c.multicurrency_code' => array(
'label' =>
'Currency',
'checked' => 0,
'enabled' => (empty($conf->multicurrency->enabled) ? 0 : 1),
'position' => 90),
210 'c.multicurrency_tx' => array(
'label' =>
'CurrencyRate',
'checked' => 0,
'enabled' => (empty($conf->multicurrency->enabled) ? 0 : 1),
'position' => 95),
211 'c.multicurrency_total_ht' => array(
'label' =>
'MulticurrencyAmountHT',
'checked' => 0,
'enabled' => (empty($conf->multicurrency->enabled) ? 0 : 1),
'position' => 100),
212 'c.multicurrency_total_vat' => array(
'label' =>
'MulticurrencyAmountVAT',
'checked' => 0,
'enabled' => (empty($conf->multicurrency->enabled) ? 0 : 1),
'position' => 105),
213 'c.multicurrency_total_ttc' => array(
'label' =>
'MulticurrencyAmountTTC',
'checked' => 0,
'enabled' => (empty($conf->multicurrency->enabled) ? 0 : 1),
'position' => 110),
214 'c.fk_warehouse' => array(
'label' =>
'Warehouse',
'checked' => 0,
'enabled' => (!isModEnabled(
'stock') && !
getDolGlobalString(
'WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER') ? 0 : 1),
'position' => 110),
215 'u.login' => array(
'label' =>
"Author",
'checked' => 1,
'position' => 115),
216 'sale_representative' => array(
'label' =>
"SaleRepresentativesOfThirdParty",
'checked' => 0,
'position' => 116),
217 'total_pa' => array(
'label' => (
getDolGlobalString(
'MARGIN_TYPE') ==
'1' ?
'BuyingPrice' :
'CostPrice'),
'checked' => 0,
'position' => 300,
'enabled' => (!isModEnabled(
'margin') || !$user->hasRight(
'margins',
'liretous') ? 0 : 1)),
218 'total_margin' => array(
'label' =>
'Margin',
'checked' => 0,
'position' => 301,
'enabled' => (!isModEnabled(
'margin') || !$user->hasRight(
'margins',
'liretous') ? 0 : 1)),
219 'total_margin_rate' => array(
'label' =>
'MarginRate',
'checked' => 0,
'position' => 302,
'enabled' => (!isModEnabled(
'margin') || !$user->hasRight(
'margins',
'liretous') || !
getDolGlobalString(
'DISPLAY_MARGIN_RATES') ? 0 : 1)),
220 'total_mark_rate' => array(
'label' =>
'MarkRate',
'checked' => 0,
'position' => 303,
'enabled' => (!isModEnabled(
'margin') || !$user->hasRight(
'margins',
'liretous') || !
getDolGlobalString(
'DISPLAY_MARK_RATES') ? 0 : 1)),
221 'c.datec' => array(
'label' =>
"DateCreation",
'checked' => 0,
'position' => 120),
222 'c.tms' => array(
'label' =>
"DateModificationShort",
'checked' => 0,
'position' => 125),
223 'c.date_cloture' => array(
'label' =>
"DateClosing",
'checked' => 0,
'position' => 130),
224 'c.note_public' => array(
'label' =>
'NotePublic',
'checked' => 0,
'enabled' => (!
getDolGlobalString(
'MAIN_LIST_ALLOW_PUBLIC_NOTES')),
'position' => 135),
225 'c.note_private' => array(
'label' =>
'NotePrivate',
'checked' => 0,
'enabled' => (!
getDolGlobalString(
'MAIN_LIST_ALLOW_PRIVATE_NOTES')),
'position' => 140),
226 'shippable' => array(
'label' =>
"Shippable",
'checked' => 1,
'enabled' => (isModEnabled(
'shipping')),
'position' => 990),
227 'c.facture' => array(
'label' =>
"Billed",
'checked' => 1,
'enabled' => (!
getDolGlobalString(
'WORKFLOW_BILL_ON_SHIPMENT')),
'position' => 995),
228 'c.import_key' => array(
'type' =>
'varchar(14)',
'label' =>
'ImportId',
'enabled' => 1,
'visible' => -2,
'position' => 999),
229 'c.fk_statut' => array(
'label' =>
"Status",
'checked' => 1,
'position' => 1000)
233include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
237'@phan-var-force array<string,array{label:string,checked?:int<0,1>,position?:int,help?:string}> $arrayfields';
239if (!$user->hasRight(
'societe',
'client',
'voir')) {
240 $search_sale = $user->id;
246 $socid = $user->socid;
255if (
GETPOST(
'cancel',
'alpha')) {
259if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend' && $massaction !=
'confirm_createbills') {
263$parameters = array(
'socid' => $socid);
264$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
269if (empty($reshook)) {
271 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
274 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
277 $disablelinefree =
'';
281 $search_product_category_array = array();
282 $searchCategoryProductOperator = 0;
284 $search_refProduct =
'';
285 $search_descProduct =
'';
287 $search_ref_customer =
'';
288 $search_company =
'';
289 $search_company_alias =
'';
294 $search_country =
'';
295 $search_type_thirdparty =
'';
296 $search_total_ht =
'';
297 $search_total_vat =
'';
298 $search_total_ttc =
'';
299 $search_warehouse =
'';
300 $search_multicurrency_code =
'';
301 $search_multicurrency_tx =
'';
302 $search_multicurrency_montant_ht =
'';
303 $search_multicurrency_montant_vat =
'';
304 $search_multicurrency_montant_ttc =
'';
306 $search_dateorder_start =
'';
307 $search_dateorder_end =
'';
308 $search_datedelivery_start =
'';
309 $search_datedelivery_end =
'';
310 $search_project_ref =
'';
311 $search_project =
'';
315 $search_array_options = array();
316 $search_categ_cus = 0;
317 $search_datecloture_start =
'';
318 $search_datecloture_end =
'';
319 $search_fk_cond_reglement =
'';
320 $search_fk_shipping_method =
'';
321 $search_fk_mode_reglement =
'';
322 $search_fk_input_reason =
'';
324 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
325 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
330 $objectclass =
'Commande';
331 $objectlabel =
'Orders';
332 $permissiontoread = $user->hasRight(
"commande",
"lire");
333 $permissiontoadd = $user->hasRight(
"commande",
"creer");
334 $permissiontodelete = $user->hasRight(
"commande",
"supprimer");
335 $permissiontoexport = $user->hasRight(
"commande",
"commande",
"export");
337 $permissiontovalidate = $user->hasRight(
"commande",
"order_advance",
"validate");
338 $permissiontoclose = $user->hasRight(
"commande",
"order_advance",
"close");
339 $permissiontocancel = $user->hasRight(
"commande",
"order_advance",
"annuler");
340 $permissiontosendbymail = $user->hasRight(
"commande",
"order_advance",
"send");
342 $permissiontovalidate = $user->hasRight(
"commande",
"creer");
343 $permissiontoclose = $user->hasRight(
"commande",
"creer");
344 $permissiontocancel = $user->hasRight(
"commande",
"creer");
345 $permissiontosendbymail = $user->hasRight(
"commande",
"creer");
347 $uploaddir = $conf->commande->multidir_output[$conf->entity];
348 $triggersendname =
'ORDER_SENTBYMAIL';
349 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
363$form =
new Form($db);
367if (isModEnabled(
'margin')) {
370$companystatic =
new Societe($db);
372$projectstatic =
new Project($db);
374$title = $langs->trans(
"Orders");
375$help_url =
"EN:Module_Customers_Orders|FR:Module_Commandes_Clients|ES:Módulo_Pedidos_de_clientes";
379if ($search_all || $search_product_category_array > 0 || $search_user > 0) {
380 $sql =
'SELECT DISTINCT';
382$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,';
383$sql .=
" typent.code as typent_code,";
384$sql .=
" state.code_departement as state_code, state.nom as state_name,";
385$sql .=
" country.code as country_code,";
386$sql .=
' c.rowid as c_rowid, c.ref, c.ref_client, c.fk_user_author,';
387$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,';
388$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,';
389$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,';
390$sql .=
' c.date_creation as date_creation, c.tms as date_modification, c.date_cloture as date_cloture,';
391$sql .=
' p.rowid as project_id, p.ref as project_ref, p.title as project_label,';
392$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,';
393$sql .=
' c.fk_cond_reglement,c.deposit_percent,c.fk_mode_reglement,c.fk_shipping_method,';
394$sql .=
' c.fk_input_reason, c.import_key,';
396$sql .=
' cdet.rowid, cdet.description, cdet.qty, cdet.product_type, cdet.fk_product, cdet.total_ht, cdet.total_tva, cdet.total_ttc,';
397$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';
399if (($search_categ_cus > 0) || ($search_categ_cus == -2)) {
400 $sql .=
", cc.fk_categorie, cc.fk_soc";
403if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
404 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
405 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
409$parameters = array();
410$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters);
411$sql .= $hookmanager->resPrint;
412$sql .=
' FROM '.MAIN_DB_PREFIX.
'societe as s';
413$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as country on (country.rowid = s.fk_pays)";
414$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_typent as typent on (typent.id = s.fk_typent)";
415$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_departements as state on (state.rowid = s.fk_departement)";
416if (($search_categ_cus > 0) || ($search_categ_cus == -2)) {
417 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
"categorie_societe as cc ON s.rowid = cc.fk_soc";
421$sql .=
', '.MAIN_DB_PREFIX.
'commandedet as cdet';
422$sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'commande as c ON cdet.fk_commande=c.rowid';
423$sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'product as pr ON pr.rowid=cdet.fk_product';
425if (!empty($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
426 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"commande_extrafields as ef on (c.rowid = ef.fk_object)";
428$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"projet as p ON p.rowid = c.fk_projet";
429$sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'user as u ON c.fk_user_author = u.rowid';
430if ($search_user > 0) {
431 $sql .=
", ".MAIN_DB_PREFIX.
"element_contact as ec";
432 $sql .=
", ".MAIN_DB_PREFIX.
"c_type_contact as tc";
435$parameters = array();
436$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object);
437$sql .= $hookmanager->resPrint;
439$sql .=
' WHERE c.fk_soc = s.rowid';
440$sql .=
' AND c.entity IN ('.getEntity(
'commande').
')';
441$sql .=
' AND cdet.product_type <> 9';
443if (!empty($productobuy)) {
444 $sql .=
" AND pr.tobuy = 1";
446if (!empty($productonly)) {
447 $sql .=
" AND (cdet.product_type = 0 OR cdet.product_type = 1)";
449if (!empty($disablelinefree)) {
450 $sql .=
" AND cdet.fk_product IS NOT NULL";
453 $sql .=
' AND s.rowid = '.((int) $socid);
458if ($search_refProduct) {
461if ($search_descProduct) {
462 $sql .=
natural_search(array(
'pr.label',
'cdet.description'), $search_descProduct);
467if ($search_ref_customer) {
471 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
473if ($search_billed !=
'' && $search_billed >= 0) {
474 $sql .=
' AND c.facture = '.((int) $search_billed);
476if ($search_status !=
'') {
477 if ($search_status <= 3 && $search_status >= -1) {
478 if ($search_status == 1 && !isModEnabled(
'shipping')) {
479 $sql .=
' AND c.fk_statut IN (1,2)';
481 $sql .=
' AND c.fk_statut = '.((int) $search_status);
484 if ($search_status == -2) {
486 $sql .=
" AND ((c.fk_statut IN (1,2)) OR (c.fk_statut = 3 AND c.facture = 0))";
488 if ($search_status == -3) {
491 $sql .=
' AND ((c.fk_statut IN (1,2)) OR (c.fk_statut = 3 AND c.facture = 0))';
493 if ($search_status == -4) {
494 $sql .=
' AND (c.fk_statut IN (1,2))';
498if ($search_datecloture_start) {
499 $sql .=
" AND c.date_cloture >= '".$db->idate($search_datecloture_start).
"'";
501if ($search_datecloture_end) {
502 $sql .=
" AND c.date_cloture <= '".$db->idate($search_datecloture_end).
"'";
504if ($search_dateorder_start) {
505 $sql .=
" AND c.date_commande >= '".$db->idate($search_dateorder_start).
"'";
507if ($search_dateorder_end) {
508 $sql .=
" AND c.date_commande <= '".$db->idate($search_dateorder_end).
"'";
510if ($search_datedelivery_start) {
511 $sql .=
" AND c.date_livraison >= '".$db->idate($search_datedelivery_start).
"'";
513if ($search_datedelivery_end) {
514 $sql .=
" AND c.date_livraison <= '".$db->idate($search_datedelivery_end).
"'";
525if ($search_country) {
526 $sql .=
" AND s.fk_pays IN (".$db->sanitize($search_country).
')';
528if ($search_type_thirdparty && $search_type_thirdparty !=
'-1') {
529 $sql .=
" AND s.fk_typent IN (".$db->sanitize($search_type_thirdparty).
')';
531if ($search_company) {
534if ($search_company_alias) {
537if ($search_user > 0) {
538 $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);
540if ($search_total_ht !=
'') {
543if ($search_total_vat !=
'') {
546if ($search_total_ttc !=
'') {
549if ($search_warehouse !=
'' && $search_warehouse > 0) {
552if ($search_multicurrency_code !=
'') {
553 $sql .=
" AND c.multicurrency_code = '".$db->escape($search_multicurrency_code).
"'";
555if ($search_multicurrency_tx !=
'') {
556 $sql .=
natural_search(
'c.multicurrency_tx', $search_multicurrency_tx, 1);
558if ($search_multicurrency_montant_ht !=
'') {
559 $sql .=
natural_search(
'c.multicurrency_total_ht', $search_multicurrency_montant_ht, 1);
561if ($search_multicurrency_montant_vat !=
'') {
562 $sql .=
natural_search(
'c.multicurrency_total_tva', $search_multicurrency_montant_vat, 1);
564if ($search_multicurrency_montant_ttc !=
'') {
565 $sql .=
natural_search(
'c.multicurrency_total_ttc', $search_multicurrency_montant_ttc, 1);
568 $sql .=
natural_search(array(
"u.login",
"u.firstname",
"u.lastname"), $search_login);
570if ($search_project_ref !=
'') {
573if ($search_project !=
'') {
576if ($search_categ_cus > 0) {
577 $sql .=
" AND cc.fk_categorie = ".((int) $search_categ_cus);
579if ($search_categ_cus == -2) {
580 $sql .=
" AND cc.fk_categorie IS NULL";
582if ($search_fk_cond_reglement > 0) {
583 $sql .=
" AND c.fk_cond_reglement = ".((int) $search_fk_cond_reglement);
585if ($search_fk_shipping_method > 0) {
586 $sql .=
" AND c.fk_shipping_method = ".((int) $search_fk_shipping_method);
588if ($search_fk_mode_reglement > 0) {
589 $sql .=
" AND c.fk_mode_reglement = ".((int) $search_fk_mode_reglement);
591if ($search_fk_input_reason > 0) {
592 $sql .=
" AND c.fk_input_reason = ".((int) $search_fk_input_reason);
595if ($search_sale && $search_sale !=
'-1') {
596 if ($search_sale == -2) {
597 $sql .=
" AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = c.fk_soc)";
598 } elseif ($search_sale > 0) {
599 $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).
")";
603$searchCategoryProductList = $search_product_category_array;
604if (!empty($searchCategoryProductList)) {
605 $searchCategoryProjectSqlList = array();
606 $listofcategoryid =
'';
607 foreach ($searchCategoryProductList as $searchCategoryProject) {
608 if (intval($searchCategoryProject) == -2) {
609 $searchCategoryProjectSqlList[] =
"NOT EXISTS (SELECT cp.fk_product FROM ".MAIN_DB_PREFIX.
"categorie_product as cp WHERE cdet.fk_product = cp.fk_product)";
610 } elseif (intval($searchCategoryProject) > 0) {
611 if ($searchCategoryProductOperator == 0) {
612 $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).
")";
614 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryProject);
618 if ($listofcategoryid) {
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 IN (".$db->sanitize($listofcategoryid).
"))";
621 if ($searchCategoryProductOperator == 1) {
622 if (!empty($searchCategoryProjectSqlList)) {
623 $sql .=
" AND (".implode(
' OR ', $searchCategoryProjectSqlList).
")";
626 if (!empty($searchCategoryProjectSqlList)) {
627 $sql .=
" AND (".implode(
' AND ', $searchCategoryProjectSqlList).
")";
633include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
636$parameters = array();
637$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters);
638$sql .= $hookmanager->resPrint;
641$parameters = array();
642$reshook = $hookmanager->executeHooks(
'printFieldListHaving', $parameters, $object);
643$sql .= empty($hookmanager->resPrint) ?
"" :
" HAVING 1=1 ".$hookmanager->resPrint;
645$sql .= $db->order($sortfield, $sortorder);
648$nbtotalofrecords =
'';
650 $result = $db->query($sql);
651 $nbtotalofrecords = $db->num_rows($result);
653 if (($page * $limit) > $nbtotalofrecords) {
659$sql .= $db->plimit($limit + 1, $offset);
662$resql = $db->query($sql);
667 $title = $langs->trans(
'ListOrderLigne').
' - '.$soc->name;
668 if (empty($search_company)) {
669 $search_company = $soc->name;
672 $title = $langs->trans(
'ListOrderLigne');
674 if (strval($search_status) ==
'0') {
675 $title .=
' - '.$langs->trans(
'StatusOrderDraftShort');
677 if ($search_status == 1) {
678 $title .=
' - '.$langs->trans(
'StatusOrderValidatedShort');
680 if ($search_status == 2) {
681 $title .=
' - '.$langs->trans(
'StatusOrderSentShort');
683 if ($search_status == 3) {
684 $title .=
' - '.$langs->trans(
'StatusOrderToBillShort');
686 if ($search_status == -1) {
687 $title .=
' - '.$langs->trans(
'StatusOrderCanceledShort');
689 if ($search_status == -2) {
690 $title .=
' - '.$langs->trans(
'StatusOrderToProcessShort');
692 if ($search_status == -3) {
693 $title .=
' - '.$langs->trans(
'StatusOrderValidated').
', '.(!isModEnabled(
'shipping') ?
'' : $langs->trans(
"StatusOrderSent").
', ').$langs->trans(
'StatusOrderToBill');
695 if ($search_status == -4) {
696 $title .=
' - '.$langs->trans(
"StatusOrderValidatedShort").
'+'.$langs->trans(
"StatusOrderSentShort");
699 $num = $db->num_rows($resql);
701 $arrayofselected = is_array($toselect) ? $toselect : array();
703 if ($num == 1 &&
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all) {
704 $obj = $db->fetch_object($resql);
706 header(
"Location: ".DOL_URL_ROOT.
'/commande/card.php?id='.$id);
710 llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-commande page-list_det');
714 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
715 $param .=
'&contextpage='.urlencode($contextpage);
717 if ($limit > 0 && $limit != $conf->liste_limit) {
718 $param .=
'&limit='.((int) $limit);
721 $param .=
'&search_all='.urlencode($search_all);
724 $param .=
'&socid='.urlencode((
string) ($socid));
727 $param .=
'&search_id='.urlencode($search_id);
730 if ($search_refProduct) {
731 $param .=
'&search_refProduct='.urlencode($search_refProduct);
733 if ($search_descProduct) {
734 $param .=
'&search_descProduct='.urlencode($search_descProduct);
736 if ($search_status !=
'') {
737 $param .=
'&search_status='.urlencode($search_status);
739 if ($search_datecloture_start) {
740 $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');
742 if ($search_datecloture_end) {
743 $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');
745 if ($search_dateorder_start) {
746 $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');
748 if ($search_dateorder_end) {
749 $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');
751 if ($search_datedelivery_start) {
752 $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');
754 if ($search_datedelivery_end) {
755 $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');
758 $param .=
'&search_ref='.urlencode($search_ref);
760 if ($search_company) {
761 $param .=
'&search_company='.urlencode($search_company);
763 if ($search_company_alias) {
764 $param .=
'&search_company_alias='.urlencode($search_company_alias);
766 if ($search_ref_customer) {
767 $param .=
'&search_ref_customer='.urlencode($search_ref_customer);
769 if ($search_user > 0) {
770 $param .=
'&search_user='.urlencode((
string) ($search_user));
772 if ($search_sale > 0) {
773 $param .=
'&search_sale='.urlencode($search_sale);
775 if ($search_total_ht !=
'') {
776 $param .=
'&search_total_ht='.urlencode($search_total_ht);
778 if ($search_total_vat !=
'') {
779 $param .=
'&search_total_vat='.urlencode($search_total_vat);
781 if ($search_total_ttc !=
'') {
782 $param .=
'&search_total_ttc='.urlencode($search_total_ttc);
784 if ($search_warehouse !=
'') {
785 $param .=
'&search_warehouse='.urlencode((
string) ($search_warehouse));
788 $param .=
'&search_login='.urlencode($search_login);
790 if ($search_multicurrency_code !=
'') {
791 $param .=
'&search_multicurrency_code='.urlencode($search_multicurrency_code);
793 if ($search_multicurrency_tx !=
'') {
794 $param .=
'&search_multicurrency_tx='.urlencode($search_multicurrency_tx);
796 if ($search_multicurrency_montant_ht !=
'') {
797 $param .=
'&search_multicurrency_montant_ht='.urlencode($search_multicurrency_montant_ht);
799 if ($search_multicurrency_montant_vat !=
'') {
800 $param .=
'&search_multicurrency_montant_vat='.urlencode($search_multicurrency_montant_vat);
802 if ($search_multicurrency_montant_ttc !=
'') {
803 $param .=
'&search_multicurrency_montant_ttc='.urlencode($search_multicurrency_montant_ttc);
805 if ($search_project_ref >= 0) {
806 $param .=
"&search_project_ref=".urlencode($search_project_ref);
808 if ($search_town !=
'') {
809 $param .=
'&search_town='.urlencode($search_town);
811 if ($search_zip !=
'') {
812 $param .=
'&search_zip='.urlencode($search_zip);
814 if ($search_state !=
'') {
815 $param .=
'&search_state='.urlencode($search_state);
817 if ($search_country !=
'') {
818 $param .=
'&search_country='.urlencode((
string) ($search_country));
820 if ($search_type_thirdparty && $search_type_thirdparty !=
'-1') {
821 $param .=
'&search_type_thirdparty='.urlencode((
string) ($search_type_thirdparty));
823 if (!empty($search_product_category_array)) {
824 foreach ($search_product_category_array as $tmpval) {
825 $param .=
'&search_categegory_product_list[]='.urlencode($tmpval);
828 if (($search_categ_cus > 0) || ($search_categ_cus == -2)) {
829 $param .=
'&search_categ_cus='.urlencode((
string) ($search_categ_cus));
832 $param .=
'&show_files='.urlencode((
string) ($show_files));
834 if ($optioncss !=
'') {
835 $param .=
'&optioncss='.urlencode($optioncss);
837 if ($search_billed !=
'') {
838 $param .=
'&search_billed='.urlencode($search_billed);
840 if ($search_fk_cond_reglement > 0) {
841 $param .=
'&search_fk_cond_reglement='.urlencode((
string) ($search_fk_cond_reglement));
843 if ($search_fk_shipping_method > 0) {
844 $param .=
'&search_fk_shipping_method='.urlencode((
string) ($search_fk_shipping_method));
846 if ($search_fk_mode_reglement > 0) {
847 $param .=
'&search_fk_mode_reglement='.urlencode((
string) ($search_fk_mode_reglement));
849 if ($search_fk_input_reason > 0) {
850 $param .=
'&search_fk_input_reason='.urlencode((
string) ($search_fk_input_reason));
852 if (!empty($productobuy)) {
853 $param .=
'&productobuy='.urlencode($productobuy);
855 if (!empty($productonly)) {
856 $param .=
'&productonly='.urlencode($productonly);
858 if (!empty($disablelinefree)) {
859 $param .=
'&disablelinefree='.urlencode($disablelinefree);
863 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
866 $parameters = array(
'param' => &$param);
867 $reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object);
868 $param .= $hookmanager->resPrint;
871 $arrayofmassactions = array(
878 $massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
880 $url = DOL_URL_ROOT.
'/commande/card.php?action=create';
881 if (!empty($socid)) {
882 $url .=
'&socid='.$socid;
887 print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">';
888 if ($optioncss !=
'') {
889 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
891 print
'<input type="hidden" name="token" value="'.newToken().
'">';
892 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
893 print
'<input type="hidden" name="action" value="list">';
894 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
895 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
896 print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
897 print
'<input type="hidden" name="search_status" value="'.$search_status.
'">';
898 print
'<input type="hidden" name="socid" value="'.$socid.
'">';
900 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'order', 0, $newcardbutton,
'', $limit, 0, 0, 1);
902 $topicmail =
"SendOrderRef";
903 $modelmail =
"order_send";
905 $trackid =
'ord'.$object->id;
906 include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
909 foreach ($fieldstosearchall as $key => $val) {
910 $fieldstosearchall[$key] = $langs->trans($val);
912 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>';
917 $moreforfilter .=
'<div class="divsearchfield">';
918 $moreforfilter .=
'<input type="checkbox" id="productobuy" name="productobuy"'.(!empty($productobuy) ?
'value="productobuychecked" checked' :
'').
'><label for="productobuy">'.$langs->trans(
"productobuy").
'</label>';
919 $moreforfilter .=
'</div>';
920 $moreforfilter .=
'<div class="divsearchfield">';
921 $moreforfilter .=
'<input type="checkbox" id="productonly" name="productonly"'.(!empty($productonly) ?
'value="productonlychecked" checked' :
'').
'><label for="productonly">'.$langs->trans(
"productonly").
'</label>';
922 $moreforfilter .=
'</div>';
923 $moreforfilter .=
'<div class="divsearchfield">';
924 $moreforfilter .=
'<input type="checkbox" id="disablelinefree" name="disablelinefree"'.(!empty($disablelinefree) ?
'value="disablelinefreechecked" checked' :
'').
'><label for="disablelinefree">'.$langs->trans(
"disablelinefree").
'</label>';
925 $moreforfilter .=
'</div><br>';
928 if ($user->hasRight(
'user',
'user',
'lire')) {
929 $langs->load(
"commercial");
930 $moreforfilter .=
'<div class="divsearchfield">';
931 $tmptitle = $langs->trans(
'ThirdPartiesOfSaleRepresentative');
932 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale,
'search_sale', $user, 0, $tmptitle,
'maxwidth250 widthcentpercentminusx');
933 $moreforfilter .=
'</div>';
936 if ($user->hasRight(
'user',
'user',
'lire')) {
937 $moreforfilter .=
'<div class="divsearchfield">';
938 $tmptitle = $langs->trans(
'LinkedToSpecificUsers');
939 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$form->select_dolusers($search_user,
'search_user', $tmptitle,
'', 0,
'',
'', 0, 0, 0,
'', 0,
'',
'maxwidth250 widthcentpercentminusx');
940 $moreforfilter .=
'</div>';
943 if (isModEnabled(
"category") && $user->hasRight(
'categorie',
'lire') && ($user->hasRight(
'produit',
'lire') || $user->hasRight(
'service',
'lire'))) {
945 $moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_PRODUCT, $search_product_category_array,
'minwidth300imp minwidth300', $searchCategoryProductOperator ? $searchCategoryProductOperator : 0);
947 if (isModEnabled(
"category") && $user->hasRight(
'categorie',
'lire')) {
948 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
949 $moreforfilter .=
'<div class="divsearchfield">';
950 $tmptitle = $langs->trans(
'CustomersProspectsCategoriesShort');
951 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"').$formother->select_categories(
'customer', $search_categ_cus,
'search_categ_cus', 1, $tmptitle,
'maxwidth300 widthcentpercentminusx');
952 $moreforfilter .=
'</div>';
954 if (isModEnabled(
'stock') &&
getDolGlobalString(
'WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER')) {
955 require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
957 $moreforfilter .=
'<div class="divsearchfield">';
958 $tmptitle = $langs->trans(
'Warehouse');
959 $moreforfilter .=
img_picto($tmptitle,
'stock',
'class="pictofixedwidth"').$formproduct->selectWarehouses($search_warehouse,
'search_warehouse',
'', 1, 0, 0, $tmptitle, 0, 0, array(),
'maxwidth250 widthcentpercentminusx');
960 $moreforfilter .=
'</div>';
964 $parameters = array();
965 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
966 if (empty($reshook)) {
967 $moreforfilter .= $hookmanager->resPrint;
969 $moreforfilter = $hookmanager->resPrint;
972 if (!empty($moreforfilter)) {
973 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
974 print $moreforfilter;
978 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
979 $selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
980 $selectedfields .= $form->showCheckAddButtons(
'checkforselect', 1);
983 $selectedfields .=
'<script>';
984 $selectedfields .=
' $(document).ready(function() {';
985 $selectedfields .=
' console.log("Autoclick on checkforselects");';
986 $selectedfields .=
' $("#checkforselects").click();';
987 $selectedfields .=
' $("#massaction").val("createbills").change();';
988 $selectedfields .=
' });';
989 $selectedfields .=
'</script>';
992 print
'<div class="div-table-responsive">';
993 print
'<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
995 print
'<tr class="liste_titre_filter">';
999 print
'<td class="liste_titre" align="middle">';
1000 $searchpicto = $form->showFilterButtons(
'left');
1005 if (!empty($arrayfields[
'rowid'][
'checked'])) {
1006 print
'<td class="liste_titre" data-key="id">';
1007 print
'<input class="flat searchstring" type="text" name="search_id" size="1" value="'.dol_escape_htmltag($search_id).
'">';
1011 if (!empty($arrayfields[
'pr.ref'][
'checked'])) {
1012 print
'<td class="liste_titre">';
1013 print
'<input class="flat" size="6" type="text" name="search_refProduct" value="'.dol_escape_htmltag($search_refProduct).
'">';
1017 if (!empty($arrayfields[
'pr.desc'][
'checked'])) {
1018 print
'<td class="liste_titre">';
1019 print
'<input class="flat" size="6" type="text" name="search_descProduct" value="'.dol_escape_htmltag($search_descProduct).
'">';
1023 if (!empty($arrayfields[
'cdet.qty'][
'checked'])) {
1024 print
'<td class="liste_titre"></td>';
1028 if (!empty($arrayfields[
'c.ref'][
'checked'])) {
1029 print
'<td class="liste_titre">';
1030 print
'<input class="flat" size="6" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
1034 if (!empty($arrayfields[
'c.ref_client'][
'checked'])) {
1035 print
'<td class="liste_titre" align="left">';
1036 print
'<input class="flat" type="text" size="6" name="search_ref_customer" value="'.dol_escape_htmltag($search_ref_customer).
'">';
1040 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1041 print
'<td class="liste_titre"><input type="text" class="flat" size="6" name="search_project_ref" value="'.dol_escape_htmltag($search_project_ref).
'"></td>';
1044 if (!empty($arrayfields[
'p.title'][
'checked'])) {
1045 print
'<td class="liste_titre"><input type="text" class="flat" size="6" name="search_project" value="'.dol_escape_htmltag($search_project).
'"></td>';
1048 if (!empty($arrayfields[
's.nom'][
'checked'])) {
1049 print
'<td class="liste_titre" align="left">';
1050 print
'<input class="flat maxwidth100" type="text" name="search_company" value="'.dol_escape_htmltag($search_company).
'">';
1054 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1055 print
'<td class="liste_titre" align="left">';
1056 print
'<input class="flat maxwidth100" type="text" name="search_company_alias" value="'.dol_escape_htmltag($search_company_alias).
'">';
1060 if (!empty($arrayfields[
's.town'][
'checked'])) {
1061 print
'<td class="liste_titre"><input class="flat" type="text" size="4" name="search_town" value="'.dol_escape_htmltag($search_town).
'"></td>';
1064 if (!empty($arrayfields[
's.zip'][
'checked'])) {
1065 print
'<td class="liste_titre"><input class="flat" type="text" size="4" name="search_zip" value="'.dol_escape_htmltag($search_zip).
'"></td>';
1068 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1069 print
'<td class="liste_titre">';
1070 print
'<input class="flat" size="4" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).
'">';
1074 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1075 print
'<td class="liste_titre" align="center">';
1076 print $form->select_country($search_country,
'search_country',
'', 0,
'minwidth100imp maxwidth100');
1080 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1081 print
'<td class="liste_titre maxwidthonsmartphone" align="center">';
1082 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);
1086 if (!empty($arrayfields[
'c.date_commande'][
'checked'])) {
1087 print
'<td class="liste_titre center">';
1088 print
'<div class="nowrapfordate">';
1089 print $form->selectDate($search_dateorder_start ? $search_dateorder_start : -1,
'search_dateorder_start_', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1091 print
'<div class="nowrapfordate">';
1092 print $form->selectDate($search_dateorder_end ? $search_dateorder_end : -1,
'search_dateorder_end_', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1096 if (!empty($arrayfields[
'c.date_delivery'][
'checked'])) {
1097 print
'<td class="liste_titre center">';
1098 print
'<div class="nowrapfordate">';
1099 print $form->selectDate($search_datedelivery_start ? $search_datedelivery_start : -1,
'search_datedelivery_start_', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1101 print
'<div class="nowrapfordate">';
1102 print $form->selectDate($search_datedelivery_end ? $search_datedelivery_end : -1,
'search_datedelivery_end_', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1107 if (!empty($arrayfields[
'c.fk_shipping_method'][
'checked'])) {
1108 print
'<td class="liste_titre">';
1109 $form->selectShippingMethod($search_fk_shipping_method,
'search_fk_shipping_method',
'', 1,
'', 1);
1113 if (!empty($arrayfields[
'c.fk_cond_reglement'][
'checked'])) {
1114 print
'<td class="liste_titre">';
1115 print $form->getSelectConditionsPaiements($search_fk_cond_reglement,
'search_fk_cond_reglement', 1, 1, 1);
1119 if (!empty($arrayfields[
'c.fk_mode_reglement'][
'checked'])) {
1120 print
'<td class="liste_titre">';
1121 $form->select_types_paiements($search_fk_mode_reglement,
'search_fk_mode_reglement',
'', 0, 1, 1, 0, -1);
1125 if (!empty($arrayfields[
'c.fk_input_reason'][
'checked'])) {
1126 print
'<td class="liste_titre">';
1127 $form->selectInputReason($search_fk_input_reason,
'search_fk_input_reason',
'', 1,
'', 1);
1130 if (!empty($arrayfields[
'cdet.total_ht'][
'checked'])) {
1132 print
'<td class="liste_titre right">';
1133 print
'<input class="flat" type="text" size="4" name="search_total_ht" value="'.dol_escape_htmltag($search_total_ht).
'">';
1136 if (!empty($arrayfields[
'c.total_vat'][
'checked'])) {
1138 print
'<td class="liste_titre right">';
1139 print
'<input class="flat" type="text" size="4" name="search_total_vat" value="'.dol_escape_htmltag($search_total_vat).
'">';
1142 if (!empty($arrayfields[
'cdet.total_ttc'][
'checked'])) {
1144 print
'<td class="liste_titre right">';
1145 print
'<input class="flat" type="text" size="5" name="search_total_ttc" value="'.$search_total_ttc.
'">';
1148 if (!empty($arrayfields[
'c.fk_warehouse'][
'checked'])) {
1150 print
'<td class="liste_titre right"></td>';
1152 if (!empty($arrayfields[
'c.multicurrency_code'][
'checked'])) {
1154 print
'<td class="liste_titre">';
1155 print $form->selectMultiCurrency($search_multicurrency_code,
'search_multicurrency_code', 1);
1158 if (!empty($arrayfields[
'c.multicurrency_tx'][
'checked'])) {
1160 print
'<td class="liste_titre">';
1161 print
'<input class="flat" type="text" size="4" name="search_multicurrency_tx" value="'.dol_escape_htmltag($search_multicurrency_tx).
'">';
1164 if (!empty($arrayfields[
'c.multicurrency_total_ht'][
'checked'])) {
1166 print
'<td class="liste_titre right">';
1167 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ht" value="'.dol_escape_htmltag($search_multicurrency_montant_ht).
'">';
1170 if (!empty($arrayfields[
'c.multicurrency_total_vat'][
'checked'])) {
1172 print
'<td class="liste_titre right">';
1173 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_vat" value="'.dol_escape_htmltag($search_multicurrency_montant_vat).
'">';
1176 if (!empty($arrayfields[
'c.multicurrency_total_ttc'][
'checked'])) {
1178 print
'<td class="liste_titre right">';
1179 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ttc" value="'.dol_escape_htmltag($search_multicurrency_montant_ttc).
'">';
1182 if (!empty($arrayfields[
'u.login'][
'checked'])) {
1184 print
'<td class="liste_titre" align="center">';
1185 print
'<input class="flat" size="4" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).
'">';
1188 if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
1189 print
'<td class="liste_titre"></td>';
1191 if (!empty($arrayfields[
'total_pa'][
'checked'])) {
1192 print
'<td class="liste_titre right">';
1195 if (!empty($arrayfields[
'total_margin'][
'checked'])) {
1196 print
'<td class="liste_titre right">';
1199 if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
1200 print
'<td class="liste_titre right">';
1203 if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
1204 print
'<td class="liste_titre right">';
1208 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
1210 $parameters = array(
'arrayfields' => $arrayfields);
1211 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters);
1212 print $hookmanager->resPrint;
1214 if (!empty($arrayfields[
'c.datec'][
'checked'])) {
1215 print
'<td class="liste_titre">';
1219 if (!empty($arrayfields[
'c.tms'][
'checked'])) {
1220 print
'<td class="liste_titre">';
1224 if (!empty($arrayfields[
'c.date_cloture'][
'checked'])) {
1225 print
'<td class="liste_titre center">';
1226 print
'<div class="nowrapfordate">';
1227 print $form->selectDate($search_datecloture_start ? $search_datecloture_start : -1,
'search_datecloture_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1229 print
'<div class="nowrapfordate">';
1230 print $form->selectDate($search_datecloture_end ? $search_datecloture_end : -1,
'search_datecloture_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1235 if (!empty($arrayfields[
'c.note_public'][
'checked'])) {
1236 print
'<td class="liste_titre">';
1240 if (!empty($arrayfields[
'c.note_private'][
'checked'])) {
1241 print
'<td class="liste_titre">';
1245 if (!empty($arrayfields[
'shippable'][
'checked'])) {
1246 print
'<td class="liste_titre maxwidthonsmartphone" align="center">';
1249 print
'<input type="checkbox" name="show_shippable_command" value="1"'.($show_shippable_command ?
' checked' :
'').
'>';
1250 print $langs->trans(
'ShowShippableStatus');
1252 $show_shippable_command = 1;
1257 if (!empty($arrayfields[
'c.facture'][
'checked'])) {
1258 print
'<td class="liste_titre maxwidthonsmartphone" align="center">';
1259 print $form->selectyesno(
'search_billed', $search_billed, 1, 0, 1, 1);
1263 if (!empty($arrayfields[
'c.import_key'][
'checked'])) {
1264 print
'<td class="liste_titre maxwidthonsmartphone" align="center">';
1268 if (!empty($arrayfields[
'c.fk_statut'][
'checked'])) {
1269 print
'<td class="liste_titre maxwidthonsmartphone center">';
1270 $liststatus = array(
1274 -2 => $langs->trans(
"StatusOrderValidatedShort").
'+'.$langs->trans(
"StatusOrderSentShort"),
1275 -3 => $langs->trans(
"StatusOrderValidatedShort").
'+'.$langs->trans(
"StatusOrderSentShort").
'+'.$langs->trans(
"StatusOrderDelivered"),
1280 print $form->selectarray(
'search_status', $liststatus, $search_status, -5, 0, 0,
'', 0, 0, 0,
'',
'maxwidth125', 1);
1285 print
'<td class="liste_titre" align="middle">';
1286 $searchpicto = $form->showFilterButtons();
1293 print
'<tr class="liste_titre">';
1296 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'', $param,
'', $sortfield, $sortorder,
'maxwidthsearch center ');
1300 if (!empty($arrayfields[
'rowid'][
'checked'])) {
1301 print_liste_field_titre($arrayfields[
'rowid'][
'label'], $_SERVER[
"PHP_SELF"],
'rowid',
'', $param,
'', $sortfield, $sortorder);
1302 '@phan-var-force array<string,array{label:string,checked?:int<0,1>,position?:int,help?:string}> $arrayfields';
1304 if (!empty($arrayfields[
'pr.ref'][
'checked'])) {
1305 print_liste_field_titre($arrayfields[
'pr.ref'][
'label'], $_SERVER[
"PHP_SELF"],
'pr.ref',
'', $param,
'', $sortfield, $sortorder);
1307 if (!empty($arrayfields[
'pr.desc'][
'checked'])) {
1308 print_liste_field_titre($arrayfields[
'pr.desc'][
'label'], $_SERVER[
"PHP_SELF"],
'pr.desc',
'', $param,
'', $sortfield, $sortorder);
1310 if (!empty($arrayfields[
'cdet.qty'][
'checked'])) {
1311 print_liste_field_titre($arrayfields[
'cdet.qty'][
'label'], $_SERVER[
"PHP_SELF"],
'cdet.qty',
'', $param,
'', $sortfield, $sortorder);
1314 if (!empty($arrayfields[
'c.ref'][
'checked'])) {
1315 print_liste_field_titre($arrayfields[
'c.ref'][
'label'], $_SERVER[
"PHP_SELF"],
'c.ref',
'', $param,
'', $sortfield, $sortorder);
1317 if (!empty($arrayfields[
'c.ref_client'][
'checked'])) {
1318 print_liste_field_titre($arrayfields[
'c.ref_client'][
'label'], $_SERVER[
"PHP_SELF"],
'c.ref_client',
'', $param,
'', $sortfield, $sortorder);
1320 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1321 print_liste_field_titre($arrayfields[
'p.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"p.ref",
"", $param,
'', $sortfield, $sortorder);
1323 if (!empty($arrayfields[
'p.title'][
'checked'])) {
1324 print_liste_field_titre($arrayfields[
'p.title'][
'label'], $_SERVER[
"PHP_SELF"],
"p.title",
"", $param,
'', $sortfield, $sortorder);
1326 if (!empty($arrayfields[
's.nom'][
'checked'])) {
1327 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
"PHP_SELF"],
's.nom',
'', $param,
'', $sortfield, $sortorder);
1329 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1330 print_liste_field_titre($arrayfields[
's.name_alias'][
'label'], $_SERVER[
"PHP_SELF"],
's.name_alias',
'', $param,
'', $sortfield, $sortorder);
1332 if (!empty($arrayfields[
's.town'][
'checked'])) {
1333 print_liste_field_titre($arrayfields[
's.town'][
'label'], $_SERVER[
"PHP_SELF"],
's.town',
'', $param,
'', $sortfield, $sortorder);
1335 if (!empty($arrayfields[
's.zip'][
'checked'])) {
1336 print_liste_field_titre($arrayfields[
's.zip'][
'label'], $_SERVER[
"PHP_SELF"],
's.zip',
'', $param,
'', $sortfield, $sortorder);
1338 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1339 print_liste_field_titre($arrayfields[
'state.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"state.nom",
"", $param,
'', $sortfield, $sortorder);
1341 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1342 print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'], $_SERVER[
"PHP_SELF"],
"country.code_iso",
"", $param,
'', $sortfield, $sortorder,
'center ');
1344 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1345 print_liste_field_titre($arrayfields[
'typent.code'][
'label'], $_SERVER[
"PHP_SELF"],
"typent.code",
"", $param,
'', $sortfield, $sortorder,
'center ');
1347 if (!empty($arrayfields[
'c.date_commande'][
'checked'])) {
1348 print_liste_field_titre($arrayfields[
'c.date_commande'][
'label'], $_SERVER[
"PHP_SELF"],
'c.date_commande',
'', $param,
'', $sortfield, $sortorder,
'center ');
1350 if (!empty($arrayfields[
'c.date_delivery'][
'checked'])) {
1351 print_liste_field_titre($arrayfields[
'c.date_delivery'][
'label'], $_SERVER[
"PHP_SELF"],
'c.date_livraison',
'', $param,
'', $sortfield, $sortorder,
'center ');
1353 if (!empty($arrayfields[
'c.fk_shipping_method'][
'checked'])) {
1354 print_liste_field_titre($arrayfields[
'c.fk_shipping_method'][
'label'], $_SERVER[
"PHP_SELF"],
"c.fk_shipping_method",
"", $param,
'', $sortfield, $sortorder);
1356 if (!empty($arrayfields[
'c.fk_cond_reglement'][
'checked'])) {
1357 print_liste_field_titre($arrayfields[
'c.fk_cond_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"c.fk_cond_reglement",
"", $param,
'', $sortfield, $sortorder);
1359 if (!empty($arrayfields[
'c.fk_mode_reglement'][
'checked'])) {
1360 print_liste_field_titre($arrayfields[
'c.fk_mode_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"c.fk_mode_reglement",
"", $param,
'', $sortfield, $sortorder);
1362 if (!empty($arrayfields[
'c.fk_input_reason'][
'checked'])) {
1363 print_liste_field_titre($arrayfields[
'c.fk_input_reason'][
'label'], $_SERVER[
"PHP_SELF"],
"c.fk_input_reason",
"", $param,
'', $sortfield, $sortorder);
1365 if (!empty($arrayfields[
'cdet.total_ht'][
'checked'])) {
1366 print_liste_field_titre($arrayfields[
'cdet.total_ht'][
'label'], $_SERVER[
"PHP_SELF"],
'cdet.total_ht',
'', $param,
'', $sortfield, $sortorder,
'right ');
1368 if (!empty($arrayfields[
'c.total_vat'][
'checked'])) {
1369 print_liste_field_titre($arrayfields[
'c.total_vat'][
'label'], $_SERVER[
"PHP_SELF"],
'cdet.total_tva',
'', $param,
'', $sortfield, $sortorder,
'right ');
1371 if (!empty($arrayfields[
'cdet.total_ttc'][
'checked'])) {
1372 print_liste_field_titre($arrayfields[
'cdet.total_ttc'][
'label'], $_SERVER[
"PHP_SELF"],
'cdet.total_ttc',
'', $param,
'', $sortfield, $sortorder,
'right ');
1374 if (!empty($arrayfields[
'c.fk_warehouse'][
'checked'])) {
1375 print_liste_field_titre($arrayfields[
'c.fk_warehouse'][
'label'],
"",
'',
'', $param,
'', $sortfield, $sortorder);
1377 if (!empty($arrayfields[
'c.multicurrency_code'][
'checked'])) {
1378 print_liste_field_titre($arrayfields[
'c.multicurrency_code'][
'label'], $_SERVER[
'PHP_SELF'],
'c.multicurrency_code',
'', $param,
'', $sortfield, $sortorder);
1380 if (!empty($arrayfields[
'c.multicurrency_tx'][
'checked'])) {
1381 print_liste_field_titre($arrayfields[
'c.multicurrency_tx'][
'label'], $_SERVER[
'PHP_SELF'],
'c.multicurrency_tx',
'', $param,
'', $sortfield, $sortorder);
1383 if (!empty($arrayfields[
'c.multicurrency_total_ht'][
'checked'])) {
1384 print_liste_field_titre($arrayfields[
'c.multicurrency_total_ht'][
'label'], $_SERVER[
'PHP_SELF'],
'c.multicurrency_total_ht',
'', $param,
'class="right"', $sortfield, $sortorder);
1386 if (!empty($arrayfields[
'c.multicurrency_total_vat'][
'checked'])) {
1387 print_liste_field_titre($arrayfields[
'c.multicurrency_total_vat'][
'label'], $_SERVER[
'PHP_SELF'],
'c.multicurrency_total_tva',
'', $param,
'class="right"', $sortfield, $sortorder);
1389 if (!empty($arrayfields[
'c.multicurrency_total_ttc'][
'checked'])) {
1390 print_liste_field_titre($arrayfields[
'c.multicurrency_total_ttc'][
'label'], $_SERVER[
'PHP_SELF'],
'c.multicurrency_total_ttc',
'', $param,
'class="right"', $sortfield, $sortorder);
1392 if (!empty($arrayfields[
'u.login'][
'checked'])) {
1393 print_liste_field_titre($arrayfields[
'u.login'][
'label'], $_SERVER[
"PHP_SELF"],
'u.login',
'', $param,
'align="center"', $sortfield, $sortorder);
1395 if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
1396 print_liste_field_titre($arrayfields[
'sale_representative'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"",
"$param",
'', $sortfield, $sortorder);
1398 if (!empty($arrayfields[
'total_pa'][
'checked'])) {
1399 print_liste_field_titre($arrayfields[
'total_pa'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1401 if (!empty($arrayfields[
'total_margin'][
'checked'])) {
1402 print_liste_field_titre($arrayfields[
'total_margin'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1404 if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
1405 print_liste_field_titre($arrayfields[
'total_margin_rate'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1407 if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
1408 print_liste_field_titre($arrayfields[
'total_mark_rate'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1411 $totalarray = array(
1414 'cdet.total_ht' => 0,
1415 'cdet.total_tva' => 0,
1416 'cdet.total_ttc' => 0,
1421 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1423 $parameters = array(
1424 'arrayfields' => $arrayfields,
1426 'sortfield' => $sortfield,
1427 'sortorder' => $sortorder,
1428 'totalarray' => &$totalarray,
1430 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters);
1431 print $hookmanager->resPrint;
1432 if (!empty($arrayfields[
'c.datec'][
'checked'])) {
1433 print_liste_field_titre($arrayfields[
'c.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"c.date_creation",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1435 if (!empty($arrayfields[
'c.tms'][
'checked'])) {
1436 print_liste_field_titre($arrayfields[
'c.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"c.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1438 if (!empty($arrayfields[
'c.date_cloture'][
'checked'])) {
1439 print_liste_field_titre($arrayfields[
'c.date_cloture'][
'label'], $_SERVER[
"PHP_SELF"],
"c.date_cloture",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1441 if (!empty($arrayfields[
'c.note_public'][
'checked'])) {
1442 print_liste_field_titre($arrayfields[
'c.note_public'][
'label'], $_SERVER[
"PHP_SELF"],
"c.note_public",
"", $param,
'', $sortfield, $sortorder,
'right ');
1444 if (!empty($arrayfields[
'c.note_private'][
'checked'])) {
1445 print_liste_field_titre($arrayfields[
'c.note_private'][
'label'], $_SERVER[
"PHP_SELF"],
"c.note_private",
"", $param,
'', $sortfield, $sortorder,
'right ');
1447 if (!empty($arrayfields[
'shippable'][
'checked'])) {
1448 print_liste_field_titre($arrayfields[
'shippable'][
'label'], $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'center ');
1450 if (!empty($arrayfields[
'c.facture'][
'checked'])) {
1451 print_liste_field_titre($arrayfields[
'c.facture'][
'label'], $_SERVER[
"PHP_SELF"],
'c.facture',
'', $param,
'', $sortfield, $sortorder,
'center ');
1453 if (!empty($arrayfields[
'c.import_key'][
'checked'])) {
1454 print_liste_field_titre($arrayfields[
'c.import_key'][
'label'], $_SERVER[
"PHP_SELF"],
"c.import_key",
"", $param,
'', $sortfield, $sortorder,
'center ');
1456 if (!empty($arrayfields[
'c.fk_statut'][
'checked'])) {
1457 print_liste_field_titre($arrayfields[
'c.fk_statut'][
'label'], $_SERVER[
"PHP_SELF"],
"c.fk_statut",
"", $param,
'', $sortfield, $sortorder,
'center ');
1460 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'', $param,
'', $sortfield, $sortorder,
'maxwidthsearch center ');
1466 $productstat_cache = array();
1467 $productstat_cachevirtual = array();
1468 $getNomUrl_cache = array();
1470 $generic_commande =
new Commande($db);
1471 $generic_product =
new Product($db);
1472 $userstatic =
new User($db);
1475 $with_margin_info =
false;
1476 if (isModEnabled(
'margin') && (
1477 !empty($arrayfields[
'total_pa'][
'checked'])
1478 || !empty($arrayfields[
'total_margin'][
'checked'])
1479 || !empty($arrayfields[
'total_margin_rate'][
'checked'])
1480 || !empty($arrayfields[
'total_mark_rate'][
'checked'])
1483 $with_margin_info =
true;
1492 $totalarray = array();
1493 $totalarray[
'nbfield'] = 0;
1494 $subtotalarray = array();
1495 $subtotalarray[
'nbfield'] = 0;
1496 $totalarray[
'val'][
'cdet.total_tva'] = 0;
1497 $totalarray[
'val'][
'cdet.total_ttc'] = 0;
1498 $imaxinloop = ($limit ? min($num, $limit) : $num);
1499 while ($i < $imaxinloop) {
1500 $obj = $db->fetch_object($resql);
1510 $oldref = $obj->product_ref;
1512 if ($oldref != $obj->product_ref && $sortfield ==
'pr.ref') {
1513 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_subtotal.tpl.php';
1514 $oldref = $obj->product_ref;
1517 $companystatic->id = $obj->socid;
1518 $companystatic->name = $obj->name;
1519 $companystatic->name_alias = $obj->alias;
1520 $companystatic->client = $obj->client;
1521 $companystatic->code_client = $obj->code_client;
1522 $companystatic->email = $obj->email;
1523 $companystatic->phone = $obj->phone;
1524 $companystatic->address = $obj->address;
1525 $companystatic->zip = $obj->zip;
1526 $companystatic->town = $obj->town;
1527 $companystatic->country_code = $obj->country_code;
1528 if (!isset($getNomUrl_cache[$obj->socid])) {
1529 $getNomUrl_cache[$obj->socid] = $companystatic->getNomUrl(1,
'customer');
1532 $generic_commande->id = $obj->c_rowid;
1533 $generic_commande->ref = $obj->ref;
1534 $generic_commande->statut = $obj->fk_statut;
1535 $generic_commande->billed = $obj->billed;
1536 $generic_commande->date = $db->jdate($obj->date_commande);
1537 $generic_commande->delivery_date = $db->jdate($obj->date_delivery);
1538 $generic_commande->ref_client = $obj->ref_client;
1539 $generic_commande->total_ht = $obj->c_total_ht;
1540 $generic_commande->total_tva = $obj->c_total_tva;
1541 $generic_commande->total_ttc = $obj->c_total_ttc;
1542 $generic_commande->note_public = $obj->note_public;
1543 $generic_commande->note_private = $obj->note_private;
1545 $projectstatic->id = $obj->project_id;
1546 $projectstatic->ref = $obj->project_ref;
1547 $projectstatic->title = $obj->project_label;
1549 $marginInfo = array();
1550 if ($with_margin_info ===
true) {
1551 $generic_commande->fetch_lines();
1552 $marginInfo = $formmargin->getMarginInfosArray($generic_commande);
1553 $total_ht += $obj->total_ht;
1554 $total_margin += $marginInfo[
'total_margin'];
1557 print
'<tr class="oddeven">';
1561 print
'<td class="nowrap center">';
1562 if ($massactionbutton || $massaction) {
1564 if (in_array($obj->rowid, $arrayofselected)) {
1567 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1571 $totalarray[
'nbfield']++;
1577 if (!empty($arrayfields[
'rowid'][
'checked'])) {
1578 print
'<td class="nowrap right">'.$obj->rowid.
'</td>';
1580 $totalarray[
'nbfield']++;
1585 if (!empty($arrayfields[
'pr.ref'][
'checked'])) {
1586 if (!empty($obj->product_rowid)) {
1587 $generic_product->id = $obj->product_rowid;
1588 $generic_product->ref = $obj->product_ref;
1589 $generic_product->label = $obj->product_label;
1590 $generic_product->status = $obj->product_status;
1591 $generic_product->status_buy = $obj->product_status_buy;
1592 $generic_product->status_batch = $obj->product_batch;
1593 $generic_product->barcode = $obj->product_barcode;
1594 print
'<td class="nowrap tdoverflowmax200">'.$generic_product->getNomUrl(1).
'</td>';
1596 print
'<td class="nowrap tdoverflowmax200">Ligne libre</td>';
1599 $totalarray[
'nbfield']++;
1603 if (!empty($arrayfields[
'pr.desc'][
'checked'])) {
1605 !empty($obj->product_label) ? $labelproduct = $obj->product_label : $labelproduct = $obj->description;
1606 print
'<td class="nowrap tdoverflowmax200">';
1611 $totalarray[
'nbfield']++;
1615 if (!empty($arrayfields[
'cdet.qty'][
'checked'])) {
1616 print
'<td class="nowrap right">'.$obj->qty.
'</td>';
1617 if (isset($totalarray[
'val'][
'cdet.qty']) || isset($subtotalarray[
'val'][
'cdet.qty'])) {
1618 $totalarray[
'val'][
'cdet.qty'] += $obj->qty;
1619 $subtotalarray[
'val'][
'cdet.qty'] += $obj->qty;
1621 $totalarray[
'val'][
'cdet.qty'] = $obj->qty;
1622 $subtotalarray[
'val'][
'cdet.qty'] = $obj->qty;
1625 $totalarray[
'nbfield']++;
1628 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'cdet.qty';
1629 $totalarray[
'pos'][$subtotalarray[
'nbfield']] =
'cdet.qty';
1634 if (!empty($arrayfields[
'c.ref'][
'checked'])) {
1635 print
'<td class="nowraponall">';
1636 print $generic_commande->getNomUrl(1, ($search_status != 2 ? 0 : $obj->fk_statut), 0, 0, 0, 1, 1);
1639 $filedir = $conf->commande->multidir_output[$conf->entity].
'/'.
dol_sanitizeFileName($obj->ref);
1640 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid;
1641 print $formfile->getDocumentsLink($generic_commande->element, $filename, $filedir);
1645 $totalarray[
'nbfield']++;
1650 if (!empty($arrayfields[
'c.ref_client'][
'checked'])) {
1651 print
'<td class="nowrap tdoverflowmax200">'.$obj->ref_client.
'</td>';
1653 $totalarray[
'nbfield']++;
1658 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1659 print
'<td class="nowrap">';
1660 if ($obj->project_id > 0) {
1661 print $projectstatic->getNomUrl(1);
1665 $totalarray[
'nbfield']++;
1670 if (!empty($arrayfields[
'p.title'][
'checked'])) {
1671 print
'<td class="nowrap">';
1672 if ($obj->project_id > 0) {
1673 print $projectstatic->title;
1677 $totalarray[
'nbfield']++;
1682 if (!empty($arrayfields[
's.nom'][
'checked'])) {
1683 print
'<td class="tdoverflowmax200">';
1684 print $getNomUrl_cache[$obj->socid];
1688 if ($user->hasRight(
'facture',
'creer')) {
1689 if (($obj->fk_statut > 0 && $obj->fk_statut < 3) || ($obj->fk_statut == 3 && $obj->billed == 0)) {
1690 print
' <a href="'.DOL_URL_ROOT.
'/commande/list.php?socid='.$companystatic->id.
'&search_billed=0&autoselectall=1">';
1691 print
img_picto($langs->trans(
"CreateInvoiceForThisCustomer").
' : '.$companystatic->name,
'object_bill',
'hideonsmartphone').
'</a>';
1697 $totalarray[
'nbfield']++;
1701 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1702 print
'<td class="nocellnopadd">';
1706 $totalarray[
'nbfield']++;
1710 if (!empty($arrayfields[
's.town'][
'checked'])) {
1711 print
'<td class="nocellnopadd">';
1715 $totalarray[
'nbfield']++;
1719 if (!empty($arrayfields[
's.zip'][
'checked'])) {
1720 print
'<td class="nocellnopadd">';
1724 $totalarray[
'nbfield']++;
1728 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1729 print
"<td>".$obj->state_name.
"</td>\n";
1731 $totalarray[
'nbfield']++;
1735 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1736 print
'<td class="center">';
1737 $tmparray =
getCountry($obj->fk_pays,
'all');
1738 print $tmparray[
'label'];
1741 $totalarray[
'nbfield']++;
1745 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1746 print
'<td class="center">';
1747 if (empty($typenArray)) {
1748 $typenArray = $formcompany->typent_array(1);
1750 print $typenArray[$obj->typent_code];
1753 $totalarray[
'nbfield']++;
1758 if (!empty($arrayfields[
'c.date_commande'][
'checked'])) {
1759 print
'<td class="center">';
1762 if ($generic_commande->hasDelay()) {
1763 print
img_picto($langs->trans(
"Late").
' : '.$generic_commande->showDelay(),
"warning");
1767 $totalarray[
'nbfield']++;
1771 if (!empty($arrayfields[
'c.date_delivery'][
'checked'])) {
1772 print
'<td class="center">';
1773 print
dol_print_date($db->jdate($obj->date_delivery),
'dayhour');
1776 $totalarray[
'nbfield']++;
1780 if (!empty($arrayfields[
'c.fk_shipping_method'][
'checked'])) {
1782 $form->formSelectShippingMethod(
'', $obj->fk_shipping_method,
'none', 1);
1785 $totalarray[
'nbfield']++;
1789 if (!empty($arrayfields[
'c.fk_cond_reglement'][
'checked'])) {
1791 $form->form_conditions_reglement($_SERVER[
'PHP_SELF'], $obj->fk_cond_reglement,
'none', 0,
'', 1, $obj->deposit_percent);
1794 $totalarray[
'nbfield']++;
1798 if (!empty($arrayfields[
'c.fk_mode_reglement'][
'checked'])) {
1800 $form->form_modes_reglement($_SERVER[
'PHP_SELF'], $obj->fk_mode_reglement,
'none',
'', -1);
1803 $totalarray[
'nbfield']++;
1807 if (!empty($arrayfields[
'c.fk_input_reason'][
'checked'])) {
1809 $form->formInputReason($_SERVER[
'PHP_SELF'], $obj->fk_input_reason,
'none',
'');
1812 $totalarray[
'nbfield']++;
1816 if (!empty($arrayfields[
'cdet.total_ht'][
'checked'])) {
1817 print
'<td class="nowrap right"><span class="amount">'.price($obj->total_ht).
"</span></td>\n";
1819 $totalarray[
'nbfield']++;
1822 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'cdet.total_ht';
1823 $totalarray[
'pos'][$subtotalarray[
'nbfield']] =
'cdet.total_ht';
1825 if (isset($totalarray[
'val'][
'cdet.total_ht']) || isset($subtotalarray[
'val'][
'cdet.total_ht'])) {
1826 $totalarray[
'val'][
'cdet.total_ht'] += $obj->total_ht;
1827 $subtotalarray[
'val'][
'cdet.total_ht'] += $obj->total_ht;
1829 $totalarray[
'val'][
'cdet.total_ht'] = $obj->total_ht;
1830 $subtotalarray[
'val'][
'cdet.total_ht'] = $obj->total_ht;
1834 if (!empty($arrayfields[
'c.total_vat'][
'checked'])) {
1835 print
'<td class="nowrap right"><span class="amount">'.price($obj->total_tva).
"</span></td>\n";
1837 $totalarray[
'nbfield']++;
1840 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'cdet.total_tva';
1841 $totalarray[
'pos'][$subtotalarray[
'nbfield']] =
'cdet.total_tva';
1843 $totalarray[
'val'][
'cdet.total_tva'] += $obj->total_tva;
1844 $subtotalarray[
'val'][
'cdet.total_tva'] += $obj->total_tva;
1847 if (!empty($arrayfields[
'cdet.total_ttc'][
'checked'])) {
1848 print
'<td class="nowrap right"><span class="amount">'.price($obj->total_ttc).
"</span></td>\n";
1850 $totalarray[
'nbfield']++;
1853 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'cdet.total_ttc';
1854 $subtotalarray[
'pos'][$totalarray[
'nbfield']] =
'cdet.total_ttc';
1856 $totalarray[
'val'][
'cdet.total_ttc'] += $obj->total_ttc;
1857 $subtotalarray[
'val'][
'cdet.total_ttc'] += $obj->total_ttc;
1860 if (!empty($arrayfields[
'c.fk_warehouse'][
'checked'])) {
1861 print
'<td class="nowrap">';
1862 if ($obj->warehouse > 0) {
1863 print
img_picto(
'',
'stock',
'class="paddingrightonly"');
1865 $formproduct->formSelectWarehouses($_SERVER[
'PHP_SELF'], $obj->warehouse,
'none');
1868 $totalarray[
'nbfield']++;
1872 if (!empty($arrayfields[
'c.multicurrency_code'][
'checked'])) {
1873 print
'<td class="nowrap">'.$obj->multicurrency_code.
' - '.$langs->trans(
'Currency'.$obj->multicurrency_code).
"</td>\n";
1875 $totalarray[
'nbfield']++;
1880 if (!empty($arrayfields[
'c.multicurrency_tx'][
'checked'])) {
1881 print
'<td class="nowrap">';
1882 $form->form_multicurrency_rate($_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid, $obj->multicurrency_tx,
'none', $obj->multicurrency_code);
1885 $totalarray[
'nbfield']++;
1889 if (!empty($arrayfields[
'c.multicurrency_total_ht'][
'checked'])) {
1890 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ht).
"</span></td>\n";
1892 $totalarray[
'nbfield']++;
1896 if (!empty($arrayfields[
'c.multicurrency_total_vat'][
'checked'])) {
1897 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_vat).
"</span></td>\n";
1899 $totalarray[
'nbfield']++;
1903 if (!empty($arrayfields[
'c.multicurrency_total_ttc'][
'checked'])) {
1904 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ttc).
"</span></td>\n";
1906 $totalarray[
'nbfield']++;
1910 $userstatic->id = $obj->fk_user_author;
1911 $userstatic->login = $obj->login;
1912 $userstatic->lastname = $obj->lastname;
1913 $userstatic->firstname = $obj->firstname;
1914 $userstatic->email = $obj->user_email;
1915 $userstatic->status = $obj->user_statut;
1916 $userstatic->entity = $obj->entity;
1917 $userstatic->photo = $obj->photo;
1918 $userstatic->office_phone = $obj->office_phone;
1919 $userstatic->office_fax = $obj->office_fax;
1920 $userstatic->user_mobile = $obj->user_mobile;
1921 $userstatic->job = $obj->job;
1922 $userstatic->gender = $obj->gender;
1925 if (!empty($arrayfields[
'u.login'][
'checked'])) {
1926 print
'<td class="tdoverflowmax200">';
1927 if ($userstatic->id) {
1928 print $userstatic->getNomUrl(-1);
1934 $totalarray[
'nbfield']++;
1938 if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
1941 if ($obj->socid > 0) {
1942 $listsalesrepresentatives = $companystatic->getSalesRepresentatives($user);
1943 if ($listsalesrepresentatives < 0) {
1946 $nbofsalesrepresentative = count($listsalesrepresentatives);
1947 if ($nbofsalesrepresentative > 6) {
1949 print $nbofsalesrepresentative;
1950 } elseif ($nbofsalesrepresentative > 0) {
1952 foreach ($listsalesrepresentatives as $val) {
1953 $userstatic->id = $val[
'id'];
1954 $userstatic->lastname = $val[
'lastname'];
1955 $userstatic->firstname = $val[
'firstname'];
1956 $userstatic->email = $val[
'email'];
1957 $userstatic->status = $val[
'statut'];
1958 $userstatic->entity = $val[
'entity'];
1959 $userstatic->photo = $val[
'photo'];
1960 $userstatic->login = $val[
'login'];
1961 $userstatic->office_phone = $val[
'office_phone'];
1962 $userstatic->office_fax = $val[
'office_fax'];
1963 $userstatic->user_mobile = $val[
'user_mobile'];
1964 $userstatic->job = $val[
'job'];
1965 $userstatic->gender = $val[
'gender'];
1967 print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1,
'', 0, 0, 12) : $userstatic->getNomUrl(-2);
1969 if ($j < $nbofsalesrepresentative) {
1981 $totalarray[
'nbfield']++;
1986 if (!empty($arrayfields[
'total_pa'][
'checked'])) {
1987 print
'<td class="right nowrap">'.price($marginInfo[
'pa_total']).
'</td>';
1989 $totalarray[
'nbfield']++;
1993 if (!empty($arrayfields[
'total_margin'][
'checked'])) {
1994 print
'<td class="right nowrap">'.price($marginInfo[
'total_margin']).
'</td>';
1996 $totalarray[
'nbfield']++;
1999 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'total_margin';
2000 $totalarray[
'pos'][$subtotalarray[
'nbfield']] =
'total_margin';
2002 $totalarray[
'val'][
'total_margin'] += $marginInfo[
'total_margin'];
2003 $subtotalarray[
'val'][
'total_margin'] += $marginInfo[
'total_margin'];
2006 if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
2007 print
'<td class="right nowrap">'.(($marginInfo[
'total_margin_rate'] ==
'') ?
'' :
price($marginInfo[
'total_margin_rate'], 0,
'', 0, 0, 2).
'%').
'</td>';
2009 $totalarray[
'nbfield']++;
2013 if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
2014 print
'<td class="right nowrap">'.(($marginInfo[
'total_mark_rate'] ==
'') ?
'' :
price($marginInfo[
'total_mark_rate'], 0,
'', 0, 0, 2).
'%').
'</td>';
2016 $totalarray[
'nbfield']++;
2019 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'total_mark_rate';
2020 $totalarray[
'pos'][$subtotalarray[
'nbfield']] =
'total_mark_rate';
2022 if ($i >= $imaxinloop - 1) {
2023 if (!empty($total_ht)) {
2024 $totalarray[
'val'][
'total_mark_rate'] =
price2num($total_margin * 100 / $total_ht,
'MT');
2025 $subtotalarray[
'val'][
'total_mark_rate'] =
price2num($total_margin * 100 / $total_ht,
'MT');
2027 $totalarray[
'val'][
'total_mark_rate'] =
'';
2028 $subtotalarray[
'val'][
'total_mark_rate'] =
'';
2034 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
2036 $parameters = array(
'arrayfields' => $arrayfields,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
2037 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
2038 print $hookmanager->resPrint;
2041 if (!empty($arrayfields[
'c.datec'][
'checked'])) {
2042 print
'<td align="center" class="nowrap">';
2043 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuser');
2046 $totalarray[
'nbfield']++;
2051 if (!empty($arrayfields[
'c.tms'][
'checked'])) {
2052 print
'<td align="center" class="nowrap">';
2053 print
dol_print_date($db->jdate($obj->date_modification),
'dayhour',
'tzuser');
2056 $totalarray[
'nbfield']++;
2061 if (!empty($arrayfields[
'c.date_cloture'][
'checked'])) {
2062 print
'<td align="center" class="nowrap">';
2063 print
dol_print_date($db->jdate($obj->date_cloture),
'dayhour',
'tzuser');
2066 $totalarray[
'nbfield']++;
2071 if (!empty($arrayfields[
'c.note_public'][
'checked'])) {
2072 print
'<td class="sensiblehtmlcontent center">';
2076 $totalarray[
'nbfield']++;
2081 if (!empty($arrayfields[
'c.note_private'][
'checked'])) {
2082 print
'<td class="center">';
2086 $totalarray[
'nbfield']++;
2091 if (!empty($arrayfields[
'shippable'][
'checked'])) {
2092 print
'<td class="center">';
2093 if (!empty($show_shippable_command) && isModEnabled(
'stock')) {
2094 if (($obj->fk_statut > $generic_commande::STATUS_DRAFT) && ($obj->fk_statut < $generic_commande::STATUS_CLOSED)) {
2095 $generic_commande->loadExpeditions();
2097 if (isset($generic_commande->expeditions[$obj->rowid])) {
2098 $reliquat = $obj->qty - $generic_commande->expeditions[$obj->rowid];
2100 $reliquat = $obj->qty;
2102 if ($obj->product_type == 0 && $obj->fk_product > 0) {
2104 $generic_product->id = $obj->fk_product;
2107 if (empty($productstat_cache[$obj->fk_product])) {
2108 $generic_product->load_stock(
'nobatch');
2109 $productstat_cache[$obj->fk_product][
'stock_reel'] = $generic_product->stock_reel;
2110 $productstat_cachevirtual[$obj->fk_product][
'stock_reel'] = $generic_product->stock_theorique;
2112 $generic_product->stock_reel = $productstat_cache[$obj->fk_product][
'stock_reel'];
2113 $generic_product->stock_theorique = $productstat_cachevirtual[$obj->fk_product][
'stock_reel'];
2116 if ($reliquat > $generic_product->stock_reel) {
2120 $text_info .= $reliquat.
' x '.$obj->product_ref.
' '.
dol_trunc($obj->product_label, 20);
2121 $text_info .=
' - '.$langs->trans(
"Stock").
': <span class="'.($generic_product->stock_reel > 0 ?
'ok' :
'error').
'">'.$generic_product->stock_reel.
'</span>';
2122 $text_info .=
' - '.$langs->trans(
"VirtualStock").
': <span class="'.($generic_product->stock_theorique > 0 ?
'ok' :
'error').
'">'.$generic_product->stock_theorique.
'</span>';
2123 $text_info .= ($reliquat != $obj->qty ?
' <span class="opacitymedium">('.$langs->trans(
"QtyInOtherShipments").
' '.($obj->qty - $reliquat).
')</span>' :
'');
2124 $text_info .=
'<br>';
2131 $stock_order_supplier = 0;
2133 if (isModEnabled(
'order')) {
2134 if (empty($productstat_cache[$obj->fk_product][
'stats_order_customer'])) {
2135 $generic_product->load_stats_commande(0,
'1,2');
2136 $productstat_cache[$obj->fk_product][
'stats_order_customer'] = $generic_product->stats_commande[
'qty'];
2138 $generic_product->stats_commande[
'qty'] = $productstat_cache[$obj->fk_product][
'stats_order_customer'];
2140 $stock_order = $generic_product->stats_commande[
'qty'];
2142 if (isModEnabled(
'supplier_order')) {
2143 if (empty($productstat_cache[$obj->fk_product][
'stats_order_supplier'])) {
2144 $generic_product->load_stats_commande_fournisseur(0,
'3');
2145 $productstat_cache[$obj->fk_product][
'stats_order_supplier'] = $generic_product->stats_commande_fournisseur[
'qty'];
2147 $generic_product->stats_commande_fournisseur[
'qty'] = $productstat_cache[$obj->fk_product][
'stats_order_supplier'];
2149 $stock_order_supplier = $generic_product->stats_commande_fournisseur[
'qty'];
2152 $text_info .= $reliquat.
' x '.$obj->product_ref.
' '.
dol_trunc($obj->product_label, 20);
2153 $text_stock_reel = $generic_product->stock_reel.
'/'.$stock_order;
2154 if ($stock_order > $generic_product->stock_reel && !($generic_product->stock_reel < $obj->qty)) {
2156 $text_warning .=
'<span class="warning">'.$langs->trans(
'Available').
' : '.$text_stock_reel.
'</span>';
2158 if ($reliquat > $generic_product->stock_reel) {
2159 $text_info .=
'<span class="warning">'.$langs->trans(
'Available').
' : '.$text_stock_reel.
'</span>';
2161 $text_info .=
'<span class="ok">'.$langs->trans(
'Available').
' : '.$text_stock_reel.
'</span>';
2163 if (isModEnabled(
'supplier_order')) {
2164 $text_info .=
' '.$langs->trans(
'SupplierOrder').
' : '.$stock_order_supplier;
2166 $text_info .= ($reliquat != $obj->qty ?
' <span class="opacitymedium">('.$langs->trans(
"QtyInOtherShipments").
' '.($obj->qty - $reliquat).
')</span>' :
'');
2167 $text_info .=
'<br>';
2170 if ($notshippable == 0) {
2171 $text_icon =
img_picto(
'',
'dolly',
'',
false, 0, 0,
'',
'green paddingleft');
2172 $text_info = $text_icon.
' '.$langs->trans(
'Shippable').
'<br>'.$text_info;
2174 $text_icon =
img_picto(
'',
'dolly',
'',
false, 0, 0,
'',
'error paddingleft');
2175 $text_info = $text_icon.
' '.$langs->trans(
'NonShippable').
'<br>'.$text_info;
2180 print $form->textwithtooltip(
'', $text_info, 2, 1, $text_icon,
'', 2);
2183 print $form->textwithtooltip(
'', $langs->trans(
'NotEnoughForAllOrders').
'<br>'.$text_warning, 2, 1,
img_picto(
'',
'error'),
'', 2);
2188 $totalarray[
'nbfield']++;
2193 if (!empty($arrayfields[
'c.facture'][
'checked'])) {
2194 print
'<td class="center">'.yn($obj->billed).
'</td>';
2196 $totalarray[
'nbfield']++;
2200 if (!empty($arrayfields[
'c.import_key'][
'checked'])) {
2201 print
'<td class="nowrap center">'.$obj->import_key.
'</td>';
2203 $totalarray[
'nbfield']++;
2207 if (!empty($arrayfields[
'c.fk_statut'][
'checked'])) {
2208 print
'<td class="nowrap center">'.$generic_commande->LibStatut($obj->fk_statut, $obj->billed, 5, 1).
'</td>';
2210 $totalarray[
'nbfield']++;
2216 print
'<td class="nowrap center">';
2217 if ($massactionbutton || $massaction) {
2219 if (in_array($obj->rowid, $arrayofselected)) {
2222 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
2226 $totalarray[
'nbfield']++;
2232 $total += $obj->total_ht;
2233 $subtotal += $obj->total_ht;
2236 if ($sortfield ==
'pr.ref') {
2237 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_subtotal.tpl.php';
2240 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
2245 foreach ($arrayfields as $key => $val) {
2246 if (!empty($val[
'checked'])) {
2250 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
2255 $parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
2256 $reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters);
2257 print $hookmanager->resPrint;
2259 print
'</table>'.
"\n";
2262 print
'</form>'.
"\n";
2264 $hidegeneratedfilelistifempty = 1;
2265 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
2266 $hidegeneratedfilelistifempty = 0;
2270 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
2271 $urlsource .= str_replace(
'&',
'&', $param);
2273 $filedir = $diroutputmassaction;
2274 $genallowed = $permissiontoread;
2275 $delallowed = $permissiontoadd;
2277 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()
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...
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.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
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 dolibarr global constant string value.
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.