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;
1513$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
1514$selectedfields = ($mode !=
'kanban' ? $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
getDolGlobalString(
'MAIN_CHECKBOX_LEFT_COLUMN',
'')) :
'');
1515$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
1517if (
GETPOST(
'autoselectall',
'int')) {
1518 $selectedfields .=
'<script>';
1519 $selectedfields .=
' $(document).ready(function() {';
1520 $selectedfields .=
' console.log("Autoclick on checkforselects");';
1521 $selectedfields .=
' $("#checkforselects").click();';
1522 $selectedfields .=
' $("#massaction").val("createbills").change();';
1523 $selectedfields .=
' });';
1524 $selectedfields .=
'</script>';
1527print
'<div class="div-table-responsive">';
1528print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
1532print
'<tr class="liste_titre_filter">';
1535 print
'<td class="liste_titre center maxwidthsearch">';
1536 $searchpicto = $form->showFilterButtons(
'left');
1542if (!empty($arrayfields[
'c.ref'][
'checked'])) {
1543 print
'<td class="liste_titre">';
1544 print
'<input class="flat" size="6" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
1548if (!empty($arrayfields[
'c.ref_client'][
'checked'])) {
1549 print
'<td class="liste_titre" align="left">';
1550 print
'<input class="flat" type="text" size="6" name="search_ref_customer" value="'.dol_escape_htmltag($search_ref_customer).
'">';
1554if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1555 print
'<td class="liste_titre"><input type="text" class="flat" size="6" name="search_project_ref" value="'.dol_escape_htmltag($search_project_ref).
'"></td>';
1558if (!empty($arrayfields[
'p.title'][
'checked'])) {
1559 print
'<td class="liste_titre"><input type="text" class="flat" size="6" name="search_project" value="'.dol_escape_htmltag($search_project).
'"></td>';
1562if (!empty($arrayfields[
's.nom'][
'checked'])) {
1563 print
'<td class="liste_titre" align="left">';
1564 print
'<input class="flat maxwidth100" type="text" name="search_company" value="'.dol_escape_htmltag($search_company).
'">';
1568if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1569 print
'<td class="liste_titre" align="left">';
1570 print
'<input class="flat maxwidth100" type="text" name="search_company_alias" value="'.dol_escape_htmltag($search_company_alias).
'">';
1574if (!empty($arrayfields[
's2.nom'][
'checked'])) {
1575 print
'<td class="liste_titre">';
1576 print
'<input class="flat maxwidth100" type="text" name="search_parent_name" value="'.dol_escape_htmltag($search_parent_name).
'">';
1580if (!empty($arrayfields[
's.town'][
'checked'])) {
1581 print
'<td class="liste_titre"><input class="flat width50" type="text" name="search_town" value="'.dol_escape_htmltag($search_town).
'"></td>';
1584if (!empty($arrayfields[
's.zip'][
'checked'])) {
1585 print
'<td class="liste_titre"><input class="flat width50" type="text" name="search_zip" value="'.dol_escape_htmltag($search_zip).
'"></td>';
1588if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1589 print
'<td class="liste_titre">';
1590 print
'<input class="flat width50" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).
'">';
1594if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1595 print
'<td class="liste_titre" align="center">';
1596 print $form->select_country($search_country,
'search_country',
'', 0,
'minwidth100imp maxwidth100');
1600if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1601 print
'<td class="liste_titre maxwidthonsmartphone" align="center">';
1602 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);
1606if (!empty($arrayfields[
'c.date_commande'][
'checked'])) {
1607 print
'<td class="liste_titre center">';
1608 print
'<div class="nowrapfordate">';
1609 print $form->selectDate($search_dateorder_start ? $search_dateorder_start : -1,
'search_dateorder_start_', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1611 print
'<div class="nowrapfordate">';
1612 print $form->selectDate($search_dateorder_end ? $search_dateorder_end : -1,
'search_dateorder_end_', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1616if (!empty($arrayfields[
'c.date_delivery'][
'checked'])) {
1617 print
'<td class="liste_titre center">';
1618 print
'<div class="nowrapfordate">';
1619 print $form->selectDate($search_datedelivery_start ? $search_datedelivery_start : -1,
'search_datedelivery_start_', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1621 print
'<div class="nowrapfordate">';
1622 print $form->selectDate($search_datedelivery_end ? $search_datedelivery_end : -1,
'search_datedelivery_end_', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1627if (!empty($arrayfields[
'c.fk_shipping_method'][
'checked'])) {
1628 print
'<td class="liste_titre">';
1629 $form->selectShippingMethod($search_fk_shipping_method,
'search_fk_shipping_method',
'', 1,
'', 1);
1633if (!empty($arrayfields[
'c.fk_cond_reglement'][
'checked'])) {
1634 print
'<td class="liste_titre">';
1635 print $form->getSelectConditionsPaiements($search_fk_cond_reglement,
'search_fk_cond_reglement', 1, 1, 1);
1639if (!empty($arrayfields[
'c.fk_mode_reglement'][
'checked'])) {
1640 print
'<td class="liste_titre">';
1641 print $form->select_types_paiements($search_fk_mode_reglement,
'search_fk_mode_reglement',
'', 0, 1, 1, 0, -1,
'', 1);
1645if (!empty($arrayfields[
'c.fk_input_reason'][
'checked'])) {
1646 print
'<td class="liste_titre">';
1647 $form->selectInputReason($search_fk_input_reason,
'search_fk_input_reason',
'', 1,
'', 1);
1651if (!empty($arrayfields[
'c.total_ht'][
'checked'])) {
1652 print
'<td class="liste_titre right">';
1653 print
'<input class="flat" type="text" size="4" name="search_total_ht" value="'.dol_escape_htmltag($search_total_ht).
'">';
1657if (!empty($arrayfields[
'c.total_vat'][
'checked'])) {
1658 print
'<td class="liste_titre right">';
1659 print
'<input class="flat" type="text" size="4" name="search_total_vat" value="'.dol_escape_htmltag($search_total_vat).
'">';
1663if (!empty($arrayfields[
'c.total_ttc'][
'checked'])) {
1664 print
'<td class="liste_titre right">';
1665 print
'<input class="flat" type="text" size="5" name="search_total_ttc" value="'.$search_total_ttc.
'">';
1669if (!empty($arrayfields[
'c.multicurrency_code'][
'checked'])) {
1670 print
'<td class="liste_titre">';
1671 print $form->selectMultiCurrency($search_multicurrency_code,
'search_multicurrency_code', 1);
1675if (!empty($arrayfields[
'c.multicurrency_tx'][
'checked'])) {
1676 print
'<td class="liste_titre">';
1677 print
'<input class="flat" type="text" size="4" name="search_multicurrency_tx" value="'.dol_escape_htmltag($search_multicurrency_tx).
'">';
1681if (!empty($arrayfields[
'c.multicurrency_total_ht'][
'checked'])) {
1682 print
'<td class="liste_titre right">';
1683 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ht" value="'.dol_escape_htmltag($search_multicurrency_montant_ht).
'">';
1687if (!empty($arrayfields[
'c.multicurrency_total_vat'][
'checked'])) {
1688 print
'<td class="liste_titre right">';
1689 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_vat" value="'.dol_escape_htmltag($search_multicurrency_montant_vat).
'">';
1693if (!empty($arrayfields[
'c.multicurrency_total_ttc'][
'checked'])) {
1694 print
'<td class="liste_titre right">';
1695 print
'<input class="flat width75" type="text" name="search_multicurrency_montant_ttc" value="'.dol_escape_htmltag($search_multicurrency_montant_ttc).
'">';
1699if (!empty($arrayfields[
'u.login'][
'checked'])) {
1700 print
'<td class="liste_titre">';
1701 print
'<input class="flat width75" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).
'">';
1705if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
1706 print
'<td class="liste_titre"></td>';
1708if (!empty($arrayfields[
'total_pa'][
'checked'])) {
1709 print
'<td class="liste_titre right">';
1712if (!empty($arrayfields[
'total_margin'][
'checked'])) {
1713 print
'<td class="liste_titre right">';
1716if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
1717 print
'<td class="liste_titre right">';
1720if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
1721 print
'<td class="liste_titre right">';
1726include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
1729$parameters = array(
'arrayfields'=>$arrayfields);
1730$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
1731print $hookmanager->resPrint;
1734if (!empty($arrayfields[
'c.datec'][
'checked'])) {
1735 print
'<td class="liste_titre">';
1739if (!empty($arrayfields[
'c.tms'][
'checked'])) {
1740 print
'<td class="liste_titre">';
1744if (!empty($arrayfields[
'c.date_cloture'][
'checked'])) {
1745 print
'<td class="liste_titre center">';
1746 print
'<div class="nowrapfordate">';
1747 print $form->selectDate($search_datecloture_start ? $search_datecloture_start : -1,
'search_datecloture_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1749 print
'<div class="nowrapfordate">';
1750 print $form->selectDate($search_datecloture_end ? $search_datecloture_end : -1,
'search_datecloture_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1755if (!empty($arrayfields[
'c.note_public'][
'checked'])) {
1756 print
'<td class="liste_titre">';
1760if (!empty($arrayfields[
'c.note_private'][
'checked'])) {
1761 print
'<td class="liste_titre">';
1765if (!empty($arrayfields[
'shippable'][
'checked'])) {
1766 print
'<td class="liste_titre maxwidthonsmartphone" align="center">';
1769 print
'<input type="checkbox" name="show_shippable_command" value="1"'.($show_shippable_command ?
' checked' :
'').
'>';
1770 print $langs->trans(
'ShowShippableStatus');
1772 $show_shippable_command = 1;
1777if (!empty($arrayfields[
'c.facture'][
'checked'])) {
1778 print
'<td class="liste_titre maxwidthonsmartphone center">';
1779 print $form->selectyesno(
'search_billed', $search_billed, 1, 0, 1, 1);
1783if (!empty($arrayfields[
'c.import_key'][
'checked'])) {
1784 print
'<td class="liste_titre maxwidthonsmartphone center">';
1788if (!empty($arrayfields[
'c.fk_statut'][
'checked'])) {
1789 print
'<td class="liste_titre center parentonrightofpage">';
1790 $liststatus = array(
1794 -2 => $langs->trans(
"StatusOrderValidatedShort").
'+'.$langs->trans(
"StatusOrderSentShort"),
1795 -3 => $langs->trans(
"StatusOrderValidatedShort").
'+'.$langs->trans(
"StatusOrderSentShort").
'+'.$langs->trans(
"StatusOrderDelivered"),
1799 print $form->selectarray(
'search_status', $liststatus, $search_status, -5, 0, 0,
'', 0, 0, 0,
'',
'search_status width100 onrightofpage', 1);
1804 print
'<td class="liste_titre center maxwidthsearch">';
1805 $searchpicto = $form->showFilterButtons();
1824print
'<tr class="liste_titre">';
1828 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'', $param,
'', $sortfield, $sortorder,
'maxwidthsearch center ');
1829 $totalarray[
'nbfield']++;
1831if (!empty($arrayfields[
'c.ref'][
'checked'])) {
1832 print_liste_field_titre($arrayfields[
'c.ref'][
'label'], $_SERVER[
"PHP_SELF"],
'c.ref',
'', $param,
'', $sortfield, $sortorder);
1833 $totalarray[
'nbfield']++;
1835if (!empty($arrayfields[
'c.ref_client'][
'checked'])) {
1836 print_liste_field_titre($arrayfields[
'c.ref_client'][
'label'], $_SERVER[
"PHP_SELF"],
'c.ref_client',
'', $param,
'', $sortfield, $sortorder);
1837 $totalarray[
'nbfield']++;
1839if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1840 print_liste_field_titre($arrayfields[
'p.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"p.ref",
"", $param,
'', $sortfield, $sortorder);
1841 $totalarray[
'nbfield']++;
1843if (!empty($arrayfields[
'p.title'][
'checked'])) {
1844 print_liste_field_titre($arrayfields[
'p.title'][
'label'], $_SERVER[
"PHP_SELF"],
"p.title",
"", $param,
'', $sortfield, $sortorder);
1845 $totalarray[
'nbfield']++;
1847if (!empty($arrayfields[
's.nom'][
'checked'])) {
1848 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
"PHP_SELF"],
's.nom',
'', $param,
'', $sortfield, $sortorder);
1849 $totalarray[
'nbfield']++;
1851if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1852 print_liste_field_titre($arrayfields[
's.name_alias'][
'label'], $_SERVER[
"PHP_SELF"],
's.name_alias',
'', $param,
'', $sortfield, $sortorder);
1853 $totalarray[
'nbfield']++;
1855if (!empty($arrayfields[
's2.nom'][
'checked'])) {
1856 print_liste_field_titre($arrayfields[
's2.nom'][
'label'], $_SERVER[
'PHP_SELF'],
's2.nom',
'', $param,
'', $sortfield, $sortorder);
1857 $totalarray[
'nbfield']++;
1859if (!empty($arrayfields[
's.town'][
'checked'])) {
1860 print_liste_field_titre($arrayfields[
's.town'][
'label'], $_SERVER[
"PHP_SELF"],
's.town',
'', $param,
'', $sortfield, $sortorder);
1861 $totalarray[
'nbfield']++;
1863if (!empty($arrayfields[
's.zip'][
'checked'])) {
1864 print_liste_field_titre($arrayfields[
's.zip'][
'label'], $_SERVER[
"PHP_SELF"],
's.zip',
'', $param,
'', $sortfield, $sortorder);
1865 $totalarray[
'nbfield']++;
1867if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1868 print_liste_field_titre($arrayfields[
'state.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"state.nom",
"", $param,
'', $sortfield, $sortorder);
1869 $totalarray[
'nbfield']++;
1871if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1872 print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'], $_SERVER[
"PHP_SELF"],
"country.code_iso",
"", $param,
'', $sortfield, $sortorder,
'center ');
1873 $totalarray[
'nbfield']++;
1875if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1876 print_liste_field_titre($arrayfields[
'typent.code'][
'label'], $_SERVER[
"PHP_SELF"],
"typent.code",
"", $param,
'', $sortfield, $sortorder,
'center ');
1877 $totalarray[
'nbfield']++;
1879if (!empty($arrayfields[
'c.date_commande'][
'checked'])) {
1880 print_liste_field_titre($arrayfields[
'c.date_commande'][
'label'], $_SERVER[
"PHP_SELF"],
'c.date_commande',
'', $param,
'', $sortfield, $sortorder,
'center ');
1881 $totalarray[
'nbfield']++;
1883if (!empty($arrayfields[
'c.date_delivery'][
'checked'])) {
1884 print_liste_field_titre($arrayfields[
'c.date_delivery'][
'label'], $_SERVER[
"PHP_SELF"],
'c.date_livraison',
'', $param,
'', $sortfield, $sortorder,
'center ');
1885 $totalarray[
'nbfield']++;
1887if (!empty($arrayfields[
'c.fk_shipping_method'][
'checked'])) {
1888 print_liste_field_titre($arrayfields[
'c.fk_shipping_method'][
'label'], $_SERVER[
"PHP_SELF"],
"c.fk_shipping_method",
"", $param,
'', $sortfield, $sortorder);
1889 $totalarray[
'nbfield']++;
1891if (!empty($arrayfields[
'c.fk_cond_reglement'][
'checked'])) {
1892 print_liste_field_titre($arrayfields[
'c.fk_cond_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"c.fk_cond_reglement",
"", $param,
'', $sortfield, $sortorder);
1893 $totalarray[
'nbfield']++;
1895if (!empty($arrayfields[
'c.fk_mode_reglement'][
'checked'])) {
1896 print_liste_field_titre($arrayfields[
'c.fk_mode_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"c.fk_mode_reglement",
"", $param,
'', $sortfield, $sortorder);
1897 $totalarray[
'nbfield']++;
1899if (!empty($arrayfields[
'c.fk_input_reason'][
'checked'])) {
1900 print_liste_field_titre($arrayfields[
'c.fk_input_reason'][
'label'], $_SERVER[
"PHP_SELF"],
"c.fk_input_reason",
"", $param,
'', $sortfield, $sortorder);
1901 $totalarray[
'nbfield']++;
1903if (!empty($arrayfields[
'c.total_ht'][
'checked'])) {
1904 print_liste_field_titre($arrayfields[
'c.total_ht'][
'label'], $_SERVER[
"PHP_SELF"],
'c.total_ht',
'', $param,
'', $sortfield, $sortorder,
'right ');
1905 $totalarray[
'nbfield']++;
1907if (!empty($arrayfields[
'c.total_vat'][
'checked'])) {
1908 print_liste_field_titre($arrayfields[
'c.total_vat'][
'label'], $_SERVER[
"PHP_SELF"],
'c.total_tva',
'', $param,
'', $sortfield, $sortorder,
'right ');
1909 $totalarray[
'nbfield']++;
1911if (!empty($arrayfields[
'c.total_ttc'][
'checked'])) {
1912 print_liste_field_titre($arrayfields[
'c.total_ttc'][
'label'], $_SERVER[
"PHP_SELF"],
'c.total_ttc',
'', $param,
'', $sortfield, $sortorder,
'right ');
1913 $totalarray[
'nbfield']++;
1915if (!empty($arrayfields[
'c.multicurrency_code'][
'checked'])) {
1916 print_liste_field_titre($arrayfields[
'c.multicurrency_code'][
'label'], $_SERVER[
'PHP_SELF'],
'c.multicurrency_code',
'', $param,
'', $sortfield, $sortorder);
1917 $totalarray[
'nbfield']++;
1919if (!empty($arrayfields[
'c.multicurrency_tx'][
'checked'])) {
1920 print_liste_field_titre($arrayfields[
'c.multicurrency_tx'][
'label'], $_SERVER[
'PHP_SELF'],
'c.multicurrency_tx',
'', $param,
'', $sortfield, $sortorder);
1921 $totalarray[
'nbfield']++;
1923if (!empty($arrayfields[
'c.multicurrency_total_ht'][
'checked'])) {
1924 print_liste_field_titre($arrayfields[
'c.multicurrency_total_ht'][
'label'], $_SERVER[
'PHP_SELF'],
'c.multicurrency_total_ht',
'', $param,
'class="right"', $sortfield, $sortorder);
1925 $totalarray[
'nbfield']++;
1927if (!empty($arrayfields[
'c.multicurrency_total_vat'][
'checked'])) {
1928 print_liste_field_titre($arrayfields[
'c.multicurrency_total_vat'][
'label'], $_SERVER[
'PHP_SELF'],
'c.multicurrency_total_tva',
'', $param,
'class="right"', $sortfield, $sortorder);
1929 $totalarray[
'nbfield']++;
1931if (!empty($arrayfields[
'c.multicurrency_total_ttc'][
'checked'])) {
1932 print_liste_field_titre($arrayfields[
'c.multicurrency_total_ttc'][
'label'], $_SERVER[
'PHP_SELF'],
'c.multicurrency_total_ttc',
'', $param,
'class="right"', $sortfield, $sortorder);
1933 $totalarray[
'nbfield']++;
1935if (!empty($arrayfields[
'u.login'][
'checked'])) {
1936 print_liste_field_titre($arrayfields[
'u.login'][
'label'], $_SERVER[
"PHP_SELF"],
'u.login',
'', $param,
'', $sortfield, $sortorder);
1937 $totalarray[
'nbfield']++;
1939if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
1940 print_liste_field_titre($arrayfields[
'sale_representative'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"",
"$param",
'', $sortfield, $sortorder);
1941 $totalarray[
'nbfield']++;
1943if (!empty($arrayfields[
'total_pa'][
'checked'])) {
1944 print_liste_field_titre($arrayfields[
'total_pa'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1945 $totalarray[
'nbfield']++;
1947if (!empty($arrayfields[
'total_margin'][
'checked'])) {
1948 print_liste_field_titre($arrayfields[
'total_margin'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1949 $totalarray[
'nbfield']++;
1951if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
1952 print_liste_field_titre($arrayfields[
'total_margin_rate'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1953 $totalarray[
'nbfield']++;
1955if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
1956 print_liste_field_titre($arrayfields[
'total_mark_rate'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
1957 $totalarray[
'nbfield']++;
1961include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
1964$parameters = array(
'arrayfields'=>$arrayfields,
'param'=>$param,
'sortfield'=>$sortfield,
'sortorder'=>$sortorder,
'totalarray'=>&$totalarray);
1965$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
1966print $hookmanager->resPrint;
1967if (!empty($arrayfields[
'c.datec'][
'checked'])) {
1968 print_liste_field_titre($arrayfields[
'c.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"c.date_creation",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1969 $totalarray[
'nbfield']++;
1971if (!empty($arrayfields[
'c.tms'][
'checked'])) {
1972 print_liste_field_titre($arrayfields[
'c.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"c.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1973 $totalarray[
'nbfield']++;
1975if (!empty($arrayfields[
'c.date_cloture'][
'checked'])) {
1976 print_liste_field_titre($arrayfields[
'c.date_cloture'][
'label'], $_SERVER[
"PHP_SELF"],
"c.date_cloture",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
1977 $totalarray[
'nbfield']++;
1979if (!empty($arrayfields[
'c.note_public'][
'checked'])) {
1980 print_liste_field_titre($arrayfields[
'c.note_public'][
'label'], $_SERVER[
"PHP_SELF"],
"c.note_public",
"", $param,
'', $sortfield, $sortorder,
'right ');
1981 $totalarray[
'nbfield']++;
1983if (!empty($arrayfields[
'c.note_private'][
'checked'])) {
1984 print_liste_field_titre($arrayfields[
'c.note_private'][
'label'], $_SERVER[
"PHP_SELF"],
"c.note_private",
"", $param,
'', $sortfield, $sortorder,
'right ');
1985 $totalarray[
'nbfield']++;
1987if (!empty($arrayfields[
'shippable'][
'checked'])) {
1988 print_liste_field_titre($arrayfields[
'shippable'][
'label'], $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'center ');
1989 $totalarray[
'nbfield']++;
1991if (!empty($arrayfields[
'c.facture'][
'checked'])) {
1992 print_liste_field_titre($arrayfields[
'c.facture'][
'label'], $_SERVER[
"PHP_SELF"],
'c.facture',
'', $param,
'', $sortfield, $sortorder,
'center ');
1993 $totalarray[
'nbfield']++;
1995if (!empty($arrayfields[
'c.import_key'][
'checked'])) {
1996 print_liste_field_titre($arrayfields[
'c.import_key'][
'label'], $_SERVER[
"PHP_SELF"],
"c.import_key",
"", $param,
'', $sortfield, $sortorder,
'center ');
1997 $totalarray[
'nbfield']++;
1999if (!empty($arrayfields[
'c.fk_statut'][
'checked'])) {
2000 print_liste_field_titre($arrayfields[
'c.fk_statut'][
'label'], $_SERVER[
"PHP_SELF"],
"c.fk_statut",
"", $param,
'', $sortfield, $sortorder,
'center ');
2001 $totalarray[
'nbfield']++;
2005 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'', $param,
'', $sortfield, $sortorder,
'maxwidthsearch center ');
2006 $totalarray[
'nbfield']++;
2012$productstat_cache = array();
2013$productstat_cachevirtual = array();
2014$getNomUrl_cache = array();
2016$generic_commande =
new Commande($db);
2017$generic_product =
new Product($db);
2018$userstatic =
new User($db);
2020$with_margin_info =
false;
2021if (isModEnabled(
'margin') && (
2022 !empty($arrayfields[
'total_pa'][
'checked'])
2023 || !empty($arrayfields[
'total_margin'][
'checked'])
2024 || !empty($arrayfields[
'total_margin_rate'][
'checked'])
2025 || !empty($arrayfields[
'total_mark_rate'][
'checked'])
2028 $with_margin_info =
true;
2037 $savnbfield = $totalarray[
'nbfield'];
2038 $totalarray = array();
2039 $totalarray[
'nbfield'] = 0;
2040 $imaxinloop = ($limit ? min($num, $limit) : $num);
2041while ($i < $imaxinloop) {
2042 $obj = $db->fetch_object($resql);
2053 $companystatic->id = $obj->socid;
2054 $companystatic->name = $obj->name;
2055 $companystatic->name_alias = $obj->alias;
2056 $companystatic->client = $obj->client;
2057 $companystatic->fournisseur = $obj->fournisseur;
2058 $companystatic->code_client = $obj->code_client;
2059 $companystatic->email = $obj->email;
2060 $companystatic->phone = $obj->phone;
2061 $companystatic->address = $obj->address;
2062 $companystatic->zip = $obj->zip;
2063 $companystatic->town = $obj->town;
2064 $companystatic->country_code = $obj->country_code;
2065 if (!isset($getNomUrl_cache[$obj->socid])) {
2066 $getNomUrl_cache[$obj->socid] = $companystatic->getNomUrl(1,
'customer', 100, 0, 1, empty($arrayfields[
's.name_alias'][
'checked']) ? 0 : 1);
2069 $generic_commande->id = $obj->rowid;
2070 $generic_commande->ref = $obj->ref;
2071 $generic_commande->statut = $obj->fk_statut;
2072 $generic_commande->billed = $obj->billed;
2073 $generic_commande->date = $db->jdate($obj->date_commande);
2074 $generic_commande->delivery_date = $db->jdate($obj->date_delivery);
2075 $generic_commande->ref_client = $obj->ref_client;
2076 $generic_commande->total_ht = $obj->total_ht;
2077 $generic_commande->total_tva = $obj->total_tva;
2078 $generic_commande->total_ttc = $obj->total_ttc;
2079 $generic_commande->note_public = $obj->note_public;
2080 $generic_commande->note_private = $obj->note_private;
2082 $generic_commande->thirdparty = $companystatic;
2085 $projectstatic->id = $obj->project_id;
2086 $projectstatic->ref = $obj->project_ref;
2087 $projectstatic->title = $obj->project_label;
2089 $marginInfo = array();
2090 if ($with_margin_info ===
true) {
2091 $generic_commande->fetch_lines();
2092 $marginInfo = $formmargin->getMarginInfosArray($generic_commande);
2093 $total_ht += $obj->total_ht;
2094 $total_margin += $marginInfo[
'total_margin'];
2097 if ($mode ==
'kanban') {
2099 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
2100 print
'<div class="box-flex-container kanban">';
2105 if ($massactionbutton || $massaction) {
2107 if (in_array($object->id, $arrayofselected)) {
2111 print $generic_commande->getKanbanView(
'', array(
'selected' => $selected));
2112 if ($i == ($imaxinloop - 1)) {
2119 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
2123 print
'<td class="nowrap center">';
2124 if ($massactionbutton || $massaction) {
2126 if (in_array($obj->rowid, $arrayofselected)) {
2129 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
2133 $totalarray[
'nbfield']++;
2138 if (!empty($arrayfields[
'c.ref'][
'checked'])) {
2139 print
'<td class="nowraponall">';
2140 print $generic_commande->getNomUrl(1, ($search_status != 2 ? 0 : $obj->fk_statut), 0, 0, 0, 1, 1);
2143 $filedir = $conf->commande->multidir_output[$conf->entity].
'/'.
dol_sanitizeFileName($obj->ref);
2144 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid;
2145 print $formfile->getDocumentsLink($generic_commande->element, $filename, $filedir);
2149 $totalarray[
'nbfield']++;
2154 if (!empty($arrayfields[
'c.ref_client'][
'checked'])) {
2155 print
'<td class="nowrap tdoverflowmax150" title="'.dol_escape_htmltag($obj->ref_client).
'">';
2159 $totalarray[
'nbfield']++;
2164 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
2165 print
'<td class="nowrap">';
2166 if ($obj->project_id > 0) {
2167 print $projectstatic->getNomUrl(1);
2171 $totalarray[
'nbfield']++;
2176 if (!empty($arrayfields[
'p.title'][
'checked'])) {
2177 print
'<td class="nowrap">';
2178 if ($obj->project_id > 0) {
2179 print $projectstatic->title;
2183 $totalarray[
'nbfield']++;
2188 if (!empty($arrayfields[
's.nom'][
'checked'])) {
2189 print
'<td class="tdoverflowmax150">';
2191 print $companystatic->getNomUrl(1,
'customer', 100, 0, 1, empty($arrayfields[
's.name_alias'][
'checked']) ? 0 : 1);
2193 print $getNomUrl_cache[$obj->socid];
2198 if ($user->hasRight(
'facture',
'creer')) {
2199 if (($obj->fk_statut > 0 && $obj->fk_statut < 3) || ($obj->fk_statut == 3 && $obj->billed == 0)) {
2200 print
' <a href="'.DOL_URL_ROOT.
'/commande/list.php?socid='.$companystatic->id.
'&search_billed=0&autoselectall=1">';
2201 print
img_picto($langs->trans(
"CreateInvoiceForThisCustomer").
' : '.$companystatic->name,
'object_bill',
'hideonsmartphone').
'</a>';
2207 $totalarray[
'nbfield']++;
2212 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
2213 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->alias).
'">';
2217 $totalarray[
'nbfield']++;
2222 if (!empty($arrayfields[
's2.nom'][
'checked'])) {
2223 print
'<td class="tdoverflowmax200">';
2224 if ($obj->fk_parent > 0) {
2225 if (!isset($company_url_list[$obj->fk_parent])) {
2226 $companyparent =
new Societe($db);
2227 $res = $companyparent->fetch($obj->fk_parent);
2229 $company_url_list[$obj->fk_parent] = $companyparent->getNomUrl(1);
2232 if (isset($company_url_list[$obj->fk_parent])) {
2233 print $company_url_list[$obj->fk_parent];
2238 $totalarray[
'nbfield']++;
2243 if (!empty($arrayfields[
's.town'][
'checked'])) {
2244 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->town).
'">';
2248 $totalarray[
'nbfield']++;
2253 if (!empty($arrayfields[
's.zip'][
'checked'])) {
2254 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->zip).
'">';
2258 $totalarray[
'nbfield']++;
2263 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
2264 print
'<td class="tdoverflowmax100" title="'.dol_escape_htmltag($obj->state_name).
'">'.
dol_escape_htmltag($obj->state_name).
"</td>\n";
2266 $totalarray[
'nbfield']++;
2271 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
2272 print
'<td class="center">';
2273 $tmparray =
getCountry($obj->fk_pays,
'all');
2274 print $tmparray[
'label'];
2277 $totalarray[
'nbfield']++;
2282 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
2283 print
'<td class="center">';
2284 if (empty($typenArray)) {
2285 $typenArray = $formcompany->typent_array(1);
2287 print $typenArray[$obj->typent_code]??
'';
2290 $totalarray[
'nbfield']++;
2295 if (!empty($arrayfields[
'c.date_commande'][
'checked'])) {
2296 print
'<td class="center nowraponall">';
2299 if ($generic_commande->hasDelay()) {
2300 print
img_picto($langs->trans(
"Late").
' : '.$generic_commande->showDelay(),
"warning");
2304 $totalarray[
'nbfield']++;
2309 if (!empty($arrayfields[
'c.date_delivery'][
'checked'])) {
2310 print
'<td class="center nowraponall">';
2311 print
dol_print_date($db->jdate($obj->date_delivery),
'dayhour');
2314 $totalarray[
'nbfield']++;
2319 if (!empty($arrayfields[
'c.fk_shipping_method'][
'checked'])) {
2321 $form->formSelectShippingMethod(
'', $obj->fk_shipping_method,
'none', 1);
2324 $totalarray[
'nbfield']++;
2329 if (!empty($arrayfields[
'c.fk_cond_reglement'][
'checked'])) {
2331 $form->form_conditions_reglement($_SERVER[
'PHP_SELF'], $obj->fk_cond_reglement,
'none', 0,
'', 1, $obj->deposit_percent);
2334 $totalarray[
'nbfield']++;
2339 if (!empty($arrayfields[
'c.fk_mode_reglement'][
'checked'])) {
2341 $form->form_modes_reglement($_SERVER[
'PHP_SELF'], $obj->fk_mode_reglement,
'none',
'', -1);
2344 $totalarray[
'nbfield']++;
2349 if (!empty($arrayfields[
'c.fk_input_reason'][
'checked'])) {
2351 $form->formInputReason($_SERVER[
'PHP_SELF'], $obj->fk_input_reason,
'none',
'');
2354 $totalarray[
'nbfield']++;
2359 if (!empty($arrayfields[
'c.total_ht'][
'checked'])) {
2360 print
'<td class="nowrap right"><span class="amount">'.price($obj->total_ht).
"</span></td>\n";
2362 $totalarray[
'nbfield']++;
2365 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'c.total_ht';
2367 if (isset($totalarray[
'val'][
'c.total_ht'])) {
2368 $totalarray[
'val'][
'c.total_ht'] += $obj->total_ht;
2370 $totalarray[
'val'][
'c.total_ht'] = $obj->total_ht;
2375 if (!empty($arrayfields[
'c.total_vat'][
'checked'])) {
2376 print
'<td class="nowrap right"><span class="amount">'.price($obj->total_tva).
"</span></td>\n";
2378 $totalarray[
'nbfield']++;
2381 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'c.total_tva';
2383 if (isset($totalarray[
'val'][
'c.total_tva'])) {
2384 $totalarray[
'val'][
'c.total_tva'] += $obj->total_tva;
2386 $totalarray[
'val'][
'c.total_tva'] = $obj->total_tva;
2391 if (!empty($arrayfields[
'c.total_ttc'][
'checked'])) {
2392 print
'<td class="nowrap right"><span class="amount">'.price($obj->total_ttc).
"</span></td>\n";
2394 $totalarray[
'nbfield']++;
2397 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'c.total_ttc';
2399 if (isset($totalarray[
'val'][
'c.total_ttc'])) {
2400 $totalarray[
'val'][
'c.total_ttc'] += $obj->total_ttc;
2402 $totalarray[
'val'][
'c.total_ttc'] = $obj->total_ttc;
2407 if (!empty($arrayfields[
'c.multicurrency_code'][
'checked'])) {
2408 print
'<td class="nowrap">'.$obj->multicurrency_code.
' - '.$langs->trans(
'Currency'.$obj->multicurrency_code).
"</td>\n";
2410 $totalarray[
'nbfield']++;
2415 if (!empty($arrayfields[
'c.multicurrency_tx'][
'checked'])) {
2416 print
'<td class="nowrap">';
2417 $form->form_multicurrency_rate($_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid, $obj->multicurrency_tx,
'none', $obj->multicurrency_code);
2420 $totalarray[
'nbfield']++;
2425 if (!empty($arrayfields[
'c.multicurrency_total_ht'][
'checked'])) {
2426 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ht).
"</span></td>\n";
2428 $totalarray[
'nbfield']++;
2432 if (!empty($arrayfields[
'c.multicurrency_total_vat'][
'checked'])) {
2433 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_vat).
"</span></td>\n";
2435 $totalarray[
'nbfield']++;
2439 if (!empty($arrayfields[
'c.multicurrency_total_ttc'][
'checked'])) {
2440 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ttc).
"</span></td>\n";
2442 $totalarray[
'nbfield']++;
2446 $userstatic->id = $obj->fk_user_author;
2447 $userstatic->login = $obj->login;
2448 $userstatic->lastname = $obj->lastname;
2449 $userstatic->firstname = $obj->firstname;
2450 $userstatic->email = $obj->user_email;
2451 $userstatic->statut = $obj->user_statut;
2452 $userstatic->entity = $obj->entity;
2453 $userstatic->photo = $obj->photo;
2454 $userstatic->office_phone = $obj->office_phone;
2455 $userstatic->office_fax = $obj->office_fax;
2456 $userstatic->user_mobile = $obj->user_mobile;
2457 $userstatic->job = $obj->job;
2458 $userstatic->gender = $obj->gender;
2461 if (!empty($arrayfields[
'u.login'][
'checked'])) {
2462 print
'<td class="tdoverflowmax150">';
2463 if ($userstatic->id) {
2464 print $userstatic->getNomUrl(-1);
2470 $totalarray[
'nbfield']++;
2475 if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
2477 if ($obj->socid > 0) {
2478 $listsalesrepresentatives = $companystatic->getSalesRepresentatives($user);
2479 if ($listsalesrepresentatives < 0) {
2482 $nbofsalesrepresentative = count($listsalesrepresentatives);
2483 if ($nbofsalesrepresentative > 6) {
2485 print $nbofsalesrepresentative;
2486 } elseif ($nbofsalesrepresentative > 0) {
2488 foreach ($listsalesrepresentatives as $val) {
2489 $userstatic->id = $val[
'id'];
2490 $userstatic->lastname = $val[
'lastname'];
2491 $userstatic->firstname = $val[
'firstname'];
2492 $userstatic->email = $val[
'email'];
2493 $userstatic->statut = $val[
'statut'];
2494 $userstatic->entity = $val[
'entity'];
2495 $userstatic->photo = $val[
'photo'];
2496 $userstatic->login = $val[
'login'];
2497 $userstatic->office_phone = $val[
'office_phone'];
2498 $userstatic->office_fax = $val[
'office_fax'];
2499 $userstatic->user_mobile = $val[
'user_mobile'];
2500 $userstatic->job = $val[
'job'];
2501 $userstatic->gender = $val[
'gender'];
2503 print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1,
'', 0, 0, 12) : $userstatic->getNomUrl(-2);
2505 if ($j < $nbofsalesrepresentative) {
2517 $totalarray[
'nbfield']++;
2522 if (!empty($arrayfields[
'total_pa'][
'checked'])) {
2523 print
'<td class="right nowrap">'.price($marginInfo[
'pa_total']).
'</td>';
2525 $totalarray[
'nbfield']++;
2530 if (!empty($arrayfields[
'total_margin'][
'checked'])) {
2531 print
'<td class="right nowrap">'.price($marginInfo[
'total_margin']).
'</td>';
2533 $totalarray[
'nbfield']++;
2536 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'total_margin';
2539 if (!isset($totalarray[
'val'][
'total_margin'])) {
2540 $totalarray[
'val'][
'total_margin'] = 0;
2543 $totalarray[
'val'][
'total_margin'] += $marginInfo[
'total_margin'];
2547 if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
2548 print
'<td class="right nowrap">'.(($marginInfo[
'total_margin_rate'] ==
'') ?
'' :
price($marginInfo[
'total_margin_rate'], null, null, null, null, 2).
'%').
'</td>';
2550 $totalarray[
'nbfield']++;
2555 if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
2556 print
'<td class="right nowrap">'.(($marginInfo[
'total_mark_rate'] ==
'') ?
'' :
price($marginInfo[
'total_mark_rate'], null, null, null, null, 2).
'%').
'</td>';
2558 $totalarray[
'nbfield']++;
2561 $totalarray[
'pos'][$totalarray[
'nbfield']] =
'total_mark_rate';
2563 if ($i >= $imaxinloop - 1) {
2564 if (!empty($total_ht)) {
2565 $totalarray[
'val'][
'total_mark_rate'] =
price2num($total_margin * 100 / $total_ht,
'MT');
2567 $totalarray[
'val'][
'total_mark_rate'] =
'';
2573 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
2575 $parameters = array(
'arrayfields'=>$arrayfields,
'obj'=>$obj,
'i'=>$i,
'totalarray'=>&$totalarray);
2576 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
2577 print $hookmanager->resPrint;
2580 if (!empty($arrayfields[
'c.datec'][
'checked'])) {
2581 print
'<td align="center" class="nowrap">';
2582 print
dol_print_date($db->jdate($obj->date_creation),
'dayhour',
'tzuser');
2585 $totalarray[
'nbfield']++;
2590 if (!empty($arrayfields[
'c.tms'][
'checked'])) {
2591 print
'<td align="center" class="nowrap">';
2592 print
dol_print_date($db->jdate($obj->date_update),
'dayhour',
'tzuser');
2595 $totalarray[
'nbfield']++;
2600 if (!empty($arrayfields[
'c.date_cloture'][
'checked'])) {
2601 print
'<td align="center" class="nowrap">';
2602 print
dol_print_date($db->jdate($obj->date_cloture),
'dayhour',
'tzuser');
2605 $totalarray[
'nbfield']++;
2610 if (!empty($arrayfields[
'c.note_public'][
'checked'])) {
2611 print
'<td class="center">';
2615 $totalarray[
'nbfield']++;
2620 if (!empty($arrayfields[
'c.note_private'][
'checked'])) {
2621 print
'<td class="center">';
2625 $totalarray[
'nbfield']++;
2630 if (!empty($arrayfields[
'shippable'][
'checked'])) {
2631 print
'<td class="center">';
2632 if (!empty($show_shippable_command) && isModEnabled(
'stock')) {
2633 if (($obj->fk_statut > $generic_commande::STATUS_DRAFT) && ($obj->fk_statut < $generic_commande::STATUS_CLOSED)) {
2634 $generic_commande->getLinesArray();
2635 $generic_commande->loadExpeditions();
2637 $numlines = count($generic_commande->lines);
2638 for ($lig = 0; $lig < $numlines; $lig++) {
2639 if (isset($generic_commande->expeditions[$generic_commande->lines[$lig]->id])) {
2640 $reliquat = $generic_commande->lines[$lig]->qty - $generic_commande->expeditions[$generic_commande->lines[$lig]->id];
2642 $reliquat = $generic_commande->lines[$lig]->qty;
2644 if ($generic_commande->lines[$lig]->product_type == 0 && $generic_commande->lines[$lig]->fk_product > 0) {
2646 $generic_product->id = $generic_commande->lines[$lig]->fk_product;
2649 if (empty($productstat_cache[$generic_commande->lines[$lig]->fk_product])) {
2650 $generic_product->load_stock(
'nobatch,warehouseopen');
2651 $productstat_cache[$generic_commande->lines[$lig]->fk_product][
'stock_reel'] = $generic_product->stock_reel;
2652 $productstat_cachevirtual[$generic_commande->lines[$lig]->fk_product][
'stock_reel'] = $generic_product->stock_theorique;
2654 $generic_product->stock_reel = $productstat_cache[$generic_commande->lines[$lig]->fk_product][
'stock_reel'];
2655 $generic_product->stock_theorique = $productstat_cachevirtual[$generic_commande->lines[$lig]->fk_product][
'stock_reel'];
2658 if ($reliquat > $generic_product->stock_reel) {
2662 $text_info .= $reliquat.
' x '.$generic_commande->lines[$lig]->product_ref.
' '.
dol_trunc($generic_commande->lines[$lig]->product_label, 20);
2663 $text_info .=
' - '.$langs->trans(
"Stock").
': <span class="'.($generic_product->stock_reel > 0 ?
'ok' :
'error').
'">'.$generic_product->stock_reel.
'</span>';
2664 $text_info .=
' - '.$langs->trans(
"VirtualStock").
': <span class="'.($generic_product->stock_theorique > 0 ?
'ok' :
'error').
'">'.$generic_product->stock_theorique.
'</span>';
2665 $text_info .= ($reliquat != $generic_commande->lines[$lig]->qty ?
' <span class="opacitymedium">('.$langs->trans(
"QtyInOtherShipments").
' '.($generic_commande->lines[$lig]->qty - $reliquat).
')</span>' :
'');
2666 $text_info .=
'<br>';
2673 $stock_order_supplier = 0;
2675 if (isModEnabled(
'commande')) {
2676 if (empty($productstat_cache[$generic_commande->lines[$lig]->fk_product][
'stats_order_customer'])) {
2677 $generic_product->load_stats_commande(0,
'1,2');
2678 $productstat_cache[$generic_commande->lines[$lig]->fk_product][
'stats_order_customer'] = $generic_product->stats_commande[
'qty'];
2680 $generic_product->stats_commande[
'qty'] = $productstat_cache[$generic_commande->lines[$lig]->fk_product][
'stats_order_customer'];
2682 $stock_order = $generic_product->stats_commande[
'qty'];
2684 if (isModEnabled(
"supplier_order")) {
2685 if (empty($productstat_cache[$generic_commande->lines[$lig]->fk_product][
'stats_order_supplier'])) {
2686 $generic_product->load_stats_commande_fournisseur(0,
'3');
2687 $productstat_cache[$generic_commande->lines[$lig]->fk_product][
'stats_order_supplier'] = $generic_product->stats_commande_fournisseur[
'qty'];
2689 $generic_product->stats_commande_fournisseur[
'qty'] = $productstat_cache[$generic_commande->lines[$lig]->fk_product][
'stats_order_supplier'];
2691 $stock_order_supplier = $generic_product->stats_commande_fournisseur[
'qty'];
2694 $text_info .= $reliquat.
' x '.$generic_commande->lines[$lig]->ref.
' '.
dol_trunc($generic_commande->lines[$lig]->product_label, 20);
2695 $text_stock_reel = $generic_product->stock_reel.
'/'.$stock_order;
2696 if ($stock_order > $generic_product->stock_reel && !($generic_product->stock_reel < $generic_commande->lines[$lig]->qty)) {
2698 $text_warning .=
'<span class="warning">'.$langs->trans(
'Available').
' : '.$text_stock_reel.
'</span>';
2700 if ($reliquat > $generic_product->stock_reel) {
2701 $text_info .=
'<span class="warning">'.$langs->trans(
'Available').
' : '.$text_stock_reel.
'</span>';
2703 $text_info .=
'<span class="ok">'.$langs->trans(
'Available').
' : '.$text_stock_reel.
'</span>';
2705 if (isModEnabled(
"supplier_order")) {
2706 $text_info .=
' '.$langs->trans(
'SupplierOrder').
' : '.$stock_order_supplier;
2708 $text_info .= ($reliquat != $generic_commande->lines[$lig]->qty ?
' <span class="opacitymedium">('.$langs->trans(
"QtyInOtherShipments").
' '.($generic_commande->lines[$lig]->qty - $reliquat).
')</span>' :
'');
2709 $text_info .=
'<br>';
2713 if ($notshippable == 0) {
2714 $text_icon =
img_picto(
'',
'dolly',
'',
false, 0, 0,
'',
'green paddingleft');
2715 $text_info = $text_icon.
' '.$langs->trans(
'Shippable').
'<br>'.$text_info;
2717 $text_icon =
img_picto(
'',
'dolly',
'',
false, 0, 0,
'',
'error paddingleft');
2718 $text_info = $text_icon.
' '.$langs->trans(
'NonShippable').
'<br>'.$text_info;
2723 print $form->textwithtooltip(
'', $text_info, 2, 1, $text_icon,
'', 2);
2726 print $form->textwithtooltip(
'', $langs->trans(
'NotEnoughForAllOrders').
'<br>'.$text_warning, 2, 1,
img_picto(
'',
'error'),
'', 2);
2731 $totalarray[
'nbfield']++;
2736 if (!empty($arrayfields[
'c.facture'][
'checked'])) {
2737 print
'<td class="center">'.yn($obj->billed).
'</td>';
2739 $totalarray[
'nbfield']++;
2744 if (!empty($arrayfields[
'c.import_key'][
'checked'])) {
2745 print
'<td class="nowrap center">'.dol_escape_htmltag($obj->import_key).
'</td>';
2747 $totalarray[
'nbfield']++;
2752 if (!empty($arrayfields[
'c.fk_statut'][
'checked'])) {
2753 print
'<td class="nowrap center">'.$generic_commande->LibStatut($obj->fk_statut, $obj->billed, 5, 1).
'</td>';
2755 $totalarray[
'nbfield']++;
2761 print
'<td class="nowrap center">';
2762 if ($massactionbutton || $massaction) {
2764 if (in_array($obj->rowid, $arrayofselected)) {
2767 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
2771 $totalarray[
'nbfield']++;
2777 $total += $obj->total_ht;
2778 $subtotal += $obj->total_ht;
2784 include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
2789 foreach ($arrayfields as $key => $val) {
2790 if (!empty($val[
'checked'])) {
2794 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
2799 $parameters = array(
'arrayfields'=>$arrayfields,
'sql'=>$sql);
2800 $reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
2801 print $hookmanager->resPrint;
2803 print
'</table>'.
"\n";
2804 print
'</div>'.
"\n";
2806 print
'</form>'.
"\n";
2808if (in_array(
'builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
2809 $hidegeneratedfilelistifempty = 1;
2810 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
2811 $hidegeneratedfilelistifempty = 0;
2815 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
2816 $urlsource .= str_replace(
'&',
'&', $param);
2818 $filedir = $diroutputmassaction;
2819 $genallowed = $permissiontoread;
2820 $delallowed = $permissiontoadd;
2822 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.