39require
'../main.inc.php';
40require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
41require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
42require_once DOL_DOCUMENT_ROOT.
'/core/class/discount.class.php';
43require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
44require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
45require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
46if (isModEnabled(
'margin')) {
47 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmargin.class.php';
49require_once DOL_DOCUMENT_ROOT.
'/commande/class/commande.class.php';
50require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
51require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
52require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
55$langs->loadLangs(array(
'orders',
'sendings',
'deliveries',
'companies',
'compta',
'bills',
'stocks',
'products'));
58$action =
GETPOST(
'action',
'aZ09');
59$massaction =
GETPOST(
'massaction',
'alpha');
60$show_files =
GETPOST(
'show_files',
'int');
61$confirm =
GETPOST(
'confirm',
'alpha');
62$toselect =
GETPOST(
'toselect',
'array');
63$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'orderlist';
64$mode =
GETPOST(
'mode',
'alpha');
67$search_datecloture_start =
GETPOST(
'search_datecloture_start',
'int');
68if (empty($search_datecloture_start)) {
69 $search_datecloture_start =
dol_mktime(0, 0, 0,
GETPOST(
'search_datecloture_startmonth',
'int'),
GETPOST(
'search_datecloture_startday',
'int'),
GETPOST(
'search_datecloture_startyear',
'int'));
71$search_datecloture_end =
GETPOST(
'search_datecloture_end',
'int');
72if (empty($search_datecloture_end)) {
73 $search_datecloture_end =
dol_mktime(23, 59, 59,
GETPOST(
'search_datecloture_endmonth',
'int'),
GETPOST(
'search_datecloture_endday',
'int'),
GETPOST(
'search_datecloture_endyear',
'int'));
75$search_dateorder_start =
dol_mktime(0, 0, 0,
GETPOST(
'search_dateorder_start_month',
'int'),
GETPOST(
'search_dateorder_start_day',
'int'),
GETPOST(
'search_dateorder_start_year',
'int'));
76$search_dateorder_end =
dol_mktime(23, 59, 59,
GETPOST(
'search_dateorder_end_month',
'int'),
GETPOST(
'search_dateorder_end_day',
'int'),
GETPOST(
'search_dateorder_end_year',
'int'));
77$search_datedelivery_start =
dol_mktime(0, 0, 0,
GETPOST(
'search_datedelivery_start_month',
'int'),
GETPOST(
'search_datedelivery_start_day',
'int'),
GETPOST(
'search_datedelivery_start_year',
'int'));
78$search_datedelivery_end =
dol_mktime(23, 59, 59,
GETPOST(
'search_datedelivery_end_month',
'int'),
GETPOST(
'search_datedelivery_end_day',
'int'),
GETPOST(
'search_datedelivery_end_year',
'int'));
80$socid =
GETPOST(
'socid',
'int');
81$search_all = trim((
GETPOST(
'search_all',
'alphanohtml') !=
'') ?
GETPOST(
'search_all',
'alphanohtml') :
GETPOST(
'sall',
'alphanohtml'));
82$search_product_category =
GETPOST(
'search_product_category',
'int');
83$search_ref =
GETPOST(
'search_ref',
'alpha') !=
'' ?
GETPOST(
'search_ref',
'alpha') :
GETPOST(
'sref',
'alpha');
84$search_ref_customer =
GETPOST(
'search_ref_customer',
'alpha');
85$search_company =
GETPOST(
'search_company',
'alpha');
86$search_company_alias =
GETPOST(
'search_company_alias',
'alpha');
87$search_parent_name = trim(
GETPOST(
'search_parent_name',
'alphanohtml'));
88$search_town =
GETPOST(
'search_town',
'alpha');
89$search_zip =
GETPOST(
'search_zip',
'alpha');
90$search_state =
GETPOST(
'search_state',
'alpha');
91$search_country =
GETPOST(
'search_country',
'int');
92$search_type_thirdparty =
GETPOST(
'search_type_thirdparty',
'int');
93$search_user =
GETPOST(
'search_user',
'int');
94$search_sale =
GETPOST(
'search_sale',
'int');
95$search_total_ht =
GETPOST(
'search_total_ht',
'alpha');
96$search_total_vat =
GETPOST(
'search_total_vat',
'alpha');
97$search_total_ttc =
GETPOST(
'search_total_ttc',
'alpha');
98$search_warehouse =
GETPOST(
'search_warehouse',
'int');
100$search_multicurrency_code =
GETPOST(
'search_multicurrency_code',
'alpha');
101$search_multicurrency_tx =
GETPOST(
'search_multicurrency_tx',
'alpha');
102$search_multicurrency_montant_ht =
GETPOST(
'search_multicurrency_montant_ht',
'alpha');
103$search_multicurrency_montant_vat =
GETPOST(
'search_multicurrency_montant_vat',
'alpha');
104$search_multicurrency_montant_ttc =
GETPOST(
'search_multicurrency_montant_ttc',
'alpha');
106$search_login =
GETPOST(
'search_login',
'alpha');
107$search_categ_cus =
GETPOST(
"search_categ_cus",
'int');
108$optioncss =
GETPOST(
'optioncss',
'alpha');
109$search_billed =
GETPOST(
'search_billed',
'int');
110$search_status =
GETPOST(
'search_status',
'int');
111$search_project_ref =
GETPOST(
'search_project_ref',
'alpha');
112$search_project =
GETPOST(
'search_project',
'alpha');
113$search_shippable =
GETPOST(
'search_shippable',
'aZ09');
115$search_fk_cond_reglement =
GETPOST(
'search_fk_cond_reglement',
'int');
116$search_fk_shipping_method =
GETPOST(
'search_fk_shipping_method',
'int');
117$search_fk_mode_reglement =
GETPOST(
'search_fk_mode_reglement',
'int');
118$search_fk_input_reason =
GETPOST(
'search_fk_input_reason',
'int');
119$search_option =
GETPOST(
'search_option',
'alpha');
120if ($search_option ==
'late') {
121 $search_status =
'-2';
124$diroutputmassaction = $conf->commande->multidir_output[$conf->entity].
'/temp/massgeneration/'.$user->id;
127$limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
128$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
129$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
130$page = GETPOSTISSET(
'pageplusone') ? (
GETPOST(
'pageplusone') - 1) :
GETPOST(
"page",
'int');
131if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
135$offset = $limit * $page;
136$pageprev = $page - 1;
137$pagenext = $page + 1;
139 $sortfield =
'c.ref';
145$show_shippable_command =
GETPOST(
'show_shippable_command',
'aZ09');
149$hookmanager->initHooks(array(
'orderlist'));
153$extrafields->fetch_name_optionals_label($object->table_element);
154$search_array_options = $extrafields->getOptionalsFromPost($object->table_element,
'',
'search_');
157$fieldstosearchall = array(
159 'c.ref_client'=>
'RefCustomerOrder',
160 'pd.description'=>
'Description',
161 's.nom'=>
"ThirdParty",
162 's.name_alias'=>
"AliasNameShort",
165 'c.note_public'=>
'NotePublic',
167if (empty($user->socid)) {
168 $fieldstosearchall[
"c.note_private"] =
"NotePrivate";
171$checkedtypetiers = 0;
173 'c.ref'=>array(
'label'=>
"Ref",
'checked'=>1,
'position'=>5),
174 'c.ref_client'=>array(
'label'=>
"RefCustomerOrder",
'checked'=>-1,
'position'=>10),
175 'p.ref'=>array(
'label'=>
"ProjectRef",
'checked'=>-1,
'enabled'=>(!isModEnabled(
'project') ? 0 : 1),
'position'=>20),
176 'p.title'=>array(
'label'=>
"ProjectLabel",
'checked'=>0,
'enabled'=>(!isModEnabled(
'project') ? 0 : 1),
'position'=>25),
177 's.nom'=>array(
'label'=>
"ThirdParty",
'checked'=>1,
'position'=>30),
178 's.name_alias'=>array(
'label'=>
"AliasNameShort",
'checked'=>-1,
'position'=>31),
179 's2.nom'=>array(
'label'=>
'ParentCompany',
'position'=>32,
'checked'=>0),
180 's.town'=>array(
'label'=>
"Town",
'checked'=>-1,
'position'=>35),
181 's.zip'=>array(
'label'=>
"Zip",
'checked'=>-1,
'position'=>40),
182 'state.nom'=>array(
'label'=>
"StateShort",
'checked'=>0,
'position'=>45),
183 'country.code_iso'=>array(
'label'=>
"Country",
'checked'=>0,
'position'=>50),
184 'typent.code'=>array(
'label'=>
"ThirdPartyType",
'checked'=>$checkedtypetiers,
'position'=>55),
185 'c.date_commande'=>array(
'label'=>
"OrderDateShort",
'checked'=>1,
'position'=>60,
'csslist'=>
'nowraponall'),
186 'c.date_delivery'=>array(
'label'=>
"DateDeliveryPlanned",
'checked'=>1,
'enabled'=>!
getDolGlobalString(
'ORDER_DISABLE_DELIVERY_DATE'),
'position'=>65,
'csslist'=>
'nowraponall'),
187 'c.fk_shipping_method'=>array(
'label'=>
"SendingMethod",
'checked'=>-1,
'position'=>66 ,
'enabled'=>isModEnabled(
"expedition")),
188 'c.fk_cond_reglement'=>array(
'label'=>
"PaymentConditionsShort",
'checked'=>-1,
'position'=>67),
189 'c.fk_mode_reglement'=>array(
'label'=>
"PaymentMode",
'checked'=>-1,
'position'=>68),
190 'c.fk_input_reason'=>array(
'label'=>
"Origin",
'checked'=>-1,
'position'=>69),
191 'c.total_ht'=>array(
'label'=>
"AmountHT",
'checked'=>1,
'position'=>75),
192 'c.total_vat'=>array(
'label'=>
"AmountVAT",
'checked'=>0,
'position'=>80),
193 'c.total_ttc'=>array(
'label'=>
"AmountTTC",
'checked'=>0,
'position'=>85),
194 'c.multicurrency_code'=>array(
'label'=>
'Currency',
'checked'=>0,
'enabled'=>(!isModEnabled(
"multicurrency") ? 0 : 1),
'position'=>90),
195 'c.multicurrency_tx'=>array(
'label'=>
'CurrencyRate',
'checked'=>0,
'enabled'=>(!isModEnabled(
"multicurrency") ? 0 : 1),
'position'=>95),
196 'c.multicurrency_total_ht'=>array(
'label'=>
'MulticurrencyAmountHT',
'checked'=>0,
'enabled'=>(!isModEnabled(
"multicurrency") ? 0 : 1),
'position'=>100),
197 'c.multicurrency_total_vat'=>array(
'label'=>
'MulticurrencyAmountVAT',
'checked'=>0,
'enabled'=>(!isModEnabled(
"multicurrency") ? 0 : 1),
'position'=>105),
198 'c.multicurrency_total_ttc'=>array(
'label'=>
'MulticurrencyAmountTTC',
'checked'=>0,
'enabled'=>(!isModEnabled(
"multicurrency") ? 0 : 1),
'position'=>110),
199 'u.login'=>array(
'label'=>
"Author",
'checked'=>1,
'position'=>115),
200 'sale_representative'=>array(
'label'=>
"SaleRepresentativesOfThirdParty",
'checked'=>0,
'position'=>116),
201 'total_pa' => array(
'label' => (
getDolGlobalString(
'MARGIN_TYPE') ==
'1' ?
'BuyingPrice' :
'CostPrice'),
'checked' => 0,
'position' => 300,
'enabled' => (!isModEnabled(
'margin') || !$user->hasRight(
"margins",
"liretous") ? 0 : 1)),
202 'total_margin' => array(
'label' =>
'Margin',
'checked' => 0,
'position' => 301,
'enabled' => (!isModEnabled(
'margin') || !$user->hasRight(
"margins",
"liretous") ? 0 : 1)),
203 'total_margin_rate' => array(
'label' =>
'MarginRate',
'checked' => 0,
'position' => 302,
'enabled' => (!isModEnabled(
'margin') || !$user->hasRight(
"margins",
"liretous") || !
getDolGlobalString(
'DISPLAY_MARGIN_RATES') ? 0 : 1)),
204 'total_mark_rate' => array(
'label' =>
'MarkRate',
'checked' => 0,
'position' => 303,
'enabled' => (!isModEnabled(
'margin') || !$user->hasRight(
"margins",
"liretous") || !
getDolGlobalString(
'DISPLAY_MARK_RATES') ? 0 : 1)),
205 'c.datec'=>array(
'label'=>
"DateCreation",
'checked'=>0,
'position'=>120),
206 'c.tms'=>array(
'label'=>
"DateModificationShort",
'checked'=>0,
'position'=>125),
207 'c.date_cloture'=>array(
'label'=>
"DateClosing",
'checked'=>0,
'position'=>130),
208 'c.note_public'=>array(
'label'=>
'NotePublic',
'checked'=>0,
'enabled'=>(!
getDolGlobalInt(
'MAIN_LIST_HIDE_PUBLIC_NOTES')),
'position'=>135),
209 'c.note_private'=>array(
'label'=>
'NotePrivate',
'checked'=>0,
'enabled'=>(!
getDolGlobalInt(
'MAIN_LIST_HIDE_PRIVATE_NOTES')),
'position'=>140),
210 'shippable'=>array(
'label'=>
"Shippable",
'checked'=>1,
'enabled'=>(isModEnabled(
"expedition")),
'position'=>990),
211 'c.facture'=>array(
'label'=>
"Billed",
'checked'=>1,
'enabled'=>(!
getDolGlobalString(
'WORKFLOW_BILL_ON_SHIPMENT')),
'position'=>995),
212 'c.import_key' =>array(
'type'=>
'varchar(14)',
'label'=>
'ImportId',
'enabled'=>1,
'visible'=>-2,
'position'=>999),
213 'c.fk_statut'=>array(
'label'=>
"Status",
'checked'=>1,
'position'=>1000)
217include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
223if (!$user->hasRight(
'societe',
'client',
'voir')) {
224 $search_sale = $user->id;
230 $socid = $user->socid;
241if (
GETPOST(
'cancel',
'alpha')) {
245if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend' && $massaction !=
'confirm_createbills') {
249$parameters = array(
'socid'=>$socid,
'arrayfields'=>&$arrayfields);
250$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
255if (empty($reshook)) {
257 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
260 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
263 $search_product_category =
'';
265 $search_ref_customer =
'';
266 $search_company =
'';
267 $search_company_alias =
'';
268 $search_parent_name =
'';
273 $search_country =
'';
274 $search_type_thirdparty =
'';
275 $search_total_ht =
'';
276 $search_total_vat =
'';
277 $search_total_ttc =
'';
278 $search_warehouse =
'';
279 $search_multicurrency_code =
'';
280 $search_multicurrency_tx =
'';
281 $search_multicurrency_montant_ht =
'';
282 $search_multicurrency_montant_vat =
'';
283 $search_multicurrency_montant_ttc =
'';
285 $search_dateorder_start =
'';
286 $search_dateorder_end =
'';
287 $search_datedelivery_start =
'';
288 $search_datedelivery_end =
'';
289 $search_project_ref =
'';
290 $search_project =
'';
294 $search_array_options = array();
295 $search_categ_cus = 0;
296 $search_datecloture_start =
'';
297 $search_datecloture_end =
'';
298 $search_fk_cond_reglement =
'';
299 $search_fk_shipping_method =
'';
300 $search_fk_mode_reglement =
'';
301 $search_fk_input_reason =
'';
304 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
305 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
310 $objectclass =
'Commande';
311 $objectlabel =
'Orders';
312 $permissiontoread = $user->hasRight(
"commande",
"lire");
313 $permissiontoadd = $user->hasRight(
"commande",
"creer");
314 $permissiontodelete = $user->hasRight(
"commande",
"supprimer");
316 $permissiontovalidate = $user->hasRight(
"commande",
"order_advance",
"validate");
317 $permissiontoclose = $user->hasRight(
"commande",
"order_advance",
"close");
318 $permissiontocancel = $user->hasRight(
"commande",
"order_advance",
"annuler");
319 $permissiontosendbymail = $user->hasRight(
"commande",
"order_advance",
"send");
321 $permissiontovalidate = $user->hasRight(
"commande",
"creer");
322 $permissiontoclose = $user->hasRight(
"commande",
"creer");
323 $permissiontocancel = $user->hasRight(
"commande",
"creer");
324 $permissiontosendbymail = $user->hasRight(
"commande",
"creer");
326 $uploaddir = $conf->commande->multidir_output[$conf->entity];
327 $triggersendname =
'ORDER_SENTBYMAIL';
330 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
332 if ($massaction ==
'confirm_createbills') {
333 $orders =
GETPOST(
'toselect',
'array');
334 $createbills_onebythird =
GETPOST(
'createbills_onebythird',
'int');
335 $validate_invoices =
GETPOST(
'validate_invoices',
'int');
340 $TFactThird = array();
341 $TFactThirdNbLines = array();
343 $nb_bills_created = 0;
349 $nbOrders = is_array($orders) ? count($orders) : 1;
351 foreach ($orders as $id_order) {
353 if ($cmd->fetch($id_order) <= 0) {
356 $cmd->fetch_thirdparty();
359 if (!empty($createbills_onebythird) && !empty($TFactThird[$cmd->socid])) {
361 $objecttmp = $TFactThird[$cmd->socid];
364 $objecttmp->socid = $cmd->socid;
365 $objecttmp->thirdparty = $cmd->thirdparty;
367 $objecttmp->type = $objecttmp::TYPE_STANDARD;
368 $objecttmp->cond_reglement_id = !empty($cmd->cond_reglement_id) ? $cmd->cond_reglement_id : $cmd->thirdparty->cond_reglement_id;
369 $objecttmp->mode_reglement_id = !empty($cmd->mode_reglement_id) ? $cmd->mode_reglement_id : $cmd->thirdparty->mode_reglement_id;
371 $objecttmp->fk_project = $cmd->fk_project;
372 $objecttmp->multicurrency_code = $cmd->multicurrency_code;
373 if (empty($createbills_onebythird)) {
374 $objecttmp->ref_client = $cmd->ref_client;
378 if (empty($datefacture)) {
382 $objecttmp->date = $datefacture;
383 $objecttmp->origin =
'commande';
384 $objecttmp->origin_id = $id_order;
386 $objecttmp->array_options = $cmd->array_options;
388 $res = $objecttmp->create($user);
392 $lastref = $objecttmp->ref;
393 $lastid = $objecttmp->id;
395 $TFactThird[$cmd->socid] = $objecttmp;
396 $TFactThirdNbLines[$cmd->socid] = 0;
398 $langs->load(
"errors");
399 $errors[] = $cmd->ref.
' : '.$langs->trans($objecttmp->errors[0]);
404 if ($objecttmp->id > 0) {
405 $res = $objecttmp->add_object_linked($objecttmp->origin, $id_order);
408 $errors[] = $cmd->ref.
' : '.$langs->trans($objecttmp->errors[0]);
413 $lines = $cmd->lines;
414 if (empty($lines) && method_exists($cmd,
'fetch_lines')) {
416 $lines = $cmd->lines;
420 $num = count($lines);
422 for ($i = 0; $i < $num; $i++) {
423 $desc = ($lines[$i]->desc ? $lines[$i]->desc :
'');
425 if (!empty($createbills_onebythird)) {
429 if ($lines[$i]->subprice < 0 && !
getDolGlobalString(
'INVOICE_KEEP_DISCOUNT_LINES_AS_IN_ORIGIN')) {
432 $discount->fk_soc = $objecttmp->socid;
433 $discount->amount_ht = abs($lines[$i]->total_ht);
434 $discount->amount_tva = abs($lines[$i]->total_tva);
435 $discount->amount_ttc = abs($lines[$i]->total_ttc);
436 $discount->tva_tx = $lines[$i]->tva_tx;
437 $discount->fk_user = $user->id;
438 $discount->description = $desc;
439 $discountid = $discount->create($user);
440 if ($discountid > 0) {
441 $result = $objecttmp->insert_discount($discountid);
450 $product_type = ($lines[$i]->product_type ? $lines[$i]->product_type : 0);
453 if ($lines[$i]->date_debut_prevue) {
454 $date_start = $lines[$i]->date_debut_prevue;
456 if ($lines[$i]->date_debut_reel) {
457 $date_start = $lines[$i]->date_debut_reel;
459 if ($lines[$i]->date_start) {
460 $date_start = $lines[$i]->date_start;
464 if ($lines[$i]->date_fin_prevue) {
465 $date_end = $lines[$i]->date_fin_prevue;
467 if ($lines[$i]->date_fin_reel) {
468 $date_end = $lines[$i]->date_fin_reel;
470 if ($lines[$i]->date_end) {
471 $date_end = $lines[$i]->date_end;
474 if (($lines[$i]->product_type != 9 && empty($lines[$i]->fk_parent_line)) || $lines[$i]->product_type == 9) {
479 if (method_exists($lines[$i],
'fetch_optionals')) {
480 $lines[$i]->fetch_optionals();
481 $array_options = $lines[$i]->array_options;
484 $objecttmp->context[
'createfromclone'] =
'createfromclone';
486 $rang = ($nbOrders > 1) ? -1 : $lines[$i]->rang;
488 if (!empty($createbills_onebythird)) {
489 $TFactThirdNbLines[$cmd->socid]++;
490 $rang = $TFactThirdNbLines[$cmd->socid];
493 $result = $objecttmp->addline(
495 $lines[$i]->subprice,
498 $lines[$i]->localtax1_tx,
499 $lines[$i]->localtax2_tx,
500 $lines[$i]->fk_product,
501 $lines[$i]->remise_percent,
505 $lines[$i]->info_bits,
506 $lines[$i]->fk_remise_except,
511 $lines[$i]->special_code,
515 $lines[$i]->fk_fournprice,
528 $errors[] = $objecttmp->error;
532 if ($result > 0 && $lines[$i]->product_type == 9) {
533 $fk_parent_line = $result;
542 if (!empty($createbills_onebythird) && empty($TFactThird[$cmd->socid])) {
543 $TFactThird[$cmd->socid] = $objecttmp;
545 $TFact[$objecttmp->id] = $objecttmp;
550 $TAllFact = empty($createbills_onebythird) ? $TFact : $TFactThird;
553 if (!$error && $validate_invoices) {
554 $massaction = $action =
'builddoc';
556 foreach ($TAllFact as &$objecttmp) {
557 $result = $objecttmp->validate($user);
564 $id = $objecttmp->id;
568 $upload_dir = $conf->facture->dir_output;
569 $permissiontoadd = $user->hasRight(
'facture',
'creer');
572 $savobject = $object;
573 $object = $objecttmp;
574 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
575 $object = $savobject;
578 $massaction = $action =
'confirm_createbills';
584 if ($nb_bills_created == 1) {
585 $texttoshow = $langs->trans(
'BillXCreated',
'{s1}');
586 $texttoshow = str_replace(
'{s1}',
'<a href="'.DOL_URL_ROOT.
'/compta/facture/card.php?id='.urlencode($lastid).
'">'.$lastref.
'</a>', $texttoshow);
589 setEventMessages($langs->trans(
'BillCreated', $nb_bills_created),
null,
'mesgs');
595 $param .=
'&mode='.urlencode($mode);
597 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
598 $param .=
'&contextpage='.urlencode($contextpage);
600 if ($limit > 0 && $limit != $conf->liste_limit) {
601 $param .=
'&limit='.((int) $limit);
603 if ($optioncss !=
'') {
604 $param .=
'&optioncss='.urlencode($optioncss);
607 $param .=
'&search_all='.urlencode($search_all);
610 $param .=
'&show_files='.urlencode($show_files);
613 $param .=
'&socid='.urlencode($socid);
615 if ($search_status !=
'') {
616 $param .=
'&search_status='.urlencode($search_status);
618 if ($search_option) {
619 $param .=
"&search_option=".urlencode($search_option);
621 if ($search_orderday) {
622 $param .=
'&search_orderday='.urlencode($search_orderday);
624 if ($search_ordermonth) {
625 $param .=
'&search_ordermonth='.urlencode($search_ordermonth);
627 if ($search_orderyear) {
628 $param .=
'&search_orderyear='.urlencode($search_orderyear);
630 if ($search_deliveryday) {
631 $param .=
'&search_deliveryday='.urlencode($search_deliveryday);
633 if ($search_deliverymonth) {
634 $param .=
'&search_deliverymonth='.urlencode($search_deliverymonth);
636 if ($search_deliveryyear) {
637 $param .=
'&search_deliveryyear='.urlencode($search_deliveryyear);
640 $param .=
'&search_ref='.urlencode($search_ref);
642 if ($search_company) {
643 $param .=
'&search_company='.urlencode($search_company);
645 if ($search_ref_customer) {
646 $param .=
'&search_ref_customer='.urlencode($search_ref_customer);
648 if ($search_user > 0) {
649 $param .=
'&search_user='.urlencode($search_user);
651 if ($search_sale > 0) {
652 $param .=
'&search_sale='.urlencode($search_sale);
654 if ($search_total_ht !=
'') {
655 $param .=
'&search_total_ht='.urlencode($search_total_ht);
657 if ($search_total_vat !=
'') {
658 $param .=
'&search_total_vat='.urlencode($search_total_vat);
660 if ($search_total_ttc !=
'') {
661 $param .=
'&search_total_ttc='.urlencode($search_total_ttc);
663 if ($search_project_ref >= 0) {
664 $param .=
"&search_project_ref=".urlencode($search_project_ref);
666 if ($search_billed !=
'') {
667 $param .=
'&search_billed='.urlencode($search_billed);
670 header(
"Location: ".$_SERVER[
'PHP_SELF'].
'?'.$param);
676 $_GET[
"origin"] = $_POST[
"origin"];
677 $_GET[
"originid"] = $_POST[
"originid"];
678 if (!empty($errors)) {
687if ($action ==
'validate' && $permissiontoadd) {
688 if (
GETPOST(
'confirm') ==
'yes') {
689 $objecttmp =
new $objectclass($db);
692 foreach ($toselect as $checked) {
693 if ($objecttmp->fetch($checked)) {
694 if ($objecttmp->statut == 0) {
695 if (!empty($objecttmp->fk_warehouse)) {
696 $idwarehouse = $objecttmp->fk_warehouse;
700 if ($objecttmp->valid($user, $idwarehouse)) {
701 setEventMessages($langs->trans(
'hasBeenValidated', $objecttmp->ref),
null,
'mesgs');
707 $langs->load(
"errors");
708 setEventMessages($langs->trans(
'ErrorIsNotADraft', $objecttmp->ref),
null,
'errors');
723if ($action ==
'shipped' && $permissiontoadd) {
724 if (
GETPOST(
'confirm') ==
'yes') {
725 $objecttmp =
new $objectclass($db);
728 foreach ($toselect as $checked) {
729 if ($objecttmp->fetch($checked)) {
730 if ($objecttmp->statut == 1 || $objecttmp->statut == 2) {
731 if ($objecttmp->cloture($user)) {
732 setEventMessages($langs->trans(
'StatusOrderDelivered', $objecttmp->ref),
null,
'mesgs');
734 setEventMessages($langs->trans(
'ErrorOrderStatusCantBeSetToDelivered'),
null,
'errors');
738 $langs->load(
"errors");
739 setEventMessages($langs->trans(
'ErrorIsNotADraft', $objecttmp->ref),
null,
'errors');
756if (!$error && $massaction ===
'setbilled' && $permissiontoclose) {
759 $objecttmp =
new $objectclass($db);
761 foreach ($toselect as $toselectid) {
762 $result = $objecttmp->fetch($toselectid);
764 $result = $objecttmp->classifyBilled($user, 0);
796$form =
new Form($db);
800if (isModEnabled(
'margin')) {
803$companystatic =
new Societe($db);
804$company_url_list = array();
806$projectstatic =
new Project($db);
810$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
811$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
813$title = $langs->trans(
"Orders");
814$help_url =
"EN:Module_Customers_Orders|FR:Module_Commandes_Clients|ES:Módulo_Pedidos_de_clientes";
819if ($search_all || $search_user > 0) {
820 $sql =
'SELECT DISTINCT';
822$sql .=
' s.rowid as socid, s.nom as name, s.name_alias as alias, s.email, s.phone, s.fax, s.address, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client,';
823$sql .=
" s.parent as fk_parent,";
824$sql .=
" s2.nom as name2,";
825$sql .=
" typent.code as typent_code,";
826$sql .=
" state.code_departement as state_code, state.nom as state_name,";
827$sql .=
" country.code as country_code,";
828$sql .=
' c.rowid, c.ref, c.total_ht, c.total_tva, c.total_ttc, c.ref_client, c.fk_user_author,';
829$sql .=
' c.fk_multicurrency, c.multicurrency_code, c.multicurrency_tx, c.multicurrency_total_ht, c.multicurrency_total_tva as multicurrency_total_vat, c.multicurrency_total_ttc,';
830$sql .=
' c.date_valid, c.date_commande, c.note_public, c.note_private, c.date_livraison as date_delivery, c.fk_statut, c.facture as billed,';
831$sql .=
' c.date_creation as date_creation, c.tms as date_update, c.date_cloture as date_cloture,';
832$sql .=
' p.rowid as project_id, p.ref as project_ref, p.title as project_label,';
833$sql .=
' u.login, u.lastname, u.firstname, u.email as user_email, u.statut as user_statut, u.entity, u.photo, u.office_phone, u.office_fax, u.user_mobile, u.job, u.gender,';
834$sql .=
' c.fk_cond_reglement,c.deposit_percent,c.fk_mode_reglement,c.fk_shipping_method,';
835$sql .=
' c.fk_input_reason, c.import_key';
838if (!empty($extrafields->attributes[$object->table_element][
'label'])) {
839 foreach ($extrafields->attributes[$object->table_element][
'label'] as $key => $val) {
840 $sql .= ($extrafields->attributes[$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
845$parameters = array();
846$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
847$sql .= $hookmanager->resPrint;
848$sql = preg_replace(
'/,\s*$/',
'', $sql);
852$sql .=
' FROM '.MAIN_DB_PREFIX.
'societe as s';
853$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s2 ON s2.rowid = s.parent";
854$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as country on (country.rowid = s.fk_pays)";
855$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_typent as typent on (typent.id = s.fk_typent)";
856$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_departements as state on (state.rowid = s.fk_departement)";
857$sql .=
', '.MAIN_DB_PREFIX.
'commande as c';
858if (!empty($extrafields->attributes[$object->table_element][
'label']) && is_array($extrafields->attributes[$object->table_element][
'label']) && count($extrafields->attributes[$object->table_element][
'label'])) {
859 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"commande_extrafields as ef on (c.rowid = ef.fk_object)";
862 $sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'commandedet as pd ON c.rowid=pd.fk_commande';
864$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"projet as p ON p.rowid = c.fk_projet";
865$sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'user as u ON c.fk_user_author = u.rowid';
866if ($search_user > 0) {
867 $sql .=
", ".MAIN_DB_PREFIX.
"element_contact as ec";
868 $sql .=
", ".MAIN_DB_PREFIX.
"c_type_contact as tc";
872$parameters = array();
873$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object, $action);
874$sql .= $hookmanager->resPrint;
876$sql .=
' WHERE c.fk_soc = s.rowid';
877$sql .=
' AND c.entity IN ('.getEntity(
'commande').
')';
879 $sql .=
' AND s.rowid = '.((int) $socid);
884if ($search_ref_customer) {
888 $sql .=
natural_search(array_keys($fieldstosearchall), $search_all);
890if ($search_billed !=
'' && $search_billed >= 0) {
891 $sql .=
' AND c.facture = '.((int) $search_billed);
893if ($search_status !=
'') {
894 if ($search_status <= 3 && $search_status >= -1) {
895 if ($search_status == 1 && !isModEnabled(
'expedition')) {
896 $sql .=
' AND c.fk_statut IN (1,2)';
898 $sql .=
' AND c.fk_statut = '.((int) $search_status);
901 if ($search_status == -2) {
903 $sql .=
" AND (c.fk_statut IN (1,2))";
905 if ($search_status == -3) {
908 $sql .=
' AND (c.fk_statut IN (1,2,3))';
911if ($search_option ==
'late') {
912 $sql .=
" AND c.date_commande < '".$db->idate(
dol_now() - $conf->commande->client->warning_delay).
"'";
914if ($search_datecloture_start) {
915 $sql .=
" AND c.date_cloture >= '".$db->idate($search_datecloture_start).
"'";
917if ($search_datecloture_end) {
918 $sql .=
" AND c.date_cloture <= '".$db->idate($search_datecloture_end).
"'";
920if ($search_dateorder_start) {
921 $sql .=
" AND c.date_commande >= '".$db->idate($search_dateorder_start).
"'";
923if ($search_dateorder_end) {
924 $sql .=
" AND c.date_commande <= '".$db->idate($search_dateorder_end).
"'";
926if ($search_datedelivery_start) {
927 $sql .=
" AND c.date_livraison >= '".$db->idate($search_datedelivery_start).
"'";
929if ($search_datedelivery_end) {
930 $sql .=
" AND c.date_livraison <= '".$db->idate($search_datedelivery_end).
"'";
941if ($search_country) {
942 $sql .=
" AND s.fk_pays IN (".$db->sanitize($search_country).
')';
944if ($search_type_thirdparty && $search_type_thirdparty !=
'-1') {
945 $sql .=
" AND s.fk_typent IN (".$db->sanitize($search_type_thirdparty).
')';
947if (empty($arrayfields[
's.name_alias'][
'checked']) && $search_company) {
948 $sql .=
natural_search(array(
"s.nom",
"s.name_alias"), $search_company);
950 if ($search_company) {
953 if ($search_company_alias) {
957if ($search_parent_name) {
960if ($search_user > 0) {
961 $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);
963if ($search_total_ht !=
'') {
966if ($search_total_vat !=
'') {
969if ($search_total_ttc !=
'') {
972if ($search_warehouse !=
'' && $search_warehouse > 0) {
975if ($search_multicurrency_code !=
'') {
976 $sql .=
" AND c.multicurrency_code = '".$db->escape($search_multicurrency_code).
"'";
978if ($search_multicurrency_tx !=
'') {
979 $sql .=
natural_search(
'c.multicurrency_tx', $search_multicurrency_tx, 1);
981if ($search_multicurrency_montant_ht !=
'') {
982 $sql .=
natural_search(
'c.multicurrency_total_ht', $search_multicurrency_montant_ht, 1);
984if ($search_multicurrency_montant_vat !=
'') {
985 $sql .=
natural_search(
'c.multicurrency_total_tva', $search_multicurrency_montant_vat, 1);
987if ($search_multicurrency_montant_ttc !=
'') {
988 $sql .=
natural_search(
'c.multicurrency_total_ttc', $search_multicurrency_montant_ttc, 1);
991 $sql .=
natural_search(array(
"u.login",
"u.firstname",
"u.lastname"), $search_login);
993if ($search_project_ref !=
'') {
996if ($search_project !=
'') {
999if ($search_fk_cond_reglement > 0) {
1000 $sql .=
" AND c.fk_cond_reglement = ".((int) $search_fk_cond_reglement);
1002if ($search_fk_shipping_method > 0) {
1003 $sql .=
" AND c.fk_shipping_method = ".((int) $search_fk_shipping_method);
1005if ($search_fk_mode_reglement > 0) {
1006 $sql .=
" AND c.fk_mode_reglement = ".((int) $search_fk_mode_reglement);
1008if ($search_fk_input_reason > 0) {
1009 $sql .=
" AND c.fk_input_reason = ".((int) $search_fk_input_reason);
1012if ($search_sale && $search_sale !=
'-1') {
1013 if ($search_sale == -2) {
1014 $sql .=
" AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX.
"societe_commerciaux as sc WHERE sc.fk_soc = c.fk_soc)";
1015 } elseif ($search_sale > 0) {
1016 $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).
")";
1020$searchCategoryCustomerOperator = -1;
1021$searchCategoryCustomerList = array($search_categ_cus);
1022if (!empty($searchCategoryCustomerList)) {
1023 $searchCategoryCustomerSqlList = array();
1024 $listofcategoryid =
'';
1025 foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
1026 if (intval($searchCategoryCustomer) == -2) {
1027 $searchCategoryCustomerSqlList[] =
"NOT EXISTS (SELECT cs.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_societe as cs WHERE s.rowid = cs.fk_soc)";
1028 } elseif (intval($searchCategoryCustomer) > 0) {
1029 if ($searchCategoryCustomerOperator == 0) {
1030 $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).
")";
1032 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryCustomer);
1036 if ($listofcategoryid) {
1037 $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).
"))";
1039 if ($searchCategoryCustomerOperator == 1) {
1040 if (!empty($searchCategoryCustomerSqlList)) {
1041 $sql .=
" AND (".implode(
' OR ', $searchCategoryCustomerSqlList).
")";
1044 if (!empty($searchCategoryCustomerSqlList)) {
1045 $sql .=
" AND (".implode(
' AND ', $searchCategoryCustomerSqlList).
")";
1050$searchCategoryProductOperator = -1;
1051$searchCategoryProductList = array($search_product_category);
1052if (!empty($searchCategoryProductList)) {
1053 $searchCategoryProductSqlList = array();
1054 $listofcategoryid =
'';
1055 foreach ($searchCategoryProductList as $searchCategoryProduct) {
1056 if (intval($searchCategoryProduct) == -2) {
1057 $searchCategoryProductSqlList[] =
"NOT EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX.
"categorie_product as ck, ".MAIN_DB_PREFIX.
"commandedet as cd WHERE cd.fk_commande = c.rowid AND cd.fk_product = ck.fk_product)";
1058 } elseif (intval($searchCategoryProduct) > 0) {
1059 if ($searchCategoryProductOperator == 0) {
1060 $searchCategoryProductSqlList[] =
" EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX.
"categorie_product as ck, ".MAIN_DB_PREFIX.
"commandedet as cd WHERE cd.fk_commande = c.rowid AND cd.fk_product = ck.fk_product AND ck.fk_categorie = ".((int) $searchCategoryProduct).
")";
1062 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryProduct);
1066 if ($listofcategoryid) {
1067 $searchCategoryProductSqlList[] =
" EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX.
"categorie_product as ck, ".MAIN_DB_PREFIX.
"commandedet as cd WHERE cd.fk_commande = c.rowid AND cd.fk_product = ck.fk_product AND ck.fk_categorie IN (".$db->sanitize($listofcategoryid).
"))";
1069 if ($searchCategoryProductOperator == 1) {
1070 if (!empty($searchCategoryProductSqlList)) {
1071 $sql .=
" AND (".implode(
' OR ', $searchCategoryProductSqlList).
")";
1074 if (!empty($searchCategoryProductSqlList)) {
1075 $sql .=
" AND (".implode(
' AND ', $searchCategoryProductSqlList).
")";
1080include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
1082$parameters = array();
1083$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
1084$sql .= $hookmanager->resPrint;
1087$parameters = array();
1088$reshook = $hookmanager->executeHooks(
'printFieldListHaving', $parameters, $object, $action);
1089$sql .= empty($hookmanager->resPrint) ?
"" :
" HAVING 1=1 ".$hookmanager->resPrint;
1093$nbtotalofrecords =
'';
1096 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
1097 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
1098 $resql = $db->query($sqlforcount);
1100 $objforcount = $db->fetch_object($resql);
1101 $nbtotalofrecords = $objforcount->nbtotalofrecords;
1106 if (($page * $limit) > $nbtotalofrecords) {
1113$sql .= $db->order($sortfield, $sortorder);
1115 $sql .= $db->plimit($limit + 1, $offset);
1119$resql = $db->query($sql);
1127 $soc->fetch($socid);
1128 $title = $langs->trans(
'CustomersOrders').
' - '.$soc->name;
1129 if (empty($search_company)) {
1130 $search_company = $soc->name;
1133 $title = $langs->trans(
'CustomersOrders');
1135if (strval($search_status) ==
'0') {
1136 $title .=
' - '.$langs->trans(
'StatusOrderDraftShort');
1138if ($search_status == 1) {
1139 $title .=
' - '.$langs->trans(
'StatusOrderValidatedShort');
1141if ($search_status == 2) {
1142 $title .=
' - '.$langs->trans(
'StatusOrderSentShort');
1144if ($search_status == 3) {
1145 $title .=
' - '.$langs->trans(
'StatusOrderToBillShort');
1147if ($search_status == -1) {
1148 $title .=
' - '.$langs->trans(
'StatusOrderCanceledShort');
1150if ($search_status == -2) {
1151 $title .=
' - '.$langs->trans(
'StatusOrderToProcessShort');
1153if ($search_status == -3) {
1154 $title .=
' - '.$langs->trans(
'StatusOrderValidated').
', '.(!isModEnabled(
'expedition') ?
'' : $langs->trans(
"StatusOrderSent").
', ').$langs->trans(
'StatusOrderToBill');
1156if ($search_status == -4) {
1157 $title .=
' - '.$langs->trans(
"StatusOrderValidatedShort").
'+'.$langs->trans(
"StatusOrderSentShort");
1160$num = $db->num_rows($resql);
1162$arrayofselected = is_array($toselect) ? $toselect : array();
1164if ($num == 1 &&
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all) {
1165 $obj = $db->fetch_object($resql);
1167 header(
"Location: ".DOL_URL_ROOT.
'/commande/card.php?id='.$id);
1176$arrayofselected = is_array($toselect) ? $toselect : array();
1180 $param .=
'&mode='.urlencode($mode);
1182if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
1183 $param .=
'&contextpage='.urlencode($contextpage);
1185if ($limit > 0 && $limit != $conf->liste_limit) {
1186 $param .=
'&limit='.((int) $limit);
1189 $param .=
'&search_all='.urlencode($search_all);
1192 $param .=
'&socid='.((int) $socid);
1194if ($search_status !=
'') {
1195 $param .=
'&search_status='.urlencode($search_status);
1197if ($search_option) {
1198 $param .=
"&search_option=".urlencode($search_option);
1200if ($search_datecloture_start) {
1201 $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');
1203if ($search_datecloture_end) {
1204 $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');
1206if ($search_dateorder_start) {
1207 $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');
1209if ($search_dateorder_end) {
1210 $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');
1212if ($search_datedelivery_start) {
1213 $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');
1215if ($search_datedelivery_end) {
1216 $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');
1219 $param .=
'&search_ref='.urlencode($search_ref);
1221if ($search_company) {
1222 $param .=
'&search_company='.urlencode($search_company);
1224if ($search_company_alias) {
1225 $param .=
'&search_company_alias='.urlencode($search_company_alias);
1227if ($search_parent_name !=
'') {
1228 $param .=
'&search_parent_name='.urlencode($search_parent_name);
1230if ($search_ref_customer) {
1231 $param .=
'&search_ref_customer='.urlencode($search_ref_customer);
1233if ($search_user > 0) {
1234 $param .=
'&search_user='.urlencode($search_user);
1236if ($search_sale > 0) {
1237 $param .=
'&search_sale='.urlencode($search_sale);
1239if ($search_total_ht !=
'') {
1240 $param .=
'&search_total_ht='.urlencode($search_total_ht);
1242if ($search_total_vat !=
'') {
1243 $param .=
'&search_total_vat='.urlencode($search_total_vat);
1245if ($search_total_ttc !=
'') {
1246 $param .=
'&search_total_ttc='.urlencode($search_total_ttc);
1248if ($search_warehouse !=
'') {
1249 $param .=
'&search_warehouse='.urlencode($search_warehouse);
1252 $param .=
'&search_login='.urlencode($search_login);
1254if ($search_multicurrency_code !=
'') {
1255 $param .=
'&search_multicurrency_code='.urlencode($search_multicurrency_code);
1257if ($search_multicurrency_tx !=
'') {
1258 $param .=
'&search_multicurrency_tx='.urlencode($search_multicurrency_tx);
1260if ($search_multicurrency_montant_ht !=
'') {
1261 $param .=
'&search_multicurrency_montant_ht='.urlencode($search_multicurrency_montant_ht);
1263if ($search_multicurrency_montant_vat !=
'') {
1264 $param .=
'&search_multicurrency_montant_vat='.urlencode($search_multicurrency_montant_vat);
1266if ($search_multicurrency_montant_ttc !=
'') {
1267 $param .=
'&search_multicurrency_montant_ttc='.urlencode($search_multicurrency_montant_ttc);
1269if ($search_project_ref >= 0) {
1270 $param .=
"&search_project_ref=".urlencode($search_project_ref);
1272if ($search_town !=
'') {
1273 $param .=
'&search_town='.urlencode($search_town);
1275if ($search_zip !=
'') {
1276 $param .=
'&search_zip='.urlencode($search_zip);
1278if ($search_state !=
'') {
1279 $param .=
'&search_state='.urlencode($search_state);
1281if ($search_country !=
'') {
1282 $param .=
'&search_country='.urlencode($search_country);
1284if ($search_type_thirdparty && $search_type_thirdparty !=
'-1') {
1285 $param .=
'&search_type_thirdparty='.urlencode($search_type_thirdparty);
1287if ($search_product_category !=
'') {
1288 $param .=
'&search_product_category='.urlencode($search_product_category);
1290if (($search_categ_cus > 0) || ($search_categ_cus == -2)) {
1291 $param .=
'&search_categ_cus='.urlencode($search_categ_cus);
1294 $param .=
'&show_files='.urlencode($show_files);
1296if ($optioncss !=
'') {
1297 $param .=
'&optioncss='.urlencode($optioncss);
1299if ($search_billed !=
'') {
1300 $param .=
'&search_billed='.urlencode($search_billed);
1302if ($search_fk_cond_reglement > 0) {
1303 $param .=
'&search_fk_cond_reglement='.urlencode($search_fk_cond_reglement);
1305if ($search_fk_shipping_method > 0) {
1306 $param .=
'&search_fk_shipping_method='.urlencode($search_fk_shipping_method);
1308if ($search_fk_mode_reglement > 0) {
1309 $param .=
'&search_fk_mode_reglement='.urlencode($search_fk_mode_reglement);
1311if ($search_fk_input_reason > 0) {
1312 $param .=
'&search_fk_input_reason='.urlencode($search_fk_input_reason);
1316include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
1319$parameters = array();
1320$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
1321$param .= $hookmanager->resPrint;
1324$arrayofmassactions = array(
1325 'generate_doc'=>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"ReGeneratePDF"),
1326 'builddoc'=>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"PDFMerge"),
1328if ($permissiontovalidate) {
1329 $arrayofmassactions[
'prevalidate'] =
img_picto(
'',
'check',
'class="pictofixedwidth"').$langs->trans(
"Validate");
1331if ($permissiontoclose) {
1332 $arrayofmassactions[
'preshipped'] =
img_picto(
'',
'dollyrevert',
'class="pictofixedwidth"').$langs->trans(
"ClassifyShipped");
1334if (isModEnabled(
'facture') && $user->hasRight(
"facture",
"creer")) {
1335 $arrayofmassactions[
'createbills'] =
img_picto(
'',
'bill',
'class="pictofixedwidth"').$langs->trans(
"CreateInvoiceForThisCustomer");
1337if ($permissiontoclose) {
1338 $arrayofmassactions[
'setbilled'] =
img_picto(
'',
'bill',
'class="pictofixedwidth"').$langs->trans(
"ClassifyBilled");
1340if ($permissiontocancel) {
1341 $arrayofmassactions[
'cancelorders'] =
img_picto(
'',
'close_title',
'class="pictofixedwidth"').$langs->trans(
"CancelOrder");
1343if (!empty($permissiontodelete)) {
1344 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
1346if ($permissiontosendbymail) {
1347 $arrayofmassactions[
'presend'] =
img_picto(
'',
'email',
'class="pictofixedwidth"').$langs->trans(
"SendByMail");
1349if (in_array($massaction, array(
'presend',
'predelete',
'createbills'))) {
1350 $arrayofmassactions = array();
1352$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
1354$url = DOL_URL_ROOT.
'/commande/card.php?action=create';
1355if (!empty($socid)) {
1356 $url .=
'&socid='.$socid;
1359$newcardbutton .=
dolGetButtonTitle($langs->trans(
'ViewList'),
'',
'fa fa-bars imgforviewmode', $_SERVER[
"PHP_SELF"].
'?mode=common'.preg_replace(
'/(&|\?)*mode=[^&]+/',
'', $param),
'', ((empty($mode) || $mode ==
'common') ? 2 : 1), array(
'morecss'=>
'reposition'));
1360$newcardbutton .=
dolGetButtonTitle($langs->trans(
'ViewKanban'),
'',
'fa fa-th-list imgforviewmode', $_SERVER[
"PHP_SELF"].
'?mode=kanban'.preg_replace(
'/(&|\?)*mode=[^&]+/',
'', $param),
'', ($mode ==
'kanban' ? 2 : 1), array(
'morecss'=>
'reposition'));
1362$newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewOrder'),
'',
'fa fa-plus-circle', $url,
'', ($contextpage ==
'orderlist' || $contextpage ==
'billableorders') && $permissiontoadd);
1365print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
1366if ($optioncss !=
'') {
1367 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
1369print
'<input type="hidden" name="token" value="'.newToken().
'">';
1370print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
1371print
'<input type="hidden" name="action" value="list">';
1372print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
1373print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
1374print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
1375print
'<input type="hidden" name="search_status" value="'.$search_status.
'">';
1376print
'<input type="hidden" name="socid" value="'.$socid.
'">';
1377print
'<input type="hidden" name="page_y" value="">';
1378print
'<input type="hidden" name="mode" value="'.$mode.
'">';
1381print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'order', 0, $newcardbutton,
'', $limit, 0, 0, 1);
1383$topicmail =
"SendOrderRef";
1384$modelmail =
"order_send";
1386$trackid =
'ord'.$object->id;
1387include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
1389if ($massaction ==
'prevalidate') {
1390 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassValidation"), $langs->trans(
"ConfirmMassValidationQuestion"),
"validate",
null,
'', 0, 200, 500, 1);
1392if ($massaction ==
'preshipped') {
1393 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"CloseOrder"), $langs->trans(
"ConfirmCloseOrder"),
"shipped",
null,
'', 0, 200, 500, 1);
1396if ($massaction ==
'createbills') {
1397 print
'<input type="hidden" name="massaction" value="confirm_createbills">';
1399 print
'<table class="noborder centpercent">';
1402 print $langs->trans(
'DateInvoice');
1405 print $form->selectDate(
'',
'',
'',
'',
'',
'', 1, 1);
1410 print $langs->trans(
'CreateOneBillByThird');
1413 print $form->selectyesno(
'createbills_onebythird',
'', 1);
1418 print $langs->trans(
'ValidateInvoices');
1422 print $form->selectyesno(
'validate_invoices', 0, 1, 1);
1423 $langs->load(
"errors");
1424 print
' ('.$langs->trans(
"WarningAutoValNotPossibleWhenStockIsDecreasedOnInvoiceVal").
')';
1426 print $form->selectyesno(
'validate_invoices', 0, 1);
1428 if (!empty($conf->workflow->enabled) &&
getDolGlobalString(
'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER')) {
1429 print
' <span class="opacitymedium">'.$langs->trans(
"IfValidateInvoiceIsNoOrderStayUnbilled").
'</span>';
1431 print
' <span class="opacitymedium">'.$langs->trans(
"OptionToSetOrderBilledNotEnabled").
'</span>';
1437 print
'<div class="center">';
1438 print
'<input type="submit" class="button" id="createbills" name="createbills" value="'.$langs->trans(
'CreateInvoiceForThisCustomer').
'"> ';
1439 print
'<input type="submit" class="button button-cancel" id="cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
1446 foreach ($fieldstosearchall as $key => $val) {
1447 $fieldstosearchall[$key] = $langs->trans($val);
1448 $setupstring .= $key.
"=".$val.
";";
1450 print
'<!-- Search done like if MYOBJECT_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
1451 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).join(
', ', $fieldstosearchall).
'</div>';
1457if ($user->hasRight(
"user",
"user",
"lire")) {
1458 $langs->load(
"commercial");
1459 $moreforfilter .=
'<div class="divsearchfield">';
1460 $tmptitle = $langs->trans(
'ThirdPartiesOfSaleRepresentative');
1461 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale,
'search_sale', $user, 0, $tmptitle,
'maxwidth250 widthcentpercentminusx');
1462 $moreforfilter .=
'</div>';
1465if ($user->hasRight(
"user",
"user",
"lire")) {
1466 $moreforfilter .=
'<div class="divsearchfield">';
1467 $tmptitle = $langs->trans(
'LinkedToSpecificUsers');
1468 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$form->select_dolusers($search_user,
'search_user', $tmptitle,
'', 0,
'',
'', 0, 0, 0,
'', 0,
'',
'maxwidth250 widthcentpercentminusx');
1469 $moreforfilter .=
'</div>';
1473if (isModEnabled(
'categorie') && $user->hasRight(
"categorie",
"lire") && ($user->hasRight(
"produit",
"lire") || $user->hasRight(
"service",
"lire"))) {
1474 include_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1475 $moreforfilter .=
'<div class="divsearchfield">';
1476 $tmptitle = $langs->trans(
'IncludingProductWithTag');
1477 $cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT,
null,
'parent',
null,
null, 1);
1478 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"').$form->selectarray(
'search_product_category', $cate_arbo, $search_product_category, $tmptitle, 0, 0,
'', 0, 0, 0, 0,
'maxwidth300 widthcentpercentminusx', 1);
1479 $moreforfilter .=
'</div>';
1482if (isModEnabled(
'categorie') && $user->hasRight(
"categorie",
"lire")) {
1483 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1484 $moreforfilter .=
'<div class="divsearchfield">';
1485 $tmptitle = $langs->trans(
'CustomersProspectsCategoriesShort');
1486 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"').$formother->select_categories(
'customer', $search_categ_cus,
'search_categ_cus', 1, $tmptitle,
'maxwidth300 widthcentpercentminusx');
1487 $moreforfilter .=
'</div>';
1490if (isModEnabled(
'stock') &&
getDolGlobalString(
'WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER')) {
1491 require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
1493 $moreforfilter .=
'<div class="divsearchfield">';
1494 $tmptitle = $langs->trans(
'Warehouse');
1495 $moreforfilter .=
img_picto($tmptitle,
'stock',
'class="pictofixedwidth"').$formproduct->selectWarehouses($search_warehouse,
'search_warehouse',
'', 1, 0, 0, $tmptitle, 0, 0, array(),
'maxwidth250 widthcentpercentminusx');
1496 $moreforfilter .=
'</div>';
1499$parameters = array();
1500$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
1501if (empty($reshook)) {
1502 $moreforfilter .= $hookmanager->resPrint;
1504 $moreforfilter = $hookmanager->resPrint;
1507if (!empty($moreforfilter)) {
1508 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1509 print $moreforfilter;
1510 $parameters = array();
1511 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
1512 print $hookmanager->resPrint;
1516$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
1517$selectedfields = ($mode !=
'kanban' ? $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN',
'')) :
'');
1518$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
1520if (
GETPOST(
'autoselectall',
'int')) {
1521 $selectedfields .=
'<script>';
1522 $selectedfields .=
' $(document).ready(function() {';
1523 $selectedfields .=
' console.log("Autoclick on checkforselects");';
1524 $selectedfields .=
' $("#checkforselects").click();';
1525 $selectedfields .=
' $("#massaction").val("createbills").change();';
1526 $selectedfields .=
' });';
1527 $selectedfields .=
'</script>';
1530print
'<div class="div-table-responsive">';
1531print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
1535print
'<tr class="liste_titre_filter">';
1538 print
'<td class="liste_titre center maxwidthsearch">';
1539 $searchpicto = $form->showFilterButtons(
'left');
1545if (!empty($arrayfields[
'c.ref'][
'checked'])) {
1546 print
'<td class="liste_titre">';
1547 print
'<input class="flat" size="6" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
1551if (!empty($arrayfields[
'c.ref_client'][
'checked'])) {
1552 print
'<td class="liste_titre" align="left">';
1553 print
'<input class="flat" type="text" size="6" name="search_ref_customer" value="'.dol_escape_htmltag($search_ref_customer).
'">';
1557if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1558 print
'<td class="liste_titre"><input type="text" class="flat" size="6" name="search_project_ref" value="'.dol_escape_htmltag($search_project_ref).
'"></td>';
1561if (!empty($arrayfields[
'p.title'][
'checked'])) {
1562 print
'<td class="liste_titre"><input type="text" class="flat" size="6" name="search_project" value="'.dol_escape_htmltag($search_project).
'"></td>';
1565if (!empty($arrayfields[
's.nom'][
'checked'])) {
1566 print
'<td class="liste_titre" align="left">';
1567 print
'<input class="flat maxwidth100" type="text" name="search_company" value="'.dol_escape_htmltag($search_company).
'">';
1571if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1572 print
'<td class="liste_titre" align="left">';
1573 print
'<input class="flat maxwidth100" type="text" name="search_company_alias" value="'.dol_escape_htmltag($search_company_alias).
'">';
1577if (!empty($arrayfields[
's2.nom'][
'checked'])) {
1578 print
'<td class="liste_titre">';
1579 print
'<input class="flat maxwidth100" type="text" name="search_parent_name" value="'.dol_escape_htmltag($search_parent_name).
'">';
1583if (!empty($arrayfields[
's.town'][
'checked'])) {
1584 print
'<td class="liste_titre"><input class="flat width50" type="text" name="search_town" value="'.dol_escape_htmltag($search_town).
'"></td>';
1587if (!empty($arrayfields[
's.zip'][
'checked'])) {
1588 print
'<td class="liste_titre"><input class="flat width50" type="text" name="search_zip" value="'.dol_escape_htmltag($search_zip).
'"></td>';
1591if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1592 print
'<td class="liste_titre">';
1593 print
'<input class="flat width50" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).
'">';
1597if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1598 print
'<td class="liste_titre" align="center">';
1599 print $form->select_country($search_country,
'search_country',
'', 0,
'minwidth100imp maxwidth100');
1603if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1604 print
'<td class="liste_titre maxwidthonsmartphone" align="center">';
1605 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);
1609if (!empty($arrayfields[
'c.date_commande'][
'checked'])) {
1610 print
'<td class="liste_titre center">';
1611 print
'<div class="nowrapfordate">';
1612 print $form->selectDate($search_dateorder_start ? $search_dateorder_start : -1,
'search_dateorder_start_', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1614 print
'<div class="nowrapfordate">';
1615 print $form->selectDate($search_dateorder_end ? $search_dateorder_end : -1,
'search_dateorder_end_', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1619if (!empty($arrayfields[
'c.date_delivery'][
'checked'])) {
1620 print
'<td class="liste_titre center">';
1621 print
'<div class="nowrapfordate">';
1622 print $form->selectDate($search_datedelivery_start ? $search_datedelivery_start : -1,
'search_datedelivery_start_', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1624 print
'<div class="nowrapfordate">';
1625 print $form->selectDate($search_datedelivery_end ? $search_datedelivery_end : -1,
'search_datedelivery_end_', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1630if (!empty($arrayfields[
'c.fk_shipping_method'][
'checked'])) {
1631 print
'<td class="liste_titre">';
1632 $form->selectShippingMethod($search_fk_shipping_method,
'search_fk_shipping_method',
'', 1,
'', 1);
1636if (!empty($arrayfields[
'c.fk_cond_reglement'][
'checked'])) {
1637 print
'<td class="liste_titre">';
1638 print $form->getSelectConditionsPaiements($search_fk_cond_reglement,
'search_fk_cond_reglement', 1, 1, 1);
1642if (!empty($arrayfields[
'c.fk_mode_reglement'][
'checked'])) {
1643 print
'<td class="liste_titre">';
1644 print $form->select_types_paiements($search_fk_mode_reglement,
'search_fk_mode_reglement',
'', 0, 1, 1, 0, -1,
'', 1);
1648if (!empty($arrayfields[
'c.fk_input_reason'][
'checked'])) {
1649 print
'<td class="liste_titre">';
1650 $form->selectInputReason($search_fk_input_reason,
'search_fk_input_reason',
'', 1,
'', 1);
1654if (!empty($arrayfields[
'c.total_ht'][
'checked'])) {
1655 print
'<td class="liste_titre right">';
1656 print
'<input class="flat" type="text" size="4" name="search_total_ht" value="'.dol_escape_htmltag($search_total_ht).
'">';
1660if (!empty($arrayfields[
'c.total_vat'][
'checked'])) {
1661 print
'<td class="liste_titre right">';
1662 print
'<input class="flat" type="text" size="4" name="search_total_vat" value="'.dol_escape_htmltag($search_total_vat).
'">';
1666if (!empty($arrayfields[
'c.total_ttc'][
'checked'])) {
1667 print
'<td class="liste_titre right">';
1668 print
'<input class="flat" type="text" size="5" name="search_total_ttc" value="'.$search_total_ttc.
'">';
1672if (!empty($arrayfields[
'c.multicurrency_code'][
'checked'])) {
1673 print
'<td class="liste_titre">';
1674 print $form->selectMultiCurrency($search_multicurrency_code,
'search_multicurrency_code', 1);
1678if (!empty($arrayfields[
'c.multicurrency_tx'][
'checked'])) {
1679 print
'<td class="liste_titre">';
1680 print
'<input class="flat" type="text" size="4" name="search_multicurrency_tx" value="'.dol_escape_htmltag($search_multicurrency_tx).
'">';
1684if (!empty($arrayfields[
'c.multicurrency_total_ht'][
'checked'])) {
1685 print
'<td class="liste_titre right">';
1686 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ht" value="'.dol_escape_htmltag($search_multicurrency_montant_ht).
'">';
1690if (!empty($arrayfields[
'c.multicurrency_total_vat'][
'checked'])) {
1691 print
'<td class="liste_titre right">';
1692 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_vat" value="'.dol_escape_htmltag($search_multicurrency_montant_vat).
'">';
1696if (!empty($arrayfields[
'c.multicurrency_total_ttc'][
'checked'])) {
1697 print
'<td class="liste_titre right">';
1698 print
'<input class="flat width75" type="text" name="search_multicurrency_montant_ttc" value="'.dol_escape_htmltag($search_multicurrency_montant_ttc).
'">';
1702if (!empty($arrayfields[
'u.login'][
'checked'])) {
1703 print
'<td class="liste_titre">';
1704 print
'<input class="flat width75" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).
'">';
1708if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
1709 print
'<td class="liste_titre"></td>';
1711if (!empty($arrayfields[
'total_pa'][
'checked'])) {
1712 print
'<td class="liste_titre right">';
1715if (!empty($arrayfields[
'total_margin'][
'checked'])) {
1716 print
'<td class="liste_titre right">';
1719if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
1720 print
'<td class="liste_titre right">';
1723if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
1724 print
'<td class="liste_titre right">';
1729include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
1732$parameters = array(
'arrayfields'=>$arrayfields);
1733$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
1734print $hookmanager->resPrint;
1737if (!empty($arrayfields[
'c.datec'][
'checked'])) {
1738 print
'<td class="liste_titre">';
1742if (!empty($arrayfields[
'c.tms'][
'checked'])) {
1743 print
'<td class="liste_titre">';
1747if (!empty($arrayfields[
'c.date_cloture'][
'checked'])) {
1748 print
'<td class="liste_titre center">';
1749 print
'<div class="nowrapfordate">';
1750 print $form->selectDate($search_datecloture_start ? $search_datecloture_start : -1,
'search_datecloture_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1752 print
'<div class="nowrapfordate">';
1753 print $form->selectDate($search_datecloture_end ? $search_datecloture_end : -1,
'search_datecloture_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1758if (!empty($arrayfields[
'c.note_public'][
'checked'])) {
1759 print
'<td class="liste_titre">';
1763if (!empty($arrayfields[
'c.note_private'][
'checked'])) {
1764 print
'<td class="liste_titre">';
1768if (!empty($arrayfields[
'shippable'][
'checked'])) {
1769 print
'<td class="liste_titre maxwidthonsmartphone" align="center">';
1772 print
'<input type="checkbox" name="show_shippable_command" value="1"'.($show_shippable_command ?
' checked' :
'').
'>';
1773 print $langs->trans(
'ShowShippableStatus');
1775 $show_shippable_command = 1;
1780if (!empty($arrayfields[
'c.facture'][
'checked'])) {
1781 print
'<td class="liste_titre maxwidthonsmartphone center">';
1782 print $form->selectyesno(
'search_billed', $search_billed, 1, 0, 1, 1);
1786if (!empty($arrayfields[
'c.import_key'][
'checked'])) {
1787 print
'<td class="liste_titre maxwidthonsmartphone center">';
1791if (!empty($arrayfields[
'c.fk_statut'][
'checked'])) {
1792 print
'<td class="liste_titre center parentonrightofpage">';
1793 $liststatus = array(
1797 -2 => $langs->trans(
"StatusOrderValidatedShort").
'+'.$langs->trans(
"StatusOrderSentShort"),
1798 -3 => $langs->trans(
"StatusOrderValidatedShort").
'+'.$langs->trans(
"StatusOrderSentShort").
'+'.$langs->trans(
"StatusOrderDelivered"),
1802 print $form->selectarray(
'search_status', $liststatus, $search_status, -5, 0, 0,
'', 0, 0, 0,
'',
'search_status width100 onrightofpage', 1);
1807 print
'<td class="liste_titre center maxwidthsearch">';
1808 $searchpicto = $form->showFilterButtons();
1827print
'<tr class="liste_titre">';
1831 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'', $param,
'', $sortfield, $sortorder,
'maxwidthsearch center ');
1832 $totalarray[
'nbfield']++;
1834if (!empty($arrayfields[
'c.ref'][
'checked'])) {
1835 print_liste_field_titre($arrayfields[
'c.ref'][
'label'], $_SERVER[
"PHP_SELF"],
'c.ref',
'', $param,
'', $sortfield, $sortorder);
1836 $totalarray[
'nbfield']++;
1838if (!empty($arrayfields[
'c.ref_client'][
'checked'])) {
1839 print_liste_field_titre($arrayfields[
'c.ref_client'][
'label'], $_SERVER[
"PHP_SELF"],
'c.ref_client',
'', $param,
'', $sortfield, $sortorder);
1840 $totalarray[
'nbfield']++;
1842if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1843 print_liste_field_titre($arrayfields[
'p.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"p.ref",
"", $param,
'', $sortfield, $sortorder);
1844 $totalarray[
'nbfield']++;
1846if (!empty($arrayfields[
'p.title'][
'checked'])) {
1847 print_liste_field_titre($arrayfields[
'p.title'][
'label'], $_SERVER[
"PHP_SELF"],
"p.title",
"", $param,
'', $sortfield, $sortorder);
1848 $totalarray[
'nbfield']++;
1850if (!empty($arrayfields[
's.nom'][
'checked'])) {
1851 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
"PHP_SELF"],
's.nom',
'', $param,
'', $sortfield, $sortorder);
1852 $totalarray[
'nbfield']++;
1854if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1855 print_liste_field_titre($arrayfields[
's.name_alias'][
'label'], $_SERVER[
"PHP_SELF"],
's.name_alias',
'', $param,
'', $sortfield, $sortorder);
1856 $totalarray[
'nbfield']++;
1858if (!empty($arrayfields[
's2.nom'][
'checked'])) {
1859 print_liste_field_titre($arrayfields[
's2.nom'][
'label'], $_SERVER[
'PHP_SELF'],
's2.nom',
'', $param,
'', $sortfield, $sortorder);
1860 $totalarray[
'nbfield']++;
1862if (!empty($arrayfields[
's.town'][
'checked'])) {
1863 print_liste_field_titre($arrayfields[
's.town'][
'label'], $_SERVER[
"PHP_SELF"],
's.town',
'', $param,
'', $sortfield, $sortorder);
1864 $totalarray[
'nbfield']++;
1866if (!empty($arrayfields[
's.zip'][
'checked'])) {
1867 print_liste_field_titre($arrayfields[
's.zip'][
'label'], $_SERVER[
"PHP_SELF"],
's.zip',
'', $param,
'', $sortfield, $sortorder);
1868 $totalarray[
'nbfield']++;
1870if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1871 print_liste_field_titre($arrayfields[
'state.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"state.nom",
"", $param,
'', $sortfield, $sortorder);
1872 $totalarray[
'nbfield']++;
1874if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1875 print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'], $_SERVER[
"PHP_SELF"],
"country.code_iso",
"", $param,
'', $sortfield, $sortorder,
'center ');
1876 $totalarray[
'nbfield']++;
1878if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1879 print_liste_field_titre($arrayfields[
'typent.code'][
'label'], $_SERVER[
"PHP_SELF"],
"typent.code",
"", $param,
'', $sortfield, $sortorder,
'center ');
1880 $totalarray[
'nbfield']++;
1882if (!empty($arrayfields[
'c.date_commande'][
'checked'])) {
1883 print_liste_field_titre($arrayfields[
'c.date_commande'][
'label'], $_SERVER[
"PHP_SELF"],
'c.date_commande',
'', $param,
'', $sortfield, $sortorder,
'center ');
1884 $totalarray[
'nbfield']++;
1886if (!empty($arrayfields[
'c.date_delivery'][
'checked'])) {
1887 print_liste_field_titre($arrayfields[
'c.date_delivery'][
'label'], $_SERVER[
"PHP_SELF"],
'c.date_livraison',
'', $param,
'', $sortfield, $sortorder,
'center ');
1888 $totalarray[
'nbfield']++;
1890if (!empty($arrayfields[
'c.fk_shipping_method'][
'checked'])) {
1891 print_liste_field_titre($arrayfields[
'c.fk_shipping_method'][
'label'], $_SERVER[
"PHP_SELF"],
"c.fk_shipping_method",
"", $param,
'', $sortfield, $sortorder);
1892 $totalarray[
'nbfield']++;
1894if (!empty($arrayfields[
'c.fk_cond_reglement'][
'checked'])) {
1895 print_liste_field_titre($arrayfields[
'c.fk_cond_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"c.fk_cond_reglement",
"", $param,
'', $sortfield, $sortorder);
1896 $totalarray[
'nbfield']++;
1898if (!empty($arrayfields[
'c.fk_mode_reglement'][
'checked'])) {
1899 print_liste_field_titre($arrayfields[
'c.fk_mode_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"c.fk_mode_reglement",
"", $param,
'', $sortfield, $sortorder);
1900 $totalarray[
'nbfield']++;
1902if (!empty($arrayfields[
'c.fk_input_reason'][
'checked'])) {
1903 print_liste_field_titre($arrayfields[
'c.fk_input_reason'][
'label'], $_SERVER[
"PHP_SELF"],
"c.fk_input_reason",
"", $param,
'', $sortfield, $sortorder);
1904 $totalarray[
'nbfield']++;
1906if (!empty($arrayfields[
'c.total_ht'][
'checked'])) {
1907 print_liste_field_titre($arrayfields[
'c.total_ht'][
'label'], $_SERVER[
"PHP_SELF"],
'c.total_ht',
'', $param,
'', $sortfield, $sortorder,
'right ');
1908 $totalarray[
'nbfield']++;
1910if (!empty($arrayfields[
'c.total_vat'][
'checked'])) {
1911 print_liste_field_titre($arrayfields[
'c.total_vat'][
'label'], $_SERVER[
"PHP_SELF"],
'c.total_tva',
'', $param,
'', $sortfield, $sortorder,
'right ');
1912 $totalarray[
'nbfield']++;
1914if (!empty($arrayfields[
'c.total_ttc'][
'checked'])) {
1915 print_liste_field_titre($arrayfields[
'c.total_ttc'][
'label'], $_SERVER[
"PHP_SELF"],
'c.total_ttc',
'', $param,
'', $sortfield, $sortorder,
'right ');
1916 $totalarray[
'nbfield']++;
1918if (!empty($arrayfields[
'c.multicurrency_code'][
'checked'])) {
1919 print_liste_field_titre($arrayfields[
'c.multicurrency_code'][
'label'], $_SERVER[
'PHP_SELF'],
'c.multicurrency_code',
'', $param,
'', $sortfield, $sortorder);
1920 $totalarray[
'nbfield']++;
1922if (!empty($arrayfields[
'c.multicurrency_tx'][
'checked'])) {
1923 print_liste_field_titre($arrayfields[
'c.multicurrency_tx'][
'label'], $_SERVER[
'PHP_SELF'],
'c.multicurrency_tx',
'', $param,
'', $sortfield, $sortorder);
1924 $totalarray[
'nbfield']++;
1926if (!empty($arrayfields[
'c.multicurrency_total_ht'][
'checked'])) {
1927 print_liste_field_titre($arrayfields[
'c.multicurrency_total_ht'][
'label'], $_SERVER[
'PHP_SELF'],
'c.multicurrency_total_ht',
'', $param,
'class="right"', $sortfield, $sortorder);
1928 $totalarray[
'nbfield']++;
1930if (!empty($arrayfields[
'c.multicurrency_total_vat'][
'checked'])) {
1931 print_liste_field_titre($arrayfields[
'c.multicurrency_total_vat'][
'label'], $_SERVER[
'PHP_SELF'],
'c.multicurrency_total_tva',
'', $param,
'class="right"', $sortfield, $sortorder);
1932 $totalarray[
'nbfield']++;
1934if (!empty($arrayfields[
'c.multicurrency_total_ttc'][
'checked'])) {
1935 print_liste_field_titre($arrayfields[
'c.multicurrency_total_ttc'][
'label'], $_SERVER[
'PHP_SELF'],
'c.multicurrency_total_ttc',
'', $param,
'class="right"', $sortfield, $sortorder);
1936 $totalarray[
'nbfield']++;
1938if (!empty($arrayfields[
'u.login'][
'checked'])) {
1939 print_liste_field_titre($arrayfields[
'u.login'][
'label'], $_SERVER[
"PHP_SELF"],
'u.login',
'', $param,
'', $sortfield, $sortorder);
1940 $totalarray[
'nbfield']++;
1942if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
1943 print_liste_field_titre($arrayfields[
'sale_representative'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"",
"$param",
'', $sortfield, $sortorder);
1944 $totalarray[
'nbfield']++;
1946if (!empty($arrayfields[
'total_pa'][
'checked'])) {
1947 print_liste_field_titre($arrayfields[
'total_pa'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1948 $totalarray[
'nbfield']++;
1950if (!empty($arrayfields[
'total_margin'][
'checked'])) {
1951 print_liste_field_titre($arrayfields[
'total_margin'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1952 $totalarray[
'nbfield']++;
1954if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
1955 print_liste_field_titre($arrayfields[
'total_margin_rate'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1956 $totalarray[
'nbfield']++;
1958if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
1959 print_liste_field_titre($arrayfields[
'total_mark_rate'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1960 $totalarray[
'nbfield']++;
1964include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1967$parameters = array(
'arrayfields'=>$arrayfields,
'param'=>$param,
'sortfield'=>$sortfield,
'sortorder'=>$sortorder,
'totalarray'=>&$totalarray);
1968$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
1969print $hookmanager->resPrint;
1970if (!empty($arrayfields[
'c.datec'][
'checked'])) {
1971 print_liste_field_titre($arrayfields[
'c.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"c.date_creation",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1972 $totalarray[
'nbfield']++;
1974if (!empty($arrayfields[
'c.tms'][
'checked'])) {
1975 print_liste_field_titre($arrayfields[
'c.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"c.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1976 $totalarray[
'nbfield']++;
1978if (!empty($arrayfields[
'c.date_cloture'][
'checked'])) {
1979 print_liste_field_titre($arrayfields[
'c.date_cloture'][
'label'], $_SERVER[
"PHP_SELF"],
"c.date_cloture",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1980 $totalarray[
'nbfield']++;
1982if (!empty($arrayfields[
'c.note_public'][
'checked'])) {
1983 print_liste_field_titre($arrayfields[
'c.note_public'][
'label'], $_SERVER[
"PHP_SELF"],
"c.note_public",
"", $param,
'', $sortfield, $sortorder,
'right ');
1984 $totalarray[
'nbfield']++;
1986if (!empty($arrayfields[
'c.note_private'][
'checked'])) {
1987 print_liste_field_titre($arrayfields[
'c.note_private'][
'label'], $_SERVER[
"PHP_SELF"],
"c.note_private",
"", $param,
'', $sortfield, $sortorder,
'right ');
1988 $totalarray[
'nbfield']++;
1990if (!empty($arrayfields[
'shippable'][
'checked'])) {
1991 print_liste_field_titre($arrayfields[
'shippable'][
'label'], $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'center ');
1992 $totalarray[
'nbfield']++;
1994if (!empty($arrayfields[
'c.facture'][
'checked'])) {
1995 print_liste_field_titre($arrayfields[
'c.facture'][
'label'], $_SERVER[
"PHP_SELF"],
'c.facture',
'', $param,
'', $sortfield, $sortorder,
'center ');
1996 $totalarray[
'nbfield']++;
1998if (!empty($arrayfields[
'c.import_key'][
'checked'])) {
1999 print_liste_field_titre($arrayfields[
'c.import_key'][
'label'], $_SERVER[
"PHP_SELF"],
"c.import_key",
"", $param,
'', $sortfield, $sortorder,
'center ');
2000 $totalarray[
'nbfield']++;
2002if (!empty($arrayfields[
'c.fk_statut'][
'checked'])) {
2003 print_liste_field_titre($arrayfields[
'c.fk_statut'][
'label'], $_SERVER[
"PHP_SELF"],
"c.fk_statut",
"", $param,
'', $sortfield, $sortorder,
'center ');
2004 $totalarray[
'nbfield']++;
2008 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'', $param,
'', $sortfield, $sortorder,
'maxwidthsearch center ');
2009 $totalarray[
'nbfield']++;
2015$productstat_cache = array();
2016$productstat_cachevirtual = array();
2017$getNomUrl_cache = array();
2019$generic_commande =
new Commande($db);
2020$generic_product =
new Product($db);
2021$userstatic =
new User($db);
2023$with_margin_info =
false;
2024if (isModEnabled(
'margin') && (
2025 !empty($arrayfields[
'total_pa'][
'checked'])
2026 || !empty($arrayfields[
'total_margin'][
'checked'])
2027 || !empty($arrayfields[
'total_margin_rate'][
'checked'])
2028 || !empty($arrayfields[
'total_mark_rate'][
'checked'])
2031 $with_margin_info =
true;
2040 $savnbfield = $totalarray[
'nbfield'];
2041 $totalarray = array();
2042 $totalarray[
'nbfield'] = 0;
2043 $imaxinloop = ($limit ? min($num, $limit) : $num);
2044while ($i < $imaxinloop) {
2045 $obj = $db->fetch_object($resql);
2056 $companystatic->id = $obj->socid;
2057 $companystatic->name = $obj->name;
2058 $companystatic->name_alias = $obj->alias;
2059 $companystatic->client = $obj->client;
2060 $companystatic->fournisseur = $obj->fournisseur;
2061 $companystatic->code_client = $obj->code_client;
2062 $companystatic->email = $obj->email;
2063 $companystatic->phone = $obj->phone;
2064 $companystatic->address = $obj->address;
2065 $companystatic->zip = $obj->zip;
2066 $companystatic->town = $obj->town;
2067 $companystatic->country_code = $obj->country_code;
2068 if (!isset($getNomUrl_cache[$obj->socid])) {
2069 $getNomUrl_cache[$obj->socid] = $companystatic->getNomUrl(1,
'customer', 100, 0, 1, empty($arrayfields[
's.name_alias'][
'checked']) ? 0 : 1);
2072 $generic_commande->id = $obj->rowid;
2073 $generic_commande->ref = $obj->ref;
2074 $generic_commande->statut = $obj->fk_statut;
2075 $generic_commande->billed = $obj->billed;
2076 $generic_commande->date = $db->jdate($obj->date_commande);
2077 $generic_commande->delivery_date = $db->jdate($obj->date_delivery);
2078 $generic_commande->ref_client = $obj->ref_client;
2079 $generic_commande->total_ht = $obj->total_ht;
2080 $generic_commande->total_tva = $obj->total_tva;
2081 $generic_commande->total_ttc = $obj->total_ttc;
2082 $generic_commande->note_public = $obj->note_public;
2083 $generic_commande->note_private = $obj->note_private;
2085 $generic_commande->thirdparty = $companystatic;
2088 $projectstatic->id = $obj->project_id;
2089 $projectstatic->ref = $obj->project_ref;
2090 $projectstatic->title = $obj->project_label;
2092 $marginInfo = array();
2093 if ($with_margin_info ===
true) {
2094 $generic_commande->fetch_lines();
2095 $marginInfo = $formmargin->getMarginInfosArray($generic_commande);
2096 $total_ht += $obj->total_ht;
2097 $total_margin += $marginInfo[
'total_margin'];
2100 if ($mode ==
'kanban') {
2102 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
2103 print
'<div class="box-flex-container kanban">';
2108 if ($massactionbutton || $massaction) {
2110 if (in_array($object->id, $arrayofselected)) {
2114 print $generic_commande->getKanbanView(
'', array(
'selected' => $selected));
2115 if ($i == ($imaxinloop - 1)) {
2122 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
2126 print
'<td class="nowrap center">';
2127 if ($massactionbutton || $massaction) {
2129 if (in_array($obj->rowid, $arrayofselected)) {
2132 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
2136 $totalarray[
'nbfield']++;
2141 if (!empty($arrayfields[
'c.ref'][
'checked'])) {
2142 print
'<td class="nowraponall">';
2143 print $generic_commande->getNomUrl(1, ($search_status != 2 ? 0 : $obj->fk_statut), 0, 0, 0, 1, 1);
2146 $filedir = $conf->commande->multidir_output[$conf->entity].
'/'.
dol_sanitizeFileName($obj->ref);
2147 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid;
2148 print $formfile->getDocumentsLink($generic_commande->element, $filename, $filedir);
2152 $totalarray[
'nbfield']++;
2157 if (!empty($arrayfields[
'c.ref_client'][
'checked'])) {
2158 print
'<td class="nowrap tdoverflowmax150" title="'.dol_escape_htmltag($obj->ref_client).
'">';
2162 $totalarray[
'nbfield']++;
2167 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
2168 print
'<td class="nowrap">';
2169 if ($obj->project_id > 0) {
2170 print $projectstatic->getNomUrl(1);
2174 $totalarray[
'nbfield']++;
2179 if (!empty($arrayfields[
'p.title'][
'checked'])) {
2180 print
'<td class="nowrap">';
2181 if ($obj->project_id > 0) {
2182 print $projectstatic->title;
2186 $totalarray[
'nbfield']++;
2191 if (!empty($arrayfields[
's.nom'][
'checked'])) {
2192 print
'<td class="tdoverflowmax150">';
2194 print $companystatic->getNomUrl(1,
'customer', 100, 0, 1, empty($arrayfields[
's.name_alias'][
'checked']) ? 0 : 1);
2196 print $getNomUrl_cache[$obj->socid];
2201 if ($user->hasRight(
'facture',
'creer')) {
2202 if (($obj->fk_statut > 0 && $obj->fk_statut < 3) || ($obj->fk_statut == 3 && $obj->billed == 0)) {
2203 print
' <a href="'.DOL_URL_ROOT.
'/commande/list.php?socid='.$companystatic->id.
'&search_billed=0&autoselectall=1">';
2204 print
img_picto($langs->trans(
"CreateInvoiceForThisCustomer").
' : '.$companystatic->name,
'object_bill',
'hideonsmartphone').
'</a>';
2210 $totalarray[
'nbfield']++;
2215 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
2216 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->alias).
'">';
2220 $totalarray[
'nbfield']++;
2225 if (!empty($arrayfields[
's2.nom'][
'checked'])) {
2226 print
'<td class="tdoverflowmax200">';
2227 if ($obj->fk_parent > 0) {
2228 if (!isset($company_url_list[$obj->fk_parent])) {
2229 $companyparent =
new Societe($db);
2230 $res = $companyparent->fetch($obj->fk_parent);
2232 $company_url_list[$obj->fk_parent] = $companyparent->getNomUrl(1);
2235 if (isset($company_url_list[$obj->fk_parent])) {
2236 print $company_url_list[$obj->fk_parent];
2241 $totalarray[
'nbfield']++;
2246 if (!empty($arrayfields[
's.town'][
'checked'])) {
2247 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->town).
'">';
2251 $totalarray[
'nbfield']++;
2256 if (!empty($arrayfields[
's.zip'][
'checked'])) {
2257 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->zip).
'">';
2261 $totalarray[
'nbfield']++;
2266 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
2267 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->state_name).
'">'.
dol_escape_htmltag($obj->state_name).
"</td>\n";
2269 $totalarray[
'nbfield']++;
2274 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
2275 print
'<td class="center">';
2276 $tmparray =
getCountry($obj->fk_pays,
'all');
2277 print $tmparray[
'label'];
2280 $totalarray[
'nbfield']++;
2285 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
2286 print
'<td class="center">';
2287 if (empty($typenArray)) {
2288 $typenArray = $formcompany->typent_array(1);
2290 print $typenArray[$obj->typent_code]??
'';
2293 $totalarray[
'nbfield']++;
2298 if (!empty($arrayfields[
'c.date_commande'][
'checked'])) {
2299 print
'<td class="center nowraponall">';
2302 if ($generic_commande->hasDelay()) {
2303 print
img_picto($langs->trans(
"Late").
' : '.$generic_commande->showDelay(),
"warning");
2307 $totalarray[
'nbfield']++;
2312 if (!empty($arrayfields[
'c.date_delivery'][
'checked'])) {
2313 print
'<td class="center nowraponall">';
2314 print
dol_print_date($db->jdate($obj->date_delivery),
'dayhour');
2317 $totalarray[
'nbfield']++;
2322 if (!empty($arrayfields[
'c.fk_shipping_method'][
'checked'])) {
2324 $form->formSelectShippingMethod(
'', $obj->fk_shipping_method,
'none', 1);
2327 $totalarray[
'nbfield']++;
2332 if (!empty($arrayfields[
'c.fk_cond_reglement'][
'checked'])) {
2334 $form->form_conditions_reglement($_SERVER[
'PHP_SELF'], $obj->fk_cond_reglement,
'none', 0,
'', 1, $obj->deposit_percent);
2337 $totalarray[
'nbfield']++;
2342 if (!empty($arrayfields[
'c.fk_mode_reglement'][
'checked'])) {
2344 $form->form_modes_reglement($_SERVER[
'PHP_SELF'], $obj->fk_mode_reglement,
'none',
'', -1);
2347 $totalarray[
'nbfield']++;
2352 if (!empty($arrayfields[
'c.fk_input_reason'][
'checked'])) {
2354 $form->formInputReason($_SERVER[
'PHP_SELF'], $obj->fk_input_reason,
'none',
'');
2357 $totalarray[
'nbfield']++;
2362 if (!empty($arrayfields[
'c.total_ht'][
'checked'])) {
2363 print
'<td class="nowrap right"><span class="amount">'.price($obj->total_ht).
"</span></td>\n";
2365 $totalarray[
'nbfield']++;
2368 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'c.total_ht';
2370 if (isset($totalarray[
'val'][
'c.total_ht'])) {
2371 $totalarray[
'val'][
'c.total_ht'] += $obj->total_ht;
2373 $totalarray[
'val'][
'c.total_ht'] = $obj->total_ht;
2378 if (!empty($arrayfields[
'c.total_vat'][
'checked'])) {
2379 print
'<td class="nowrap right"><span class="amount">'.price($obj->total_tva).
"</span></td>\n";
2381 $totalarray[
'nbfield']++;
2384 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'c.total_tva';
2386 if (isset($totalarray[
'val'][
'c.total_tva'])) {
2387 $totalarray[
'val'][
'c.total_tva'] += $obj->total_tva;
2389 $totalarray[
'val'][
'c.total_tva'] = $obj->total_tva;
2394 if (!empty($arrayfields[
'c.total_ttc'][
'checked'])) {
2395 print
'<td class="nowrap right"><span class="amount">'.price($obj->total_ttc).
"</span></td>\n";
2397 $totalarray[
'nbfield']++;
2400 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'c.total_ttc';
2402 if (isset($totalarray[
'val'][
'c.total_ttc'])) {
2403 $totalarray[
'val'][
'c.total_ttc'] += $obj->total_ttc;
2405 $totalarray[
'val'][
'c.total_ttc'] = $obj->total_ttc;
2410 if (!empty($arrayfields[
'c.multicurrency_code'][
'checked'])) {
2411 print
'<td class="nowrap">'.$obj->multicurrency_code.
' - '.$langs->trans(
'Currency'.$obj->multicurrency_code).
"</td>\n";
2413 $totalarray[
'nbfield']++;
2418 if (!empty($arrayfields[
'c.multicurrency_tx'][
'checked'])) {
2419 print
'<td class="nowrap">';
2420 $form->form_multicurrency_rate($_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid, $obj->multicurrency_tx,
'none', $obj->multicurrency_code);
2423 $totalarray[
'nbfield']++;
2428 if (!empty($arrayfields[
'c.multicurrency_total_ht'][
'checked'])) {
2429 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ht).
"</span></td>\n";
2431 $totalarray[
'nbfield']++;
2435 if (!empty($arrayfields[
'c.multicurrency_total_vat'][
'checked'])) {
2436 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_vat).
"</span></td>\n";
2438 $totalarray[
'nbfield']++;
2442 if (!empty($arrayfields[
'c.multicurrency_total_ttc'][
'checked'])) {
2443 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ttc).
"</span></td>\n";
2445 $totalarray[
'nbfield']++;
2449 $userstatic->id = $obj->fk_user_author;
2450 $userstatic->login = $obj->login;
2451 $userstatic->lastname = $obj->lastname;
2452 $userstatic->firstname = $obj->firstname;
2453 $userstatic->email = $obj->user_email;
2454 $userstatic->statut = $obj->user_statut;
2455 $userstatic->entity = $obj->entity;
2456 $userstatic->photo = $obj->photo;
2457 $userstatic->office_phone = $obj->office_phone;
2458 $userstatic->office_fax = $obj->office_fax;
2459 $userstatic->user_mobile = $obj->user_mobile;
2460 $userstatic->job = $obj->job;
2461 $userstatic->gender = $obj->gender;
2464 if (!empty($arrayfields[
'u.login'][
'checked'])) {
2465 print
'<td class="tdoverflowmax150">';
2466 if ($userstatic->id) {
2467 print $userstatic->getNomUrl(-1);
2473 $totalarray[
'nbfield']++;
2478 if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
2480 if ($obj->socid > 0) {
2481 $listsalesrepresentatives = $companystatic->getSalesRepresentatives($user);
2482 if ($listsalesrepresentatives < 0) {
2485 $nbofsalesrepresentative = count($listsalesrepresentatives);
2486 if ($nbofsalesrepresentative > 6) {
2488 print $nbofsalesrepresentative;
2489 } elseif ($nbofsalesrepresentative > 0) {
2491 foreach ($listsalesrepresentatives as $val) {
2492 $userstatic->id = $val[
'id'];
2493 $userstatic->lastname = $val[
'lastname'];
2494 $userstatic->firstname = $val[
'firstname'];
2495 $userstatic->email = $val[
'email'];
2496 $userstatic->statut = $val[
'statut'];
2497 $userstatic->entity = $val[
'entity'];
2498 $userstatic->photo = $val[
'photo'];
2499 $userstatic->login = $val[
'login'];
2500 $userstatic->office_phone = $val[
'office_phone'];
2501 $userstatic->office_fax = $val[
'office_fax'];
2502 $userstatic->user_mobile = $val[
'user_mobile'];
2503 $userstatic->job = $val[
'job'];
2504 $userstatic->gender = $val[
'gender'];
2506 print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1,
'', 0, 0, 12) : $userstatic->getNomUrl(-2);
2508 if ($j < $nbofsalesrepresentative) {
2520 $totalarray[
'nbfield']++;
2525 if (!empty($arrayfields[
'total_pa'][
'checked'])) {
2526 print
'<td class="right nowrap">'.price($marginInfo[
'pa_total']).
'</td>';
2528 $totalarray[
'nbfield']++;
2533 if (!empty($arrayfields[
'total_margin'][
'checked'])) {
2534 print
'<td class="right nowrap">'.price($marginInfo[
'total_margin']).
'</td>';
2536 $totalarray[
'nbfield']++;
2539 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'total_margin';
2542 if (!isset($totalarray[
'val'][
'total_margin'])) {
2543 $totalarray[
'val'][
'total_margin'] = 0;
2546 $totalarray[
'val'][
'total_margin'] += $marginInfo[
'total_margin'];
2550 if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
2551 print
'<td class="right nowrap">'.(($marginInfo[
'total_margin_rate'] ==
'') ?
'' :
price($marginInfo[
'total_margin_rate'], null, null, null, null, 2).
'%').
'</td>';
2553 $totalarray[
'nbfield']++;
2558 if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
2559 print
'<td class="right nowrap">'.(($marginInfo[
'total_mark_rate'] ==
'') ?
'' :
price($marginInfo[
'total_mark_rate'], null, null, null, null, 2).
'%').
'</td>';
2561 $totalarray[
'nbfield']++;
2564 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'total_mark_rate';
2566 if ($i >= $imaxinloop - 1) {
2567 if (!empty($total_ht)) {
2568 $totalarray[
'val'][
'total_mark_rate'] =
price2num($total_margin * 100 / $total_ht,
'MT');
2570 $totalarray[
'val'][
'total_mark_rate'] =
'';
2576 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
2578 $parameters = array(
'arrayfields'=>$arrayfields,
'obj'=>$obj,
'i'=>$i,
'totalarray'=>&$totalarray);
2579 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
2580 print $hookmanager->resPrint;
2583 if (!empty($arrayfields[
'c.datec'][
'checked'])) {
2584 print
'<td align="center" class="nowrap">';
2585 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuser');
2588 $totalarray[
'nbfield']++;
2593 if (!empty($arrayfields[
'c.tms'][
'checked'])) {
2594 print
'<td align="center" class="nowrap">';
2595 print
dol_print_date($db->jdate($obj->date_update),
'dayhour',
'tzuser');
2598 $totalarray[
'nbfield']++;
2603 if (!empty($arrayfields[
'c.date_cloture'][
'checked'])) {
2604 print
'<td align="center" class="nowrap">';
2605 print
dol_print_date($db->jdate($obj->date_cloture),
'dayhour',
'tzuser');
2608 $totalarray[
'nbfield']++;
2613 if (!empty($arrayfields[
'c.note_public'][
'checked'])) {
2614 print
'<td class="center">';
2618 $totalarray[
'nbfield']++;
2623 if (!empty($arrayfields[
'c.note_private'][
'checked'])) {
2624 print
'<td class="center">';
2628 $totalarray[
'nbfield']++;
2633 if (!empty($arrayfields[
'shippable'][
'checked'])) {
2634 print
'<td class="center">';
2635 if (!empty($show_shippable_command) && isModEnabled(
'stock')) {
2636 if (($obj->fk_statut > $generic_commande::STATUS_DRAFT) && ($obj->fk_statut < $generic_commande::STATUS_CLOSED)) {
2637 $generic_commande->getLinesArray();
2638 $generic_commande->loadExpeditions();
2640 $numlines = count($generic_commande->lines);
2641 for ($lig = 0; $lig < $numlines; $lig++) {
2642 if (isset($generic_commande->expeditions[$generic_commande->lines[$lig]->id])) {
2643 $reliquat = $generic_commande->lines[$lig]->qty - $generic_commande->expeditions[$generic_commande->lines[$lig]->id];
2645 $reliquat = $generic_commande->lines[$lig]->qty;
2647 if ($generic_commande->lines[$lig]->product_type == 0 && $generic_commande->lines[$lig]->fk_product > 0) {
2649 $generic_product->id = $generic_commande->lines[$lig]->fk_product;
2652 if (empty($productstat_cache[$generic_commande->lines[$lig]->fk_product])) {
2653 $generic_product->load_stock(
'nobatch,warehouseopen');
2654 $productstat_cache[$generic_commande->lines[$lig]->fk_product][
'stock_reel'] = $generic_product->stock_reel;
2655 $productstat_cachevirtual[$generic_commande->lines[$lig]->fk_product][
'stock_reel'] = $generic_product->stock_theorique;
2657 $generic_product->stock_reel = $productstat_cache[$generic_commande->lines[$lig]->fk_product][
'stock_reel'];
2658 $generic_product->stock_theorique = $productstat_cachevirtual[$generic_commande->lines[$lig]->fk_product][
'stock_reel'];
2661 if ($reliquat > $generic_product->stock_reel) {
2665 $text_info .= $reliquat.
' x '.$generic_commande->lines[$lig]->product_ref.
' '.
dol_trunc($generic_commande->lines[$lig]->product_label, 20);
2666 $text_info .=
' - '.$langs->trans(
"Stock").
': <span class="'.($generic_product->stock_reel > 0 ?
'ok' :
'error').
'">'.$generic_product->stock_reel.
'</span>';
2667 $text_info .=
' - '.$langs->trans(
"VirtualStock").
': <span class="'.($generic_product->stock_theorique > 0 ?
'ok' :
'error').
'">'.$generic_product->stock_theorique.
'</span>';
2668 $text_info .= ($reliquat != $generic_commande->lines[$lig]->qty ?
' <span class="opacitymedium">('.$langs->trans(
"QtyInOtherShipments").
' '.($generic_commande->lines[$lig]->qty - $reliquat).
')</span>' :
'');
2669 $text_info .=
'<br>';
2676 $stock_order_supplier = 0;
2678 if (isModEnabled(
'commande')) {
2679 if (empty($productstat_cache[$generic_commande->lines[$lig]->fk_product][
'stats_order_customer'])) {
2680 $generic_product->load_stats_commande(0,
'1,2');
2681 $productstat_cache[$generic_commande->lines[$lig]->fk_product][
'stats_order_customer'] = $generic_product->stats_commande[
'qty'];
2683 $generic_product->stats_commande[
'qty'] = $productstat_cache[$generic_commande->lines[$lig]->fk_product][
'stats_order_customer'];
2685 $stock_order = $generic_product->stats_commande[
'qty'];
2687 if (isModEnabled(
"supplier_order")) {
2688 if (empty($productstat_cache[$generic_commande->lines[$lig]->fk_product][
'stats_order_supplier'])) {
2689 $generic_product->load_stats_commande_fournisseur(0,
'3');
2690 $productstat_cache[$generic_commande->lines[$lig]->fk_product][
'stats_order_supplier'] = $generic_product->stats_commande_fournisseur[
'qty'];
2692 $generic_product->stats_commande_fournisseur[
'qty'] = $productstat_cache[$generic_commande->lines[$lig]->fk_product][
'stats_order_supplier'];
2694 $stock_order_supplier = $generic_product->stats_commande_fournisseur[
'qty'];
2697 $text_info .= $reliquat.
' x '.$generic_commande->lines[$lig]->ref.
' '.
dol_trunc($generic_commande->lines[$lig]->product_label, 20);
2698 $text_stock_reel = $generic_product->stock_reel.
'/'.$stock_order;
2699 if ($stock_order > $generic_product->stock_reel && !($generic_product->stock_reel < $generic_commande->lines[$lig]->qty)) {
2701 $text_warning .=
'<span class="warning">'.$langs->trans(
'Available').
' : '.$text_stock_reel.
'</span>';
2703 if ($reliquat > $generic_product->stock_reel) {
2704 $text_info .=
'<span class="warning">'.$langs->trans(
'Available').
' : '.$text_stock_reel.
'</span>';
2706 $text_info .=
'<span class="ok">'.$langs->trans(
'Available').
' : '.$text_stock_reel.
'</span>';
2708 if (isModEnabled(
"supplier_order")) {
2709 $text_info .=
' '.$langs->trans(
'SupplierOrder').
' : '.$stock_order_supplier;
2711 $text_info .= ($reliquat != $generic_commande->lines[$lig]->qty ?
' <span class="opacitymedium">('.$langs->trans(
"QtyInOtherShipments").
' '.($generic_commande->lines[$lig]->qty - $reliquat).
')</span>' :
'');
2712 $text_info .=
'<br>';
2716 if ($notshippable == 0) {
2717 $text_icon =
img_picto(
'',
'dolly',
'',
false, 0, 0,
'',
'green paddingleft');
2718 $text_info = $text_icon.
' '.$langs->trans(
'Shippable').
'<br>'.$text_info;
2720 $text_icon =
img_picto(
'',
'dolly',
'',
false, 0, 0,
'',
'error paddingleft');
2721 $text_info = $text_icon.
' '.$langs->trans(
'NonShippable').
'<br>'.$text_info;
2726 print $form->textwithtooltip(
'', $text_info, 2, 1, $text_icon,
'', 2);
2729 print $form->textwithtooltip(
'', $langs->trans(
'NotEnoughForAllOrders').
'<br>'.$text_warning, 2, 1,
img_picto(
'',
'error'),
'', 2);
2734 $totalarray[
'nbfield']++;
2739 if (!empty($arrayfields[
'c.facture'][
'checked'])) {
2740 print
'<td class="center">'.yn($obj->billed).
'</td>';
2742 $totalarray[
'nbfield']++;
2747 if (!empty($arrayfields[
'c.import_key'][
'checked'])) {
2748 print
'<td class="nowrap center">'.dol_escape_htmltag($obj->import_key).
'</td>';
2750 $totalarray[
'nbfield']++;
2755 if (!empty($arrayfields[
'c.fk_statut'][
'checked'])) {
2756 print
'<td class="nowrap center">'.$generic_commande->LibStatut($obj->fk_statut, $obj->billed, 5, 1).
'</td>';
2758 $totalarray[
'nbfield']++;
2764 print
'<td class="nowrap center">';
2765 if ($massactionbutton || $massaction) {
2767 if (in_array($obj->rowid, $arrayofselected)) {
2770 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
2774 $totalarray[
'nbfield']++;
2780 $total += $obj->total_ht;
2781 $subtotal += $obj->total_ht;
2787 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
2792 foreach ($arrayfields as $key => $val) {
2793 if (!empty($val[
'checked'])) {
2797 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
2802 $parameters = array(
'arrayfields'=>$arrayfields,
'sql'=>$sql);
2803 $reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
2804 print $hookmanager->resPrint;
2806 print
'</table>'.
"\n";
2807 print
'</div>'.
"\n";
2809 print
'</form>'.
"\n";
2811if (in_array(
'builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
2812 $hidegeneratedfilelistifempty = 1;
2813 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
2814 $hidegeneratedfilelistifempty = 0;
2818 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
2819 $urlsource .= str_replace(
'&',
'&', $param);
2821 $filedir = $diroutputmassaction;
2822 $genallowed = $permissiontoread;
2823 $delallowed = $permissiontoadd;
2825 print $formfile->showdocuments(
'massfilesarea_orders',
'', $filedir, $urlsource, 0, $delallowed,
'', 1, 1, 0, 48, 1, $param, $title,
'',
'',
'',
null, $hidegeneratedfilelistifempty);
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage customers orders.
const STATUS_SHIPMENTONPROCESS
Shipment on process.
const STATUS_CLOSED
Closed (Sent, billed or not)
const STATUS_CANCELED
Canceled status.
const STATUS_DRAFT
Draft status.
const STATUS_VALIDATED
Validated status.
Class to manage absolute discounts.
Class to manage invoices.
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=0, $outputlangs='', $entconv=1, $searchlabel='')
Return country label, code or id from an id, code or label.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed informations (by default a local PHP server timestamp) Re...
dol_string_nohtmltag($stringtoclean, $removelinefeed=1, $pagecodeto='UTF-8', $strip_tags=0, $removedoublespaces=1)
Clean a string from all HTML tags and entities.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
natural_search($fields, $value, $mode=0, $nofirstand=0)
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by second index function, which produces ascending (default) or descending output...
print_liste_field_titre($name, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
dol_concatdesc($text1, $text2, $forxml=false, $invert=false)
Concat 2 descriptions with a new line between them (second operand after first one with appropriate n...
dolGetButtonTitleSeparator($moreClass="")
Add space between dolGetButtonTitle.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
print_barre_liste($titre, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $hideselectlimit=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
dol_trunc($string, $size=40, $trunc='right', $stringencoding='UTF-8', $nodot=0, $display=0)
Truncate a string to a particular length adding '…' if string larger than length.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
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.