38require
'../main.inc.php';
46require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
47require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
48require_once DOL_DOCUMENT_ROOT.
'/core/class/discount.class.php';
49require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
50require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
51require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
53 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmargin.class.php';
55require_once DOL_DOCUMENT_ROOT.
'/commande/class/commande.class.php';
56require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
57require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
58require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
61 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcategory.class.php';
62 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
66$langs->loadLangs(array(
"categories",
"orders",
'sendings',
'companies',
'compta',
'bills',
'stocks',
'products'));
68$action =
GETPOST(
'action',
'aZ09');
69$massaction =
GETPOST(
'massaction',
'alpha');
71$confirm =
GETPOST(
'confirm',
'alpha');
72$toselect =
GETPOST(
'toselect',
'array:int');
73$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'orderlistdet';
74$optioncss =
GETPOST(
'optioncss',
'alpha');
76$productobuy =
GETPOST(
'productobuy',
'alpha');
77$productonly =
GETPOST(
'productonly',
'alpha');
78$disablelinefree =
GETPOST(
'disablelinefree',
'alpha');
80$search_datecloture_start =
GETPOSTINT(
'search_datecloture_start');
81if (empty($search_datecloture_start)) {
84$search_datecloture_end =
GETPOSTINT(
'search_datecloture_end');
85if (empty($search_datecloture_end)) {
93$search_product_category_array = array();
95 $search_product_category_array =
GETPOST(
"search_category_".Categorie::TYPE_PRODUCT.
"_list",
"array");
96 $searchCategoryProductOperator = 0;
97 if (GETPOSTISSET(
'formfilteraction')) {
98 $searchCategoryProductOperator =
GETPOSTINT(
'search_category_product_operator');
107$search_id =
GETPOST(
'search_id',
'alpha');
108$search_refProduct =
GETPOST(
'search_refProduct',
'alpha');
109$search_descProduct =
GETPOST(
'search_descProduct',
'alpha');
111$search_ref =
GETPOST(
'search_ref',
'alpha') !=
'' ?
GETPOST(
'search_ref',
'alpha') :
GETPOST(
'sref',
'alpha');
112$search_ref_customer =
GETPOST(
'search_ref_customer',
'alpha');
113$search_company =
GETPOST(
'search_company',
'alpha');
114$search_company_alias =
GETPOST(
'search_company_alias',
'alpha');
115$search_town =
GETPOST(
'search_town',
'alpha');
116$search_zip =
GETPOST(
'search_zip',
'alpha');
117$search_state =
GETPOST(
"search_state",
'alpha');
118$search_country =
GETPOST(
"search_country",
'aZ09');
119$search_type_thirdparty =
GETPOST(
"search_type_thirdparty",
'intcomma');
120$search_all = trim(
GETPOST(
'search_all',
'alphanohtml'));
121$search_user =
GETPOST(
'search_user',
'intcomma');
122$search_sale =
GETPOST(
'search_sale',
'intcomma');
123$search_total_ht =
GETPOST(
'search_total_ht',
'alpha');
124$search_total_vat =
GETPOST(
'search_total_vat',
'alpha');
125$search_total_ttc =
GETPOST(
'search_total_ttc',
'alpha');
126$search_warehouse =
GETPOST(
'search_warehouse',
'intcomma');
127$search_multicurrency_code =
GETPOST(
'search_multicurrency_code',
'alpha');
128$search_multicurrency_tx =
GETPOST(
'search_multicurrency_tx',
'alpha');
129$search_multicurrency_montant_ht =
GETPOST(
'search_multicurrency_montant_ht',
'alpha');
130$search_multicurrency_montant_vat =
GETPOST(
'search_multicurrency_montant_vat',
'alpha');
131$search_multicurrency_montant_ttc =
GETPOST(
'search_multicurrency_montant_ttc',
'alpha');
132$search_login =
GETPOST(
'search_login',
'alpha');
133$search_categ_cus =
GETPOST(
"search_categ_cus",
'intcomma');
134$search_billed =
GETPOST(
'search_billed',
'intcomma');
135$search_status =
GETPOST(
'search_status',
'intcomma');
136$search_project_ref =
GETPOST(
'search_project_ref',
'alpha');
137$search_project =
GETPOST(
'search_project',
'alpha');
138$search_shippable =
GETPOST(
'search_shippable',
'aZ09');
139$search_fk_cond_reglement =
GETPOSTINT(
"search_fk_cond_reglement");
140$search_fk_shipping_method =
GETPOSTINT(
"search_fk_shipping_method");
141$search_fk_mode_reglement =
GETPOSTINT(
"search_fk_mode_reglement");
142$search_fk_input_reason =
GETPOSTINT(
"search_fk_input_reason");
144$diroutputmassaction = $conf->commande->multidir_output[$conf->entity].
'/temp/massgeneration/'.$user->id;
148$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
149$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
151if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
154$offset = $limit * $page;
155$pageprev = $page - 1;
156$pagenext = $page + 1;
158 $sortfield =
'c.ref';
164$show_shippable_command =
GETPOST(
'show_shippable_command',
'aZ09');
168$hookmanager->initHooks(array(
'orderlistdetail'));
172$extrafields->fetch_name_optionals_label(
$object->table_element);
173$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
176$fieldstosearchall = array(
178 'c.ref_client' =>
'RefCustomerOrder',
179 'cdet.description' =>
'Description',
180 's.nom' =>
"ThirdParty",
181 's.name_alias' =>
"AliasNameShort",
184 'c.note_public' =>
'NotePublic',
186if (empty($user->socid)) {
187 $fieldstosearchall[
"c.note_private"] =
"NotePrivate";
190$checkedtypetiers = 0;
193 'rowid' => array(
'label' =>
'LineID',
'checked' =>
'-1',
'position' => 1,
'enabled' =>
'1'),
194 'c.ref' => array(
'label' =>
"RefOrder",
'checked' =>
'1',
'position' => 5),
195 'pr.ref' => array(
'label' =>
'ProductRef',
'checked' =>
'1',
'position' => 6),
196 'pr.desc' => array(
'label' =>
'ProductDescription',
'checked' =>
'-1',
'position' => 7),
197 'cdet.qty' => array(
'label' =>
'QtyOrdered',
'checked' =>
'1',
'position' => 8),
198 'c.ref_client' => array(
'label' =>
"RefCustomerOrder",
'checked' =>
'-1',
'position' => 10),
199 'p.ref' => array(
'label' =>
"ProjectRef",
'checked' =>
'-1',
'enabled' => (
string) (
int)
isModEnabled(
'project'),
'position' => 20),
200 'p.title' => array(
'label' =>
"ProjectLabel",
'checked' =>
'0',
'enabled' => (
string) (
int)
isModEnabled(
'project'),
'position' => 25),
201 's.nom' => array(
'label' =>
"ThirdParty",
'checked' =>
'1',
'position' => 30),
202 's.name_alias' => array(
'label' =>
"AliasNameShort",
'checked' =>
'-1',
'position' => 31),
203 's.town' => array(
'label' =>
"Town",
'checked' =>
'-1',
'position' => 35),
204 's.zip' => array(
'label' =>
"Zip",
'checked' =>
'-1',
'position' => 40),
205 'state.nom' => array(
'label' =>
"StateShort",
'checked' =>
'0',
'position' => 45),
206 'country.code_iso' => array(
'label' =>
"Country",
'checked' =>
'0',
'position' => 50),
207 'typent.code' => array(
'label' =>
"ThirdPartyType",
'checked' => (
string) $checkedtypetiers,
'position' => 55),
208 'c.date_commande' => array(
'label' =>
"OrderDateShort",
'checked' =>
'1',
'position' => 60),
209 'c.delivery_date' => array(
'label' =>
"DateDeliveryPlanned",
'checked' =>
'1',
'enabled' => (
string) (
int) !
getDolGlobalString(
'ORDER_DISABLE_DELIVERY_DATE'),
'position' => 65),
210 'c.fk_shipping_method' => array(
'label' =>
"SendingMethod",
'checked' =>
'-1',
'position' => 66 ,
'enabled' => (
string) (
int)
isModEnabled(
'shipping')),
211 'c.fk_cond_reglement' => array(
'label' =>
"PaymentConditionsShort",
'checked' =>
'-1',
'position' => 67),
212 'c.fk_mode_reglement' => array(
'label' =>
"PaymentMode",
'checked' =>
'-1',
'position' => 68),
213 'c.fk_input_reason' => array(
'label' =>
"Channel",
'checked' =>
'-1',
'position' => 69),
214 'cdet.total_ht' => array(
'label' =>
"AmountHT",
'checked' =>
'1',
'position' => 75),
215 'c.total_vat' => array(
'label' =>
"AmountVAT",
'checked' =>
'0',
'position' => 80),
216 'cdet.total_ttc' => array(
'label' =>
"AmountTTC",
'checked' =>
'0',
'position' => 85),
217 'c.multicurrency_code' => array(
'label' =>
'Currency',
'checked' =>
'0',
'enabled' => (empty($conf->multicurrency->enabled) ?
'0' :
'1'),
'position' => 90),
218 'c.multicurrency_tx' => array(
'label' =>
'CurrencyRate',
'checked' =>
'0',
'enabled' => (empty($conf->multicurrency->enabled) ?
'0' :
'1'),
'position' => 95),
219 'c.multicurrency_total_ht' => array(
'label' =>
'MulticurrencyAmountHT',
'checked' =>
'0',
'enabled' => (empty($conf->multicurrency->enabled) ?
'0' :
'1'),
'position' => 100),
220 'c.multicurrency_total_vat' => array(
'label' =>
'MulticurrencyAmountVAT',
'checked' =>
'0',
'enabled' => (empty($conf->multicurrency->enabled) ?
'0' :
'1'),
'position' => 105),
221 'c.multicurrency_total_ttc' => array(
'label' =>
'MulticurrencyAmountTTC',
'checked' =>
'0',
'enabled' => (empty($conf->multicurrency->enabled) ?
'0' :
'1'),
'position' => 110),
222 'c.fk_warehouse' => array(
'label' =>
'Warehouse',
'checked' =>
'0',
'enabled' => (string) (int) (!
isModEnabled(
'stock') && !
getDolGlobalString(
'WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER') ?
'0' :
'1'),
'position' => 110),
223 'u.login' => array(
'label' =>
"Author",
'checked' =>
'1',
'position' => 115),
224 'sale_representative' => array(
'label' =>
"SaleRepresentativesOfThirdParty",
'checked' =>
'0',
'position' => 116),
225 'total_pa' => array(
'label' => (
getDolGlobalString(
'MARGIN_TYPE') ==
'1' ?
'BuyingPrice' :
'CostPrice'),
'checked' =>
'0',
'position' => 300,
'enabled' => (string) (int) (!
isModEnabled(
'margin') || !$user->hasRight(
'margins',
'liretous') ?
'0' :
'1')),
226 'total_margin' => array(
'label' =>
'Margin',
'checked' =>
'0',
'position' => 301,
'enabled' => (string) (int) (!
isModEnabled(
'margin') || !$user->hasRight(
'margins',
'liretous') ?
'0' :
'1')),
227 'total_margin_rate' => array(
'label' =>
'MarginRate',
'checked' =>
'0',
'position' => 302,
'enabled' => (string) (int) (!
isModEnabled(
'margin') || !$user->hasRight(
'margins',
'liretous') || !
getDolGlobalString(
'DISPLAY_MARGIN_RATES') ?
'0' :
'1')),
228 'total_mark_rate' => array(
'label' =>
'MarkRate',
'checked' =>
'0',
'position' => 303,
'enabled' => (string) (int) (!
isModEnabled(
'margin') || !$user->hasRight(
'margins',
'liretous') || !
getDolGlobalString(
'DISPLAY_MARK_RATES') ?
'0' :
'1')),
229 'c.datec' => array(
'label' =>
"DateCreation",
'checked' =>
'0',
'position' => 120),
230 'c.tms' => array(
'label' =>
"DateModificationShort",
'checked' =>
'0',
'position' => 125),
231 'c.date_cloture' => array(
'label' =>
"DateClosing",
'checked' =>
'0',
'position' => 130),
232 'c.note_public' => array(
'label' =>
'NotePublic',
'checked' =>
'0',
'enabled' => (string) (int) (!
getDolGlobalString(
'MAIN_LIST_HIDE_PUBLIC_NOTES')),
'position' => 135),
233 'c.note_private' => array(
'label' =>
'NotePrivate',
'checked' =>
'0',
'enabled' => (string) (int) (!
getDolGlobalString(
'MAIN_LIST_HIDE_PRIVATE_NOTES')),
'position' => 140),
234 'shippable' => array(
'label' =>
"Shippable",
'checked' =>
'1',
'enabled' => (string) (int) (
isModEnabled(
'shipping')),
'position' => 990),
235 'c.facture' => array(
'label' =>
"Billed",
'checked' =>
'1',
'enabled' => (string) (int) (!
getDolGlobalString(
'WORKFLOW_BILL_ON_SHIPMENT')),
'position' => 995),
236 'c.import_key' => array(
'type' =>
'varchar(14)',
'label' =>
'ImportId',
'enabled' =>
'1',
'visible' => -2,
'position' => 999),
237 'c.fk_statut' => array(
'label' =>
"Status",
'checked' =>
'1',
'position' => 1000)
241include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
246if (!$user->hasRight(
'societe',
'client',
'voir')) {
247 $search_sale = $user->id;
253 $socid = $user->socid;
257$permissiontoread =
false;
263if (
GETPOST(
'cancel',
'alpha')) {
267if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend' && $massaction !=
'confirm_createbills') {
271$parameters = array(
'socid' => $socid);
272$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
277if (empty($reshook)) {
279 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
282 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
285 $disablelinefree =
'';
289 $search_product_category_array = array();
290 $searchCategoryProductOperator = 0;
292 $search_refProduct =
'';
293 $search_descProduct =
'';
295 $search_ref_customer =
'';
296 $search_company =
'';
297 $search_company_alias =
'';
302 $search_country =
'';
303 $search_type_thirdparty =
'';
304 $search_total_ht =
'';
305 $search_total_vat =
'';
306 $search_total_ttc =
'';
307 $search_warehouse =
'';
308 $search_multicurrency_code =
'';
309 $search_multicurrency_tx =
'';
310 $search_multicurrency_montant_ht =
'';
311 $search_multicurrency_montant_vat =
'';
312 $search_multicurrency_montant_ttc =
'';
314 $search_dateorder_start =
'';
315 $search_dateorder_end =
'';
316 $search_datedelivery_start =
'';
317 $search_datedelivery_end =
'';
318 $search_project_ref =
'';
319 $search_project =
'';
323 $search_array_options = array();
324 $search_categ_cus =
'';
325 $search_datecloture_start =
'';
326 $search_datecloture_end =
'';
327 $search_fk_cond_reglement =
'';
328 $search_fk_shipping_method =
'';
329 $search_fk_mode_reglement =
'';
330 $search_fk_input_reason =
'';
332 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
333 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
338 $objectclass =
'Commande';
339 $objectlabel =
'Orders';
340 $permissiontoread = $user->hasRight(
"commande",
"lire");
341 $permissiontoadd = $user->hasRight(
"commande",
"creer");
342 $permissiontodelete = $user->hasRight(
"commande",
"supprimer");
343 $permissiontoexport = $user->hasRight(
"commande",
"commande",
"export");
345 $permissiontovalidate = $user->hasRight(
"commande",
"order_advance",
"validate");
346 $permissiontoclose = $user->hasRight(
"commande",
"order_advance",
"close");
347 $permissiontocancel = $user->hasRight(
"commande",
"order_advance",
"annuler");
348 $permissiontosendbymail = $user->hasRight(
"commande",
"order_advance",
"send");
350 $permissiontovalidate = $user->hasRight(
"commande",
"creer");
351 $permissiontoclose = $user->hasRight(
"commande",
"creer");
352 $permissiontocancel = $user->hasRight(
"commande",
"creer");
353 $permissiontosendbymail = $user->hasRight(
"commande",
"creer");
355 $uploaddir = $conf->commande->multidir_output[$conf->entity];
356 $triggersendname =
'ORDER_SENTBYMAIL';
357 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
371$form =
new Form($db);
378$companystatic =
new Societe($db);
380$projectstatic =
new Project($db);
382$title = $langs->trans(
"Orders");
383$help_url =
"EN:Module_Customers_Orders|FR:Module_Commandes_Clients|ES:Módulo_Pedidos_de_clientes";
387$sqlSelect =
'SELECT';
389if ($search_all || !empty($search_product_category_array) || $search_user > 0) {
390 $sqlSelect =
'SELECT DISTINCT';
392$sqlSelect .=
' 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$sqlSelect .=
" typent.code as typent_code,";
394$sqlSelect .=
" state.code_departement as state_code, state.nom as state_name,";
395$sqlSelect .=
" country.code as country_code,";
396$sqlSelect .=
' c.rowid as c_rowid, c.ref, c.ref_client, c.fk_user_author,';
397$sqlSelect .=
' 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$sqlSelect .=
' 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$sqlSelect .=
' c.date_valid, c.date_commande, c.note_public, c.note_private, c.date_livraison as delivery_date, c.fk_statut, c.facture as billed,';
400$sqlSelect .=
' c.date_creation as date_creation, c.tms as date_modification, c.date_cloture as date_cloture,';
401$sqlSelect .=
' p.rowid as project_id, p.ref as project_ref, p.title as project_label,';
402$sqlSelect .=
' 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$sqlSelect .=
' c.fk_cond_reglement,c.deposit_percent,c.fk_mode_reglement,c.fk_shipping_method,';
404$sqlSelect .=
' c.fk_input_reason, c.import_key,';
406$sqlSelect .=
' cdet.rowid, cdet.description, cdet.qty, cdet.product_type, cdet.fk_product, cdet.total_ht, cdet.total_tva, cdet.total_ttc,';
407$sqlSelect .=
' 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 (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
410 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
411 $sqlSelect .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
416$parameters = array();
417$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters);
418$sqlSelect .= $hookmanager->resPrint;
420$sql =
' FROM '.MAIN_DB_PREFIX.
'societe as s';
421$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as country on (country.rowid = s.fk_pays)";
422$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_typent as typent on (typent.id = s.fk_typent)";
423$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_departements as state on (state.rowid = s.fk_departement)";
425$sql .=
', '.MAIN_DB_PREFIX.
'commandedet as cdet';
426$sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'commande as c ON cdet.fk_commande = c.rowid';
427$sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'product as pr ON pr.rowid = cdet.fk_product';
428if (!empty($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
429 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"commande_extrafields as ef on (c.rowid = ef.fk_object)";
431$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"projet as p ON p.rowid = c.fk_projet";
432$sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'user as u ON c.fk_user_author = u.rowid';
434if ($search_user > 0) {
435 $sql .=
", ".MAIN_DB_PREFIX.
"element_contact as ec";
436 $sql .=
", ".MAIN_DB_PREFIX.
"c_type_contact as tc";
439$parameters = array();
440$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object);
441$sql .= $hookmanager->resPrint;
443$sql .=
' WHERE c.fk_soc = s.rowid';
444$sql .=
' AND c.entity IN ('.getEntity(
'commande').
')';
445$sql .=
' AND cdet.product_type <> 9';
447if (!empty($productobuy)) {
448 $sql .=
" AND pr.tobuy = 1";
450if (!empty($productonly)) {
451 $sql .=
" AND (cdet.product_type = 0 OR cdet.product_type = 1)";
453if (!empty($disablelinefree)) {
454 $sql .=
" AND cdet.fk_product IS NOT NULL";
457 $sql .=
' AND s.rowid = '.((int) $socid);
462if ($search_refProduct) {
465if ($search_descProduct) {
466 $sql .=
natural_search(array(
'pr.label',
'cdet.description'), $search_descProduct);
471if ($search_ref_customer) {
475 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
477if ($search_billed !=
'' && $search_billed >= 0) {
478 $sql .=
' AND c.facture = '.((int) $search_billed);
480if ($search_status !=
'') {
481 if ($search_status <= 3 && $search_status >= -1) {
483 $sql .=
' AND c.fk_statut IN (1,2)';
485 $sql .=
' AND c.fk_statut = '.((int) $search_status);
488 if ($search_status == -2) {
490 $sql .=
" AND c.fk_statut IN (1,2)";
492 if ($search_status == -3) {
495 $sql .=
' AND c.fk_statut IN (1,2,3)';
499if ($search_datecloture_start) {
500 $sql .=
" AND c.date_cloture >= '".$db->idate($search_datecloture_start).
"'";
502if ($search_datecloture_end) {
503 $sql .=
" AND c.date_cloture <= '".$db->idate($search_datecloture_end).
"'";
505if ($search_dateorder_start) {
506 $sql .=
" AND c.date_commande >= '".$db->idate($search_dateorder_start).
"'";
508if ($search_dateorder_end) {
509 $sql .=
" AND c.date_commande <= '".$db->idate($search_dateorder_end).
"'";
511if ($search_datedelivery_start) {
512 $sql .=
" AND c.date_livraison >= '".$db->idate($search_datedelivery_start).
"'";
514if ($search_datedelivery_end) {
515 $sql .=
" AND c.date_livraison <= '".$db->idate($search_datedelivery_end).
"'";
526if ($search_country) {
527 $sql .=
" AND s.fk_pays IN (".$db->sanitize($search_country).
')';
529if ($search_type_thirdparty && $search_type_thirdparty !=
'-1') {
530 $sql .=
" AND s.fk_typent IN (".$db->sanitize($search_type_thirdparty).
')';
532if ($search_company) {
535if ($search_company_alias) {
538if ($search_user > 0) {
539 $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);
541if ($search_total_ht !=
'') {
544if ($search_total_vat !=
'') {
547if ($search_total_ttc !=
'') {
550if ($search_warehouse !=
'' && $search_warehouse > 0) {
553if ($search_multicurrency_code !=
'') {
554 $sql .=
" AND c.multicurrency_code = '".$db->escape($search_multicurrency_code).
"'";
556if ($search_multicurrency_tx !=
'') {
557 $sql .=
natural_search(
'c.multicurrency_tx', $search_multicurrency_tx, 1);
559if ($search_multicurrency_montant_ht !=
'') {
560 $sql .=
natural_search(
'c.multicurrency_total_ht', $search_multicurrency_montant_ht, 1);
562if ($search_multicurrency_montant_vat !=
'') {
563 $sql .=
natural_search(
'c.multicurrency_total_tva', $search_multicurrency_montant_vat, 1);
565if ($search_multicurrency_montant_ttc !=
'') {
566 $sql .=
natural_search(
'c.multicurrency_total_ttc', $search_multicurrency_montant_ttc, 1);
569 $sql .=
natural_search(array(
"u.login",
"u.firstname",
"u.lastname"), $search_login);
571if ($search_project_ref !=
'') {
574if ($search_project !=
'') {
577if ($search_fk_cond_reglement > 0) {
578 $sql .=
" AND c.fk_cond_reglement = ".((int) $search_fk_cond_reglement);
580if ($search_fk_shipping_method > 0) {
581 $sql .=
" AND c.fk_shipping_method = ".((int) $search_fk_shipping_method);
583if ($search_fk_mode_reglement > 0) {
584 $sql .=
" AND c.fk_mode_reglement = ".((int) $search_fk_mode_reglement);
586if ($search_fk_input_reason > 0) {
587 $sql .=
" AND c.fk_input_reason = ".((int) $search_fk_input_reason);
590if ($search_sale && $search_sale !=
'-1') {
591 if ($search_sale == -2) {
592 $sql .=
" AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = c.fk_soc)";
593 } elseif ($search_sale > 0) {
594 $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).
")";
598$searchCategoryCustomerOperator =
GETPOSTINT(
'search_category_customer_operator');
599$searchCategoryCustomerList = ($search_categ_cus !==
'-1' ? explode(
',', $search_categ_cus) : array());
600if (!empty($searchCategoryCustomerList)) {
601 $searchCategoryCustomerSqlList = array();
602 $listofcategoryid =
'';
603 foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
604 if (intval($searchCategoryCustomer) == -2) {
605 $searchCategoryCustomerSqlList[] =
"NOT EXISTS (SELECT cs.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_societe as cs WHERE s.rowid = cs.fk_soc)";
606 } elseif (intval($searchCategoryCustomer) > 0) {
607 if ($searchCategoryCustomerOperator == 0) {
608 $searchCategoryCustomerSqlList[] =
" EXISTS (SELECT cs.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_societe as cs WHERE s.rowid = cs.fk_soc AND cs.fk_categorie = ".((int) $searchCategoryCustomer).
")";
610 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryCustomer);
614 if ($listofcategoryid) {
615 $searchCategoryCustomerSqlList[] =
" EXISTS (SELECT cs.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_societe as cs WHERE s.rowid = cs.fk_soc AND cs.fk_categorie IN (".$db->sanitize($listofcategoryid).
"))";
617 if ($searchCategoryCustomerOperator == 1) {
618 if (!empty($searchCategoryCustomerSqlList)) {
619 $sql .=
" AND (".implode(
' OR ', $searchCategoryCustomerSqlList).
")";
622 if (!empty($searchCategoryCustomerSqlList)) {
623 $sql .=
" AND (".implode(
' AND ', $searchCategoryCustomerSqlList).
")";
628$searchCategoryProductList = $search_product_category_array;
629if (!empty($searchCategoryProductList)) {
630 $searchCategoryProjectSqlList = array();
631 $listofcategoryid =
'';
632 foreach ($searchCategoryProductList as $searchCategoryProject) {
633 if (intval($searchCategoryProject) == -2) {
634 $searchCategoryProjectSqlList[] =
"NOT EXISTS (SELECT cp.fk_product FROM ".MAIN_DB_PREFIX.
"categorie_product as cp WHERE cdet.fk_product = cp.fk_product)";
635 } elseif (intval($searchCategoryProject) > 0) {
636 if ($searchCategoryProductOperator == 0) {
637 $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).
")";
639 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryProject);
643 if ($listofcategoryid) {
644 $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).
"))";
646 if ($searchCategoryProductOperator == 1) {
647 if (!empty($searchCategoryProjectSqlList)) {
648 $sql .=
" AND (".implode(
' OR ', $searchCategoryProjectSqlList).
")";
651 if (!empty($searchCategoryProjectSqlList)) {
652 $sql .=
" AND (".implode(
' AND ', $searchCategoryProjectSqlList).
")";
658include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
661$parameters = array();
662$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object);
663$sql .= $hookmanager->resPrint;
666$parameters = array();
667$reshook = $hookmanager->executeHooks(
'printFieldListHaving', $parameters, $object);
668if (empty($reshook)) {
669 $sql .= empty($hookmanager->resPrint) ?
"" :
" HAVING 1=1 ".$hookmanager->resPrint;
671 $sql = $hookmanager->resPrint;
674$sql .= $db->order($sortfield, $sortorder);
677$nbtotalofrecords =
'';
679 $result = $db->query(
'SELECT COUNT(*) as numrows ' . $sql);
680 $obj = $db->fetch_object($result);
682 $nbtotalofrecords = 0;
684 $nbtotalofrecords = $obj->numrows;
687 if (($page * $limit) > (
int) $nbtotalofrecords) {
693$sql .= $db->plimit($limit + 1, $offset);
695$resql = $db->query($sqlSelect . $sql);
700 $title = $langs->trans(
'ListOrderLigne').
' - '.$soc->name;
701 if (empty($search_company)) {
702 $search_company = $soc->name;
705 $title = $langs->trans(
'ListOrderLigne');
707 if (strval($search_status) ==
'0') {
708 $title .=
' - '.$langs->trans(
'StatusOrderDraftShort');
710 if ($search_status == 1) {
711 $title .=
' - '.$langs->trans(
'StatusOrderValidatedShort');
713 if ($search_status == 2) {
714 $title .=
' - '.$langs->trans(
'StatusOrderSentShort');
716 if ($search_status == 3) {
717 $title .=
' - '.$langs->trans(
'StatusOrderToBillShort');
719 if ($search_status == -1) {
720 $title .=
' - '.$langs->trans(
'StatusOrderCanceledShort');
722 if ($search_status == -2) {
723 $title .=
' - '.$langs->trans(
'StatusOrderToProcessShort');
725 if ($search_status == -3) {
726 $title .=
' - '.$langs->trans(
'StatusOrderValidated').
', '.(!
isModEnabled(
'shipping') ?
'' : $langs->trans(
"StatusOrderSent").
', ').$langs->trans(
'StatusOrderToBill');
729 $num = $db->num_rows($resql);
731 $arrayofselected = is_array($toselect) ? $toselect : array();
733 if ($num == 1 &&
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all) {
734 $obj = $db->fetch_object($resql);
736 header(
"Location: ".DOL_URL_ROOT.
'/commande/card.php?id='.$id);
740 llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-commande page-list_det');
744 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
745 $param .=
'&contextpage='.urlencode($contextpage);
747 if ($limit > 0 && $limit != $conf->liste_limit) {
748 $param .=
'&limit='.((int) $limit);
751 $param .=
'&search_all='.urlencode($search_all);
754 $param .=
'&socid='.urlencode((
string) ($socid));
757 $param .=
'&search_id='.urlencode($search_id);
760 if ($search_refProduct) {
761 $param .=
'&search_refProduct='.urlencode($search_refProduct);
763 if ($search_descProduct) {
764 $param .=
'&search_descProduct='.urlencode($search_descProduct);
766 if ($search_status !=
'') {
767 $param .=
'&search_status='.urlencode($search_status);
769 if ($search_datecloture_start) {
770 $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');
772 if ($search_datecloture_end) {
773 $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');
775 if ($search_dateorder_start) {
776 $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');
778 if ($search_dateorder_end) {
779 $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');
781 if ($search_datedelivery_start) {
782 $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');
784 if ($search_datedelivery_end) {
785 $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');
788 $param .=
'&search_ref='.urlencode($search_ref);
790 if ($search_company) {
791 $param .=
'&search_company='.urlencode($search_company);
793 if ($search_company_alias) {
794 $param .=
'&search_company_alias='.urlencode($search_company_alias);
796 if ($search_ref_customer) {
797 $param .=
'&search_ref_customer='.urlencode($search_ref_customer);
799 if ($search_user > 0) {
800 $param .=
'&search_user='.urlencode((
string) ($search_user));
802 if ($search_sale > 0) {
803 $param .=
'&search_sale='.urlencode($search_sale);
805 if ($search_total_ht !=
'') {
806 $param .=
'&search_total_ht='.urlencode($search_total_ht);
808 if ($search_total_vat !=
'') {
809 $param .=
'&search_total_vat='.urlencode($search_total_vat);
811 if ($search_total_ttc !=
'') {
812 $param .=
'&search_total_ttc='.urlencode($search_total_ttc);
814 if ($search_warehouse !=
'') {
815 $param .=
'&search_warehouse='.urlencode((
string) ($search_warehouse));
818 $param .=
'&search_login='.urlencode($search_login);
820 if ($search_multicurrency_code !=
'') {
821 $param .=
'&search_multicurrency_code='.urlencode($search_multicurrency_code);
823 if ($search_multicurrency_tx !=
'') {
824 $param .=
'&search_multicurrency_tx='.urlencode($search_multicurrency_tx);
826 if ($search_multicurrency_montant_ht !=
'') {
827 $param .=
'&search_multicurrency_montant_ht='.urlencode($search_multicurrency_montant_ht);
829 if ($search_multicurrency_montant_vat !=
'') {
830 $param .=
'&search_multicurrency_montant_vat='.urlencode($search_multicurrency_montant_vat);
832 if ($search_multicurrency_montant_ttc !=
'') {
833 $param .=
'&search_multicurrency_montant_ttc='.urlencode($search_multicurrency_montant_ttc);
835 if ($search_project_ref >= 0) {
836 $param .=
"&search_project_ref=".urlencode($search_project_ref);
838 if ($search_town !=
'') {
839 $param .=
'&search_town='.urlencode($search_town);
841 if ($search_zip !=
'') {
842 $param .=
'&search_zip='.urlencode($search_zip);
844 if ($search_state !=
'') {
845 $param .=
'&search_state='.urlencode($search_state);
847 if ($search_country !=
'') {
848 $param .=
'&search_country='.urlencode((
string) ($search_country));
850 if ($search_type_thirdparty && $search_type_thirdparty !=
'-1') {
851 $param .=
'&search_type_thirdparty='.urlencode((
string) ($search_type_thirdparty));
853 if (!empty($search_product_category_array)) {
854 foreach ($search_product_category_array as $tmpval) {
855 $param .=
'&search_categegory_product_list[]='.urlencode($tmpval);
858 if (($search_categ_cus > 0) || ($search_categ_cus == -2)) {
859 $param .=
'&search_categ_cus='.urlencode((
string) ($search_categ_cus));
862 $param .=
'&show_files='.urlencode((
string) ($show_files));
864 if ($optioncss !=
'') {
865 $param .=
'&optioncss='.urlencode($optioncss);
867 if ($search_billed !=
'') {
868 $param .=
'&search_billed='.urlencode($search_billed);
870 if ($search_fk_cond_reglement > 0) {
871 $param .=
'&search_fk_cond_reglement='.urlencode((
string) ($search_fk_cond_reglement));
873 if ($search_fk_shipping_method > 0) {
874 $param .=
'&search_fk_shipping_method='.urlencode((
string) ($search_fk_shipping_method));
876 if ($search_fk_mode_reglement > 0) {
877 $param .=
'&search_fk_mode_reglement='.urlencode((
string) ($search_fk_mode_reglement));
879 if ($search_fk_input_reason > 0) {
880 $param .=
'&search_fk_input_reason='.urlencode((
string) ($search_fk_input_reason));
882 if (!empty($productobuy)) {
883 $param .=
'&productobuy='.urlencode($productobuy);
885 if (!empty($productonly)) {
886 $param .=
'&productonly='.urlencode($productonly);
888 if (!empty($disablelinefree)) {
889 $param .=
'&disablelinefree='.urlencode($disablelinefree);
893 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
896 $parameters = array(
'param' => &$param);
897 $reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object);
898 $param .= $hookmanager->resPrint;
901 $arrayofmassactions = array(
908 $massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
910 $url = DOL_URL_ROOT.
'/commande/card.php?action=create';
911 if (!empty($socid)) {
912 $url .=
'&socid='.$socid;
917 print
'<form method="POST" id="searchFormList" action="'.dolBuildUrl($_SERVER[
"PHP_SELF"]).
'">';
918 if ($optioncss !=
'') {
919 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
921 print
'<input type="hidden" name="token" value="'.newToken().
'">';
922 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
923 print
'<input type="hidden" name="action" value="list">';
924 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
925 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
926 print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
927 print
'<input type="hidden" name="search_status" value="'.$search_status.
'">';
928 print
'<input type="hidden" name="socid" value="'.$socid.
'">';
930 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'order', 0, $newcardbutton,
'', $limit, 0, 0, 1);
932 $topicmail =
"SendOrderRef";
933 $modelmail =
"order_send";
935 $trackid =
'ord'.$object->id;
936 include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
939 foreach ($fieldstosearchall as $key => $val) {
940 $fieldstosearchall[$key] = $langs->trans($val);
942 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>';
947 $moreforfilter .=
'<div class="divsearchfield">';
948 $moreforfilter .=
'<input type="checkbox" id="productobuy" name="productobuy"'.(!empty($productobuy) ?
'value="productobuychecked" checked' :
'').
'><label for="productobuy">'.$langs->trans(
"productobuy").
'</label>';
949 $moreforfilter .=
'</div>';
950 $moreforfilter .=
'<div class="divsearchfield">';
951 $moreforfilter .=
'<input type="checkbox" id="productonly" name="productonly"'.(!empty($productonly) ?
'value="productonlychecked" checked' :
'').
'><label for="productonly">'.$langs->trans(
"productonly").
'</label>';
952 $moreforfilter .=
'</div>';
953 $moreforfilter .=
'<div class="divsearchfield">';
954 $moreforfilter .=
'<input type="checkbox" id="disablelinefree" name="disablelinefree"'.(!empty($disablelinefree) ?
'value="disablelinefreechecked" checked' :
'').
'><label for="disablelinefree">'.$langs->trans(
"disablelinefree").
'</label>';
955 $moreforfilter .=
'</div><br>';
958 if ($user->hasRight(
'user',
'user',
'lire')) {
959 $langs->load(
"commercial");
960 $moreforfilter .=
'<div class="divsearchfield">';
961 $tmptitle = $langs->trans(
'ThirdPartiesOfSaleRepresentative');
962 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale,
'search_sale', $user, 0, $tmptitle,
'maxwidth250 widthcentpercentminusx');
963 $moreforfilter .=
'</div>';
966 if ($user->hasRight(
'user',
'user',
'lire')) {
967 $moreforfilter .=
'<div class="divsearchfield">';
968 $tmptitle = $langs->trans(
'LinkedToSpecificUsers');
969 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$form->select_dolusers($search_user,
'search_user', $tmptitle,
null, 0,
'',
'',
'0', 0, 0,
'', 0,
'',
'maxwidth250 widthcentpercentminusx');
970 $moreforfilter .=
'</div>';
973 if (
isModEnabled(
"category") && $user->hasRight(
'categorie',
'lire') && ($user->hasRight(
'produit',
'lire') || $user->hasRight(
'service',
'lire'))) {
975 $moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_PRODUCT, $search_product_category_array,
'minwidth300imp minwidth300', $searchCategoryProductOperator ? $searchCategoryProductOperator : 0, 1, 1, $langs->transnoentitiesnoconv(
"ProductsCategoryShort"));
977 if (
isModEnabled(
"category") && $user->hasRight(
'categorie',
'lire')) {
978 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
979 $moreforfilter .=
'<div class="divsearchfield">';
980 $tmptitle = $langs->trans(
'CustomersProspectsCategoriesShort');
981 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"').$formother->select_categories(
'customer', $search_categ_cus,
'search_categ_cus', 1, $tmptitle,
'minwidth300imp maxwidth300 widthcentpercentminusx');
982 $moreforfilter .=
'</div>';
985 require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
987 $moreforfilter .=
'<div class="divsearchfield">';
988 $tmptitle = $langs->trans(
'Warehouse');
989 $moreforfilter .=
img_picto($tmptitle,
'stock',
'class="pictofixedwidth"').$formproduct->selectWarehouses($search_warehouse,
'search_warehouse',
'', 1, 0, 0, $tmptitle, 0, 0, array(),
'minwidth300imp maxwidth300 widthcentpercentminusx');
990 $moreforfilter .=
'</div>';
994 $parameters = array();
995 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
996 if (empty($reshook)) {
997 $moreforfilter .= $hookmanager->resPrint;
999 $moreforfilter = $hookmanager->resPrint;
1002 if (!empty($moreforfilter)) {
1003 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1004 print $moreforfilter;
1008 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
1009 $selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN'));
1010 $selectedfields .= $form->showCheckAddButtons(
'checkforselect', 1);
1013 $selectedfields .=
'<script>';
1014 $selectedfields .=
' $(document).ready(function() {';
1015 $selectedfields .=
' console.log("Autoclick on checkforselects");';
1016 $selectedfields .=
' $("#checkforselects").click();';
1017 $selectedfields .=
' $("#massaction").val("createbills").change();';
1018 $selectedfields .=
' });';
1019 $selectedfields .=
'</script>';
1022 print
'<div class="div-table-responsive">';
1023 print
'<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
1025 print
'<tr class="liste_titre_filter">';
1029 print
'<td class="liste_titre center">';
1030 $searchpicto = $form->showFilterButtons(
'left');
1035 if (!empty($arrayfields[
'rowid'][
'checked'])) {
1036 print
'<td class="liste_titre right" data-key="id">';
1037 print
'<input class="flat searchstring width50" type="text" name="search_id" value="'.dol_escape_htmltag($search_id).
'">';
1041 if (!empty($arrayfields[
'c.ref'][
'checked'])) {
1042 print
'<td class="liste_titre">';
1043 print
'<input class="flat" size="6" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
1047 if (!empty($arrayfields[
'pr.ref'][
'checked'])) {
1048 print
'<td class="liste_titre">';
1049 print
'<input class="flat" size="6" type="text" name="search_refProduct" value="'.dol_escape_htmltag($search_refProduct).
'">';
1053 if (!empty($arrayfields[
'pr.desc'][
'checked'])) {
1054 print
'<td class="liste_titre">';
1055 print
'<input class="flat" size="6" type="text" name="search_descProduct" value="'.dol_escape_htmltag($search_descProduct).
'">';
1059 if (!empty($arrayfields[
'cdet.qty'][
'checked'])) {
1060 print
'<td class="liste_titre"></td>';
1064 if (!empty($arrayfields[
'c.ref_client'][
'checked'])) {
1065 print
'<td class="liste_titre" align="left">';
1066 print
'<input class="flat" type="text" size="6" name="search_ref_customer" value="'.dol_escape_htmltag($search_ref_customer).
'">';
1070 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1071 print
'<td class="liste_titre"><input type="text" class="flat" size="6" name="search_project_ref" value="'.dol_escape_htmltag($search_project_ref).
'"></td>';
1074 if (!empty($arrayfields[
'p.title'][
'checked'])) {
1075 print
'<td class="liste_titre"><input type="text" class="flat" size="6" name="search_project" value="'.dol_escape_htmltag($search_project).
'"></td>';
1078 if (!empty($arrayfields[
's.nom'][
'checked'])) {
1079 print
'<td class="liste_titre" align="left">';
1080 print
'<input class="flat maxwidth100" type="text" name="search_company" value="'.dol_escape_htmltag((
string) $search_company).
'">';
1084 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1085 print
'<td class="liste_titre" align="left">';
1086 print
'<input class="flat maxwidth100" type="text" name="search_company_alias" value="'.dol_escape_htmltag($search_company_alias).
'">';
1090 if (!empty($arrayfields[
's.town'][
'checked'])) {
1091 print
'<td class="liste_titre"><input class="flat" type="text" size="4" name="search_town" value="'.dol_escape_htmltag($search_town).
'"></td>';
1094 if (!empty($arrayfields[
's.zip'][
'checked'])) {
1095 print
'<td class="liste_titre"><input class="flat" type="text" size="4" name="search_zip" value="'.dol_escape_htmltag($search_zip).
'"></td>';
1098 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1099 print
'<td class="liste_titre">';
1100 print
'<input class="flat" size="4" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).
'">';
1104 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1105 print
'<td class="liste_titre" align="center">';
1106 print $form->select_country($search_country,
'search_country',
'', 0,
'minwidth100imp maxwidth100');
1110 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1111 print
'<td class="liste_titre maxwidthonsmartphone" align="center">';
1112 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);
1116 if (!empty($arrayfields[
'c.date_commande'][
'checked'])) {
1117 print
'<td class="liste_titre center">';
1118 print
'<div class="nowrapfordate">';
1119 print $form->selectDate($search_dateorder_start ? $search_dateorder_start : -1,
'search_dateorder_start_', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1121 print
'<div class="nowrapfordate">';
1122 print $form->selectDate($search_dateorder_end ? $search_dateorder_end : -1,
'search_dateorder_end_', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1126 if (!empty($arrayfields[
'c.delivery_date'][
'checked'])) {
1127 print
'<td class="liste_titre center">';
1128 print
'<div class="nowrapfordate">';
1129 print $form->selectDate($search_datedelivery_start ? $search_datedelivery_start : -1,
'search_datedelivery_start_', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1131 print
'<div class="nowrapfordate">';
1132 print $form->selectDate($search_datedelivery_end ? $search_datedelivery_end : -1,
'search_datedelivery_end_', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1137 if (!empty($arrayfields[
'c.fk_shipping_method'][
'checked'])) {
1138 print
'<td class="liste_titre">';
1139 $form->selectShippingMethod($search_fk_shipping_method,
'search_fk_shipping_method',
'', 1,
'', 1);
1143 if (!empty($arrayfields[
'c.fk_cond_reglement'][
'checked'])) {
1144 print
'<td class="liste_titre">';
1145 print $form->getSelectConditionsPaiements($search_fk_cond_reglement,
'search_fk_cond_reglement', 1, 1, 1);
1149 if (!empty($arrayfields[
'c.fk_mode_reglement'][
'checked'])) {
1150 print
'<td class="liste_titre">';
1151 $form->select_types_paiements($search_fk_mode_reglement,
'search_fk_mode_reglement',
'', 0, 1, 1, 0, -1);
1155 if (!empty($arrayfields[
'c.fk_input_reason'][
'checked'])) {
1156 print
'<td class="liste_titre">';
1157 $form->selectInputReason($search_fk_input_reason,
'search_fk_input_reason',
'', 1,
'', 1);
1160 if (!empty($arrayfields[
'cdet.total_ht'][
'checked'])) {
1162 print
'<td class="liste_titre right">';
1163 print
'<input class="flat" type="text" size="4" name="search_total_ht" value="'.dol_escape_htmltag($search_total_ht).
'">';
1166 if (!empty($arrayfields[
'c.total_vat'][
'checked'])) {
1168 print
'<td class="liste_titre right">';
1169 print
'<input class="flat" type="text" size="4" name="search_total_vat" value="'.dol_escape_htmltag($search_total_vat).
'">';
1172 if (!empty($arrayfields[
'cdet.total_ttc'][
'checked'])) {
1174 print
'<td class="liste_titre right">';
1175 print
'<input class="flat" type="text" size="5" name="search_total_ttc" value="'.$search_total_ttc.
'">';
1178 if (!empty($arrayfields[
'c.fk_warehouse'][
'checked'])) {
1180 print
'<td class="liste_titre right"></td>';
1182 if (!empty($arrayfields[
'c.multicurrency_code'][
'checked'])) {
1184 print
'<td class="liste_titre">';
1185 print $form->selectMultiCurrency($search_multicurrency_code,
'search_multicurrency_code', 1);
1188 if (!empty($arrayfields[
'c.multicurrency_tx'][
'checked'])) {
1190 print
'<td class="liste_titre">';
1191 print
'<input class="flat" type="text" size="4" name="search_multicurrency_tx" value="'.dol_escape_htmltag($search_multicurrency_tx).
'">';
1194 if (!empty($arrayfields[
'c.multicurrency_total_ht'][
'checked'])) {
1196 print
'<td class="liste_titre right">';
1197 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ht" value="'.dol_escape_htmltag($search_multicurrency_montant_ht).
'">';
1200 if (!empty($arrayfields[
'c.multicurrency_total_vat'][
'checked'])) {
1202 print
'<td class="liste_titre right">';
1203 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_vat" value="'.dol_escape_htmltag($search_multicurrency_montant_vat).
'">';
1206 if (!empty($arrayfields[
'c.multicurrency_total_ttc'][
'checked'])) {
1208 print
'<td class="liste_titre right">';
1209 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ttc" value="'.dol_escape_htmltag($search_multicurrency_montant_ttc).
'">';
1212 if (!empty($arrayfields[
'u.login'][
'checked'])) {
1214 print
'<td class="liste_titre" align="center">';
1215 print
'<input class="flat" size="4" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).
'">';
1218 if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
1219 print
'<td class="liste_titre"></td>';
1221 if (!empty($arrayfields[
'total_pa'][
'checked'])) {
1222 print
'<td class="liste_titre right">';
1225 if (!empty($arrayfields[
'total_margin'][
'checked'])) {
1226 print
'<td class="liste_titre right">';
1229 if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
1230 print
'<td class="liste_titre right">';
1233 if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
1234 print
'<td class="liste_titre right">';
1238 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
1240 $parameters = array(
'arrayfields' => $arrayfields);
1241 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters);
1242 print $hookmanager->resPrint;
1244 if (!empty($arrayfields[
'c.datec'][
'checked'])) {
1245 print
'<td class="liste_titre">';
1249 if (!empty($arrayfields[
'c.tms'][
'checked'])) {
1250 print
'<td class="liste_titre">';
1254 if (!empty($arrayfields[
'c.date_cloture'][
'checked'])) {
1255 print
'<td class="liste_titre center">';
1256 print
'<div class="nowrapfordate">';
1257 print $form->selectDate($search_datecloture_start ? $search_datecloture_start : -1,
'search_datecloture_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1259 print
'<div class="nowrapfordate">';
1260 print $form->selectDate($search_datecloture_end ? $search_datecloture_end : -1,
'search_datecloture_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1265 if (!empty($arrayfields[
'c.note_public'][
'checked'])) {
1266 print
'<td class="liste_titre">';
1270 if (!empty($arrayfields[
'c.note_private'][
'checked'])) {
1271 print
'<td class="liste_titre">';
1275 if (!empty($arrayfields[
'shippable'][
'checked'])) {
1276 print
'<td class="liste_titre maxwidthonsmartphone" align="center">';
1279 print
'<input type="checkbox" name="show_shippable_command" value="1"'.($show_shippable_command ?
' checked' :
'').
'>';
1280 print $langs->trans(
'ShowShippableStatus');
1282 $show_shippable_command = 1;
1287 if (!empty($arrayfields[
'c.facture'][
'checked'])) {
1288 print
'<td class="liste_titre maxwidthonsmartphone" align="center">';
1289 print $form->selectyesno(
'search_billed', $search_billed, 1, 0, 1, 1);
1293 if (!empty($arrayfields[
'c.import_key'][
'checked'])) {
1294 print
'<td class="liste_titre maxwidthonsmartphone" align="center">';
1298 if (!empty($arrayfields[
'c.fk_statut'][
'checked'])) {
1299 print
'<td class="liste_titre maxwidthonsmartphone center">';
1300 $liststatus = array(
1304 -2 => $langs->trans(
"StatusOrderValidatedShort").
'+'.$langs->trans(
"StatusOrderSentShort"),
1305 -3 => $langs->trans(
"StatusOrderValidatedShort").
'+'.$langs->trans(
"StatusOrderSentShort").
'+'.$langs->trans(
"StatusOrderDelivered"),
1310 print $form->selectarray(
'search_status', $liststatus, $search_status, -5, 0, 0,
'', 0, 0, 0,
'',
'maxwidth125', 1);
1315 print
'<td class="liste_titre" align="middle">';
1316 $searchpicto = $form->showFilterButtons();
1323 print
'<tr class="liste_titre">';
1326 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'', $param,
'', $sortfield, $sortorder,
'maxwidthsearch center ');
1330 if (!empty($arrayfields[
'rowid'][
'checked'])) {
1332 print_liste_field_titre($arrayfields[
'rowid'][
'label'], $_SERVER[
"PHP_SELF"],
'rowid',
'', $param,
'', $sortfield, $sortorder);
1334 if (!empty($arrayfields[
'c.ref'][
'checked'])) {
1335 print_liste_field_titre($arrayfields[
'c.ref'][
'label'], $_SERVER[
"PHP_SELF"],
'c.ref',
'', $param,
'', $sortfield, $sortorder);
1337 if (!empty($arrayfields[
'pr.ref'][
'checked'])) {
1338 print_liste_field_titre($arrayfields[
'pr.ref'][
'label'], $_SERVER[
"PHP_SELF"],
'pr.ref',
'', $param,
'', $sortfield, $sortorder);
1340 if (!empty($arrayfields[
'pr.desc'][
'checked'])) {
1341 print_liste_field_titre($arrayfields[
'pr.desc'][
'label'], $_SERVER[
"PHP_SELF"],
'pr.desc',
'', $param,
'', $sortfield, $sortorder);
1343 if (!empty($arrayfields[
'cdet.qty'][
'checked'])) {
1344 print_liste_field_titre($arrayfields[
'cdet.qty'][
'label'], $_SERVER[
"PHP_SELF"],
'cdet.qty',
'', $param,
'', $sortfield, $sortorder);
1347 if (!empty($arrayfields[
'c.ref_client'][
'checked'])) {
1348 print_liste_field_titre($arrayfields[
'c.ref_client'][
'label'], $_SERVER[
"PHP_SELF"],
'c.ref_client',
'', $param,
'', $sortfield, $sortorder);
1350 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1351 print_liste_field_titre($arrayfields[
'p.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"p.ref",
"", $param,
'', $sortfield, $sortorder);
1353 if (!empty($arrayfields[
'p.title'][
'checked'])) {
1354 print_liste_field_titre($arrayfields[
'p.title'][
'label'], $_SERVER[
"PHP_SELF"],
"p.title",
"", $param,
'', $sortfield, $sortorder);
1356 if (!empty($arrayfields[
's.nom'][
'checked'])) {
1357 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
"PHP_SELF"],
's.nom',
'', $param,
'', $sortfield, $sortorder);
1359 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1360 print_liste_field_titre($arrayfields[
's.name_alias'][
'label'], $_SERVER[
"PHP_SELF"],
's.name_alias',
'', $param,
'', $sortfield, $sortorder);
1362 if (!empty($arrayfields[
's.town'][
'checked'])) {
1363 print_liste_field_titre($arrayfields[
's.town'][
'label'], $_SERVER[
"PHP_SELF"],
's.town',
'', $param,
'', $sortfield, $sortorder);
1365 if (!empty($arrayfields[
's.zip'][
'checked'])) {
1366 print_liste_field_titre($arrayfields[
's.zip'][
'label'], $_SERVER[
"PHP_SELF"],
's.zip',
'', $param,
'', $sortfield, $sortorder);
1368 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1369 print_liste_field_titre($arrayfields[
'state.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"state.nom",
"", $param,
'', $sortfield, $sortorder);
1371 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1372 print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'], $_SERVER[
"PHP_SELF"],
"country.code_iso",
"", $param,
'', $sortfield, $sortorder,
'center ');
1374 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1375 print_liste_field_titre($arrayfields[
'typent.code'][
'label'], $_SERVER[
"PHP_SELF"],
"typent.code",
"", $param,
'', $sortfield, $sortorder,
'center ');
1377 if (!empty($arrayfields[
'c.date_commande'][
'checked'])) {
1378 print_liste_field_titre($arrayfields[
'c.date_commande'][
'label'], $_SERVER[
"PHP_SELF"],
'c.date_commande',
'', $param,
'', $sortfield, $sortorder,
'center ');
1380 if (!empty($arrayfields[
'c.delivery_date'][
'checked'])) {
1381 print_liste_field_titre($arrayfields[
'c.delivery_date'][
'label'], $_SERVER[
"PHP_SELF"],
'c.date_livraison',
'', $param,
'', $sortfield, $sortorder,
'center ');
1383 if (!empty($arrayfields[
'c.fk_shipping_method'][
'checked'])) {
1384 print_liste_field_titre($arrayfields[
'c.fk_shipping_method'][
'label'], $_SERVER[
"PHP_SELF"],
"c.fk_shipping_method",
"", $param,
'', $sortfield, $sortorder);
1386 if (!empty($arrayfields[
'c.fk_cond_reglement'][
'checked'])) {
1387 print_liste_field_titre($arrayfields[
'c.fk_cond_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"c.fk_cond_reglement",
"", $param,
'', $sortfield, $sortorder);
1389 if (!empty($arrayfields[
'c.fk_mode_reglement'][
'checked'])) {
1390 print_liste_field_titre($arrayfields[
'c.fk_mode_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"c.fk_mode_reglement",
"", $param,
'', $sortfield, $sortorder);
1392 if (!empty($arrayfields[
'c.fk_input_reason'][
'checked'])) {
1393 print_liste_field_titre($arrayfields[
'c.fk_input_reason'][
'label'], $_SERVER[
"PHP_SELF"],
"c.fk_input_reason",
"", $param,
'', $sortfield, $sortorder);
1395 if (!empty($arrayfields[
'cdet.total_ht'][
'checked'])) {
1396 print_liste_field_titre($arrayfields[
'cdet.total_ht'][
'label'], $_SERVER[
"PHP_SELF"],
'cdet.total_ht',
'', $param,
'', $sortfield, $sortorder,
'right ');
1398 if (!empty($arrayfields[
'c.total_vat'][
'checked'])) {
1399 print_liste_field_titre($arrayfields[
'c.total_vat'][
'label'], $_SERVER[
"PHP_SELF"],
'cdet.total_tva',
'', $param,
'', $sortfield, $sortorder,
'right ');
1401 if (!empty($arrayfields[
'cdet.total_ttc'][
'checked'])) {
1402 print_liste_field_titre($arrayfields[
'cdet.total_ttc'][
'label'], $_SERVER[
"PHP_SELF"],
'cdet.total_ttc',
'', $param,
'', $sortfield, $sortorder,
'right ');
1404 if (!empty($arrayfields[
'c.fk_warehouse'][
'checked'])) {
1405 print_liste_field_titre($arrayfields[
'c.fk_warehouse'][
'label'],
"",
'',
'', $param,
'', $sortfield, $sortorder);
1407 if (!empty($arrayfields[
'c.multicurrency_code'][
'checked'])) {
1408 print_liste_field_titre($arrayfields[
'c.multicurrency_code'][
'label'], $_SERVER[
'PHP_SELF'],
'c.multicurrency_code',
'', $param,
'', $sortfield, $sortorder);
1410 if (!empty($arrayfields[
'c.multicurrency_tx'][
'checked'])) {
1411 print_liste_field_titre($arrayfields[
'c.multicurrency_tx'][
'label'], $_SERVER[
'PHP_SELF'],
'c.multicurrency_tx',
'', $param,
'', $sortfield, $sortorder);
1413 if (!empty($arrayfields[
'c.multicurrency_total_ht'][
'checked'])) {
1414 print_liste_field_titre($arrayfields[
'c.multicurrency_total_ht'][
'label'], $_SERVER[
'PHP_SELF'],
'c.multicurrency_total_ht',
'', $param,
'class="right"', $sortfield, $sortorder);
1416 if (!empty($arrayfields[
'c.multicurrency_total_vat'][
'checked'])) {
1417 print_liste_field_titre($arrayfields[
'c.multicurrency_total_vat'][
'label'], $_SERVER[
'PHP_SELF'],
'c.multicurrency_total_tva',
'', $param,
'class="right"', $sortfield, $sortorder);
1419 if (!empty($arrayfields[
'c.multicurrency_total_ttc'][
'checked'])) {
1420 print_liste_field_titre($arrayfields[
'c.multicurrency_total_ttc'][
'label'], $_SERVER[
'PHP_SELF'],
'c.multicurrency_total_ttc',
'', $param,
'class="right"', $sortfield, $sortorder);
1422 if (!empty($arrayfields[
'u.login'][
'checked'])) {
1423 print_liste_field_titre($arrayfields[
'u.login'][
'label'], $_SERVER[
"PHP_SELF"],
'u.login',
'', $param,
'align="center"', $sortfield, $sortorder);
1425 if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
1426 print_liste_field_titre($arrayfields[
'sale_representative'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"",
"$param",
'', $sortfield, $sortorder);
1428 if (!empty($arrayfields[
'total_pa'][
'checked'])) {
1429 print_liste_field_titre($arrayfields[
'total_pa'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1431 if (!empty($arrayfields[
'total_margin'][
'checked'])) {
1432 print_liste_field_titre($arrayfields[
'total_margin'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1434 if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
1435 print_liste_field_titre($arrayfields[
'total_margin_rate'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1437 if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
1438 print_liste_field_titre($arrayfields[
'total_mark_rate'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1444 'cdet.total_ht' => 0,
1445 'cdet.total_tva' => 0,
1446 'cdet.total_ttc' => 0,
1451 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1453 $parameters = array(
1454 'arrayfields' => $arrayfields,
1456 'sortfield' => $sortfield,
1457 'sortorder' => $sortorder,
1460 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters);
1461 print $hookmanager->resPrint;
1462 if (!empty($arrayfields[
'c.datec'][
'checked'])) {
1463 print_liste_field_titre($arrayfields[
'c.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"c.date_creation",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1465 if (!empty($arrayfields[
'c.tms'][
'checked'])) {
1466 print_liste_field_titre($arrayfields[
'c.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"c.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1468 if (!empty($arrayfields[
'c.date_cloture'][
'checked'])) {
1469 print_liste_field_titre($arrayfields[
'c.date_cloture'][
'label'], $_SERVER[
"PHP_SELF"],
"c.date_cloture",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1471 if (!empty($arrayfields[
'c.note_public'][
'checked'])) {
1472 print_liste_field_titre($arrayfields[
'c.note_public'][
'label'], $_SERVER[
"PHP_SELF"],
"c.note_public",
"", $param,
'', $sortfield, $sortorder,
'right ');
1474 if (!empty($arrayfields[
'c.note_private'][
'checked'])) {
1475 print_liste_field_titre($arrayfields[
'c.note_private'][
'label'], $_SERVER[
"PHP_SELF"],
"c.note_private",
"", $param,
'', $sortfield, $sortorder,
'right ');
1477 if (!empty($arrayfields[
'shippable'][
'checked'])) {
1478 print_liste_field_titre($arrayfields[
'shippable'][
'label'], $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'center ');
1480 if (!empty($arrayfields[
'c.facture'][
'checked'])) {
1481 print_liste_field_titre($arrayfields[
'c.facture'][
'label'], $_SERVER[
"PHP_SELF"],
'c.facture',
'', $param,
'', $sortfield, $sortorder,
'center ');
1483 if (!empty($arrayfields[
'c.import_key'][
'checked'])) {
1484 print_liste_field_titre($arrayfields[
'c.import_key'][
'label'], $_SERVER[
"PHP_SELF"],
"c.import_key",
"", $param,
'', $sortfield, $sortorder,
'center ');
1486 if (!empty($arrayfields[
'c.fk_statut'][
'checked'])) {
1487 print_liste_field_titre($arrayfields[
'c.fk_statut'][
'label'], $_SERVER[
"PHP_SELF"],
"c.fk_statut",
"", $param,
'', $sortfield, $sortorder,
'center ');
1490 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'', $param,
'', $sortfield, $sortorder,
'maxwidthsearch center ');
1496 $productstat_cache = array();
1497 '@phan-var-force array<int,array{stats_order_customer?:float|int,stats_order_supplier?:float|int}> $product_stat_cache';
1498 $productstat_cachevirtual = array();
1499 '@phan-var-force array<int,array{stats_order_customer?:float|int,stats_order_supplier?:float|int}> $product_stat_cachevirtual';
1500 $getNomUrl_cache = array();
1502 $generic_commande =
new Commande($db);
1503 $generic_product =
new Product($db);
1504 $userstatic =
new User($db);
1507 $with_margin_info =
false;
1509 !empty($arrayfields[
'total_pa'][
'checked'])
1510 || !empty($arrayfields[
'total_margin'][
'checked'])
1511 || !empty($arrayfields[
'total_margin_rate'][
'checked'])
1512 || !empty($arrayfields[
'total_mark_rate'][
'checked'])
1515 $with_margin_info =
true;
1527 $subtotalarray = array();
1528 $subtotalarray[
'nbfield'] = 0;
1531 $imaxinloop = ($limit ? min($num, $limit) : $num);
1532 while ($i < $imaxinloop) {
1533 $obj = $db->fetch_object($resql);
1543 $oldref = $obj->product_ref;
1545 if ($oldref != $obj->product_ref && $sortfield ==
'pr.ref') {
1546 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_subtotal.tpl.php';
1547 $oldref = $obj->product_ref;
1550 $companystatic->id = $obj->socid;
1551 $companystatic->name = $obj->name;
1552 $companystatic->name_alias = $obj->alias;
1553 $companystatic->client = $obj->client;
1554 $companystatic->code_client = $obj->code_client;
1555 $companystatic->email = $obj->email;
1556 $companystatic->phone = $obj->phone;
1557 $companystatic->address = $obj->address;
1558 $companystatic->zip = $obj->zip;
1559 $companystatic->town = $obj->town;
1560 $companystatic->country_code = $obj->country_code;
1561 if (!isset($getNomUrl_cache[$obj->socid])) {
1562 $getNomUrl_cache[$obj->socid] = $companystatic->getNomUrl(1,
'customer');
1565 $generic_commande->id = $obj->c_rowid;
1566 $generic_commande->ref = $obj->ref;
1567 $generic_commande->statut = $obj->fk_statut;
1568 $generic_commande->status = $obj->fk_statut;
1569 $generic_commande->billed = $obj->billed;
1570 $generic_commande->date = $db->jdate($obj->date_commande);
1571 $generic_commande->delivery_date = $db->jdate($obj->delivery_date);
1572 $generic_commande->ref_client = $obj->ref_client;
1573 $generic_commande->total_ht = $obj->c_total_ht;
1574 $generic_commande->total_tva = $obj->c_total_tva;
1575 $generic_commande->total_ttc = $obj->c_total_ttc;
1576 $generic_commande->note_public = $obj->note_public;
1577 $generic_commande->note_private = $obj->note_private;
1579 $projectstatic->id = $obj->project_id;
1580 $projectstatic->ref = $obj->project_ref;
1581 $projectstatic->title = $obj->project_label;
1583 $marginInfo = array();
1584 if ($with_margin_info) {
1585 $generic_commande->fetch_lines();
1586 $marginInfo = $formmargin->getMarginInfosArray($generic_commande);
1587 $total_ht += $obj->total_ht;
1588 $total_margin += $marginInfo[
'total_margin'];
1591 print
'<tr class="oddeven">';
1595 print
'<td class="nowrap center">';
1596 if ($massactionbutton || $massaction) {
1598 if (in_array($obj->rowid, $arrayofselected)) {
1601 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1612 if (!empty($arrayfields[
'rowid'][
'checked'])) {
1613 print
'<td class="nowrap right">'.$obj->rowid.
'</td>';
1620 if (!empty($arrayfields[
'c.ref'][
'checked'])) {
1621 print
'<td class="nowraponall">';
1622 print $generic_commande->getNomUrl(1, ($search_status != 2 ? 0 : $obj->fk_statut), 0, 0, 0, 1, 1);
1625 $filedir = $conf->commande->multidir_output[$conf->entity].
'/'.
dol_sanitizeFileName($obj->ref);
1626 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid;
1627 print $formfile->getDocumentsLink($generic_commande->element, $filename, $filedir);
1636 if (!empty($arrayfields[
'pr.ref'][
'checked'])) {
1637 if (!empty($obj->product_rowid)) {
1638 $generic_product->id = $obj->product_rowid;
1639 $generic_product->ref = $obj->product_ref;
1640 $generic_product->label = $obj->product_label;
1641 $generic_product->status = $obj->product_status;
1642 $generic_product->status_buy = $obj->product_status_buy;
1643 $generic_product->status_batch = $obj->product_batch;
1644 $generic_product->barcode = $obj->product_barcode;
1645 print
'<td class="nowrap tdoverflowmax200">'.$generic_product->getNomUrl(1).
'</td>';
1647 print
'<td class="nowrap tdoverflowmax200"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td>';
1654 if (!empty($arrayfields[
'pr.desc'][
'checked'])) {
1656 $descline = empty($obj->description) ? $obj->product_label : $obj->description;
1657 print
'<td class="nowrap tdoverflowmax200">';
1666 if (!empty($arrayfields[
'cdet.qty'][
'checked'])) {
1667 print
'<td class="nowrap right">'.$obj->qty.
'</td>';
1668 if (isset(
$totalarray[
'val'][
'cdet.qty']) || isset($subtotalarray[
'val'][
'cdet.qty'])) {
1670 $subtotalarray[
'val'][
'cdet.qty'] += $obj->qty;
1673 $subtotalarray[
'val'][
'cdet.qty'] = $obj->qty;
1680 $totalarray[
'pos'][$subtotalarray[
'nbfield']] =
'cdet.qty';
1685 if (!empty($arrayfields[
'c.ref_client'][
'checked'])) {
1686 print
'<td class="nowrap tdoverflowmax200">'.$obj->ref_client.
'</td>';
1693 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1694 print
'<td class="nowrap">';
1695 if ($obj->project_id > 0) {
1696 print $projectstatic->getNomUrl(1);
1705 if (!empty($arrayfields[
'p.title'][
'checked'])) {
1706 print
'<td class="nowrap">';
1707 if ($obj->project_id > 0) {
1708 print $projectstatic->title;
1717 if (!empty($arrayfields[
's.nom'][
'checked'])) {
1718 print
'<td class="tdoverflowmax150">';
1719 print $getNomUrl_cache[$obj->socid];
1723 if ($user->hasRight(
'facture',
'creer')) {
1724 if (($obj->fk_statut > 0 && $obj->fk_statut < 3) || ($obj->fk_statut == 3 && $obj->billed == 0)) {
1725 print
' <a href="'.DOL_URL_ROOT.
'/commande/list.php?socid='.$companystatic->id.
'&search_billed=0&autoselectall=1">';
1726 print
img_picto($langs->trans(
"CreateInvoiceForThisCustomer").
' : '.$companystatic->name,
'object_bill',
'hideonsmartphone').
'</a>';
1736 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1737 print
'<td class="nocellnopadd">';
1745 if (!empty($arrayfields[
's.town'][
'checked'])) {
1746 print
'<td class="nocellnopadd">';
1754 if (!empty($arrayfields[
's.zip'][
'checked'])) {
1755 print
'<td class="nocellnopadd">';
1763 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1764 print
"<td>".$obj->state_name.
"</td>\n";
1770 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1771 print
'<td class="center">';
1772 $tmparray =
getCountry($obj->fk_pays,
'all');
1773 print $tmparray[
'label'];
1780 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1781 print
'<td class="center">';
1782 if (empty($typenArray)) {
1783 $typenArray = $formcompany->typent_array(1);
1785 print $typenArray[$obj->typent_code];
1793 if (!empty($arrayfields[
'c.date_commande'][
'checked'])) {
1794 print
'<td class="center">';
1797 if ($generic_commande->hasDelay()) {
1798 print
img_picto($langs->trans(
"Late").
' : '.$generic_commande->showDelay(),
"warning");
1806 if (!empty($arrayfields[
'c.delivery_date'][
'checked'])) {
1807 print
'<td class="center" title="'.$langs->trans((
string) $arrayfields[
'c.delivery_date'][
'label']).
': '.
dol_print_date($db->jdate($obj->delivery_date),
'dayhour').
'">';
1815 if (!empty($arrayfields[
'c.fk_shipping_method'][
'checked'])) {
1817 $form->formSelectShippingMethod(
'', $obj->fk_shipping_method,
'none', 1);
1824 if (!empty($arrayfields[
'c.fk_cond_reglement'][
'checked'])) {
1826 $form->form_conditions_reglement($_SERVER[
'PHP_SELF'], $obj->fk_cond_reglement,
'none', 0,
'', 1, $obj->deposit_percent);
1833 if (!empty($arrayfields[
'c.fk_mode_reglement'][
'checked'])) {
1835 $form->form_modes_reglement($_SERVER[
'PHP_SELF'], $obj->fk_mode_reglement,
'none',
'', -1);
1842 if (!empty($arrayfields[
'c.fk_input_reason'][
'checked'])) {
1844 $form->formInputReason($_SERVER[
'PHP_SELF'], $obj->fk_input_reason,
'none', 0);
1851 if (!empty($arrayfields[
'cdet.total_ht'][
'checked'])) {
1852 print
'<td class="nowrap right"><span class="amount">'.price($obj->total_ht).
"</span></td>\n";
1858 $totalarray[
'pos'][$subtotalarray[
'nbfield']] =
'cdet.total_ht';
1860 if (isset(
$totalarray[
'val'][
'cdet.total_ht']) || isset($subtotalarray[
'val'][
'cdet.total_ht'])) {
1861 $totalarray[
'val'][
'cdet.total_ht'] += $obj->total_ht;
1862 $subtotalarray[
'val'][
'cdet.total_ht'] += $obj->total_ht;
1864 $totalarray[
'val'][
'cdet.total_ht'] = $obj->total_ht;
1865 $subtotalarray[
'val'][
'cdet.total_ht'] = $obj->total_ht;
1869 if (!empty($arrayfields[
'c.total_vat'][
'checked'])) {
1870 print
'<td class="nowrap right"><span class="amount">'.price($obj->total_tva).
"</span></td>\n";
1876 $totalarray[
'pos'][$subtotalarray[
'nbfield']] =
'cdet.total_tva';
1878 $totalarray[
'val'][
'cdet.total_tva'] += $obj->total_tva;
1879 $subtotalarray[
'val'][
'cdet.total_tva'] += $obj->total_tva;
1882 if (!empty($arrayfields[
'cdet.total_ttc'][
'checked'])) {
1883 print
'<td class="nowrap right"><span class="amount">'.price($obj->total_ttc).
"</span></td>\n";
1889 $subtotalarray[
'pos'][
$totalarray[
'nbfield']] =
'cdet.total_ttc';
1891 $totalarray[
'val'][
'cdet.total_ttc'] += $obj->total_ttc;
1892 $subtotalarray[
'val'][
'cdet.total_ttc'] += $obj->total_ttc;
1895 if (!empty($arrayfields[
'c.fk_warehouse'][
'checked'])) {
1896 print
'<td class="nowrap">';
1897 if ($obj->warehouse > 0) {
1898 print
img_picto(
'',
'stock',
'class="paddingrightonly"');
1900 if (!is_object($formproduct)) {
1901 require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
1904 $formproduct->formSelectWarehouses($_SERVER[
'PHP_SELF'], $obj->warehouse,
'none');
1911 if (!empty($arrayfields[
'c.multicurrency_code'][
'checked'])) {
1912 print
'<td class="nowrap">'.$obj->multicurrency_code.
' - '.$langs->trans(
'Currency'.$obj->multicurrency_code).
"</td>\n";
1919 if (!empty($arrayfields[
'c.multicurrency_tx'][
'checked'])) {
1920 print
'<td class="nowrap">';
1921 $form->form_multicurrency_rate($_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid, $obj->multicurrency_tx,
'none', $obj->multicurrency_code);
1928 if (!empty($arrayfields[
'c.multicurrency_total_ht'][
'checked'])) {
1929 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ht).
"</span></td>\n";
1935 if (!empty($arrayfields[
'c.multicurrency_total_vat'][
'checked'])) {
1936 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_vat).
"</span></td>\n";
1942 if (!empty($arrayfields[
'c.multicurrency_total_ttc'][
'checked'])) {
1943 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ttc).
"</span></td>\n";
1949 $userstatic->id = $obj->fk_user_author;
1950 $userstatic->login = $obj->login;
1951 $userstatic->lastname = $obj->lastname;
1952 $userstatic->firstname = $obj->firstname;
1953 $userstatic->email = $obj->user_email;
1954 $userstatic->status = $obj->user_statut;
1955 $userstatic->entity = $obj->entity;
1956 $userstatic->photo = $obj->photo;
1957 $userstatic->office_phone = $obj->office_phone;
1958 $userstatic->office_fax = $obj->office_fax;
1959 $userstatic->user_mobile = $obj->user_mobile;
1960 $userstatic->job = $obj->job;
1961 $userstatic->gender = $obj->gender;
1964 if (!empty($arrayfields[
'u.login'][
'checked'])) {
1965 print
'<td class="tdoverflowmax200">';
1966 if ($userstatic->id) {
1967 print $userstatic->getNomUrl(-1);
1977 if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
1980 if ($obj->socid > 0) {
1981 $listsalesrepresentatives = $companystatic->getSalesRepresentatives($user);
1982 if ($listsalesrepresentatives < 0) {
1985 $nbofsalesrepresentative = count($listsalesrepresentatives);
1986 if ($nbofsalesrepresentative > 6) {
1988 print $nbofsalesrepresentative;
1989 } elseif ($nbofsalesrepresentative > 0) {
1991 foreach ($listsalesrepresentatives as $val) {
1992 $userstatic->id = $val[
'id'];
1993 $userstatic->lastname = $val[
'lastname'];
1994 $userstatic->firstname = $val[
'firstname'];
1995 $userstatic->email = $val[
'email'];
1996 $userstatic->status = $val[
'statut'];
1997 $userstatic->entity = $val[
'entity'];
1998 $userstatic->photo = $val[
'photo'];
1999 $userstatic->login = $val[
'login'];
2000 $userstatic->office_phone = $val[
'office_phone'];
2001 $userstatic->office_fax = $val[
'office_fax'];
2002 $userstatic->user_mobile = $val[
'user_mobile'];
2003 $userstatic->job = $val[
'job'];
2004 $userstatic->gender = $val[
'gender'];
2006 print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1,
'', 0, 0, 12) : $userstatic->getNomUrl(-2);
2008 if ($j < $nbofsalesrepresentative) {
2025 if (!empty($arrayfields[
'total_pa'][
'checked'])) {
2026 print
'<td class="right nowrap">'.price($marginInfo[
'pa_total']).
'</td>';
2032 if (!empty($arrayfields[
'total_margin'][
'checked'])) {
2033 print
'<td class="right nowrap">'.price($marginInfo[
'total_margin']).
'</td>';
2039 $totalarray[
'pos'][$subtotalarray[
'nbfield']] =
'total_margin';
2041 $totalarray[
'val'][
'total_margin'] += $marginInfo[
'total_margin'];
2042 $subtotalarray[
'val'][
'total_margin'] += $marginInfo[
'total_margin'];
2045 if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
2046 print
'<td class="right nowrap">'.(($marginInfo[
'total_margin_rate'] ==
'') ?
'' :
price($marginInfo[
'total_margin_rate'], 0,
'', 0, 0, 2).
'%').
'</td>';
2052 if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
2053 print
'<td class="right nowrap">'.(($marginInfo[
'total_mark_rate'] ==
'') ?
'' :
price($marginInfo[
'total_mark_rate'], 0,
'', 0, 0, 2).
'%').
'</td>';
2059 $totalarray[
'pos'][$subtotalarray[
'nbfield']] =
'total_mark_rate';
2061 if ($i >= $imaxinloop - 1) {
2062 if (!empty($total_ht)) {
2064 $subtotalarray[
'val'][
'total_mark_rate'] =
price2num($total_margin * 100 / $total_ht,
'MT');
2067 $subtotalarray[
'val'][
'total_mark_rate'] =
'';
2073 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
2075 $parameters = array(
'arrayfields' => $arrayfields,
'obj' => $obj,
'i' => $i,
'totalarray' => &
$totalarray);
2076 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
2077 print $hookmanager->resPrint;
2080 if (!empty($arrayfields[
'c.datec'][
'checked'])) {
2081 print
'<td align="center" class="nowrap">';
2082 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuser');
2090 if (!empty($arrayfields[
'c.tms'][
'checked'])) {
2091 print
'<td align="center" class="nowrap">';
2092 print
dol_print_date($db->jdate($obj->date_modification),
'dayhour',
'tzuser');
2100 if (!empty($arrayfields[
'c.date_cloture'][
'checked'])) {
2101 print
'<td align="center" class="nowrap">';
2102 print
dol_print_date($db->jdate($obj->date_cloture),
'dayhour',
'tzuser');
2110 if (!empty($arrayfields[
'c.note_public'][
'checked'])) {
2111 print
'<td class="sensiblehtmlcontent center">';
2120 if (!empty($arrayfields[
'c.note_private'][
'checked'])) {
2121 print
'<td class="center">';
2130 if (!empty($arrayfields[
'shippable'][
'checked'])) {
2131 print
'<td class="center">';
2132 if (!empty($show_shippable_command) &&
isModEnabled(
'stock')) {
2134 if (($obj->fk_statut > $generic_commande::STATUS_DRAFT) && ($obj->fk_statut < $generic_commande::STATUS_CLOSED)) {
2135 $generic_commande->loadExpeditions();
2137 if (isset($generic_commande->expeditions[$obj->rowid])) {
2138 $reliquat = $obj->qty - $generic_commande->expeditions[$obj->rowid];
2140 $reliquat = $obj->qty;
2142 if ($obj->product_type == 0 && $obj->fk_product > 0) {
2144 $generic_product->id = $obj->fk_product;
2147 if (empty($productstat_cache[$obj->fk_product])) {
2148 $generic_product->load_stock(
'nobatch');
2149 $productstat_cache[$obj->fk_product][
'stock_reel'] = $generic_product->stock_reel;
2150 $productstat_cachevirtual[$obj->fk_product][
'stock_reel'] = $generic_product->stock_theorique;
2152 $generic_product->stock_reel = $productstat_cache[$obj->fk_product][
'stock_reel'];
2153 $generic_product->stock_theorique = $productstat_cachevirtual[$obj->fk_product][
'stock_reel'];
2156 if ($reliquat > $generic_product->stock_reel) {
2160 $text_info .= $reliquat.
' x '.$obj->product_ref.
' '.
dol_trunc($obj->product_label, 20);
2161 $text_info .=
' - '.$langs->trans(
"Stock").
': <span class="'.($generic_product->stock_reel > 0 ?
'ok' :
'error').
'">'.$generic_product->stock_reel.
'</span>';
2162 $text_info .=
' - '.$langs->trans(
"VirtualStock").
': <span class="'.($generic_product->stock_theorique > 0 ?
'ok' :
'error').
'">'.$generic_product->stock_theorique.
'</span>';
2163 $text_info .= ($reliquat != $obj->qty ?
' <span class="opacitymedium">('.$langs->trans(
"QtyInOtherShipments").
' '.($obj->qty - $reliquat).
')</span>' :
'');
2164 $text_info .=
'<br>';
2171 $stock_order_supplier = 0;
2174 if (empty($productstat_cache[$obj->fk_product][
'stats_order_customer'])) {
2175 $generic_product->load_stats_commande(0,
'1,2');
2176 $productstat_cache[$obj->fk_product][
'stats_order_customer'] = $generic_product->stats_commande[
'qty'];
2178 $generic_product->stats_commande[
'qty'] = $productstat_cache[$obj->fk_product][
'stats_order_customer'];
2180 $stock_order = $generic_product->stats_commande[
'qty'];
2183 if (empty($productstat_cache[$obj->fk_product][
'stats_order_supplier'])) {
2184 $generic_product->load_stats_commande_fournisseur(0,
'3');
2185 $productstat_cache[$obj->fk_product][
'stats_order_supplier'] = $generic_product->stats_commande_fournisseur[
'qty'];
2187 $generic_product->stats_commande_fournisseur[
'qty'] = $productstat_cache[$obj->fk_product][
'stats_order_supplier'];
2189 $stock_order_supplier = $generic_product->stats_commande_fournisseur[
'qty'];
2192 $text_info .= $reliquat.
' x '.$obj->product_ref.
' '.
dol_trunc($obj->product_label, 20);
2193 $text_stock_reel = $generic_product->stock_reel.
'/'.$stock_order;
2194 if ($stock_order > $generic_product->stock_reel && !($generic_product->stock_reel < $obj->qty)) {
2196 $text_warning .=
'<span class="warning">'.$langs->trans(
'Available').
' : '.$text_stock_reel.
'</span>';
2198 if ($reliquat > $generic_product->stock_reel) {
2199 $text_info .=
'<span class="warning">'.$langs->trans(
'Available').
' : '.$text_stock_reel.
'</span>';
2201 $text_info .=
'<span class="ok">'.$langs->trans(
'Available').
' : '.$text_stock_reel.
'</span>';
2204 $text_info .=
' '.$langs->trans(
'SupplierOrder').
' : '.$stock_order_supplier;
2206 $text_info .= ($reliquat != $obj->qty ?
' <span class="opacitymedium">('.$langs->trans(
"QtyInOtherShipments").
' '.($obj->qty - $reliquat).
')</span>' :
'');
2207 $text_info .=
'<br>';
2210 if ($notshippable == 0) {
2211 $text_icon =
img_picto(
'',
'dolly',
'', 0, 0, 0,
'',
'green paddingleft');
2212 $text_info = $text_icon.
' '.$langs->trans(
'Shippable').
'<br>'.$text_info;
2214 $text_icon =
img_picto(
'',
'dolly',
'', 0, 0, 0,
'',
'error paddingleft');
2215 $text_info = $text_icon.
' '.$langs->trans(
'NonShippable').
'<br>'.$text_info;
2220 print $form->textwithtooltip(
'', $text_info, 2, 1, $text_icon,
'', 2);
2223 print $form->textwithtooltip(
'', $langs->trans(
'NotEnoughForAllOrders').
'<br>'.$text_warning, 2, 1,
img_picto(
'',
'error'),
'', 2);
2233 if (!empty($arrayfields[
'c.facture'][
'checked'])) {
2234 print
'<td class="center">';
2236 print
yn($obj->billed, $langs->trans(
"Billed"));
2244 if (!empty($arrayfields[
'c.import_key'][
'checked'])) {
2245 print
'<td class="nowrap center">'.$obj->import_key.
'</td>';
2251 if (!empty($arrayfields[
'c.fk_statut'][
'checked'])) {
2252 print
'<td class="nowrap center">'.$generic_commande->LibStatut($obj->fk_statut, $obj->billed, 5, 1).
'</td>';
2260 print
'<td class="nowrap center">';
2261 if ($massactionbutton || $massaction) {
2263 if (in_array($obj->rowid, $arrayofselected)) {
2266 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
2276 $total += $obj->total_ht;
2277 $subtotal += $obj->total_ht;
2280 if ($sortfield ==
'pr.ref') {
2281 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_subtotal.tpl.php';
2284 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
2289 foreach ($arrayfields as $key => $val) {
2290 if (!empty($val[
'checked'])) {
2294 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
2299 $parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
2300 $reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters);
2301 print $hookmanager->resPrint;
2303 print
'</table>'.
"\n";
2306 print
'</form>'.
"\n";
2308 $hidegeneratedfilelistifempty = 1;
2309 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
2310 $hidegeneratedfilelistifempty = 0;
2314 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
2315 $urlsource .= str_replace(
'&',
'&', $param);
2317 $filedir = $diroutputmassaction;
2318 $genallowed = $permissiontoread;
2319 $delallowed = $permissiontoadd;
2321 print $formfile->showdocuments(
'massfilesarea_orders',
'', $filedir, $urlsource, 0, $delallowed,
'', 1, 1, 0, 48, 1, $param, $title,
'',
'',
'',
null, $hidegeneratedfilelistifempty);
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $object
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage customers orders.
const STATUS_SHIPMENTONPROCESS
Shipment on process.
const STATUS_CLOSED
Closed (Sent, billed or not)
const STATUS_CANCELED
Canceled status.
const STATUS_DRAFT
Draft status.
const STATUS_VALIDATED
Validated status.
Class to manage products or services.
Class to manage projects.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage Dolibarr users.
getCountry($searchkey, $withcode='', $dbtouse=null, $outputlangs=null, $entconv=1, $searchlabel='')
Return country label, code or id from an id, code or label.
dol_now($mode='gmt')
Return date for now.
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_liste_field_titre($name, $file="", $field="", $begin="", $param="", $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, $selectlimitsuffix=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dolGetFirstLineOfText($text, $nboflines=1, $charset='UTF-8')
Return first line of text.
dolPrintHTML($s, $allowiframe=0)
Return a string (that can be on several lines) ready to be output on a HTML page.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0, $allowdash=0)
Clean a string to use it as a file name.
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.
natural_search($fields, $value, $mode=0, $nofirstand=0, $sqltoadd='')
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
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...
yn($yesno, $format=1, $color=0)
Return yes or no in current language.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
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.
isModEnabled($module)
Is Dolibarr module enabled.
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.