38require
'../main.inc.php';
47require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
48require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
49require_once DOL_DOCUMENT_ROOT.
'/core/class/discount.class.php';
50require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
51require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
52require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
54 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmargin.class.php';
56require_once DOL_DOCUMENT_ROOT.
'/commande/class/commande.class.php';
57require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
58require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
59require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
60require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
63 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcategory.class.php';
64 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
68$langs->loadLangs(array(
"categories",
"orders",
'sendings',
'companies',
'compta',
'bills',
'stocks',
'products'));
70$action =
GETPOST(
'action',
'aZ09');
71$massaction =
GETPOST(
'massaction',
'alpha');
73$confirm =
GETPOST(
'confirm',
'alpha');
74$toselect =
GETPOST(
'toselect',
'array:int');
75$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'orderlistdet';
76$optioncss =
GETPOST(
'optioncss',
'alpha');
78$productobuy =
GETPOST(
'productobuy',
'alpha');
79$productonly =
GETPOST(
'productonly',
'alpha');
80$disablelinefree =
GETPOST(
'disablelinefree',
'alpha');
82$search_datecloture_start =
GETPOSTINT(
'search_datecloture_start');
83if (empty($search_datecloture_start)) {
86$search_datecloture_end =
GETPOSTINT(
'search_datecloture_end');
87if (empty($search_datecloture_end)) {
95$search_product_category_array = array();
96$searchCategoryProductOperator = 0;
98 $search_product_category_array =
GETPOST(
"search_category_".Categorie::TYPE_PRODUCT.
"_list",
"array");
100 $searchCategoryProductOperator =
GETPOSTINT(
'search_category_product_operator');
109$search_id =
GETPOST(
'search_id',
'alpha');
110$search_refProduct =
GETPOST(
'search_refProduct',
'alpha');
111$search_descProduct =
GETPOST(
'search_descProduct',
'alpha');
113$search_ref =
GETPOST(
'search_ref',
'alpha') !=
'' ?
GETPOST(
'search_ref',
'alpha') :
GETPOST(
'sref',
'alpha');
114$search_ref_customer =
GETPOST(
'search_ref_customer',
'alpha');
115$search_company =
GETPOST(
'search_company',
'alpha');
116$search_company_alias =
GETPOST(
'search_company_alias',
'alpha');
117$search_town =
GETPOST(
'search_town',
'alpha');
118$search_zip =
GETPOST(
'search_zip',
'alpha');
119$search_state =
GETPOST(
"search_state",
'alpha');
120$search_country =
GETPOST(
"search_country",
'aZ09');
121$search_type_thirdparty =
GETPOST(
"search_type_thirdparty",
'intcomma');
122$search_all = trim(
GETPOST(
'search_all',
'alphanohtml'));
123$search_user =
GETPOST(
'search_user',
'intcomma');
124$search_sale =
GETPOST(
'search_sale',
'intcomma');
125$search_total_ht =
GETPOST(
'search_total_ht',
'alpha');
126$search_total_vat =
GETPOST(
'search_total_vat',
'alpha');
127$search_total_ttc =
GETPOST(
'search_total_ttc',
'alpha');
128$search_warehouse =
GETPOST(
'search_warehouse',
'intcomma');
129$search_multicurrency_code =
GETPOST(
'search_multicurrency_code',
'alpha');
130$search_multicurrency_tx =
GETPOST(
'search_multicurrency_tx',
'alpha');
131$search_multicurrency_montant_ht =
GETPOST(
'search_multicurrency_montant_ht',
'alpha');
132$search_multicurrency_montant_vat =
GETPOST(
'search_multicurrency_montant_vat',
'alpha');
133$search_multicurrency_montant_ttc =
GETPOST(
'search_multicurrency_montant_ttc',
'alpha');
134$search_login =
GETPOST(
'search_login',
'alpha');
135$search_categ_cus =
GETPOST(
"search_categ_cus",
'intcomma');
136$search_billed =
GETPOST(
'search_billed',
'intcomma');
137$search_status =
GETPOST(
'search_status',
'intcomma');
138$search_project_ref =
GETPOST(
'search_project_ref',
'alpha');
139$search_project =
GETPOST(
'search_project',
'alpha');
140$search_shippable =
GETPOST(
'search_shippable',
'aZ09');
141$search_fk_cond_reglement =
GETPOSTINT(
"search_fk_cond_reglement");
142$search_fk_shipping_method =
GETPOSTINT(
"search_fk_shipping_method");
143$search_fk_mode_reglement =
GETPOSTINT(
"search_fk_mode_reglement");
144$search_fk_input_reason =
GETPOSTINT(
"search_fk_input_reason");
146$diroutputmassaction =
$conf->commande->multidir_output[
$conf->entity].
'/temp/massgeneration/'.$user->id;
150$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
151$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
153if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
156$offset = $limit * $page;
157$pageprev = $page - 1;
158$pagenext = $page + 1;
160 $sortfield =
'c.ref';
166$show_shippable_command =
GETPOST(
'show_shippable_command',
'aZ09');
170$hookmanager->initHooks(array(
'orderlistdetail'));
173$extrafields->fetch_name_optionals_label(
$object->table_element);
174$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
177$fieldstosearchall = array(
179 'c.ref_client' =>
'RefCustomerOrder',
180 'cdet.description' =>
'Description',
181 's.nom' =>
"ThirdParty",
182 's.name_alias' =>
"AliasNameShort",
185 'c.note_public' =>
'NotePublic',
187if (empty($user->socid)) {
188 $fieldstosearchall[
"c.note_private"] =
"NotePrivate";
191$checkedtypetiers = 0;
194 'rowid' => array(
'label' =>
'LineID',
'checked' =>
'-1',
'position' => 1,
'enabled' =>
'1'),
195 'c.ref' => array(
'label' =>
"RefOrder",
'checked' =>
'1',
'position' => 5),
196 'pr.ref' => array(
'label' =>
'ProductRef',
'checked' =>
'1',
'position' => 6),
197 'pr.label' => array(
'label' =>
'ProductLabel',
'checked' =>
'-1',
'position' => 7),
198 'cdet.qty' => array(
'label' =>
'QtyOrdered',
'checked' =>
'1',
'position' => 8),
199 'c.ref_client' => array(
'label' =>
"RefCustomerOrder",
'checked' =>
'-1',
'position' => 10),
200 'p.ref' => array(
'label' =>
"ProjectRef",
'checked' =>
'-1',
'enabled' => (
string) (
int)
isModEnabled(
'project'),
'position' => 20),
201 'p.title' => array(
'label' =>
"ProjectLabel",
'checked' =>
'0',
'enabled' => (
string) (
int)
isModEnabled(
'project'),
'position' => 25),
202 's.nom' => array(
'label' =>
"ThirdParty",
'checked' =>
'1',
'position' => 30),
203 's.name_alias' => array(
'label' =>
"AliasNameShort",
'checked' =>
'-1',
'position' => 31),
204 's.town' => array(
'label' =>
"Town",
'checked' =>
'-1',
'position' => 35),
205 's.zip' => array(
'label' =>
"Zip",
'checked' =>
'-1',
'position' => 40),
206 'state.nom' => array(
'label' =>
"StateShort",
'checked' =>
'0',
'position' => 45),
207 'country.code_iso' => array(
'label' =>
"Country",
'checked' =>
'0',
'position' => 50),
208 'typent.code' => array(
'label' =>
"ThirdPartyType",
'checked' => (
string) $checkedtypetiers,
'position' => 55),
209 'c.date_commande' => array(
'label' =>
"OrderDateShort",
'checked' =>
'1',
'position' => 60),
210 'c.delivery_date' => array(
'label' =>
"DateDeliveryPlanned",
'checked' =>
'1',
'enabled' => (
string) (
int) !
getDolGlobalString(
'ORDER_DISABLE_DELIVERY_DATE'),
'position' => 65),
211 'c.fk_shipping_method' => array(
'label' =>
"SendingMethod",
'checked' =>
'-1',
'position' => 66 ,
'enabled' => (
string) (
int)
isModEnabled(
'shipping')),
212 'c.fk_cond_reglement' => array(
'label' =>
"PaymentConditionsShort",
'checked' =>
'-1',
'position' => 67),
213 'c.fk_mode_reglement' => array(
'label' =>
"PaymentMode",
'checked' =>
'-1',
'position' => 68),
214 'c.fk_input_reason' => array(
'label' =>
"Channel",
'checked' =>
'-1',
'position' => 69),
215 'cdet.total_ht' => array(
'label' =>
"AmountHT",
'checked' =>
'1',
'position' => 75),
216 'c.total_vat' => array(
'label' =>
"AmountVAT",
'checked' =>
'0',
'position' => 80),
217 'cdet.total_ttc' => array(
'label' =>
"AmountTTC",
'checked' =>
'0',
'position' => 85),
218 'c.multicurrency_code' => array(
'label' =>
'Currency',
'checked' =>
'0',
'enabled' => (empty(
$conf->multicurrency->enabled) ?
'0' :
'1'),
'position' => 90),
219 'c.multicurrency_tx' => array(
'label' =>
'CurrencyRate',
'checked' =>
'0',
'enabled' => (empty(
$conf->multicurrency->enabled) ?
'0' :
'1'),
'position' => 95),
220 'c.multicurrency_total_ht' => array(
'label' =>
'MulticurrencyAmountHT',
'checked' =>
'0',
'enabled' => (empty(
$conf->multicurrency->enabled) ?
'0' :
'1'),
'position' => 100),
221 'c.multicurrency_total_vat' => array(
'label' =>
'MulticurrencyAmountVAT',
'checked' =>
'0',
'enabled' => (empty(
$conf->multicurrency->enabled) ?
'0' :
'1'),
'position' => 105),
222 'c.multicurrency_total_ttc' => array(
'label' =>
'MulticurrencyAmountTTC',
'checked' =>
'0',
'enabled' => (empty(
$conf->multicurrency->enabled) ?
'0' :
'1'),
'position' => 110),
223 'c.fk_warehouse' => array(
'label' =>
'Warehouse',
'checked' =>
'0',
'enabled' => (
string) (int) (!
isModEnabled(
'stock') && !
getDolGlobalString(
'WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER') ?
'0' :
'1'),
'position' => 110),
224 'u.login' => array(
'label' =>
"Author",
'checked' =>
'1',
'position' => 115),
225 'sale_representative' => array(
'label' =>
"SaleRepresentativesOfThirdParty",
'checked' =>
'0',
'position' => 116),
226 'total_pa' => array(
'label' => (
getDolGlobalString(
'MARGIN_TYPE') ==
'1' ?
'BuyingPrice' :
'CostPrice'),
'checked' =>
'0',
'position' => 300,
'enabled' => (
string) (int) (!
isModEnabled(
'margin') || !$user->hasRight(
'margins',
'liretous') ?
'0' :
'1')),
227 'total_margin' => array(
'label' =>
'Margin',
'checked' =>
'0',
'position' => 301,
'enabled' => (
string) (int) (!
isModEnabled(
'margin') || !$user->hasRight(
'margins',
'liretous') ?
'0' :
'1')),
228 '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')),
229 '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')),
230 'c.datec' => array(
'label' =>
"DateCreation",
'checked' =>
'0',
'position' => 120),
231 'c.tms' => array(
'label' =>
"DateModificationShort",
'checked' =>
'0',
'position' => 125),
232 'c.date_cloture' => array(
'label' =>
"DateClosing",
'checked' =>
'0',
'position' => 130),
233 'c.note_public' => array(
'label' =>
'NotePublic',
'checked' =>
'0',
'enabled' => (
string) (int) (!
getDolGlobalString(
'MAIN_LIST_HIDE_PUBLIC_NOTES')),
'position' => 135),
234 'c.note_private' => array(
'label' =>
'NotePrivate',
'checked' =>
'0',
'enabled' => (
string) (int) (!
getDolGlobalString(
'MAIN_LIST_HIDE_PRIVATE_NOTES')),
'position' => 140),
235 'shippable' => array(
'label' =>
"Shippable",
'checked' =>
'1',
'enabled' => (
string) (int) (
isModEnabled(
'shipping')),
'position' => 990),
236 'c.facture' => array(
'label' =>
"Billed",
'checked' =>
'1',
'enabled' => (
string) (int) (!
getDolGlobalString(
'WORKFLOW_BILL_ON_SHIPMENT')),
'position' => 995),
237 'c.import_key' => array(
'type' =>
'varchar(14)',
'label' =>
'ImportId',
'enabled' =>
'1',
'visible' => -2,
'position' => 999),
238 'c.fk_statut' => array(
'label' =>
"Status",
'checked' =>
'1',
'position' => 1000)
242include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
244$parameters = array(
'arrayfields' => &$arrayfields);
245$reshook = $hookmanager->executeHooks(
'completeArrayFields', $parameters, $object, $action);
250if (!$user->hasRight(
'societe',
'client',
'voir')) {
251 $search_sale = $user->id;
257 $socid = $user->socid;
261$permissiontoread = $user->hasRight(
"commande",
"lire");
262$permissiontoadd = $user->hasRight(
"commande",
"creer");
263$permissiontodelete = $user->hasRight(
"commande",
"supprimer");
264$permissiontoexport = $user->hasRight(
"commande",
"commande",
"export");
266 $permissiontovalidate = $user->hasRight(
"commande",
"order_advance",
"validate");
267 $permissiontoclose = $user->hasRight(
"commande",
"order_advance",
"close");
268 $permissiontocancel = $user->hasRight(
"commande",
"order_advance",
"annuler");
269 $permissiontosendbymail = $user->hasRight(
"commande",
"order_advance",
"send");
271 $permissiontovalidate = $user->hasRight(
"commande",
"creer");
272 $permissiontoclose = $user->hasRight(
"commande",
"creer");
273 $permissiontocancel = $user->hasRight(
"commande",
"creer");
274 $permissiontosendbymail = $user->hasRight(
"commande",
"creer");
282if (
GETPOST(
'cancel',
'alpha')) {
286if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend' && $massaction !=
'confirm_createbills') {
290$parameters = array(
'socid' => $socid);
291$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
296if (empty($reshook)) {
298 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
301 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
304 $disablelinefree =
'';
308 $search_product_category_array = array();
309 $searchCategoryProductOperator = 0;
311 $search_refProduct =
'';
312 $search_descProduct =
'';
314 $search_ref_customer =
'';
315 $search_company =
'';
316 $search_company_alias =
'';
321 $search_country =
'';
322 $search_type_thirdparty =
'';
323 $search_total_ht =
'';
324 $search_total_vat =
'';
325 $search_total_ttc =
'';
326 $search_warehouse =
'';
327 $search_multicurrency_code =
'';
328 $search_multicurrency_tx =
'';
329 $search_multicurrency_montant_ht =
'';
330 $search_multicurrency_montant_vat =
'';
331 $search_multicurrency_montant_ttc =
'';
333 $search_dateorder_start =
'';
334 $search_dateorder_end =
'';
335 $search_datedelivery_start =
'';
336 $search_datedelivery_end =
'';
337 $search_project_ref =
'';
338 $search_project =
'';
342 $search_array_options = array();
343 $search_categ_cus =
'';
344 $search_datecloture_start =
'';
345 $search_datecloture_end =
'';
346 $search_fk_cond_reglement =
'';
347 $search_fk_shipping_method =
'';
348 $search_fk_mode_reglement =
'';
349 $search_fk_input_reason =
'';
351 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
352 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
357 $objectclass =
'Commande';
358 $objectlabel =
'Orders';
359 $uploaddir =
$conf->commande->multidir_output[
$conf->entity];
360 $triggersendname =
'ORDER_SENTBYMAIL';
361 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
383$title = $langs->trans(
"Orders");
384$help_url =
"EN:Module_Customers_Orders|FR:Module_Commandes_Clients|ES:Módulo_Pedidos_de_clientes";
388$sqlSelect =
'SELECT';
390if ($search_all || !empty($search_product_category_array) || $search_user > 0) {
391 $sqlSelect =
'SELECT DISTINCT';
393$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,';
394$sqlSelect .=
" typent.code as typent_code,";
395$sqlSelect .=
" state.code_departement as state_code, state.nom as state_name,";
396$sqlSelect .=
" country.code as country_code,";
397$sqlSelect .=
' c.rowid as c_rowid, c.ref, c.ref_client, c.fk_user_author,';
398$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,';
399$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,';
400$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,';
401$sqlSelect .=
' c.date_creation as date_creation, c.tms as date_modification, c.date_cloture as date_cloture,';
402$sqlSelect .=
' p.rowid as project_id, p.ref as project_ref, p.title as project_label,';
403$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,';
404$sqlSelect .=
' c.fk_cond_reglement,c.deposit_percent,c.fk_mode_reglement,c.fk_shipping_method,';
405$sqlSelect .=
' c.fk_input_reason, c.import_key,';
407$sqlSelect .=
' cdet.rowid, cdet.description, cdet.qty, cdet.product_type, cdet.fk_product, cdet.total_ht, cdet.total_tva, cdet.total_ttc,';
408$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';
410if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
411 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
412 $sqlSelect .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
417$parameters = array();
418$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters);
419$sqlSelect .= $hookmanager->resPrint;
421$sql =
' FROM '.MAIN_DB_PREFIX.
'societe as s';
422$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as country on (country.rowid = s.fk_pays)";
423$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_typent as typent on (typent.id = s.fk_typent)";
424$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_departements as state on (state.rowid = s.fk_departement)";
426$sql .=
', '.MAIN_DB_PREFIX.
'commandedet as cdet';
427$sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'commande as c ON cdet.fk_commande = c.rowid';
428$sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'product as pr ON pr.rowid = cdet.fk_product';
429if (!empty($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
430 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"commande_extrafields as ef on (c.rowid = ef.fk_object)";
432$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"projet as p ON p.rowid = c.fk_projet";
433$sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'user as u ON c.fk_user_author = u.rowid';
435if ($search_user > 0) {
436 $sql .=
", ".MAIN_DB_PREFIX.
"element_contact as ec";
437 $sql .=
", ".MAIN_DB_PREFIX.
"c_type_contact as tc";
440$parameters = array();
441$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object);
442$sql .= $hookmanager->resPrint;
444$sql .=
' WHERE c.fk_soc = s.rowid';
445$sql .=
' AND c.entity IN ('.getEntity(
'commande').
')';
446$sql .=
' AND cdet.product_type <> 9';
448if (!empty($productobuy)) {
449 $sql .=
" AND pr.tobuy = 1";
451if (!empty($productonly)) {
452 $sql .=
" AND (cdet.product_type = 0 OR cdet.product_type = 1)";
454if (!empty($disablelinefree)) {
455 $sql .=
" AND cdet.fk_product IS NOT NULL";
458 $sql .=
' AND s.rowid = '.((int) $socid);
463if ($search_refProduct) {
466if ($search_descProduct) {
467 $sql .=
natural_search(array(
'pr.label',
'cdet.description'), $search_descProduct);
472if ($search_ref_customer) {
476 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
478if ($search_billed !=
'' && $search_billed >= 0) {
479 $sql .=
' AND c.facture = '.((int) $search_billed);
481if ($search_status !=
'') {
482 if ($search_status <= 3 && $search_status >= -1) {
484 $sql .=
' AND c.fk_statut IN (1,2)';
486 $sql .=
' AND c.fk_statut = '.((int) $search_status);
489 if ($search_status == -2) {
491 $sql .=
" AND c.fk_statut IN (1,2)";
493 if ($search_status == -3) {
496 $sql .=
' AND c.fk_statut IN (1,2,3)';
500if ($search_datecloture_start) {
501 $sql .=
" AND c.date_cloture >= '".$db->idate($search_datecloture_start).
"'";
503if ($search_datecloture_end) {
504 $sql .=
" AND c.date_cloture <= '".$db->idate($search_datecloture_end).
"'";
506if ($search_dateorder_start) {
507 $sql .=
" AND c.date_commande >= '".$db->idate($search_dateorder_start).
"'";
509if ($search_dateorder_end) {
510 $sql .=
" AND c.date_commande <= '".$db->idate($search_dateorder_end).
"'";
512if ($search_datedelivery_start) {
513 $sql .=
" AND c.date_livraison >= '".$db->idate($search_datedelivery_start).
"'";
515if ($search_datedelivery_end) {
516 $sql .=
" AND c.date_livraison <= '".$db->idate($search_datedelivery_end).
"'";
527if ($search_country) {
528 $sql .=
" AND s.fk_pays IN (".$db->sanitize($search_country).
')';
530if ($search_type_thirdparty && $search_type_thirdparty !=
'-1') {
531 $sql .=
" AND s.fk_typent IN (".$db->sanitize($search_type_thirdparty).
')';
533if ($search_company) {
536if ($search_company_alias) {
539if ($search_user > 0) {
540 $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);
542if ($search_total_ht !=
'') {
545if ($search_total_vat !=
'') {
548if ($search_total_ttc !=
'') {
551if ($search_warehouse !=
'' && $search_warehouse > 0) {
554if ($search_multicurrency_code !=
'') {
555 $sql .=
" AND c.multicurrency_code = '".$db->escape($search_multicurrency_code).
"'";
557if ($search_multicurrency_tx !=
'') {
558 $sql .=
natural_search(
'c.multicurrency_tx', $search_multicurrency_tx, 1);
560if ($search_multicurrency_montant_ht !=
'') {
561 $sql .=
natural_search(
'c.multicurrency_total_ht', $search_multicurrency_montant_ht, 1);
563if ($search_multicurrency_montant_vat !=
'') {
564 $sql .=
natural_search(
'c.multicurrency_total_tva', $search_multicurrency_montant_vat, 1);
566if ($search_multicurrency_montant_ttc !=
'') {
567 $sql .=
natural_search(
'c.multicurrency_total_ttc', $search_multicurrency_montant_ttc, 1);
570 $sql .=
natural_search(array(
"u.login",
"u.firstname",
"u.lastname"), $search_login);
572if ($search_project_ref !=
'') {
575if ($search_project !=
'') {
578if ($search_fk_cond_reglement > 0) {
579 $sql .=
" AND c.fk_cond_reglement = ".((int) $search_fk_cond_reglement);
581if ($search_fk_shipping_method > 0) {
582 $sql .=
" AND c.fk_shipping_method = ".((int) $search_fk_shipping_method);
584if ($search_fk_mode_reglement > 0) {
585 $sql .=
" AND c.fk_mode_reglement = ".((int) $search_fk_mode_reglement);
587if ($search_fk_input_reason > 0) {
588 $sql .=
" AND c.fk_input_reason = ".((int) $search_fk_input_reason);
591if ($search_sale && $search_sale !=
'-1') {
592 if ($search_sale == -2) {
593 $sql .=
" AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = c.fk_soc)";
594 } elseif ($search_sale > 0) {
595 $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).
")";
599$searchCategoryCustomerOperator =
GETPOSTINT(
'search_category_customer_operator');
600$searchCategoryCustomerList = ($search_categ_cus !==
'-1' ? explode(
',', $search_categ_cus) : array());
601if (!empty($searchCategoryCustomerList)) {
602 $searchCategoryCustomerSqlList = array();
603 $listofcategoryid =
'';
604 foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
605 if (intval($searchCategoryCustomer) == -2) {
606 $searchCategoryCustomerSqlList[] =
"NOT EXISTS (SELECT cs.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_societe as cs WHERE s.rowid = cs.fk_soc)";
607 } elseif (intval($searchCategoryCustomer) > 0) {
608 if ($searchCategoryCustomerOperator == 0) {
609 $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).
")";
611 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryCustomer);
615 if ($listofcategoryid) {
616 $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).
"))";
618 if ($searchCategoryCustomerOperator == 1) {
619 if (!empty($searchCategoryCustomerSqlList)) {
620 $sql .=
" AND (".implode(
' OR ', $searchCategoryCustomerSqlList).
")";
623 if (!empty($searchCategoryCustomerSqlList)) {
624 $sql .=
" AND (".implode(
' AND ', $searchCategoryCustomerSqlList).
")";
629$searchCategoryProductList = $search_product_category_array;
630if (!empty($searchCategoryProductList)) {
631 $searchCategoryProjectSqlList = array();
632 $listofcategoryid =
'';
633 foreach ($searchCategoryProductList as $searchCategoryProject) {
634 if (intval($searchCategoryProject) == -2) {
635 $searchCategoryProjectSqlList[] =
"NOT EXISTS (SELECT cp.fk_product FROM ".MAIN_DB_PREFIX.
"categorie_product as cp WHERE cdet.fk_product = cp.fk_product)";
636 } elseif (intval($searchCategoryProject) > 0) {
637 if ($searchCategoryProductOperator == 0) {
638 $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).
")";
640 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryProject);
644 if ($listofcategoryid) {
645 $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).
"))";
647 if ($searchCategoryProductOperator == 1) {
648 if (!empty($searchCategoryProjectSqlList)) {
649 $sql .=
" AND (".implode(
' OR ', $searchCategoryProjectSqlList).
")";
652 if (!empty($searchCategoryProjectSqlList)) {
653 $sql .=
" AND (".implode(
' AND ', $searchCategoryProjectSqlList).
")";
659include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
662$parameters = array();
663$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object);
664$sql .= $hookmanager->resPrint;
667$parameters = array();
668$reshook = $hookmanager->executeHooks(
'printFieldListHaving', $parameters, $object);
669if (empty($reshook)) {
670 $sql .= empty($hookmanager->resPrint) ?
"" :
" HAVING 1=1 ".$hookmanager->resPrint;
672 $sql = $hookmanager->resPrint;
676$nbtotalofrecords =
'';
678 $result =
$db->query(
'SELECT COUNT(*) as numrows ' . $sql);
679 $obj =
$db->fetch_object($result);
681 $nbtotalofrecords = 0;
683 $nbtotalofrecords = $obj->numrows;
686 if (($page * $limit) > (
int) $nbtotalofrecords) {
692$sql .=
$db->order($sortfield, $sortorder);
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(
905 $massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
907 $url = DOL_URL_ROOT.
'/commande/card.php?action=create';
908 if (!empty($socid)) {
909 $url .=
'&socid='.$socid;
914 print
'<form method="POST" id="searchFormList" action="'.dolBuildUrl($_SERVER[
"PHP_SELF"]).
'">';
915 if ($optioncss !=
'') {
916 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
918 print
'<input type="hidden" name="token" value="'.newToken().
'">';
919 print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
920 print
'<input type="hidden" name="action" value="list">';
921 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
922 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
923 print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
924 print
'<input type="hidden" name="search_status" value="'.$search_status.
'">';
925 print
'<input type="hidden" name="socid" value="'.$socid.
'">';
927 print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'order', 0, $newcardbutton,
'', $limit, 0, 0, 1);
929 $topicmail =
"SendOrderRef";
930 $modelmail =
"order_send";
932 $trackid =
'ord'.$object->id;
933 include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
936 foreach ($fieldstosearchall as $key => $val) {
937 $fieldstosearchall[$key] = $langs->trans($val);
939 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>';
944 $moreforfilter .=
'<div class="divsearchfield">';
945 $moreforfilter .=
'<input type="checkbox" id="productobuy" name="productobuy"'.(!empty($productobuy) ?
'value="productobuychecked" checked' :
'').
'><label for="productobuy">'.$langs->trans(
"productobuy").
'</label>';
946 $moreforfilter .=
'</div>';
947 $moreforfilter .=
'<div class="divsearchfield">';
948 $moreforfilter .=
'<input type="checkbox" id="productonly" name="productonly"'.(!empty($productonly) ?
'value="productonlychecked" checked' :
'').
'><label for="productonly">'.$langs->trans(
"productonly").
'</label>';
949 $moreforfilter .=
'</div>';
950 $moreforfilter .=
'<div class="divsearchfield">';
951 $moreforfilter .=
'<input type="checkbox" id="disablelinefree" name="disablelinefree"'.(!empty($disablelinefree) ?
'value="disablelinefreechecked" checked' :
'').
'><label for="disablelinefree">'.$langs->trans(
"disablelinefree").
'</label>';
952 $moreforfilter .=
'</div><br>';
955 if ($user->hasRight(
'user',
'user',
'lire')) {
956 $langs->load(
"commercial");
957 $moreforfilter .=
'<div class="divsearchfield">';
958 $tmptitle = $langs->trans(
'ThirdPartiesOfSaleRepresentative');
959 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale,
'search_sale', $user, 0, $tmptitle,
'maxwidth250 widthcentpercentminusx');
960 $moreforfilter .=
'</div>';
963 if ($user->hasRight(
'user',
'user',
'lire')) {
964 $moreforfilter .=
'<div class="divsearchfield">';
965 $tmptitle = $langs->trans(
'LinkedToSpecificUsers');
966 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$form->select_dolusers($search_user,
'search_user', $tmptitle,
null, 0,
'',
'',
'0', 0, 0,
'', 0,
'',
'maxwidth250 widthcentpercentminusx');
967 $moreforfilter .=
'</div>';
970 if (
isModEnabled(
"category") && $user->hasRight(
'categorie',
'lire') && ($user->hasRight(
'produit',
'lire') || $user->hasRight(
'service',
'lire'))) {
972 $moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_PRODUCT, $search_product_category_array,
'minwidth300imp minwidth300', $searchCategoryProductOperator ? $searchCategoryProductOperator : 0, 1, 1, $langs->transnoentitiesnoconv(
"ProductsCategoryShort"));
974 if (
isModEnabled(
"category") && $user->hasRight(
'categorie',
'lire')) {
975 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
976 $moreforfilter .=
'<div class="divsearchfield">';
977 $tmptitle = $langs->trans(
'CustomersProspectsCategoriesShort');
978 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"').$formother->select_categories(
'customer', $search_categ_cus,
'search_categ_cus', 1, $tmptitle,
'minwidth300imp maxwidth300 widthcentpercentminusx');
979 $moreforfilter .=
'</div>';
982 $moreforfilter .=
'<div class="divsearchfield">';
983 $tmptitle = $langs->trans(
'Warehouse');
984 $moreforfilter .=
img_picto($tmptitle,
'stock',
'class="pictofixedwidth"').$formproduct->selectWarehouses($search_warehouse,
'search_warehouse',
'', 1, 0, 0, $tmptitle, 0, 0, array(),
'minwidth300imp maxwidth300 widthcentpercentminusx');
985 $moreforfilter .=
'</div>';
989 $parameters = array();
990 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
991 if (empty($reshook)) {
992 $moreforfilter .= $hookmanager->resPrint;
994 $moreforfilter = $hookmanager->resPrint;
997 if (!empty($moreforfilter)) {
998 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
999 print $moreforfilter;
1003 $varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
1004 $selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
$conf->main_checkbox_left_column);
1005 $selectedfields .= $form->showCheckAddButtons(
'checkforselect', 1);
1008 $selectedfields .=
'<script>';
1009 $selectedfields .=
' $(document).ready(function() {';
1010 $selectedfields .=
' console.log("Autoclick on checkforselects");';
1011 $selectedfields .=
' $("#checkforselects").click();';
1012 $selectedfields .=
' $("#massaction").val("createbills").change();';
1013 $selectedfields .=
' });';
1014 $selectedfields .=
'</script>';
1017 print
'<div class="div-table-responsive">';
1018 print
'<table class="tagtable liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
1020 print
'<tr class="liste_titre_filter">';
1023 if (
$conf->main_checkbox_left_column) {
1024 print
'<td class="liste_titre center">';
1025 $searchpicto = $form->showFilterButtons(
'left');
1030 if (!empty($arrayfields[
'rowid'][
'checked'])) {
1031 print
'<td class="liste_titre right" data-key="id">';
1032 print
'<input class="flat searchstring width50" type="text" name="search_id" value="'.dol_escape_htmltag($search_id).
'">';
1036 if (!empty($arrayfields[
'c.ref'][
'checked'])) {
1037 print
'<td class="liste_titre">';
1038 print
'<input class="flat" size="6" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
1042 if (!empty($arrayfields[
'pr.ref'][
'checked'])) {
1043 print
'<td class="liste_titre">';
1044 print
'<input class="flat" size="6" type="text" name="search_refProduct" value="'.dol_escape_htmltag($search_refProduct).
'">';
1048 if (!empty($arrayfields[
'pr.label'][
'checked'])) {
1049 print
'<td class="liste_titre">';
1050 print
'<input class="flat" size="6" type="text" name="search_descProduct" value="'.dol_escape_htmltag($search_descProduct).
'">';
1054 if (!empty($arrayfields[
'cdet.qty'][
'checked'])) {
1055 print
'<td class="liste_titre"></td>';
1059 if (!empty($arrayfields[
'c.ref_client'][
'checked'])) {
1060 print
'<td class="liste_titre" align="left">';
1061 print
'<input class="flat" type="text" size="6" name="search_ref_customer" value="'.dol_escape_htmltag($search_ref_customer).
'">';
1065 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1066 print
'<td class="liste_titre"><input type="text" class="flat" size="6" name="search_project_ref" value="'.dol_escape_htmltag($search_project_ref).
'"></td>';
1069 if (!empty($arrayfields[
'p.title'][
'checked'])) {
1070 print
'<td class="liste_titre"><input type="text" class="flat" size="6" name="search_project" value="'.dol_escape_htmltag($search_project).
'"></td>';
1073 if (!empty($arrayfields[
's.nom'][
'checked'])) {
1074 print
'<td class="liste_titre" align="left">';
1075 print
'<input class="flat maxwidth100" type="text" name="search_company" value="'.dol_escape_htmltag((
string) $search_company).
'">';
1079 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1080 print
'<td class="liste_titre" align="left">';
1081 print
'<input class="flat maxwidth100" type="text" name="search_company_alias" value="'.dol_escape_htmltag($search_company_alias).
'">';
1085 if (!empty($arrayfields[
's.town'][
'checked'])) {
1086 print
'<td class="liste_titre"><input class="flat" type="text" size="4" name="search_town" value="'.dol_escape_htmltag($search_town).
'"></td>';
1089 if (!empty($arrayfields[
's.zip'][
'checked'])) {
1090 print
'<td class="liste_titre"><input class="flat" type="text" size="4" name="search_zip" value="'.dol_escape_htmltag($search_zip).
'"></td>';
1093 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1094 print
'<td class="liste_titre">';
1095 print
'<input class="flat" size="4" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).
'">';
1099 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1100 print
'<td class="liste_titre" align="center">';
1101 print $form->select_country($search_country,
'search_country',
'', 0,
'minwidth100imp maxwidth100');
1105 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1106 print
'<td class="liste_titre maxwidthonsmartphone" align="center">';
1107 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'),
'', 1);
1111 if (!empty($arrayfields[
'c.date_commande'][
'checked'])) {
1112 print
'<td class="liste_titre center">';
1113 print
'<div class="nowrapfordate">';
1114 print $form->selectDate($search_dateorder_start ? $search_dateorder_start : -1,
'search_dateorder_start_', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1116 print
'<div class="nowrapfordate">';
1117 print $form->selectDate($search_dateorder_end ? $search_dateorder_end : -1,
'search_dateorder_end_', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1121 if (!empty($arrayfields[
'c.delivery_date'][
'checked'])) {
1122 print
'<td class="liste_titre center">';
1123 print
'<div class="nowrapfordate">';
1124 print $form->selectDate($search_datedelivery_start ? $search_datedelivery_start : -1,
'search_datedelivery_start_', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1126 print
'<div class="nowrapfordate">';
1127 print $form->selectDate($search_datedelivery_end ? $search_datedelivery_end : -1,
'search_datedelivery_end_', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1132 if (!empty($arrayfields[
'c.fk_shipping_method'][
'checked'])) {
1133 print
'<td class="liste_titre">';
1134 $form->selectShippingMethod($search_fk_shipping_method,
'search_fk_shipping_method',
'', 1,
'', 1);
1138 if (!empty($arrayfields[
'c.fk_cond_reglement'][
'checked'])) {
1139 print
'<td class="liste_titre">';
1140 print $form->getSelectConditionsPaiements($search_fk_cond_reglement,
'search_fk_cond_reglement', 1, 1, 1);
1144 if (!empty($arrayfields[
'c.fk_mode_reglement'][
'checked'])) {
1145 print
'<td class="liste_titre">';
1146 $form->select_types_paiements($search_fk_mode_reglement,
'search_fk_mode_reglement',
'', 0, 1, 1, 0, -1);
1150 if (!empty($arrayfields[
'c.fk_input_reason'][
'checked'])) {
1151 print
'<td class="liste_titre">';
1152 $form->selectInputReason($search_fk_input_reason,
'search_fk_input_reason',
'', 1,
'', 1);
1155 if (!empty($arrayfields[
'cdet.total_ht'][
'checked'])) {
1157 print
'<td class="liste_titre right">';
1158 print
'<input class="flat" type="text" size="4" name="search_total_ht" value="'.dol_escape_htmltag($search_total_ht).
'">';
1161 if (!empty($arrayfields[
'c.total_vat'][
'checked'])) {
1163 print
'<td class="liste_titre right">';
1164 print
'<input class="flat" type="text" size="4" name="search_total_vat" value="'.dol_escape_htmltag($search_total_vat).
'">';
1167 if (!empty($arrayfields[
'cdet.total_ttc'][
'checked'])) {
1169 print
'<td class="liste_titre right">';
1170 print
'<input class="flat" type="text" size="5" name="search_total_ttc" value="'.$search_total_ttc.
'">';
1173 if (!empty($arrayfields[
'c.fk_warehouse'][
'checked'])) {
1175 print
'<td class="liste_titre right"></td>';
1177 if (!empty($arrayfields[
'c.multicurrency_code'][
'checked'])) {
1179 print
'<td class="liste_titre">';
1180 print $form->selectMultiCurrency($search_multicurrency_code,
'search_multicurrency_code', 1);
1183 if (!empty($arrayfields[
'c.multicurrency_tx'][
'checked'])) {
1185 print
'<td class="liste_titre">';
1186 print
'<input class="flat" type="text" size="4" name="search_multicurrency_tx" value="'.dol_escape_htmltag($search_multicurrency_tx).
'">';
1189 if (!empty($arrayfields[
'c.multicurrency_total_ht'][
'checked'])) {
1191 print
'<td class="liste_titre right">';
1192 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ht" value="'.dol_escape_htmltag($search_multicurrency_montant_ht).
'">';
1195 if (!empty($arrayfields[
'c.multicurrency_total_vat'][
'checked'])) {
1197 print
'<td class="liste_titre right">';
1198 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_vat" value="'.dol_escape_htmltag($search_multicurrency_montant_vat).
'">';
1201 if (!empty($arrayfields[
'c.multicurrency_total_ttc'][
'checked'])) {
1203 print
'<td class="liste_titre right">';
1204 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ttc" value="'.dol_escape_htmltag($search_multicurrency_montant_ttc).
'">';
1207 if (!empty($arrayfields[
'u.login'][
'checked'])) {
1209 print
'<td class="liste_titre" align="center">';
1210 print
'<input class="flat" size="4" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).
'">';
1213 if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
1214 print
'<td class="liste_titre"></td>';
1216 if (!empty($arrayfields[
'total_pa'][
'checked'])) {
1217 print
'<td class="liste_titre right">';
1220 if (!empty($arrayfields[
'total_margin'][
'checked'])) {
1221 print
'<td class="liste_titre right">';
1224 if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
1225 print
'<td class="liste_titre right">';
1228 if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
1229 print
'<td class="liste_titre right">';
1233 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
1235 $parameters = array(
'arrayfields' => $arrayfields);
1236 $reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters);
1237 print $hookmanager->resPrint;
1239 if (!empty($arrayfields[
'c.datec'][
'checked'])) {
1240 print
'<td class="liste_titre">';
1244 if (!empty($arrayfields[
'c.tms'][
'checked'])) {
1245 print
'<td class="liste_titre">';
1249 if (!empty($arrayfields[
'c.date_cloture'][
'checked'])) {
1250 print
'<td class="liste_titre center">';
1251 print
'<div class="nowrapfordate">';
1252 print $form->selectDate($search_datecloture_start ? $search_datecloture_start : -1,
'search_datecloture_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1254 print
'<div class="nowrapfordate">';
1255 print $form->selectDate($search_datecloture_end ? $search_datecloture_end : -1,
'search_datecloture_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1260 if (!empty($arrayfields[
'c.note_public'][
'checked'])) {
1261 print
'<td class="liste_titre">';
1265 if (!empty($arrayfields[
'c.note_private'][
'checked'])) {
1266 print
'<td class="liste_titre">';
1270 if (!empty($arrayfields[
'shippable'][
'checked'])) {
1271 print
'<td class="liste_titre maxwidthonsmartphone" align="center">';
1274 print
'<input type="checkbox" name="show_shippable_command" value="1"'.($show_shippable_command ?
' checked' :
'').
'>';
1275 print $langs->trans(
'ShowShippableStatus');
1277 $show_shippable_command = 1;
1282 if (!empty($arrayfields[
'c.facture'][
'checked'])) {
1283 print
'<td class="liste_titre maxwidthonsmartphone" align="center">';
1284 print $form->selectyesno(
'search_billed', $search_billed, 1, 0, 1, 1);
1288 if (!empty($arrayfields[
'c.import_key'][
'checked'])) {
1289 print
'<td class="liste_titre maxwidthonsmartphone" align="center">';
1293 if (!empty($arrayfields[
'c.fk_statut'][
'checked'])) {
1294 print
'<td class="liste_titre maxwidthonsmartphone center">';
1295 $liststatus = array(
1299 -2 => $langs->trans(
"StatusOrderValidatedShort").
'+'.$langs->trans(
"StatusOrderSentShort"),
1300 -3 => $langs->trans(
"StatusOrderValidatedShort").
'+'.$langs->trans(
"StatusOrderSentShort").
'+'.$langs->trans(
"StatusOrderDelivered"),
1305 print $form->selectarray(
'search_status', $liststatus, $search_status, -5, 0, 0,
'', 0, 0, 0,
'',
'maxwidth125', 1);
1309 if (!
$conf->main_checkbox_left_column) {
1310 print
'<td class="liste_titre" align="middle">';
1311 $searchpicto = $form->showFilterButtons();
1318 print
'<tr class="liste_titre">';
1320 if (
$conf->main_checkbox_left_column) {
1321 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'', $param,
'', $sortfield, $sortorder,
'maxwidthsearch center ');
1325 if (!empty($arrayfields[
'rowid'][
'checked'])) {
1327 print_liste_field_titre($arrayfields[
'rowid'][
'label'], $_SERVER[
"PHP_SELF"],
'rowid',
'', $param,
'', $sortfield, $sortorder);
1329 if (!empty($arrayfields[
'c.ref'][
'checked'])) {
1330 print_liste_field_titre($arrayfields[
'c.ref'][
'label'], $_SERVER[
"PHP_SELF"],
'c.ref',
'', $param,
'', $sortfield, $sortorder);
1332 if (!empty($arrayfields[
'pr.ref'][
'checked'])) {
1333 print_liste_field_titre($arrayfields[
'pr.ref'][
'label'], $_SERVER[
"PHP_SELF"],
'pr.ref',
'', $param,
'', $sortfield, $sortorder);
1335 if (!empty($arrayfields[
'pr.label'][
'checked'])) {
1336 print_liste_field_titre($arrayfields[
'pr.label'][
'label'], $_SERVER[
"PHP_SELF"],
'pr.label',
'', $param,
'', $sortfield, $sortorder);
1338 if (!empty($arrayfields[
'cdet.qty'][
'checked'])) {
1339 print_liste_field_titre($arrayfields[
'cdet.qty'][
'label'], $_SERVER[
"PHP_SELF"],
'cdet.qty',
'', $param,
'', $sortfield, $sortorder);
1342 if (!empty($arrayfields[
'c.ref_client'][
'checked'])) {
1343 print_liste_field_titre($arrayfields[
'c.ref_client'][
'label'], $_SERVER[
"PHP_SELF"],
'c.ref_client',
'', $param,
'', $sortfield, $sortorder);
1345 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1346 print_liste_field_titre($arrayfields[
'p.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"p.ref",
"", $param,
'', $sortfield, $sortorder);
1348 if (!empty($arrayfields[
'p.title'][
'checked'])) {
1349 print_liste_field_titre($arrayfields[
'p.title'][
'label'], $_SERVER[
"PHP_SELF"],
"p.title",
"", $param,
'', $sortfield, $sortorder);
1351 if (!empty($arrayfields[
's.nom'][
'checked'])) {
1352 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
"PHP_SELF"],
's.nom',
'', $param,
'', $sortfield, $sortorder);
1354 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1355 print_liste_field_titre($arrayfields[
's.name_alias'][
'label'], $_SERVER[
"PHP_SELF"],
's.name_alias',
'', $param,
'', $sortfield, $sortorder);
1357 if (!empty($arrayfields[
's.town'][
'checked'])) {
1358 print_liste_field_titre($arrayfields[
's.town'][
'label'], $_SERVER[
"PHP_SELF"],
's.town',
'', $param,
'', $sortfield, $sortorder);
1360 if (!empty($arrayfields[
's.zip'][
'checked'])) {
1361 print_liste_field_titre($arrayfields[
's.zip'][
'label'], $_SERVER[
"PHP_SELF"],
's.zip',
'', $param,
'', $sortfield, $sortorder);
1363 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1364 print_liste_field_titre($arrayfields[
'state.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"state.nom",
"", $param,
'', $sortfield, $sortorder);
1366 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1367 print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'], $_SERVER[
"PHP_SELF"],
"country.code_iso",
"", $param,
'', $sortfield, $sortorder,
'center ');
1369 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1370 print_liste_field_titre($arrayfields[
'typent.code'][
'label'], $_SERVER[
"PHP_SELF"],
"typent.code",
"", $param,
'', $sortfield, $sortorder,
'center ');
1372 if (!empty($arrayfields[
'c.date_commande'][
'checked'])) {
1373 print_liste_field_titre($arrayfields[
'c.date_commande'][
'label'], $_SERVER[
"PHP_SELF"],
'c.date_commande',
'', $param,
'', $sortfield, $sortorder,
'center ');
1375 if (!empty($arrayfields[
'c.delivery_date'][
'checked'])) {
1376 print_liste_field_titre($arrayfields[
'c.delivery_date'][
'label'], $_SERVER[
"PHP_SELF"],
'c.date_livraison',
'', $param,
'', $sortfield, $sortorder,
'center ');
1378 if (!empty($arrayfields[
'c.fk_shipping_method'][
'checked'])) {
1379 print_liste_field_titre($arrayfields[
'c.fk_shipping_method'][
'label'], $_SERVER[
"PHP_SELF"],
"c.fk_shipping_method",
"", $param,
'', $sortfield, $sortorder);
1381 if (!empty($arrayfields[
'c.fk_cond_reglement'][
'checked'])) {
1382 print_liste_field_titre($arrayfields[
'c.fk_cond_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"c.fk_cond_reglement",
"", $param,
'', $sortfield, $sortorder);
1384 if (!empty($arrayfields[
'c.fk_mode_reglement'][
'checked'])) {
1385 print_liste_field_titre($arrayfields[
'c.fk_mode_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"c.fk_mode_reglement",
"", $param,
'', $sortfield, $sortorder);
1387 if (!empty($arrayfields[
'c.fk_input_reason'][
'checked'])) {
1388 print_liste_field_titre($arrayfields[
'c.fk_input_reason'][
'label'], $_SERVER[
"PHP_SELF"],
"c.fk_input_reason",
"", $param,
'', $sortfield, $sortorder);
1390 if (!empty($arrayfields[
'cdet.total_ht'][
'checked'])) {
1391 print_liste_field_titre($arrayfields[
'cdet.total_ht'][
'label'], $_SERVER[
"PHP_SELF"],
'cdet.total_ht',
'', $param,
'', $sortfield, $sortorder,
'right ');
1393 if (!empty($arrayfields[
'c.total_vat'][
'checked'])) {
1394 print_liste_field_titre($arrayfields[
'c.total_vat'][
'label'], $_SERVER[
"PHP_SELF"],
'cdet.total_tva',
'', $param,
'', $sortfield, $sortorder,
'right ');
1396 if (!empty($arrayfields[
'cdet.total_ttc'][
'checked'])) {
1397 print_liste_field_titre($arrayfields[
'cdet.total_ttc'][
'label'], $_SERVER[
"PHP_SELF"],
'cdet.total_ttc',
'', $param,
'', $sortfield, $sortorder,
'right ');
1399 if (!empty($arrayfields[
'c.fk_warehouse'][
'checked'])) {
1400 print_liste_field_titre($arrayfields[
'c.fk_warehouse'][
'label'],
"",
'',
'', $param,
'', $sortfield, $sortorder);
1402 if (!empty($arrayfields[
'c.multicurrency_code'][
'checked'])) {
1403 print_liste_field_titre($arrayfields[
'c.multicurrency_code'][
'label'], $_SERVER[
'PHP_SELF'],
'c.multicurrency_code',
'', $param,
'', $sortfield, $sortorder);
1405 if (!empty($arrayfields[
'c.multicurrency_tx'][
'checked'])) {
1406 print_liste_field_titre($arrayfields[
'c.multicurrency_tx'][
'label'], $_SERVER[
'PHP_SELF'],
'c.multicurrency_tx',
'', $param,
'', $sortfield, $sortorder);
1408 if (!empty($arrayfields[
'c.multicurrency_total_ht'][
'checked'])) {
1409 print_liste_field_titre($arrayfields[
'c.multicurrency_total_ht'][
'label'], $_SERVER[
'PHP_SELF'],
'c.multicurrency_total_ht',
'', $param,
'class="right"', $sortfield, $sortorder);
1411 if (!empty($arrayfields[
'c.multicurrency_total_vat'][
'checked'])) {
1412 print_liste_field_titre($arrayfields[
'c.multicurrency_total_vat'][
'label'], $_SERVER[
'PHP_SELF'],
'c.multicurrency_total_tva',
'', $param,
'class="right"', $sortfield, $sortorder);
1414 if (!empty($arrayfields[
'c.multicurrency_total_ttc'][
'checked'])) {
1415 print_liste_field_titre($arrayfields[
'c.multicurrency_total_ttc'][
'label'], $_SERVER[
'PHP_SELF'],
'c.multicurrency_total_ttc',
'', $param,
'class="right"', $sortfield, $sortorder);
1417 if (!empty($arrayfields[
'u.login'][
'checked'])) {
1418 print_liste_field_titre($arrayfields[
'u.login'][
'label'], $_SERVER[
"PHP_SELF"],
'u.login',
'', $param,
'align="center"', $sortfield, $sortorder);
1420 if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
1421 print_liste_field_titre($arrayfields[
'sale_representative'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"",
"$param",
'', $sortfield, $sortorder);
1423 if (!empty($arrayfields[
'total_pa'][
'checked'])) {
1424 print_liste_field_titre($arrayfields[
'total_pa'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1426 if (!empty($arrayfields[
'total_margin'][
'checked'])) {
1427 print_liste_field_titre($arrayfields[
'total_margin'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1429 if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
1430 print_liste_field_titre($arrayfields[
'total_margin_rate'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1432 if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
1433 print_liste_field_titre($arrayfields[
'total_mark_rate'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1439 'cdet.total_ht' => 0,
1440 'cdet.total_tva' => 0,
1441 'cdet.total_ttc' => 0,
1446 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1448 $parameters = array(
1449 'arrayfields' => $arrayfields,
1451 'sortfield' => $sortfield,
1452 'sortorder' => $sortorder,
1455 $reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters);
1456 print $hookmanager->resPrint;
1457 if (!empty($arrayfields[
'c.datec'][
'checked'])) {
1458 print_liste_field_titre($arrayfields[
'c.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"c.date_creation",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1460 if (!empty($arrayfields[
'c.tms'][
'checked'])) {
1461 print_liste_field_titre($arrayfields[
'c.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"c.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1463 if (!empty($arrayfields[
'c.date_cloture'][
'checked'])) {
1464 print_liste_field_titre($arrayfields[
'c.date_cloture'][
'label'], $_SERVER[
"PHP_SELF"],
"c.date_cloture",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1466 if (!empty($arrayfields[
'c.note_public'][
'checked'])) {
1467 print_liste_field_titre($arrayfields[
'c.note_public'][
'label'], $_SERVER[
"PHP_SELF"],
"c.note_public",
"", $param,
'', $sortfield, $sortorder,
'right ');
1469 if (!empty($arrayfields[
'c.note_private'][
'checked'])) {
1470 print_liste_field_titre($arrayfields[
'c.note_private'][
'label'], $_SERVER[
"PHP_SELF"],
"c.note_private",
"", $param,
'', $sortfield, $sortorder,
'right ');
1472 if (!empty($arrayfields[
'shippable'][
'checked'])) {
1473 print_liste_field_titre($arrayfields[
'shippable'][
'label'], $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'center ');
1475 if (!empty($arrayfields[
'c.facture'][
'checked'])) {
1476 print_liste_field_titre($arrayfields[
'c.facture'][
'label'], $_SERVER[
"PHP_SELF"],
'c.facture',
'', $param,
'', $sortfield, $sortorder,
'center ');
1478 if (!empty($arrayfields[
'c.import_key'][
'checked'])) {
1479 print_liste_field_titre($arrayfields[
'c.import_key'][
'label'], $_SERVER[
"PHP_SELF"],
"c.import_key",
"", $param,
'', $sortfield, $sortorder,
'center ');
1481 if (!empty($arrayfields[
'c.fk_statut'][
'checked'])) {
1482 print_liste_field_titre($arrayfields[
'c.fk_statut'][
'label'], $_SERVER[
"PHP_SELF"],
"c.fk_statut",
"", $param,
'', $sortfield, $sortorder,
'center ');
1484 if (!
$conf->main_checkbox_left_column) {
1485 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'', $param,
'', $sortfield, $sortorder,
'maxwidthsearch center ');
1491 $productstat_cache = array();
1492 '@phan-var-force array<int,array{stats_order_customer?:float|int,stats_order_supplier?:float|int}> $product_stat_cache';
1493 $productstat_cachevirtual = array();
1494 '@phan-var-force array<int,array{stats_order_customer?:float|int,stats_order_supplier?:float|int}> $product_stat_cachevirtual';
1495 $getNomUrl_cache = array();
1502 $with_margin_info =
false;
1504 !empty($arrayfields[
'total_pa'][
'checked'])
1505 || !empty($arrayfields[
'total_margin'][
'checked'])
1506 || !empty($arrayfields[
'total_margin_rate'][
'checked'])
1507 || !empty($arrayfields[
'total_mark_rate'][
'checked'])
1510 $with_margin_info =
true;
1522 $subtotalarray = array();
1523 $subtotalarray[
'nbfield'] = 0;
1526 $imaxinloop = ($limit ? min($num, $limit) : $num);
1527 while ($i < $imaxinloop) {
1528 $obj =
$db->fetch_object($resql);
1538 $oldref = $obj->product_ref;
1540 if ($oldref != $obj->product_ref && $sortfield ==
'pr.ref') {
1541 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_subtotal.tpl.php';
1542 $oldref = $obj->product_ref;
1545 $companystatic->id = $obj->socid;
1546 $companystatic->name = $obj->name;
1547 $companystatic->name_alias = $obj->alias;
1548 $companystatic->client = $obj->client;
1549 $companystatic->code_client = $obj->code_client;
1550 $companystatic->email = $obj->email;
1551 $companystatic->phone = $obj->phone;
1552 $companystatic->address = $obj->address;
1553 $companystatic->zip = $obj->zip;
1554 $companystatic->town = $obj->town;
1555 $companystatic->country_code = $obj->country_code;
1556 if (!isset($getNomUrl_cache[$obj->socid])) {
1557 $getNomUrl_cache[$obj->socid] = $companystatic->getNomUrl(1,
'customer');
1560 $generic_commande->id = $obj->c_rowid;
1561 $generic_commande->ref = $obj->ref;
1562 $generic_commande->statut = $obj->fk_statut;
1563 $generic_commande->status = $obj->fk_statut;
1564 $generic_commande->billed = $obj->billed;
1565 $generic_commande->date =
$db->jdate($obj->date_commande);
1566 $generic_commande->delivery_date =
$db->jdate($obj->delivery_date);
1567 $generic_commande->ref_client = $obj->ref_client;
1568 $generic_commande->total_ht = $obj->c_total_ht;
1569 $generic_commande->total_tva = $obj->c_total_tva;
1570 $generic_commande->total_ttc = $obj->c_total_ttc;
1571 $generic_commande->note_public = $obj->note_public;
1572 $generic_commande->note_private = $obj->note_private;
1574 $projectstatic->id = $obj->project_id;
1575 $projectstatic->ref = $obj->project_ref;
1576 $projectstatic->title = $obj->project_label;
1578 $marginInfo = array();
1579 if ($with_margin_info) {
1580 $generic_commande->fetch_lines();
1581 $marginInfo = $formmargin->getMarginInfosArray($generic_commande);
1582 $total_ht += $obj->total_ht;
1583 $total_margin += $marginInfo[
'total_margin'];
1586 print
'<tr class="oddeven">';
1589 if (
$conf->main_checkbox_left_column) {
1590 print
'<td class="nowrap center">';
1591 if ($massactionbutton || $massaction) {
1593 if (in_array($obj->rowid, $arrayofselected)) {
1596 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
1607 if (!empty($arrayfields[
'rowid'][
'checked'])) {
1608 print
'<td class="nowrap right">'.$obj->rowid.
'</td>';
1615 if (!empty($arrayfields[
'c.ref'][
'checked'])) {
1616 print
'<td class="nowraponall">';
1617 print $generic_commande->getNomUrl(1, ($search_status != 2 ? 0 : $obj->fk_statut), 0, 0, 0, 1, 1);
1621 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid;
1622 print $formfile->getDocumentsLink($generic_commande->element, $filename, $filedir);
1631 if (!empty($arrayfields[
'pr.ref'][
'checked'])) {
1632 if (!empty($obj->product_rowid)) {
1633 $generic_product->id = $obj->product_rowid;
1634 $generic_product->ref = $obj->product_ref;
1635 $generic_product->label = $obj->product_label;
1636 $generic_product->status = $obj->product_status;
1637 $generic_product->status_buy = $obj->product_status_buy;
1638 $generic_product->status_batch = $obj->product_batch;
1639 $generic_product->barcode = $obj->product_barcode;
1640 print
'<td class="nowrap tdoverflowmax200">'.$generic_product->getNomUrl(1).
'</td>';
1642 print
'<td class="nowrap tdoverflowmax200"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td>';
1649 if (!empty($arrayfields[
'pr.label'][
'checked'])) {
1651 $descline = empty($obj->description) ? $obj->product_label : $obj->description;
1652 print
'<td class="nowrap tdoverflowmax200">';
1661 if (!empty($arrayfields[
'cdet.qty'][
'checked'])) {
1662 print
'<td class="nowrap right">'.$obj->qty.
'</td>';
1663 if (isset(
$totalarray[
'val'][
'cdet.qty']) || isset($subtotalarray[
'val'][
'cdet.qty'])) {
1665 $subtotalarray[
'val'][
'cdet.qty'] += $obj->qty;
1668 $subtotalarray[
'val'][
'cdet.qty'] = $obj->qty;
1675 $totalarray[
'pos'][$subtotalarray[
'nbfield']] =
'cdet.qty';
1680 if (!empty($arrayfields[
'c.ref_client'][
'checked'])) {
1681 print
'<td class="nowrap tdoverflowmax200">'.$obj->ref_client.
'</td>';
1688 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1689 print
'<td class="nowrap">';
1690 if ($obj->project_id > 0) {
1691 print $projectstatic->getNomUrl(1);
1700 if (!empty($arrayfields[
'p.title'][
'checked'])) {
1701 print
'<td class="nowrap">';
1702 if ($obj->project_id > 0) {
1703 print $projectstatic->title;
1712 if (!empty($arrayfields[
's.nom'][
'checked'])) {
1713 print
'<td class="tdoverflowmax150">';
1714 print $getNomUrl_cache[$obj->socid];
1718 if ($user->hasRight(
'facture',
'creer')) {
1719 if (($obj->fk_statut > 0 && $obj->fk_statut < 3) || ($obj->fk_statut == 3 && $obj->billed == 0)) {
1720 print
' <a href="'.DOL_URL_ROOT.
'/commande/list.php?socid='.$companystatic->id.
'&search_billed=0&autoselectall=1">';
1721 print
img_picto($langs->trans(
"CreateInvoiceForThisCustomer").
' : '.$companystatic->name,
'object_bill',
'hideonsmartphone').
'</a>';
1731 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1732 print
'<td class="nocellnopadd">';
1740 if (!empty($arrayfields[
's.town'][
'checked'])) {
1741 print
'<td class="nocellnopadd">';
1749 if (!empty($arrayfields[
's.zip'][
'checked'])) {
1750 print
'<td class="nocellnopadd">';
1758 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1759 print
"<td>".$obj->state_name.
"</td>\n";
1765 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1766 print
'<td class="center">';
1767 $tmparray =
getCountry($obj->fk_pays,
'all');
1768 print $tmparray[
'label'];
1775 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1776 print
'<td class="center">';
1777 if (empty($typenArray)) {
1778 $typenArray = $formcompany->typent_array(1);
1780 print $typenArray[$obj->typent_code];
1788 if (!empty($arrayfields[
'c.date_commande'][
'checked'])) {
1789 print
'<td class="center">';
1792 if ($generic_commande->hasDelay()) {
1793 print
img_picto($langs->trans(
"Late").
' : '.$generic_commande->showDelay(),
"warning");
1801 if (!empty($arrayfields[
'c.delivery_date'][
'checked'])) {
1802 print
'<td class="center" title="'.$langs->trans((
string) $arrayfields[
'c.delivery_date'][
'label']).
': '.
dol_print_date(
$db->jdate($obj->delivery_date),
'dayhour').
'">';
1810 if (!empty($arrayfields[
'c.fk_shipping_method'][
'checked'])) {
1812 $form->formSelectShippingMethod(
'', $obj->fk_shipping_method,
'none', 1);
1819 if (!empty($arrayfields[
'c.fk_cond_reglement'][
'checked'])) {
1821 $form->form_conditions_reglement($_SERVER[
'PHP_SELF'], $obj->fk_cond_reglement,
'none', 0,
'', 1, $obj->deposit_percent);
1828 if (!empty($arrayfields[
'c.fk_mode_reglement'][
'checked'])) {
1830 $form->form_modes_reglement($_SERVER[
'PHP_SELF'], $obj->fk_mode_reglement,
'none',
'', -1);
1837 if (!empty($arrayfields[
'c.fk_input_reason'][
'checked'])) {
1839 $form->formInputReason($_SERVER[
'PHP_SELF'], $obj->fk_input_reason,
'none', 0);
1846 if (!empty($arrayfields[
'cdet.total_ht'][
'checked'])) {
1847 print
'<td class="nowrap right"><span class="amount">'.price($obj->total_ht).
"</span></td>\n";
1853 $totalarray[
'pos'][$subtotalarray[
'nbfield']] =
'cdet.total_ht';
1855 if (isset(
$totalarray[
'val'][
'cdet.total_ht']) || isset($subtotalarray[
'val'][
'cdet.total_ht'])) {
1856 $totalarray[
'val'][
'cdet.total_ht'] += $obj->total_ht;
1857 $subtotalarray[
'val'][
'cdet.total_ht'] += $obj->total_ht;
1859 $totalarray[
'val'][
'cdet.total_ht'] = $obj->total_ht;
1860 $subtotalarray[
'val'][
'cdet.total_ht'] = $obj->total_ht;
1864 if (!empty($arrayfields[
'c.total_vat'][
'checked'])) {
1865 print
'<td class="nowrap right"><span class="amount">'.price($obj->total_tva).
"</span></td>\n";
1871 $totalarray[
'pos'][$subtotalarray[
'nbfield']] =
'cdet.total_tva';
1873 $totalarray[
'val'][
'cdet.total_tva'] += $obj->total_tva;
1874 $subtotalarray[
'val'][
'cdet.total_tva'] += $obj->total_tva;
1877 if (!empty($arrayfields[
'cdet.total_ttc'][
'checked'])) {
1878 print
'<td class="nowrap right"><span class="amount">'.price($obj->total_ttc).
"</span></td>\n";
1884 $subtotalarray[
'pos'][
$totalarray[
'nbfield']] =
'cdet.total_ttc';
1886 $totalarray[
'val'][
'cdet.total_ttc'] += $obj->total_ttc;
1887 $subtotalarray[
'val'][
'cdet.total_ttc'] += $obj->total_ttc;
1890 if (!empty($arrayfields[
'c.fk_warehouse'][
'checked'])) {
1891 print
'<td class="nowrap">';
1892 if ($obj->warehouse > 0) {
1893 print
img_picto(
'',
'stock',
'class="paddingrightonly"');
1895 $formproduct->formSelectWarehouses($_SERVER[
'PHP_SELF'], $obj->warehouse,
'none');
1902 if (!empty($arrayfields[
'c.multicurrency_code'][
'checked'])) {
1903 print
'<td class="nowrap">'.$obj->multicurrency_code.
' - '.$langs->trans(
'Currency'.$obj->multicurrency_code).
"</td>\n";
1910 if (!empty($arrayfields[
'c.multicurrency_tx'][
'checked'])) {
1911 print
'<td class="nowrap">';
1912 $form->form_multicurrency_rate($_SERVER[
'PHP_SELF'].
'?id='.$obj->c_rowid, $obj->multicurrency_tx,
'none', $obj->multicurrency_code);
1919 if (!empty($arrayfields[
'c.multicurrency_total_ht'][
'checked'])) {
1920 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ht).
"</span></td>\n";
1926 if (!empty($arrayfields[
'c.multicurrency_total_vat'][
'checked'])) {
1927 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_vat).
"</span></td>\n";
1933 if (!empty($arrayfields[
'c.multicurrency_total_ttc'][
'checked'])) {
1934 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ttc).
"</span></td>\n";
1940 $userstatic->id = $obj->fk_user_author;
1941 $userstatic->login = $obj->login;
1942 $userstatic->lastname = $obj->lastname;
1943 $userstatic->firstname = $obj->firstname;
1944 $userstatic->email = $obj->user_email;
1945 $userstatic->status = $obj->user_statut;
1946 $userstatic->entity = $obj->entity;
1947 $userstatic->photo = $obj->photo;
1948 $userstatic->office_phone = $obj->office_phone;
1949 $userstatic->office_fax = $obj->office_fax;
1950 $userstatic->user_mobile = $obj->user_mobile;
1951 $userstatic->job = $obj->job;
1952 $userstatic->gender = $obj->gender;
1955 if (!empty($arrayfields[
'u.login'][
'checked'])) {
1956 print
'<td class="tdoverflowmax200">';
1957 if ($userstatic->id) {
1958 print $userstatic->getNomUrl(-1);
1968 if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
1971 if ($obj->socid > 0) {
1972 $listsalesrepresentatives = $companystatic->getSalesRepresentatives($user);
1973 if ($listsalesrepresentatives < 0) {
1976 $nbofsalesrepresentative = count($listsalesrepresentatives);
1977 if ($nbofsalesrepresentative > 6) {
1979 print $nbofsalesrepresentative;
1980 } elseif ($nbofsalesrepresentative > 0) {
1982 foreach ($listsalesrepresentatives as $val) {
1983 $userstatic->id = $val[
'id'];
1984 $userstatic->lastname = $val[
'lastname'];
1985 $userstatic->firstname = $val[
'firstname'];
1986 $userstatic->email = $val[
'email'];
1987 $userstatic->status = $val[
'statut'];
1988 $userstatic->entity = $val[
'entity'];
1989 $userstatic->photo = $val[
'photo'];
1990 $userstatic->login = $val[
'login'];
1991 $userstatic->office_phone = $val[
'office_phone'];
1992 $userstatic->office_fax = $val[
'office_fax'];
1993 $userstatic->user_mobile = $val[
'user_mobile'];
1994 $userstatic->job = $val[
'job'];
1995 $userstatic->gender = $val[
'gender'];
1997 print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1,
'', 0, 0, 12) : $userstatic->getNomUrl(-2);
1999 if ($j < $nbofsalesrepresentative) {
2016 if (!empty($arrayfields[
'total_pa'][
'checked'])) {
2017 print
'<td class="right nowrap">'.price($marginInfo[
'pa_total']).
'</td>';
2023 if (!empty($arrayfields[
'total_margin'][
'checked'])) {
2024 print
'<td class="right nowrap">'.price($marginInfo[
'total_margin']).
'</td>';
2030 $totalarray[
'pos'][$subtotalarray[
'nbfield']] =
'total_margin';
2032 $totalarray[
'val'][
'total_margin'] += $marginInfo[
'total_margin'];
2033 $subtotalarray[
'val'][
'total_margin'] += $marginInfo[
'total_margin'];
2036 if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
2037 print
'<td class="right nowrap">'.(($marginInfo[
'total_margin_rate'] ==
'') ?
'' :
price($marginInfo[
'total_margin_rate'], 0,
'', 0, 0, 2).
'%').
'</td>';
2043 if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
2044 print
'<td class="right nowrap">'.(($marginInfo[
'total_mark_rate'] ==
'') ?
'' :
price($marginInfo[
'total_mark_rate'], 0,
'', 0, 0, 2).
'%').
'</td>';
2050 $totalarray[
'pos'][$subtotalarray[
'nbfield']] =
'total_mark_rate';
2052 if ($i >= $imaxinloop - 1) {
2053 if (!empty($total_ht)) {
2055 $subtotalarray[
'val'][
'total_mark_rate'] =
price2num($total_margin * 100 / $total_ht,
'MT');
2058 $subtotalarray[
'val'][
'total_mark_rate'] =
'';
2064 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
2066 $parameters = array(
'arrayfields' => $arrayfields,
'obj' => $obj,
'i' => $i,
'totalarray' => &
$totalarray);
2067 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
2068 print $hookmanager->resPrint;
2071 if (!empty($arrayfields[
'c.datec'][
'checked'])) {
2072 print
'<td align="center" class="nowrap">';
2081 if (!empty($arrayfields[
'c.tms'][
'checked'])) {
2082 print
'<td align="center" class="nowrap">';
2091 if (!empty($arrayfields[
'c.date_cloture'][
'checked'])) {
2092 print
'<td align="center" class="nowrap">';
2101 if (!empty($arrayfields[
'c.note_public'][
'checked'])) {
2102 print
'<td class="sensiblehtmlcontent center">';
2111 if (!empty($arrayfields[
'c.note_private'][
'checked'])) {
2112 print
'<td class="center">';
2121 if (!empty($arrayfields[
'shippable'][
'checked'])) {
2122 print
'<td class="center">';
2123 if (!empty($show_shippable_command) &&
isModEnabled(
'stock')) {
2125 if (($obj->fk_statut > $generic_commande::STATUS_DRAFT) && ($obj->fk_statut < $generic_commande::STATUS_CLOSED)) {
2126 $generic_commande->loadExpeditions();
2128 if (isset($generic_commande->expeditions[$obj->rowid])) {
2129 $reliquat = $obj->qty - $generic_commande->expeditions[$obj->rowid];
2131 $reliquat = $obj->qty;
2133 if ($obj->product_type == 0 && $obj->fk_product > 0) {
2135 $generic_product->id = $obj->fk_product;
2138 if (empty($productstat_cache[$obj->fk_product])) {
2139 $generic_product->load_stock(
'nobatch');
2140 $productstat_cache[$obj->fk_product][
'stock_reel'] = $generic_product->stock_reel;
2141 $productstat_cachevirtual[$obj->fk_product][
'stock_reel'] = $generic_product->stock_theorique;
2143 $generic_product->stock_reel = $productstat_cache[$obj->fk_product][
'stock_reel'];
2144 $generic_product->stock_theorique = $productstat_cachevirtual[$obj->fk_product][
'stock_reel'];
2147 if ($reliquat > $generic_product->stock_reel) {
2151 $text_info .= $reliquat.
' x '.$obj->product_ref.
' '.
dol_trunc($obj->product_label, 20);
2152 $text_info .=
' - '.$langs->trans(
"Stock").
': <span class="'.($generic_product->stock_reel > 0 ?
'ok' :
'error').
'">'.$generic_product->stock_reel.
'</span>';
2153 $text_info .=
' - '.$langs->trans(
"VirtualStock").
': <span class="'.($generic_product->stock_theorique > 0 ?
'ok' :
'error').
'">'.$generic_product->stock_theorique.
'</span>';
2154 $text_info .= ($reliquat != $obj->qty ?
' <span class="opacitymedium">('.$langs->trans(
"QtyInOtherShipments").
' '.($obj->qty - $reliquat).
')</span>' :
'');
2155 $text_info .=
'<br>';
2162 $stock_order_supplier = 0;
2165 if (empty($productstat_cache[$obj->fk_product][
'stats_order_customer'])) {
2166 $generic_product->load_stats_commande(0,
'1,2');
2167 $productstat_cache[$obj->fk_product][
'stats_order_customer'] = $generic_product->stats_commande[
'qty'];
2169 $generic_product->stats_commande[
'qty'] = $productstat_cache[$obj->fk_product][
'stats_order_customer'];
2171 $stock_order = $generic_product->stats_commande[
'qty'];
2174 if (empty($productstat_cache[$obj->fk_product][
'stats_order_supplier'])) {
2175 $generic_product->load_stats_commande_fournisseur(0,
'3');
2176 $productstat_cache[$obj->fk_product][
'stats_order_supplier'] = $generic_product->stats_commande_fournisseur[
'qty'];
2178 $generic_product->stats_commande_fournisseur[
'qty'] = $productstat_cache[$obj->fk_product][
'stats_order_supplier'];
2180 $stock_order_supplier = $generic_product->stats_commande_fournisseur[
'qty'];
2183 $text_info .= $reliquat.
' x '.$obj->product_ref.
' '.
dol_trunc($obj->product_label, 20);
2184 $text_stock_reel = $generic_product->stock_reel.
'/'.$stock_order;
2185 if ($stock_order > $generic_product->stock_reel && !($generic_product->stock_reel < $obj->qty)) {
2187 $text_warning .=
'<span class="warning">'.$langs->trans(
'Available').
' : '.$text_stock_reel.
'</span>';
2189 if ($reliquat > $generic_product->stock_reel) {
2190 $text_info .=
'<span class="warning">'.$langs->trans(
'Available').
' : '.$text_stock_reel.
'</span>';
2192 $text_info .=
'<span class="ok">'.$langs->trans(
'Available').
' : '.$text_stock_reel.
'</span>';
2195 $text_info .=
' '.$langs->trans(
'SupplierOrder').
' : '.$stock_order_supplier;
2197 $text_info .= ($reliquat != $obj->qty ?
' <span class="opacitymedium">('.$langs->trans(
"QtyInOtherShipments").
' '.($obj->qty - $reliquat).
')</span>' :
'');
2198 $text_info .=
'<br>';
2201 if ($notshippable == 0) {
2202 $text_icon =
img_picto(
'',
'dolly',
'', 0, 0, 0,
'',
'green paddingleft');
2203 $text_info = $text_icon.
' '.$langs->trans(
'Shippable').
'<br>'.$text_info;
2205 $text_icon =
img_picto(
'',
'dolly',
'', 0, 0, 0,
'',
'error paddingleft');
2206 $text_info = $text_icon.
' '.$langs->trans(
'NonShippable').
'<br>'.$text_info;
2211 print $form->textwithtooltip(
'', $text_info, 2, 1, $text_icon,
'', 2);
2214 print $form->textwithtooltip(
'', $langs->trans(
'NotEnoughForAllOrders').
'<br>'.$text_warning, 2, 1,
img_picto(
'',
'error'),
'', 2);
2224 if (!empty($arrayfields[
'c.facture'][
'checked'])) {
2225 print
'<td class="center">';
2227 print
yn($obj->billed, $langs->trans(
"Billed"));
2235 if (!empty($arrayfields[
'c.import_key'][
'checked'])) {
2236 print
'<td class="nowrap center">'.$obj->import_key.
'</td>';
2242 if (!empty($arrayfields[
'c.fk_statut'][
'checked'])) {
2243 print
'<td class="nowrap center">'.$generic_commande->LibStatut($obj->fk_statut, $obj->billed, 5, 1).
'</td>';
2250 if (!
$conf->main_checkbox_left_column) {
2251 print
'<td class="nowrap center">';
2252 if ($massactionbutton || $massaction) {
2254 if (in_array($obj->rowid, $arrayofselected)) {
2257 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
2267 $total += $obj->total_ht;
2268 $subtotal += $obj->total_ht;
2271 if ($sortfield ==
'pr.ref') {
2272 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_subtotal.tpl.php';
2275 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
2280 foreach ($arrayfields as $key => $val) {
2281 if (!empty($val[
'checked'])) {
2285 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
2290 $parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
2291 $reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters);
2292 print $hookmanager->resPrint;
2294 print
'</table>'.
"\n";
2297 print
'</form>'.
"\n";
2299 $hidegeneratedfilelistifempty = 1;
2300 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
2301 $hidegeneratedfilelistifempty = 0;
2305 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
2306 $urlsource .= str_replace(
'&',
'&', $param);
2308 $filedir = $diroutputmassaction;
2312 print $formfile->showdocuments(
'massfilesarea_orders',
'', $filedir, $urlsource, $genallowed, $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)
dolPrintHTML($s, $allowiframe=0, $moreallowedtags=array())
Return a string (that can be on several lines) ready to be output on a HTML page.
dolGetFirstLineOfText($text, $nboflines=1, $charset='UTF-8')
Return first line of text.
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...
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
yn($yesno, $format=1, $color=0)
Return yes or no in current language.
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
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.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
print $langs trans("Show") . '< td style="' . $timeColor . '" align="center"> s</td > badge status0 badge status4 badge status3 Error badge status8< td align="center">< span class="badge ' . $badge . '"></span ></td >< td align="center">< a href="#" class="button button-small" onclick="openLogModal(this)" data-req="' . dol_escape_htmltag($reqSafe) . '" data-res="' . dol_escape_htmltag($resSafe) . '" data-err="' . dol_escape_htmltag($errSafe) . '">< span class="fa fa-search-plus"></span ></a ></td ></tr >< tr >< td colspan="' . $colspan . '" class="opacitymedium"></td ></tr ></table ></div ></form > logModal none logModal none s a JSON string
buildzip.php
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $nodie=0, $mode='')
Check permissions of a user to show a page and an object.