44require
'../main.inc.php';
54require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
55require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
56require_once DOL_DOCUMENT_ROOT.
'/core/class/discount.class.php';
57require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
58require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
59require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
61 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formmargin.class.php';
63require_once DOL_DOCUMENT_ROOT.
'/commande/class/commande.class.php';
64require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
65require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
66require_once DOL_DOCUMENT_ROOT.
'/product/class/html.formproduct.class.php';
67require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
70 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
71 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcategory.class.php';
75$langs->loadLangs(array(
'orders',
'sendings',
'companies',
'compta',
'bills',
'stocks',
'products'));
78$action =
GETPOST(
'action',
'aZ09');
79$massaction =
GETPOST(
'massaction',
'alpha');
81$confirm =
GETPOST(
'confirm',
'alpha');
82$toselect =
GETPOST(
'toselect',
'array:int');
83$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'orderlist';
84$optioncss =
GETPOST(
'optioncss',
'alpha');
88 $userschilds = $user->getAllChildIds();
90 $userschilds = array();
94$search_datecloture_start =
GETPOSTINT(
'search_datecloture_start');
95if (empty($search_datecloture_start)) {
98$search_datecloture_end =
GETPOSTINT(
'search_datecloture_end');
99if (empty($search_datecloture_end)) {
109$search_all = trim(
GETPOST(
'search_all',
'alphanohtml'));
110$searchCategoryOrderOperator = 0;
111if (GETPOSTISSET(
'formfilteraction')) {
112 $searchCategoryOrderOperator =
GETPOSTINT(
'search_category_order_operator');
116$searchCategoryOrderList =
GETPOST(
'search_category_order_list',
'array');
117$search_product_category =
GETPOST(
'search_product_category',
'intcomma');
118$search_id =
GETPOST(
'search_id',
'int');
119$search_ref =
GETPOST(
'search_ref',
'alpha') !=
'' ?
GETPOST(
'search_ref',
'alpha') :
GETPOST(
'sref',
'alpha');
120$search_ref_ext =
GETPOST(
'search_ref_ext',
'alpha');
121$search_ref_customer =
GETPOST(
'search_ref_customer',
'alpha');
122$search_company =
GETPOST(
'search_company',
'alpha');
123$search_company_alias =
GETPOST(
'search_company_alias',
'alpha');
124$search_parent_name = trim(
GETPOST(
'search_parent_name',
'alphanohtml'));
125$search_town =
GETPOST(
'search_town',
'alpha');
126$search_zip =
GETPOST(
'search_zip',
'alpha');
127$search_state =
GETPOST(
'search_state',
'alpha');
128$search_country =
GETPOST(
'search_country',
'aZ09');
129$search_type_thirdparty =
GETPOST(
'search_type_thirdparty',
'intcomma');
130$search_user =
GETPOST(
'search_user',
'intcomma');
131$search_sale =
GETPOST(
'search_sale',
'intcomma');
132$search_total_ht =
GETPOST(
'search_total_ht',
'alpha');
133$search_total_vat =
GETPOST(
'search_total_vat',
'alpha');
134$search_total_ttc =
GETPOST(
'search_total_ttc',
'alpha');
135$search_warehouse =
GETPOST(
'search_warehouse',
'intcomma');
136$search_note_public =
GETPOST(
'search_note_public',
'alphanohtml');
137$search_note_private =
GETPOST(
'search_note_private',
'alphanohtml');
139$search_module_source =
GETPOST(
'search_module_source',
'alphanohtml');
140$search_pos_source =
GETPOST(
'search_pos_source',
'alphanohtml');
142$search_multicurrency_code =
GETPOST(
'search_multicurrency_code',
'alpha');
143$search_multicurrency_tx =
GETPOST(
'search_multicurrency_tx',
'alpha');
144$search_multicurrency_montant_ht =
GETPOST(
'search_multicurrency_montant_ht',
'alpha');
145$search_multicurrency_montant_vat =
GETPOST(
'search_multicurrency_montant_vat',
'alpha');
146$search_multicurrency_montant_ttc =
GETPOST(
'search_multicurrency_montant_ttc',
'alpha');
148$search_login =
GETPOST(
'search_login',
'alpha');
149$search_categ_cus =
GETPOST(
"search_categ_cus",
'intcomma');
150$search_billed =
GETPOST(
'search_billed',
'intcomma');
151$search_status =
GETPOST(
'search_status',
'intcomma');
152$search_project_ref =
GETPOST(
'search_project_ref',
'alpha');
153$search_project =
GETPOST(
'search_project',
'alpha');
154$search_shippable =
GETPOST(
'search_shippable',
'aZ09');
156$search_fk_cond_reglement =
GETPOST(
'search_fk_cond_reglement',
'intcomma');
157$search_fk_shipping_method =
GETPOST(
'search_fk_shipping_method',
'intcomma');
158$search_fk_mode_reglement =
GETPOST(
'search_fk_mode_reglement',
'intcomma');
159$search_fk_input_reason =
GETPOST(
'search_fk_input_reason',
'intcomma');
161$search_option =
GETPOST(
'search_option',
'alpha');
162if ($search_option ==
'late') {
163 $search_status =
'-2';
165$search_orderday =
'';
166$search_ordermonth =
'';
167$search_orderyear =
'';
168$search_deliveryday =
'';
169$search_deliverymonth =
'';
170$search_deliveryyear =
'';
172$search_import_key = trim(
GETPOST(
"search_import_key",
"alpha"));
174$diroutputmassaction =
$conf->order->multidir_output[
$conf->entity].
'/temp/massgeneration/'.$user->id;
178$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
179$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
181if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
185$offset = $limit * $page;
186$pageprev = $page - 1;
187$pagenext = $page + 1;
189 $sortfield =
'c.ref';
195$show_shippable_command =
GETPOST(
'show_shippable_command',
'aZ09');
199$hookmanager->initHooks(array(
'orderlist'));
202$extrafields->fetch_name_optionals_label(
$object->table_element);
203$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
206$fieldstosearchall = array(
208 'c.ref_client' =>
'RefCustomerOrder',
209 'pd.description' =>
'ProductDescription',
210 's.nom' =>
"ThirdParty",
211 's.name_alias' =>
"AliasNameShort",
214 'c.note_public' =>
'NotePublic',
216if (empty($user->socid)) {
217 $fieldstosearchall[
"c.note_private"] =
"NotePrivate";
223$checkedtypetiers =
'0';
225 'c.rowid' => array(
'label' =>
"ID",
'checked' =>
'1',
'enabled' => (
string)
getDolGlobalInt(
'MAIN_SHOW_TECHNICAL_ID'),
'position' => 1),
226 'c.ref' => array(
'label' =>
"Ref",
'checked' =>
'1',
'position' => 5,
'searchall' => 1),
227 'c.ref_ext' => array(
'label' =>
"RefExt",
'checked' =>
'1',
'position' => 5,
'visible' => 0,
'searchall' => 1),
228 'c.ref_client' => array(
'label' =>
"RefCustomerOrder",
'checked' =>
'-1',
'position' => 10,
'searchall' => 1),
229 'p.ref' => array(
'label' =>
"ProjectRef",
'langfile' =>
'projects',
'checked' =>
'-1',
'enabled' => (!
isModEnabled(
'project') ?
'0' :
'1'),
'position' => 20),
230 'p.title' => array(
'label' =>
"ProjectLabel",
'langfile' =>
'projects',
'checked' =>
'0',
'enabled' => (!
isModEnabled(
'project') ?
'0' :
'1'),
'position' => 25),
231 's.nom' => array(
'label' =>
"ThirdParty",
'checked' =>
'1',
'position' => 30,
'searchall' => 1),
232 's.name_alias' => array(
'label' =>
"AliasNameShort",
'checked' =>
'-1',
'position' => 31,
'searchall' => 1),
233 's2.nom' => array(
'label' =>
'ParentCompany',
'position' => 32,
'checked' =>
'0'),
234 's.town' => array(
'label' =>
"Town",
'checked' =>
'-1',
'position' => 35,
'searchall' => 1),
235 's.zip' => array(
'label' =>
"Zip",
'checked' =>
'-1',
'position' => 40,
'searchall' => 1),
236 'state.nom' => array(
'label' =>
"StateShort",
'checked' =>
'0',
'position' => 45),
237 'country.code_iso' => array(
'label' =>
"Country",
'checked' =>
'0',
'position' => 50),
238 'typent.code' => array(
'label' =>
"ThirdPartyType",
'checked' => (
string) $checkedtypetiers,
'position' => 55),
239 'c.date_commande' => array(
'label' =>
"OrderDateShort",
'checked' =>
'1',
'position' => 60,
'csslist' =>
'nowraponall'),
240 'c.delivery_date' => array(
'label' =>
"DateDeliveryPlanned",
'checked' =>
'1',
'enabled' => (
string) (int) !
getDolGlobalString(
'ORDER_DISABLE_DELIVERY_DATE'),
'position' => 65,
'csslist' =>
'nowraponall'),
241 'c.fk_shipping_method' => array(
'label' =>
"SendingMethod",
'checked' =>
'-1',
'position' => 66 ,
'enabled' => (
string) (int)
isModEnabled(
"shipping")),
242 'c.fk_cond_reglement' => array(
'label' =>
"PaymentConditionsShort",
'checked' =>
'-1',
'position' => 67),
243 'c.fk_mode_reglement' => array(
'label' =>
"PaymentMode",
'checked' =>
'-1',
'position' => 68),
244 'c.fk_input_reason' => array(
'label' =>
"Origin",
'checked' =>
'-1',
'position' => 69),
245 'c.module_source' => array(
'label' =>
"POSModule",
'langfile' =>
'cashdesk',
'checked' => ($contextpage ==
'poslist' ?
'1' :
'0'),
'enabled' => $showpos,
'position' => 90),
246 'c.pos_source' => array(
'label' =>
"POSTerminal",
'langfile' =>
'cashdesk',
'checked' => ($contextpage ==
'poslist' ?
'1' :
'0'),
'enabled' => $showpos,
'position' => 91),
247 'c.total_ht' => array(
'label' =>
"AmountHT",
'checked' =>
'1',
'position' => 75),
248 'c.total_vat' => array(
'label' =>
"AmountVAT",
'checked' =>
'0',
'position' => 80),
249 'c.total_ttc' => array(
'label' =>
"AmountTTC",
'checked' =>
'0',
'position' => 85),
250 'c.multicurrency_code' => array(
'label' =>
'Currency',
'checked' =>
'0',
'enabled' => (!
isModEnabled(
"multicurrency") ?
'0' :
'1'),
'position' => 92),
251 'c.multicurrency_tx' => array(
'label' =>
'CurrencyRate',
'checked' =>
'0',
'enabled' => (!
isModEnabled(
"multicurrency") ?
'0' :
'1'),
'position' => 95),
252 'c.multicurrency_total_ht' => array(
'label' =>
'MulticurrencyAmountHT',
'checked' =>
'0',
'enabled' => (!
isModEnabled(
"multicurrency") ?
'0' :
'1'),
'position' => 100),
253 'c.multicurrency_total_vat' => array(
'label' =>
'MulticurrencyAmountVAT',
'checked' =>
'0',
'enabled' => (!
isModEnabled(
"multicurrency") ?
'0' :
'1'),
'position' => 105),
254 'c.multicurrency_total_ttc' => array(
'label' =>
'MulticurrencyAmountTTC',
'checked' =>
'0',
'enabled' => (!
isModEnabled(
"multicurrency") ?
'0' :
'1'),
'position' => 110),
255 'u.login' => array(
'label' =>
"Author",
'checked' =>
'-1',
'position' => 115),
256 'sale_representative' => array(
'label' =>
"SaleRepresentativesOfThirdParty",
'checked' =>
'0',
'position' => 116),
257 'total_pa' => array(
'label' => (
getDolGlobalString(
'MARGIN_TYPE') ==
'1' ?
'BuyingPrice' :
'CostPrice'),
'checked' =>
'0',
'position' => 300,
'enabled' => (
string) (int) (!
isModEnabled(
'margin') || !$user->hasRight(
"margins",
"liretous") ? 0 : 1)),
258 'total_margin' => array(
'label' =>
'Margin',
'checked' =>
'0',
'position' => 301,
'enabled' => (
string) (int) (!
isModEnabled(
'margin') || !$user->hasRight(
"margins",
"liretous") ? 0 : 1)),
259 'total_margin_rate' => array(
'label' =>
'MarginRate',
'checked' =>
'0',
'position' => 302,
'enabled' => (
string) (int) (!
isModEnabled(
'margin') || !$user->hasRight(
"margins",
"liretous") || !
getDolGlobalString(
'DISPLAY_MARGIN_RATES') ? 0 : 1)),
260 'total_mark_rate' => array(
'label' =>
'MarkRate',
'checked' =>
'0',
'position' => 303,
'enabled' => (
string) (int) (!
isModEnabled(
'margin') || !$user->hasRight(
"margins",
"liretous") || !
getDolGlobalString(
'DISPLAY_MARK_RATES') ? 0 : 1)),
261 'c.datec' => array(
'label' =>
"DateCreation",
'checked' =>
'0',
'position' => 120),
262 'c.tms' => array(
'label' =>
"DateModificationShort",
'checked' =>
'0',
'position' => 125),
263 'c.date_cloture' => array(
'label' =>
"DateClosing",
'checked' =>
'0',
'position' => 130),
264 'c.note_public' => array(
'label' =>
'NotePublic',
'checked' =>
'0',
'enabled' => (
string) (int) (!
getDolGlobalInt(
'MAIN_LIST_HIDE_PUBLIC_NOTES')),
'position' => 135,
'searchall' => 1),
265 'c.note_private' => array(
'label' =>
'NotePrivate',
'checked' =>
'0',
'enabled' => (
string) (int) (!
getDolGlobalInt(
'MAIN_LIST_HIDE_PRIVATE_NOTES')),
'position' => 140),
266 'shippable' => array(
'label' =>
"Shippable",
'checked' =>
'1',
'enabled' => (
string) (int) (
isModEnabled(
"shipping")),
'position' => 990),
267 'c.facture' => array(
'label' =>
"Billed",
'checked' =>
'1',
'enabled' => (
string) (int) (!
getDolGlobalString(
'WORKFLOW_BILL_ON_SHIPMENT')),
'position' => 995),
268 'c.import_key' => array(
'type' =>
'varchar(14)',
'label' =>
'ImportId',
'enabled' =>
'1',
'visible' => -2,
'position' => 999),
269 'c.fk_statut' => array(
'label' =>
"Status",
'checked' =>
'1',
'position' => 1000)
272$parameters = array(
'fieldstosearchall' => $fieldstosearchall);
273$reshook = $hookmanager->executeHooks(
'completeFieldsToSearchAll', $parameters, $object, $action);
275 $fieldstosearchall = empty($hookmanager->resArray[
'fieldstosearchall']) ? array() : $hookmanager->resArray[
'fieldstosearchall'];
276} elseif ($reshook == 0) {
277 $fieldstosearchall = array_merge($fieldstosearchall, empty($hookmanager->resArray[
'fieldstosearchall']) ? array() : $hookmanager->resArray[
'fieldstosearchall']);
281include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
283$parameters = array(
'arrayfields' => &$arrayfields);
284$reshook = $hookmanager->executeHooks(
'completeArrayFields', $parameters, $object, $action);
287$parameters = array(
'arrayfields' => &$arrayfields);
288$reshook = $hookmanager->executeHooks(
'completeArrayFields', $parameters, $object, $action);
299 $socid = $user->socid;
302$permissiontoreadallthirdparty = $user->hasRight(
'societe',
'client',
'voir');
303$permissiontoread =
false;
304$permissiontovalidate =
false;
305$permissiontoclose =
false;
306$permissiontocancel =
false;
307$permissiontosendbymail =
false;
313$permissiontoread = $user->hasRight(
"commande",
"lire");
314$permissiontoadd = $user->hasRight(
"commande",
"creer");
315$permissiontodelete = $user->hasRight(
"commande",
"supprimer");
317 $permissiontovalidate = $user->hasRight(
"commande",
"order_advance",
"validate");
318 $permissiontoclose = $user->hasRight(
"commande",
"order_advance",
"close");
319 $permissiontocancel = $user->hasRight(
"commande",
"order_advance",
"annuler");
320 $permissiontosendbymail = $user->hasRight(
"commande",
"order_advance",
"send");
322 $permissiontovalidate = $user->hasRight(
"commande",
"creer");
323 $permissiontoclose = $user->hasRight(
"commande",
"creer");
324 $permissiontocancel = $user->hasRight(
"commande",
"creer");
325 $permissiontosendbymail = $user->hasRight(
"commande",
"creer");
335if (
GETPOST(
'cancel',
'alpha')) {
339if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend' && $massaction !=
'confirm_createbills') {
343$parameters = array(
'socid' => $socid,
'arrayfields' => &$arrayfields);
344$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
349if (empty($reshook)) {
351 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
354 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
357 $search_product_category =
'';
358 $searchCategoryOrderList = array();
361 $search_ref_ext =
'';
362 $search_ref_customer =
'';
363 $search_company =
'';
364 $search_company_alias =
'';
365 $search_parent_name =
'';
366 $search_module_source =
'';
367 $search_pos_source =
'';
372 $search_country =
'';
373 $search_type_thirdparty =
'';
374 $search_total_ht =
'';
375 $search_total_vat =
'';
376 $search_total_ttc =
'';
377 $search_warehouse =
'';
378 $search_note_public =
'';
379 $search_note_private =
'';
380 $search_multicurrency_code =
'';
381 $search_multicurrency_tx =
'';
382 $search_multicurrency_montant_ht =
'';
383 $search_multicurrency_montant_vat =
'';
384 $search_multicurrency_montant_ttc =
'';
386 $search_dateorder_start =
'';
387 $search_dateorder_end =
'';
388 $search_datedelivery_start =
'';
389 $search_datedelivery_end =
'';
390 $search_project_ref =
'';
391 $search_project =
'';
394 $search_datecloture_start =
'';
395 $search_datecloture_end =
'';
396 $search_fk_cond_reglement =
'';
397 $search_fk_shipping_method =
'';
398 $search_fk_mode_reglement =
'';
399 $search_fk_input_reason =
'';
401 $search_import_key =
'';
402 $search_categ_cus = 0;
406 $search_array_options = array();
408 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
409 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
414 $objectclass =
'Commande';
415 $objectlabel =
'Orders';
416 $uploaddir =
$conf->order->multidir_output[
$conf->entity];
417 $triggersendname =
'ORDER_SENTBYMAIL';
420 include DOL_DOCUMENT_ROOT.
'/core/actions_massactions.inc.php';
422 if ($massaction ==
'confirm_createbills' && $user->hasRight(
'facture',
'creer')) {
423 $orders =
GETPOST(
'toselect',
'array:int');
424 $createbills_onebythird =
GETPOSTINT(
'createbills_onebythird');
425 $validate_invoices =
GETPOSTINT(
'validate_invoices');
430 $TFactThird = array();
431 $TFactThirdNbLines = array();
433 $nb_bills_created = 0;
439 $nbOrders = is_array($orders) ? count($orders) : 1;
442 foreach ($orders as $id_order) {
444 if ($cmd->fetch($id_order) <= 0) {
452 setEventMessages($langs->trans(
'WarningOrderNotEligibleForInvoicing', $cmd->ref),
null,
'warnings');
456 $cmd->fetch_thirdparty();
459 if (!empty($createbills_onebythird) && !empty($TFactThird[$cmd->socid])) {
462 $objecttmp = $TFactThird[$cmd->socid];
465 $objecttmp->socid = $cmd->socid;
466 $objecttmp->thirdparty = $cmd->thirdparty;
468 $objecttmp->type = $objecttmp::TYPE_STANDARD;
469 $objecttmp->cond_reglement_id = !empty($cmd->cond_reglement_id) ? $cmd->cond_reglement_id : $cmd->thirdparty->cond_reglement_id;
470 $objecttmp->mode_reglement_id = !empty($cmd->mode_reglement_id) ? $cmd->mode_reglement_id : $cmd->thirdparty->mode_reglement_id;
471 $objecttmp->demand_reason_id = !empty($cmd->demand_reason_id) ? $cmd->demand_reason_id : $cmd->thirdparty->demand_reason_id;
473 $objecttmp->fk_project = $cmd->fk_project;
474 $objecttmp->multicurrency_code = $cmd->multicurrency_code;
475 if (empty($createbills_onebythird)) {
476 $objecttmp->ref_client = $cmd->ref_client;
479 if (empty($objecttmp->note_public) &&
getDolGlobalInt(
"MAXREFONDOC", 10)>0) {
480 $objecttmp->note_public = $langs->transnoentities(
"Orders");
484 if (empty($datefacture)) {
488 $objecttmp->date = $datefacture;
489 $objecttmp->origin =
'commande';
490 $objecttmp->origin_id = (int) $id_order;
492 $objecttmp->array_options = $cmd->array_options;
494 $res = $objecttmp->create($user);
498 $lastref = $objecttmp->ref;
499 $lastid = $objecttmp->id;
501 $TFactThird[$cmd->socid] = $objecttmp;
502 $TFactThirdNbLines[$cmd->socid] = 0;
504 $langs->load(
"errors");
505 $errors[] = $cmd->ref.
' : '.$langs->trans($objecttmp->errors[0]);
510 if ($objecttmp->id > 0) {
511 $res = $objecttmp->add_object_linked($objecttmp->origin, $id_order);
514 $errors[] = $cmd->ref.
' : '.$langs->trans($objecttmp->errors[0]);
520 $cmd->fetchObjectLinked();
522 if (!$error && $cmd->id && !empty($cmd->linkedObjectsIds[
'shipping']) && is_array($cmd->linkedObjectsIds[
'shipping'])) {
523 $cmd->linked_objects = $cmd->linkedObjectsIds;
524 foreach ($cmd->linked_objects as $origin_type => $tmp_origin_id) {
526 if ($origin_type ==
'shipping') {
527 if (is_array($tmp_origin_id)) {
528 foreach ($tmp_origin_id as $origin_id) {
529 $res = $objecttmp->add_object_linked($origin_type, $origin_id);
531 $errors[] = $cmd->ref.
' : '.$langs->trans($objecttmp->errors[0]);
536 $origin_id = $tmp_origin_id;
537 $res = $objecttmp->add_object_linked($origin_type, $origin_id);
539 $errors[] = $cmd->ref.
' : '.$langs->trans($objecttmp->errors[0]);
549 $lines = $cmd->lines;
550 if (empty($lines) && method_exists($cmd,
'fetch_lines')) {
552 $lines = $cmd->lines;
556 $num = count($lines);
557 $array_options = array();
559 for ($i = 0; $i < $num; $i++) {
560 $desc = ($lines[$i]->desc ? $lines[$i]->desc :
'');
562 if (!empty($createbills_onebythird)) {
566 if ($lines[$i]->subprice < 0 && !
getDolGlobalString(
'INVOICE_KEEP_DISCOUNT_LINES_AS_IN_ORIGIN')) {
569 $discount->fk_soc = $objecttmp->socid;
570 $discount->socid = $objecttmp->socid;
571 $discount->amount_ht = abs($lines[$i]->total_ht);
572 $discount->amount_tva = abs($lines[$i]->total_tva);
573 $discount->amount_ttc = abs($lines[$i]->total_ttc);
574 $discount->tva_tx = $lines[$i]->tva_tx;
575 $discount->fk_user = $user->id;
576 $discount->description = $desc;
577 $discountid = $discount->create($user);
578 if ($discountid > 0) {
579 $result = $objecttmp->insert_discount($discountid);
588 $product_type = ($lines[$i]->product_type ? $lines[$i]->product_type : 0);
591 if ($lines[$i]->date_debut_prevue) {
594 if ($lines[$i]->date_debut_reel) {
597 if ($lines[$i]->date_start) {
602 if ($lines[$i]->date_fin_prevue) {
603 $date_end = $lines[$i]->date_fin_prevue;
605 if ($lines[$i]->date_fin_reel) {
606 $date_end = $lines[$i]->date_fin_reel;
608 if ($lines[$i]->date_end) {
609 $date_end = $lines[$i]->date_end;
612 if (($lines[$i]->product_type != 9 && empty($lines[$i]->fk_parent_line)) || $lines[$i]->product_type == 9) {
617 if (method_exists($lines[$i],
'fetch_optionals')) {
618 $lines[$i]->fetch_optionals();
619 $array_options = $lines[$i]->array_options;
622 $objecttmp->context[
'createfromclone'] =
'createfromclone';
624 $rang = ($nbOrders > 1) ? -1 : $lines[$i]->rang;
626 if (!empty($createbills_onebythird)) {
627 $TFactThirdNbLines[$cmd->socid]++;
628 $rang = $TFactThirdNbLines[$cmd->socid];
631 $result = $objecttmp->addline(
633 $lines[$i]->subprice,
636 $lines[$i]->localtax1_tx,
637 $lines[$i]->localtax2_tx,
638 $lines[$i]->fk_product,
639 $lines[$i]->remise_percent,
643 $lines[$i]->info_bits,
644 $lines[$i]->fk_remise_except,
649 $lines[$i]->special_code,
653 $lines[$i]->fk_fournprice,
662 if (!empty($lines[$i]->extraparams)) {
664 $factureLine->id = $result;
665 $factureLine->extraparams = $lines[$i]->extraparams;
666 $factureLine->setExtraParameters();
673 $errors[] = $objecttmp->error;
677 if ($result > 0 && $lines[$i]->product_type == 9) {
678 $fk_parent_line = $result;
686 $objecttmp->note_public =
dol_concatdesc($objecttmp->note_public, $langs->transnoentities($cmd->ref).(empty($cmd->ref_client) ?
'' :
' ('.$cmd->ref_client.
')'));
687 $objecttmp->update($user);
692 if (!empty($createbills_onebythird) && empty($TFactThird[$cmd->socid])) {
693 $TFactThird[$cmd->socid] = $objecttmp;
695 $TFact[$objecttmp->id] = $objecttmp;
700 $TAllFact = empty($createbills_onebythird) ? $TFact : $TFactThird;
703 if (!$error && $validate_invoices) {
704 $massaction = $action =
'builddoc';
706 foreach ($TAllFact as &$objecttmp) {
707 $result = $objecttmp->validate($user);
714 $id = $objecttmp->id;
715 $lastref = $objecttmp->ref;
719 $upload_dir =
$conf->facture->dir_output;
720 $permissiontoadd = $user->hasRight(
'facture',
'creer');
725 include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
729 $massaction = $action =
'confirm_createbills';
735 if ($nb_bills_created == 1) {
736 if (
getDolGlobalInt(
'MAIN_MASSACTION_CREATEBILLS_REDIRECT_IF_ONE') == 1) {
738 header(
'Location: '.DOL_URL_ROOT.
'/compta/facture/card.php?id='.urlencode((
string) $lastid));
741 $texttoshow = $langs->trans(
'BillXCreated',
'{s1}');
742 $texttoshow = str_replace(
'{s1}',
'<a href="'.DOL_URL_ROOT.
'/compta/facture/card.php?id='.urlencode((
string) ($lastid)).
'">'.$lastref.
'</a>', $texttoshow);
745 if (
getDolGlobalInt(
'MAIN_MASSACTION_CREATEBILLS_REDIRECT_IF_MANY') == 1) {
747 header(
"Location: ".DOL_URL_ROOT.
'/compta/facture/list.php?mainmenu=billing&leftmenu=customers_bills');
750 setEventMessages($langs->trans(
'BillCreated', $nb_bills_created),
null,
'mesgs');
756 $param .=
'&mode='.urlencode($mode);
758 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
759 $param .=
'&contextpage='.urlencode($contextpage);
761 if ($limit > 0 && $limit !=
$conf->liste_limit) {
762 $param .=
'&limit='.((int) $limit);
764 if ($optioncss !=
'') {
765 $param .=
'&optioncss='.urlencode($optioncss);
768 $param .=
'&search_all='.urlencode($search_all);
771 $param .=
'&show_files='.urlencode((
string) ($show_files));
774 $param .=
'&socid='.urlencode((
string) ($socid));
776 if ($search_status !=
'') {
777 $param .=
'&search_status='.urlencode($search_status);
779 if ($search_option) {
780 $param .=
"&search_option=".urlencode($search_option);
782 if ($search_orderday) {
783 $param .=
'&search_orderday='.urlencode($search_orderday);
785 if ($search_ordermonth) {
786 $param .=
'&search_ordermonth='.urlencode($search_ordermonth);
788 if ($search_orderyear) {
789 $param .=
'&search_orderyear='.urlencode($search_orderyear);
791 if ($search_deliveryday) {
792 $param .=
'&search_deliveryday='.urlencode($search_deliveryday);
794 if ($search_deliverymonth) {
795 $param .=
'&search_deliverymonth='.urlencode($search_deliverymonth);
797 if ($search_deliveryyear) {
798 $param .=
'&search_deliveryyear='.urlencode($search_deliveryyear);
801 $param .=
'&search_id='.urlencode((
string) $search_id);
804 $param .=
'&search_ref='.urlencode($search_ref);
806 if ($search_ref_ext) {
807 $param .=
'&search_ref_ext='.urlencode($search_ref_ext);
809 if ($search_company) {
810 $param .=
'&search_company='.urlencode($search_company);
812 if ($search_ref_customer) {
813 $param .=
'&search_ref_customer='.urlencode($search_ref_customer);
815 if ($search_user > 0) {
816 $param .=
'&search_user='.urlencode((
string) ($search_user));
818 if ($search_sale > 0) {
819 $param .=
'&search_sale='.urlencode((
string) ($search_sale));
821 if ($search_total_ht !=
'') {
822 $param .=
'&search_total_ht='.urlencode($search_total_ht);
824 if ($search_total_vat !=
'') {
825 $param .=
'&search_total_vat='.urlencode($search_total_vat);
827 if ($search_total_ttc !=
'') {
828 $param .=
'&search_total_ttc='.urlencode($search_total_ttc);
830 if ($search_project_ref >= 0) {
831 $param .=
"&search_project_ref=".urlencode($search_project_ref);
833 if ($search_project !=
'') {
834 $param .=
"&search_project=".urlencode($search_project);
836 if ($search_billed !=
'') {
837 $param .=
'&search_billed='.urlencode($search_billed);
840 header(
"Location: ".$_SERVER[
'PHP_SELF'].
'?'.$param);
846 $_GET[
"origin"] =
GETPOST(
"origin",
'alpha');
848 if (!empty($errors)) {
858if ($action ==
'validate' && $permissiontoadd && $objectclass !==
null) {
859 if (
GETPOST(
'confirm') ==
'yes') {
861 $objecttmp =
new $objectclass(
$db);
864 foreach ($toselect as $checked) {
865 if ($objecttmp->fetch($checked)) {
866 if ($objecttmp->status == $objecttmp::STATUS_DRAFT) {
867 if (!empty($objecttmp->fk_warehouse)) {
868 $idwarehouse = $objecttmp->fk_warehouse;
872 if ($objecttmp->valid($user, $idwarehouse) > 0) {
873 setEventMessages($langs->trans(
'hasBeenValidated', $objecttmp->ref),
null,
'mesgs');
879 $langs->load(
"errors");
880 setEventMessages($langs->trans(
'ErrorIsNotADraft', $objecttmp->ref),
null,
'errors');
895if ($action ==
'shipped' && $permissiontoadd && $objectclass !==
null) {
896 if (
GETPOST(
'confirm') ==
'yes') {
898 $objecttmp =
new $objectclass(
$db);
901 foreach ($toselect as $checked) {
902 if ($objecttmp->fetch($checked)) {
903 if ($objecttmp->status == $objecttmp::STATUS_VALIDATED || $objecttmp->status == $objecttmp::STATUS_SHIPMENTONPROCESS || $objecttmp->status == $objecttmp::STATUS_CLOSED) {
904 $result = $objecttmp->cloture($user);
906 setEventMessages($langs->trans(
'StatusOrderDelivered', $objecttmp->ref),
null,
'mesgs');
907 } elseif ($result < 0) {
908 setEventMessages($langs->trans(
'ErrorOrderStatusCantBeSetToDelivered'),
null,
'errors');
912 $langs->load(
"errors");
913 setEventMessages($langs->trans(
'ErrorObjectHasWrongStatus', $objecttmp->ref),
null,
'errors');
930if (!$error && $massaction ===
'setbilled' && $permissiontoclose && $objectclass !==
null) {
933 $objecttmp =
new $objectclass(
$db);
935 foreach ($toselect as $toselectid) {
936 $result = $objecttmp->fetch($toselectid);
938 $result = $objecttmp->classifyBilled($user, 0);
975$company_url_list = array();
981$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
982$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage);
984$title = $langs->trans(
"Orders");
985$help_url =
"EN:Module_Customers_Orders|FR:Module_Commandes_Clients|ES:Módulo_Pedidos_de_clientes";
990$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,';
991$sql .=
" s.parent as fk_parent,";
992$sql .=
" s2.nom as name2,";
993$sql .=
" typent.code as typent_code,";
994$sql .=
" state.code_departement as state_code, state.nom as state_name,";
995$sql .=
" country.code as country_code,";
996$sql .=
' c.rowid, c.ref, c.ref_ext, c.total_ht, c.total_tva, c.total_ttc, c.ref_client, c.fk_user_author,';
997$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,';
998$sql .=
' c.date_valid, c.date_commande, c.note_public, c.note_private, c.date_livraison as delivery_date, c.fk_statut, c.facture as billed,';
999$sql .=
' c.date_creation as date_creation, c.tms as date_modification, c.date_cloture as date_cloture,';
1000$sql .=
' c.fk_cond_reglement,c.deposit_percent,c.fk_mode_reglement,c.fk_shipping_method,';
1001$sql .=
' c.fk_input_reason, c.import_key,';
1002$sql .=
" c.module_source, c.pos_source,";
1003$sql .=
' p.rowid as project_id, p.ref as project_ref, p.title as project_label,';
1004$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';
1007if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
1008 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
1009 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
1014$parameters = array();
1015$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object, $action);
1016$sql .= $hookmanager->resPrint;
1017$sql = preg_replace(
'/,\s*$/',
'', $sql);
1021$sql .=
' FROM '.MAIN_DB_PREFIX.
'societe as s';
1022$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"societe as s2 ON s2.rowid = s.parent";
1023$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_country as country on (country.rowid = s.fk_pays)";
1024$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_typent as typent on (typent.id = s.fk_typent)";
1025$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"c_departements as state on (state.rowid = s.fk_departement)";
1026$sql .=
', '.MAIN_DB_PREFIX.
'commande as c';
1027if (!empty($extrafields->attributes[
$object->table_element][
'label']) && is_array($extrafields->attributes[
$object->table_element][
'label']) && count($extrafields->attributes[
$object->table_element][
'label'])) {
1028 $sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"commande_extrafields as ef on (c.rowid = ef.fk_object)";
1030$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"projet as p ON p.rowid = c.fk_projet";
1031$sql .=
' LEFT JOIN '.MAIN_DB_PREFIX.
'user as u ON c.fk_user_author = u.rowid';
1033$parameters = array();
1034$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object, $action);
1035$sql .= $hookmanager->resPrint;
1037$sql .=
' WHERE c.fk_soc = s.rowid';
1038$sql .=
' AND c.entity IN ('.getEntity(
'commande').
')';
1040 $sql .=
' AND s.rowid = '.((int) $socid);
1043if (empty($user->socid) && !$permissiontoreadallthirdparty) {
1044 $sql .=
" AND (".getSalesRepresentativeSqlFilter(
'c.fk_soc', (
int) $user->id);
1046 $sql .=
" OR ".getSalesRepresentativeSqlFilter(
'c.fk_soc',
$db->sanitize(implode(
',', $userschilds)));
1051if ($search_id > 0) {
1057if ($search_ref_ext) {
1060if ($search_ref_customer) {
1063if ($search_billed !=
'' && $search_billed >= 0) {
1064 $sql .=
' AND c.facture = '.((int) $search_billed);
1066if ($search_status !=
'') {
1067 if ($search_status <= 3 && $search_status >= -1) {
1068 if ($search_status == 1 && !
isModEnabled(
'shipping')) {
1069 $sql .=
' AND c.fk_statut IN (1,2)';
1071 $sql .=
' AND c.fk_statut = '.((int) $search_status);
1074 if ($search_status == -2) {
1076 $sql .=
" AND (c.fk_statut IN (1,2))";
1078 if ($search_status == -3) {
1081 $sql .=
' AND (c.fk_statut IN (1,2,3))';
1084if ($search_option ==
'late') {
1087 $sql .=
" AND ((c.date_livraison IS NOT NULL AND c.date_livraison < '".$db->idate(
dol_now() -
$conf->order->client->warning_delay).
"') OR (c.date_livraison IS NULL AND c.date_commande < '".
$db->idate(
dol_now() -
$conf->order->client->warning_delay).
"'))";
1089 $sql .=
" AND c.date_commande < '".$db->idate(
dol_now() -
$conf->order->client->warning_delay).
"'";
1092if ($search_datecloture_start) {
1093 $sql .=
" AND c.date_cloture >= '".$db->idate($search_datecloture_start).
"'";
1095if ($search_datecloture_end) {
1096 $sql .=
" AND c.date_cloture <= '".$db->idate($search_datecloture_end).
"'";
1098if ($search_dateorder_start) {
1099 $sql .=
" AND c.date_commande >= '".$db->idate($search_dateorder_start).
"'";
1101if ($search_dateorder_end) {
1102 $sql .=
" AND c.date_commande <= '".$db->idate($search_dateorder_end).
"'";
1104if ($search_datedelivery_start) {
1105 $sql .=
" AND c.date_livraison >= '".$db->idate($search_datedelivery_start).
"'";
1107if ($search_datedelivery_end) {
1108 $sql .=
" AND c.date_livraison <= '".$db->idate($search_datedelivery_end).
"'";
1119if ($search_country) {
1120 $sql .=
" AND s.fk_pays IN (".$db->sanitize($search_country).
')';
1122if ($search_type_thirdparty && $search_type_thirdparty !=
'-1') {
1123 $sql .=
" AND s.fk_typent IN (".$db->sanitize($search_type_thirdparty).
')';
1125if (empty($arrayfields[
's.name_alias'][
'checked']) && $search_company) {
1126 $sql .=
natural_search(array(
"s.nom",
"s.name_alias"), $search_company);
1128 if ($search_company) {
1131 if ($search_company_alias) {
1135if ($search_parent_name) {
1138if ($search_total_ht !=
'') {
1141if ($search_total_vat !=
'') {
1144if ($search_total_ttc !=
'') {
1147if ($search_warehouse !=
'' && $search_warehouse > 0) {
1150if ($search_note_public !=
'') {
1153if ($search_note_private !=
'') {
1156if ($search_multicurrency_code !=
'') {
1157 $sql .=
" AND c.multicurrency_code = '".$db->escape($search_multicurrency_code).
"'";
1159if ($search_multicurrency_tx !=
'') {
1160 $sql .=
natural_search(
'c.multicurrency_tx', $search_multicurrency_tx, 1);
1162if ($search_multicurrency_montant_ht !=
'') {
1163 $sql .=
natural_search(
'c.multicurrency_total_ht', $search_multicurrency_montant_ht, 1);
1165if ($search_multicurrency_montant_vat !=
'') {
1166 $sql .=
natural_search(
'c.multicurrency_total_tva', $search_multicurrency_montant_vat, 1);
1168if ($search_multicurrency_montant_ttc !=
'') {
1169 $sql .=
natural_search(
'c.multicurrency_total_ttc', $search_multicurrency_montant_ttc, 1);
1172 $sql .=
natural_search(array(
"u.login",
"u.firstname",
"u.lastname"), $search_login);
1174if ($search_project_ref !=
'') {
1177if ($search_project !=
'') {
1180if ($search_fk_cond_reglement > 0) {
1181 $sql .=
" AND c.fk_cond_reglement = ".((int) $search_fk_cond_reglement);
1183if ($search_fk_shipping_method > 0) {
1184 $sql .=
" AND c.fk_shipping_method = ".((int) $search_fk_shipping_method);
1186if ($search_fk_mode_reglement > 0) {
1187 $sql .=
" AND c.fk_mode_reglement = ".((int) $search_fk_mode_reglement);
1189if ($search_fk_input_reason > 0) {
1190 $sql .=
" AND c.fk_input_reason = ".((int) $search_fk_input_reason);
1192if ($search_module_source) {
1193 $sql .=
natural_search(
"c.module_source", $search_module_source);
1195if ($search_pos_source) {
1198if ($search_import_key) {
1202if ($search_user > 0) {
1203 $sql .=
" AND EXISTS (";
1204 $sql .=
" SELECT ec.fk_c_type_contact, ec.element_id, ec.fk_socpeople";
1205 $sql .=
" FROM ".MAIN_DB_PREFIX.
"element_contact as ec";
1206 $sql .=
" INNER JOIN ".MAIN_DB_PREFIX.
"c_type_contact as tc";
1207 $sql .=
" ON ec.fk_c_type_contact = tc.rowid AND tc.element = 'commande' AND tc.source = 'internal'";
1208 $sql .=
" WHERE ec.element_id = c.rowid AND ec.fk_socpeople = ".((int) $search_user).
")";
1211if ($search_sale && $search_sale !=
'-1') {
1212 if ($search_sale == -2) {
1213 $sql .=
" AND ".getSalesRepresentativeSqlFilter(
'c.fk_soc', 0, 1);
1214 } elseif ($search_sale > 0) {
1215 $sql .=
" AND ".getSalesRepresentativeSqlFilter(
'c.fk_soc', (
int) $search_sale);
1220if (!empty($searchCategoryOrderList)) {
1221 $searchCategoryOrderSqlList = array();
1222 $listofcategoryid =
'';
1223 foreach ($searchCategoryOrderList as $searchCategoryOrder) {
1224 if (intval($searchCategoryOrder) == -2) {
1225 $searchCategoryOrderSqlList[] =
"NOT EXISTS (SELECT ck.fk_order FROM ".MAIN_DB_PREFIX.
"categorie_order as ck WHERE c.rowid = ck.fk_order)";
1226 } elseif (intval($searchCategoryOrder) > 0) {
1227 if ($searchCategoryOrderOperator == 0) {
1228 $searchCategoryOrderSqlList[] =
" EXISTS (SELECT ck.fk_order FROM ".MAIN_DB_PREFIX.
"categorie_order as ck WHERE c.rowid = ck.fk_order AND ck.fk_categorie = ".((int) $searchCategoryOrder).
")";
1230 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryOrder);
1234 if ($listofcategoryid) {
1235 $searchCategoryOrderSqlList[] =
" EXISTS (SELECT ck.fk_order FROM ".MAIN_DB_PREFIX.
"categorie_order as ck WHERE c.rowid = ck.fk_order AND ck.fk_categorie IN (".
$db->sanitize($listofcategoryid).
"))";
1237 if ($searchCategoryOrderOperator == 1) {
1238 if (!empty($searchCategoryOrderSqlList)) {
1239 $sql .=
" AND (".implode(
' OR ', $searchCategoryOrderSqlList).
")";
1242 if (!empty($searchCategoryOrderSqlList)) {
1243 $sql .=
" AND (".implode(
' AND ', $searchCategoryOrderSqlList).
")";
1249$searchCategoryCustomerOperator =
GETPOSTINT(
'search_category_customer_operator');
1250$searchCategoryCustomerList = array($search_categ_cus);
1251if (!empty($searchCategoryCustomerList)) {
1252 $searchCategoryCustomerSqlList = array();
1253 $listofcategoryid =
'';
1254 foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
1255 if (intval($searchCategoryCustomer) == -2) {
1256 $searchCategoryCustomerSqlList[] =
"NOT EXISTS (SELECT cs.fk_soc FROM ".MAIN_DB_PREFIX.
"categorie_societe as cs WHERE s.rowid = cs.fk_soc)";
1257 } elseif (intval($searchCategoryCustomer) > 0) {
1258 if ($searchCategoryCustomerOperator == 0) {
1259 $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).
")";
1261 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryCustomer);
1265 if ($listofcategoryid) {
1266 $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).
"))";
1268 if ($searchCategoryCustomerOperator == 1) {
1269 if (!empty($searchCategoryCustomerSqlList)) {
1270 $sql .=
" AND (".implode(
' OR ', $searchCategoryCustomerSqlList).
")";
1273 if (!empty($searchCategoryCustomerSqlList)) {
1274 $sql .=
" AND (".implode(
' AND ', $searchCategoryCustomerSqlList).
")";
1279$searchCategoryProductOperator =
GETPOSTINT(
'search_category_product_operator');
1280$searchCategoryProductList = array($search_product_category);
1281if (!empty($searchCategoryProductList)) {
1282 $searchCategoryProductSqlList = array();
1283 $listofcategoryid =
'';
1284 foreach ($searchCategoryProductList as $searchCategoryProduct) {
1285 if (intval($searchCategoryProduct) == -2) {
1286 $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)";
1287 } elseif (intval($searchCategoryProduct) > 0) {
1288 if ($searchCategoryProductOperator == 0) {
1289 $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).
")";
1291 $listofcategoryid .= ($listofcategoryid ?
', ' :
'') .((
int) $searchCategoryProduct);
1295 if ($listofcategoryid) {
1296 $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).
"))";
1298 if ($searchCategoryProductOperator == 1) {
1299 if (!empty($searchCategoryProductSqlList)) {
1300 $sql .=
" AND (".implode(
' OR ', $searchCategoryProductSqlList).
")";
1303 if (!empty($searchCategoryProductSqlList)) {
1304 $sql .=
" AND (".implode(
' AND ', $searchCategoryProductSqlList).
")";
1309include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
1311$parameters = array();
1312$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
1313$sql .= $hookmanager->resPrint;
1318 $fieldstosearchallwithoutpd = array();
1319 $fieldstosearchallwithpd = array();
1320 foreach ($fieldstosearchall as $key => $val) {
1321 if (!preg_match(
'/^pd\./', $key)) {
1322 $fieldstosearchallwithoutpd[$key] = $val;
1324 $fieldstosearchallwithpd[$key] = $val;
1328 if (count($fieldstosearchallwithpd) > 0) {
1329 $sqltoadd .=
" OR EXISTS (SELECT pd.rowid FROM ".MAIN_DB_PREFIX.
"commandedet as pd WHERE pd.fk_commande = c.rowid";
1330 $sqltoadd .=
natural_search(array_keys($fieldstosearchallwithpd),
'__KEYTOSEARCH__');
1334 $sql .=
natural_search(array_keys($fieldstosearchallwithoutpd), $search_all, 0, 0, $sqltoadd);
1338$parameters = array();
1339$reshook = $hookmanager->executeHooks(
'printFieldListHaving', $parameters, $object, $action);
1340if (empty($reshook)) {
1341 $sql .= empty($hookmanager->resPrint) ?
"" :
" HAVING 1=1 ".$hookmanager->resPrint;
1343 $sql = $hookmanager->resPrint;
1348$nbtotalofrecords =
'';
1351 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
1352 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
1353 $resql =
$db->query($sqlforcount);
1355 $objforcount =
$db->fetch_object($resql);
1356 $nbtotalofrecords = $objforcount->nbtotalofrecords;
1361 if (($page * $limit) > (
int) $nbtotalofrecords) {
1369$sql .=
$db->order($sortfield, $sortorder);
1371 $sql .=
$db->plimit($limit + 1, $offset);
1375$resql =
$db->query($sql);
1383 $soc->fetch($socid);
1384 $title = $langs->trans(
'CustomersOrders').
' - '.$soc->name;
1385 if (empty($search_company)) {
1386 $search_company = $soc->name;
1389 $title = $langs->trans(
'CustomersOrders');
1391if (strval($search_status) ==
'0') {
1392 $title .=
' - '.$langs->trans(
'StatusOrderDraftShort');
1394if ($search_status == 1) {
1395 $title .=
' - '.$langs->trans(
'StatusOrderValidatedShort');
1397if ($search_status == 2) {
1398 $title .=
' - '.$langs->trans(
'StatusOrderSentShort');
1400if ($search_status == 3) {
1401 $title .=
' - '.$langs->trans(
'StatusOrderToBillShort');
1403if ($search_status == -1) {
1404 $title .=
' - '.$langs->trans(
'StatusOrderCanceledShort');
1406if ($search_status == -2) {
1407 $title .=
' - '.$langs->trans(
'StatusOrderToProcessShort');
1409if ($search_status == -3) {
1410 $title .=
' - '.$langs->trans(
'StatusOrderValidated').
', '.(!
isModEnabled(
'shipping') ?
'' : $langs->trans(
"StatusOrderSent").
', ').$langs->trans(
'StatusOrderToBill');
1412if ($search_status == -4) {
1413 $title .=
' - '.$langs->trans(
"StatusOrderValidatedShort").
'+'.$langs->trans(
"StatusOrderSentShort");
1416$num =
$db->num_rows($resql);
1418$arrayofselected = is_array($toselect) ? $toselect : array();
1420if ($num == 1 &&
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all) {
1421 $obj =
$db->fetch_object($resql);
1423 header(
"Location: ".DOL_URL_ROOT.
'/commande/card.php?id='.
$id);
1430llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'bodyforlist mod-order page-list');
1432$arrayofselected = is_array($toselect) ? $toselect : array();
1436 $param .=
'&mode='.urlencode($mode);
1438if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
1439 $param .=
'&contextpage='.urlencode($contextpage);
1441if ($limit > 0 && $limit !=
$conf->liste_limit) {
1442 $param .=
'&limit='.((int) $limit);
1444if ($optioncss !=
'') {
1445 $param .=
'&optioncss='.urlencode($optioncss);
1448 $param .=
'&show_files='.urlencode((
string) ($show_files));
1451 $param .=
'&search_all='.urlencode($search_all);
1454 $param .=
'&socid='.((int) $socid);
1456if ($search_status !=
'') {
1457 $param .=
'&search_status='.urlencode($search_status);
1459if ($search_option) {
1460 $param .=
"&search_option=".urlencode($search_option);
1462if ($search_datecloture_start) {
1463 $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');
1465if ($search_datecloture_end) {
1466 $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');
1468if ($search_dateorder_start) {
1469 $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');
1471if ($search_dateorder_end) {
1472 $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');
1474if ($search_datedelivery_start) {
1475 $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');
1477if ($search_datedelivery_end) {
1478 $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');
1481 $param .=
'&search_id='.urlencode((
string) $search_id);
1484 $param .=
'&search_ref='.urlencode($search_ref);
1486if ($search_ref_ext) {
1487 $param .=
'&search_ref_ext='.urlencode($search_ref_ext);
1489if ($search_company) {
1490 $param .=
'&search_company='.urlencode($search_company);
1492if ($search_company_alias) {
1493 $param .=
'&search_company_alias='.urlencode($search_company_alias);
1495if ($search_parent_name !=
'') {
1496 $param .=
'&search_parent_name='.urlencode($search_parent_name);
1498if ($search_ref_customer) {
1499 $param .=
'&search_ref_customer='.urlencode($search_ref_customer);
1501if ($search_user > 0) {
1502 $param .=
'&search_user='.urlencode((
string) ($search_user));
1504if ($search_sale > 0) {
1505 $param .=
'&search_sale='.urlencode((
string) ($search_sale));
1507if ($search_total_ht !=
'') {
1508 $param .=
'&search_total_ht='.urlencode($search_total_ht);
1510if ($search_total_vat !=
'') {
1511 $param .=
'&search_total_vat='.urlencode($search_total_vat);
1513if ($search_total_ttc !=
'') {
1514 $param .=
'&search_total_ttc='.urlencode($search_total_ttc);
1516if ($search_warehouse !=
'') {
1517 $param .=
'&search_warehouse='.urlencode((
string) ($search_warehouse));
1520 $param .=
'&search_login='.urlencode($search_login);
1522if ($search_multicurrency_code !=
'') {
1523 $param .=
'&search_multicurrency_code='.urlencode($search_multicurrency_code);
1525if ($search_multicurrency_tx !=
'') {
1526 $param .=
'&search_multicurrency_tx='.urlencode($search_multicurrency_tx);
1528if ($search_multicurrency_montant_ht !=
'') {
1529 $param .=
'&search_multicurrency_montant_ht='.urlencode($search_multicurrency_montant_ht);
1531if ($search_multicurrency_montant_vat !=
'') {
1532 $param .=
'&search_multicurrency_montant_vat='.urlencode($search_multicurrency_montant_vat);
1534if ($search_multicurrency_montant_ttc !=
'') {
1535 $param .=
'&search_multicurrency_montant_ttc='.urlencode($search_multicurrency_montant_ttc);
1537if ($search_project_ref >= 0) {
1538 $param .=
"&search_project_ref=".urlencode($search_project_ref);
1540if ($search_project !=
'') {
1541 $param .=
"&search_project=".urlencode($search_project);
1543if ($search_town !=
'') {
1544 $param .=
'&search_town='.urlencode($search_town);
1546if ($search_zip !=
'') {
1547 $param .=
'&search_zip='.urlencode($search_zip);
1549if ($search_state !=
'') {
1550 $param .=
'&search_state='.urlencode($search_state);
1552if ($search_country !=
'') {
1553 $param .=
'&search_country='.urlencode((
string) ($search_country));
1555if ($search_type_thirdparty && $search_type_thirdparty !=
'-1') {
1556 $param .=
'&search_type_thirdparty='.urlencode((
string) ($search_type_thirdparty));
1558if ($searchCategoryOrderOperator == 1) {
1559 $param .=
"&search_category_order_operator=".urlencode((
string) ($searchCategoryOrderOperator));
1561foreach ($searchCategoryOrderList as $searchCategoryOrder) {
1562 $param .=
"&search_category_order_list[]=".urlencode($searchCategoryOrder);
1564if ($search_product_category !=
'') {
1565 $param .=
'&search_product_category='.urlencode((
string) ($search_product_category));
1567if (($search_categ_cus > 0) || ($search_categ_cus == -2)) {
1568 $param .=
'&search_categ_cus='.urlencode((
string) ($search_categ_cus));
1570if ($search_billed !=
'') {
1571 $param .=
'&search_billed='.urlencode($search_billed);
1573if ($search_fk_cond_reglement > 0) {
1574 $param .=
'&search_fk_cond_reglement='.urlencode((
string) ($search_fk_cond_reglement));
1576if ($search_fk_shipping_method > 0) {
1577 $param .=
'&search_fk_shipping_method='.urlencode((
string) ($search_fk_shipping_method));
1579if ($search_fk_mode_reglement > 0) {
1580 $param .=
'&search_fk_mode_reglement='.urlencode((
string) ($search_fk_mode_reglement));
1582if ($search_fk_input_reason > 0) {
1583 $param .=
'&search_fk_input_reason='.urlencode((
string) ($search_fk_input_reason));
1585if ($search_module_source) {
1586 $param .=
'&search_module_source='.urlencode($search_module_source);
1588if ($search_pos_source) {
1589 $param .=
'&search_pos_source='.urlencode($search_pos_source);
1591if ($search_import_key !=
'') {
1592 $param .=
'&search_import_key='.urlencode($search_import_key);
1596include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
1599$parameters = array();
1600$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
1601$param .= $hookmanager->resPrint;
1604$arrayofmassactions = array(
1605 'generate_doc' =>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"ReGeneratePDF"),
1606 'builddoc' =>
img_picto(
'',
'pdf',
'class="pictofixedwidth"').$langs->trans(
"PDFMerge"),
1608if (
isModEnabled(
'category') && $user->hasRight(
"commande",
"lire")) {
1609 $arrayofmassactions[
'preaffecttag'] =
img_picto(
'',
'category',
'class="pictofixedwidth"').$langs->trans(
"AffectTag");
1611if ($permissiontovalidate) {
1612 $arrayofmassactions[
'prevalidate'] =
img_picto(
'',
'check',
'class="pictofixedwidth"').$langs->trans(
"Validate");
1614if ($permissiontoclose) {
1615 $arrayofmassactions[
'preshipped'] =
img_picto(
'',
'dolly',
'class="pictofixedwidth"').$langs->trans(
"ClassifyShipped");
1617if (
isModEnabled(
'invoice') && $user->hasRight(
"facture",
"creer")) {
1618 $arrayofmassactions[
'createbills'] =
img_picto(
'',
'bill',
'class="pictofixedwidth"').$langs->trans(
"CreateInvoiceForThisCustomer");
1620if ($permissiontoclose) {
1621 $arrayofmassactions[
'setbilled'] =
img_picto(
'',
'bill',
'class="pictofixedwidth"').$langs->trans(
"ClassifyBilled");
1623if ($permissiontocancel) {
1624 $arrayofmassactions[
'cancelorders'] =
img_picto(
'',
'close_title',
'class="pictofixedwidth"').$langs->trans(
"CancelOrder");
1626if (!empty($permissiontodelete)) {
1627 $arrayofmassactions[
'predelete'] =
img_picto(
'',
'delete',
'class="pictofixedwidth"').$langs->trans(
"Delete");
1629if ($permissiontosendbymail) {
1630 $arrayofmassactions[
'presend'] =
img_picto(
'',
'email',
'class="pictofixedwidth"').$langs->trans(
"SendByMail");
1632if (in_array($massaction, array(
'presend',
'predelete',
'createbills'))) {
1633 $arrayofmassactions = array();
1635$massactionbutton = $form->selectMassAction(
'', $arrayofmassactions);
1637$url = DOL_URL_ROOT.
'/commande/card.php?action=create';
1638if (!empty($socid)) {
1639 $url .=
'&socid='.$socid;
1642$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'));
1643$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'));
1644$newcardbutton .=
dolGetButtonTitle($langs->trans(
'Statistics'),
'',
'fa fa-chart-bar imgforviewmode', DOL_URL_ROOT.
'/commande/stats/index.php?'.preg_replace(
'/(&|\?)*(mode|groupby)=[^&]+/',
'', $param),
'', ($mode ==
'statistics' ? 2 : 1), array(
'morecss' =>
'reposition'));
1646$newcardbutton .=
dolGetButtonTitle($langs->trans(
'NewOrder'),
'',
'fa fa-plus-circle', $url,
'', (
int) (($contextpage ==
'orderlist' || $contextpage ==
'billableorders') && $permissiontoadd));
1649print
'<form method="POST" id="searchFormList" name="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
1650if ($optioncss !=
'') {
1651 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
1653print
'<input type="hidden" name="token" value="'.newToken().
'">';
1654print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
1655print
'<input type="hidden" name="action" value="list">';
1656print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
1657print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
1658print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
1659print
'<input type="hidden" name="search_status" value="'.$search_status.
'">';
1660print
'<input type="hidden" name="socid" value="'.$socid.
'">';
1661print
'<input type="hidden" name="page_y" value="">';
1662print
'<input type="hidden" name="mode" value="'.$mode.
'">';
1665print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'order', 0, $newcardbutton,
'', $limit, 0, 0, 1);
1667$topicmail =
"SendOrderRef";
1668$modelmail =
"order_send";
1670$trackid =
'ord'.$object->id;
1671include DOL_DOCUMENT_ROOT.
'/core/tpl/massactions_pre.tpl.php';
1673if ($massaction ==
'prevalidate') {
1674 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"ConfirmMassValidation"), $langs->trans(
"ConfirmMassValidationQuestion"),
"validate",
null,
'', 0, 200, 500, 1);
1676if ($massaction ==
'preshipped') {
1677 print $form->formconfirm($_SERVER[
"PHP_SELF"], $langs->trans(
"CloseOrder"), $langs->trans(
"ConfirmCloseOrder"),
"shipped",
null,
'', 0, 200, 500, 1);
1680if ($massaction ==
'createbills') {
1681 print
'<input type="hidden" name="massaction" value="confirm_createbills">';
1683 print
'<table class="noborder centpercent">';
1686 print $langs->trans(
'DateInvoice');
1689 print $form->selectDate(
'',
'', 0, 0, 0,
'', 1, 1);
1694 print $langs->trans(
'CreateOneBillByThird');
1697 print $form->selectyesno(
'createbills_onebythird',
getDolGlobalString(
'MAIN_ORDERLIST_CREATEBILLS_ONEBYTHIRD',
'no'), 1);
1702 print $langs->trans(
'ValidateInvoices');
1706 print $form->selectyesno(
'validate_invoices', 0, 1, 1);
1707 $langs->load(
"errors");
1708 print
' ('.$langs->trans(
"WarningAutoValNotPossibleWhenStockIsDecreasedOnInvoiceVal").
')';
1710 print $form->selectyesno(
'validate_invoices', 0, 1);
1712 if (!empty(
$conf->workflow->enabled) &&
getDolGlobalString(
'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER')) {
1713 print
' <span class="opacitymedium">'.$langs->trans(
"IfValidateInvoiceIsNoOrderStayUnbilled").
'</span>';
1715 print
' <span class="opacitymedium">'.$langs->trans(
"OptionToSetOrderBilledNotEnabled").
'</span>';
1721 print
'<div class="center">';
1722 print
'<input type="submit" class="button" id="createbills" name="createbills" value="'.$langs->trans(
'CreateInvoiceForThisCustomer').
'"> ';
1723 print
'<input type="submit" class="button button-cancel" id="cancel" name="cancel" value="'.$langs->trans(
"Cancel").
'">';
1730 foreach ($fieldstosearchall as $key => $val) {
1731 $fieldstosearchall[$key] = $langs->trans($val);
1732 $setupstring .= $key.
"=".$val.
";";
1734 print
'<!-- Search done like if MYOBJECT_QUICKSEARCH_ON_FIELDS = '.$setupstring.
' -->'.
"\n";
1735 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>';
1740if (
isModEnabled(
'category') && $user->hasRight(
'categorie',
'read')) {
1742 $moreforfilter .= $formcategory->getFilterBox(Categorie::TYPE_ORDER, $searchCategoryOrderList,
'minwidth300', $searchCategoryOrderOperator ? $searchCategoryOrderOperator : 0);
1746if ($user->hasRight(
"user",
"user",
"lire")) {
1747 $langs->load(
"commercial");
1748 $moreforfilter .=
'<div class="divsearchfield">';
1749 $tmptitle = $langs->trans(
'ThirdPartiesOfSaleRepresentative');
1750 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$formother->select_salesrepresentatives($search_sale,
'search_sale', $user, 0, $tmptitle,
'maxwidth250 widthcentpercentminusx');
1751 $moreforfilter .=
'</div>';
1754if ($user->hasRight(
"user",
"user",
"lire")) {
1755 $moreforfilter .=
'<div class="divsearchfield">';
1756 $tmptitle = $langs->trans(
'LinkedToSpecificUsers');
1757 $moreforfilter .=
img_picto($tmptitle,
'user',
'class="pictofixedwidth"').$form->select_dolusers($search_user,
'search_user', $tmptitle,
null, 0,
'',
'',
'0', 0, 0,
'', 0,
'',
'maxwidth250 widthcentpercentminusx');
1758 $moreforfilter .=
'</div>';
1762if (
isModEnabled(
'category') && $user->hasRight(
"categorie",
"lire") && ($user->hasRight(
"produit",
"lire") || $user->hasRight(
"service",
"lire"))) {
1763 include_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1764 $moreforfilter .=
'<div class="divsearchfield">';
1765 $tmptitle = $langs->trans(
'IncludingProductWithTag');
1766 $cate_arbo = $form->select_all_categories(Categorie::TYPE_PRODUCT,
'',
'parent', 0, array(), 1);
1767 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"').$form->selectarray(
'search_product_category', $cate_arbo, $search_product_category, $tmptitle, 0, 0,
'', 0, 0, 0,
'',
'maxwidth300 widthcentpercentminusx', 1);
1768 $moreforfilter .=
'</div>';
1771if (
isModEnabled(
'category') && $user->hasRight(
"categorie",
"lire")) {
1772 require_once DOL_DOCUMENT_ROOT.
'/categories/class/categorie.class.php';
1773 $moreforfilter .=
'<div class="divsearchfield">';
1774 $tmptitle = $langs->trans(
'CustomersProspectsCategoriesShort');
1775 $moreforfilter .=
img_picto($tmptitle,
'category',
'class="pictofixedwidth"').$formother->select_categories(
'customer', $search_categ_cus,
'search_categ_cus', 1, $tmptitle,
'maxwidth300 widthcentpercentminusx');
1776 $moreforfilter .=
'</div>';
1780 $moreforfilter .=
'<div class="divsearchfield">';
1781 $tmptitle = $langs->trans(
'Warehouse');
1782 $moreforfilter .=
img_picto($tmptitle,
'stock',
'class="pictofixedwidth"').$formproduct->selectWarehouses($search_warehouse,
'search_warehouse',
'', 1, 0, 0, $tmptitle, 0, 0, array(),
'maxwidth250 widthcentpercentminusx');
1783 $moreforfilter .=
'</div>';
1786$parameters = array();
1787$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
1788if (empty($reshook)) {
1789 $moreforfilter .= $hookmanager->resPrint;
1791 $moreforfilter = $hookmanager->resPrint;
1794if (!empty($moreforfilter)) {
1795 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
1796 print $moreforfilter;
1800$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
1801$htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
$conf->main_checkbox_left_column);
1802$selectedfields = ($mode !=
'kanban' ? $htmlofselectarray :
'');
1803$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
1806 $selectedfields .=
'<script>';
1807 $selectedfields .=
' $(document).ready(function() {';
1808 $selectedfields .=
' console.log("Autoclick on checkforselects");';
1809 $selectedfields .=
' $("#checkforselects").click();';
1810 $selectedfields .=
' $("#massaction").val("createbills").change();';
1811 $selectedfields .=
' });';
1812 $selectedfields .=
'</script>';
1815print
'<div class="div-table-responsive">';
1816print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
1820print
'<tr class="liste_titre_filter">';
1822if (
$conf->main_checkbox_left_column) {
1823 print
'<td class="liste_titre center maxwidthsearch actioncolumn">';
1824 $searchpicto = $form->showFilterButtons(
'left');
1830if (!empty($arrayfields[
'c.rowid'][
'checked'])) {
1831 print
'<td class="liste_titre">';
1832 print
'<input class="flat" size="6" type="text" name="search_id" value="'.dol_escape_htmltag($search_id).
'">';
1837if (!empty($arrayfields[
'c.ref'][
'checked'])) {
1838 print
'<td class="liste_titre">';
1839 print
'<input class="flat maxwidth50imp" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
1843if (!empty($arrayfields[
'c.ref_ext'][
'checked'])) {
1844 print
'<td class="liste_titre">';
1845 print
'<input class="flat maxwidth50imp" type="text" name="search_ref_ext" value="'.dol_escape_htmltag($search_ref_ext).
'">';
1849if (!empty($arrayfields[
'c.ref_client'][
'checked'])) {
1850 print
'<td class="liste_titre" align="left">';
1851 print
'<input class="flat" type="text" size="6" name="search_ref_customer" value="'.dol_escape_htmltag($search_ref_customer).
'">';
1855if (!empty($arrayfields[
'p.ref'][
'checked'])) {
1856 print
'<td class="liste_titre"><input type="text" class="flat" size="6" name="search_project_ref" value="'.dol_escape_htmltag($search_project_ref).
'"></td>';
1859if (!empty($arrayfields[
'p.title'][
'checked'])) {
1860 print
'<td class="liste_titre"><input type="text" class="flat" size="6" name="search_project" value="'.dol_escape_htmltag($search_project).
'"></td>';
1863if (!empty($arrayfields[
's.nom'][
'checked'])) {
1864 print
'<td class="liste_titre">';
1865 print
'<input class="flat maxwidth75imp" type="text" name="search_company" value="'.dol_escape_htmltag((
string) $search_company).
'"'.(!empty($user->socid) ?
" disabled" :
"").
'>';
1869if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
1870 print
'<td class="liste_titre">';
1871 print
'<input class="flat maxwidth75imp" type="text" name="search_company_alias" value="'.dol_escape_htmltag($search_company_alias).
'">';
1875if (!empty($arrayfields[
's2.nom'][
'checked'])) {
1876 print
'<td class="liste_titre">';
1877 print
'<input class="flat maxwidth100" type="text" name="search_parent_name" value="'.dol_escape_htmltag($search_parent_name).
'">';
1881if (!empty($arrayfields[
's.town'][
'checked'])) {
1882 print
'<td class="liste_titre"><input class="flat maxwidth75imp" type="text" name="search_town" value="'.dol_escape_htmltag($search_town).
'"></td>';
1885if (!empty($arrayfields[
's.zip'][
'checked'])) {
1886 print
'<td class="liste_titre"><input class="flat maxwidth50imp" type="text" name="search_zip" value="'.dol_escape_htmltag($search_zip).
'"></td>';
1889if (!empty($arrayfields[
'state.nom'][
'checked'])) {
1890 print
'<td class="liste_titre">';
1891 print
'<input class="flat maxwidth50imp" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).
'">';
1895if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
1896 print
'<td class="liste_titre" align="center">';
1897 print $form->select_country($search_country,
'search_country',
'', 0,
'minwidth100imp maxwidth100');
1901if (!empty($arrayfields[
'typent.code'][
'checked'])) {
1902 print
'<td class="liste_titre maxwidthonsmartphone center">';
1903 print $form->selectarray(
"search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 1, 0, 0,
'', 0, 0, 0,
getDolGlobalString(
'SOCIETE_SORT_ON_TYPEENT',
'ASC'),
'', 1);
1907if (!empty($arrayfields[
'c.date_commande'][
'checked'])) {
1908 print
'<td class="liste_titre center">';
1909 print
'<div class="nowrapfordate">';
1910 print $form->selectDate($search_dateorder_start ? $search_dateorder_start : -1,
'search_dateorder_start_', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1912 print
'<div class="nowrapfordate">';
1913 print $form->selectDate($search_dateorder_end ? $search_dateorder_end : -1,
'search_dateorder_end_', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1917if (!empty($arrayfields[
'c.delivery_date'][
'checked'])) {
1918 print
'<td class="liste_titre center">';
1919 print
'<div class="nowrapfordate">';
1920 print $form->selectDate($search_datedelivery_start ? $search_datedelivery_start : -1,
'search_datedelivery_start_', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
1922 print
'<div class="nowrapfordate">';
1923 print $form->selectDate($search_datedelivery_end ? $search_datedelivery_end : -1,
'search_datedelivery_end_', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
1928if (!empty($arrayfields[
'c.fk_shipping_method'][
'checked'])) {
1929 print
'<td class="liste_titre">';
1930 $form->selectShippingMethod($search_fk_shipping_method,
'search_fk_shipping_method',
'', 1,
'', 1);
1934if (!empty($arrayfields[
'c.fk_cond_reglement'][
'checked'])) {
1935 print
'<td class="liste_titre">';
1936 print $form->getSelectConditionsPaiements((
int) $search_fk_cond_reglement,
'search_fk_cond_reglement', 1, 1, 1);
1940if (!empty($arrayfields[
'c.fk_mode_reglement'][
'checked'])) {
1941 print
'<td class="liste_titre">';
1942 print $form->select_types_paiements($search_fk_mode_reglement,
'search_fk_mode_reglement',
'', 0, 1, 1, 0, -1,
'', 1);
1946if (!empty($arrayfields[
'c.fk_input_reason'][
'checked'])) {
1947 print
'<td class="liste_titre">';
1948 $form->selectInputReason($search_fk_input_reason,
'search_fk_input_reason',
'', 1,
'', 1);
1952if (!empty($arrayfields[
'c.module_source'][
'checked'])) {
1953 print
'<td class="liste_titre">';
1954 print
'<input class="flat maxwidth75" type="text" name="search_module_source" value="'.dol_escape_htmltag($search_module_source).
'">';
1958if (!empty($arrayfields[
'c.pos_source'][
'checked'])) {
1959 print
'<td class="liste_titre">';
1960 print
'<input class="flat maxwidth50" type="text" name="search_pos_source" value="'.dol_escape_htmltag($search_pos_source).
'">';
1964if (!empty($arrayfields[
'c.total_ht'][
'checked'])) {
1965 print
'<td class="liste_titre right">';
1966 print
'<input class="flat" type="text" size="4" name="search_total_ht" value="'.dol_escape_htmltag($search_total_ht).
'">';
1970if (!empty($arrayfields[
'c.total_vat'][
'checked'])) {
1971 print
'<td class="liste_titre right">';
1972 print
'<input class="flat" type="text" size="4" name="search_total_vat" value="'.dol_escape_htmltag($search_total_vat).
'">';
1976if (!empty($arrayfields[
'c.total_ttc'][
'checked'])) {
1977 print
'<td class="liste_titre right">';
1978 print
'<input class="flat" type="text" size="5" name="search_total_ttc" value="'.$search_total_ttc.
'">';
1982if (!empty($arrayfields[
'c.multicurrency_code'][
'checked'])) {
1983 print
'<td class="liste_titre">';
1984 print $form->selectMultiCurrency($search_multicurrency_code,
'search_multicurrency_code', 1);
1988if (!empty($arrayfields[
'c.multicurrency_tx'][
'checked'])) {
1989 print
'<td class="liste_titre">';
1990 print
'<input class="flat" type="text" size="4" name="search_multicurrency_tx" value="'.dol_escape_htmltag($search_multicurrency_tx).
'">';
1994if (!empty($arrayfields[
'c.multicurrency_total_ht'][
'checked'])) {
1995 print
'<td class="liste_titre right">';
1996 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_ht" value="'.dol_escape_htmltag($search_multicurrency_montant_ht).
'">';
2000if (!empty($arrayfields[
'c.multicurrency_total_vat'][
'checked'])) {
2001 print
'<td class="liste_titre right">';
2002 print
'<input class="flat" type="text" size="4" name="search_multicurrency_montant_vat" value="'.dol_escape_htmltag($search_multicurrency_montant_vat).
'">';
2006if (!empty($arrayfields[
'c.multicurrency_total_ttc'][
'checked'])) {
2007 print
'<td class="liste_titre right">';
2008 print
'<input class="flat width75" type="text" name="search_multicurrency_montant_ttc" value="'.dol_escape_htmltag($search_multicurrency_montant_ttc).
'">';
2012if (!empty($arrayfields[
'u.login'][
'checked'])) {
2013 print
'<td class="liste_titre">';
2014 print
'<input class="flat width75" type="text" name="search_login" value="'.dol_escape_htmltag($search_login).
'">';
2018if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
2019 print
'<td class="liste_titre"></td>';
2021if (!empty($arrayfields[
'total_pa'][
'checked'])) {
2022 print
'<td class="liste_titre right">';
2025if (!empty($arrayfields[
'total_margin'][
'checked'])) {
2026 print
'<td class="liste_titre right">';
2029if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
2030 print
'<td class="liste_titre right">';
2033if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
2034 print
'<td class="liste_titre right">';
2039if (!empty($arrayfields[
'c.datec'][
'checked'])) {
2040 print
'<td class="liste_titre">';
2044if (!empty($arrayfields[
'c.tms'][
'checked'])) {
2045 print
'<td class="liste_titre">';
2049if (!empty($arrayfields[
'c.date_cloture'][
'checked'])) {
2050 print
'<td class="liste_titre center">';
2051 print
'<div class="nowrapfordate">';
2052 print $form->selectDate($search_datecloture_start ? $search_datecloture_start : -1,
'search_datecloture_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
2054 print
'<div class="nowrapfordate">';
2055 print $form->selectDate($search_datecloture_end ? $search_datecloture_end : -1,
'search_datecloture_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
2060if (!empty($arrayfields[
'c.note_public'][
'checked'])) {
2061 print
'<td class="liste_titre">';
2062 print
'<input class="flat width75" type="text" name="search_note_public" value="'.dolPrintHTMLForAttribute($search_note_public).
'">';
2066if (!empty($arrayfields[
'c.note_private'][
'checked'])) {
2067 print
'<td class="liste_titre">';
2068 print
'<input class="flat width75" type="text" name="search_note_private" value="'.dolPrintHTMLForAttribute($search_note_private).
'">';
2072if (!empty($arrayfields[
'shippable'][
'checked'])) {
2073 print
'<td class="liste_titre maxwidthonsmartphone" align="center">';
2076 print
'<input type="checkbox" name="show_shippable_command" value="1"'.($show_shippable_command ?
' checked' :
'').
'>';
2077 print $langs->trans(
'ShowShippableStatus');
2079 $show_shippable_command = 1;
2085include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
2088$parameters = array(
'arrayfields' => $arrayfields);
2089$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object, $action);
2090print $hookmanager->resPrint;
2093if (!empty($arrayfields[
'c.facture'][
'checked'])) {
2094 print
'<td class="liste_titre maxwidthonsmartphone center">';
2095 print $form->selectyesno(
'search_billed', $search_billed, 1, 0, 1, 1);
2100if (!empty($arrayfields[
'c.import_key'][
'checked'])) {
2101 print
'<td class="liste_titre maxwidthonsmartphone center">';
2102 print
'<input class="flat searchstring maxwidth50" type="text" name="search_import_key" value="'.dol_escape_htmltag($search_import_key).
'">';
2107if (!empty($arrayfields[
'c.fk_statut'][
'checked'])) {
2108 print
'<td class="liste_titre center parentonrightofpage">';
2109 $liststatus = array(
2113 -2 => $langs->trans(
"StatusOrderValidatedShort").
'+'.$langs->trans(
"StatusOrderSentShort"),
2114 -3 => $langs->trans(
"StatusOrderValidatedShort").
'+'.$langs->trans(
"StatusOrderSentShort").
'+'.$langs->trans(
"StatusOrderDelivered"),
2119 print $form->selectarray(
'search_status', $liststatus, $search_status, -5, 0, 0,
'', 0, 0, 0,
'',
'search_status width100 onrightofpage', 1);
2123if (!
$conf->main_checkbox_left_column) {
2124 print
'<td class="liste_titre center maxwidthsearch">';
2125 $searchpicto = $form->showFilterButtons();
2144print
'<tr class="liste_titre">';
2147if (
$conf->main_checkbox_left_column) {
2148 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'', $param,
'', $sortfield, $sortorder,
'maxwidthsearch center ');
2151if (!empty($arrayfields[
'c.rowid'][
'checked'])) {
2152 print_liste_field_titre($arrayfields[
'c.rowid'][
'label'], $_SERVER[
"PHP_SELF"],
'c.rowid',
'', $param,
'', $sortfield, $sortorder,
'center ');
2155if (!empty($arrayfields[
'c.ref'][
'checked'])) {
2156 print_liste_field_titre($arrayfields[
'c.ref'][
'label'], $_SERVER[
"PHP_SELF"],
'c.ref',
'', $param,
'', $sortfield, $sortorder);
2159if (!empty($arrayfields[
'c.ref_ext'][
'checked'])) {
2160 print_liste_field_titre($arrayfields[
'c.ref_ext'][
'label'], $_SERVER[
"PHP_SELF"],
'c.ref_ext',
'', $param,
'', $sortfield, $sortorder);
2163if (!empty($arrayfields[
'c.ref_client'][
'checked'])) {
2164 print_liste_field_titre($arrayfields[
'c.ref_client'][
'label'], $_SERVER[
"PHP_SELF"],
'c.ref_client',
'', $param,
'', $sortfield, $sortorder);
2167if (!empty($arrayfields[
'p.ref'][
'checked'])) {
2168 print_liste_field_titre($arrayfields[
'p.ref'][
'label'], $_SERVER[
"PHP_SELF"],
"p.ref",
"", $param,
'', $sortfield, $sortorder);
2171if (!empty($arrayfields[
'p.title'][
'checked'])) {
2172 print_liste_field_titre($arrayfields[
'p.title'][
'label'], $_SERVER[
"PHP_SELF"],
"p.title",
"", $param,
'', $sortfield, $sortorder);
2175if (!empty($arrayfields[
's.nom'][
'checked'])) {
2176 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
"PHP_SELF"],
's.nom',
'', $param,
'', $sortfield, $sortorder);
2179if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
2181 print_liste_field_titre($arrayfields[
's.name_alias'][
'label'], $_SERVER[
"PHP_SELF"],
's.name_alias',
'', $param,
'', $sortfield, $sortorder);
2184if (!empty($arrayfields[
's2.nom'][
'checked'])) {
2185 print_liste_field_titre($arrayfields[
's2.nom'][
'label'], $_SERVER[
'PHP_SELF'],
's2.nom',
'', $param,
'', $sortfield, $sortorder);
2188if (!empty($arrayfields[
's.town'][
'checked'])) {
2189 print_liste_field_titre($arrayfields[
's.town'][
'label'], $_SERVER[
"PHP_SELF"],
's.town',
'', $param,
'', $sortfield, $sortorder);
2192if (!empty($arrayfields[
's.zip'][
'checked'])) {
2193 print_liste_field_titre($arrayfields[
's.zip'][
'label'], $_SERVER[
"PHP_SELF"],
's.zip',
'', $param,
'', $sortfield, $sortorder);
2196if (!empty($arrayfields[
'state.nom'][
'checked'])) {
2197 print_liste_field_titre($arrayfields[
'state.nom'][
'label'], $_SERVER[
"PHP_SELF"],
"state.nom",
"", $param,
'', $sortfield, $sortorder);
2200if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
2201 print_liste_field_titre($arrayfields[
'country.code_iso'][
'label'], $_SERVER[
"PHP_SELF"],
"country.code_iso",
"", $param,
'', $sortfield, $sortorder,
'center ');
2204if (!empty($arrayfields[
'typent.code'][
'checked'])) {
2205 print_liste_field_titre($arrayfields[
'typent.code'][
'label'], $_SERVER[
"PHP_SELF"],
"typent.code",
"", $param,
'', $sortfield, $sortorder,
'center ');
2208if (!empty($arrayfields[
'c.date_commande'][
'checked'])) {
2209 print_liste_field_titre($arrayfields[
'c.date_commande'][
'label'], $_SERVER[
"PHP_SELF"],
'c.date_commande',
'', $param,
'', $sortfield, $sortorder,
'center ');
2212if (!empty($arrayfields[
'c.delivery_date'][
'checked'])) {
2213 print_liste_field_titre($arrayfields[
'c.delivery_date'][
'label'], $_SERVER[
"PHP_SELF"],
'c.date_livraison',
'', $param,
'', $sortfield, $sortorder,
'center ');
2216if (!empty($arrayfields[
'c.fk_shipping_method'][
'checked'])) {
2217 print_liste_field_titre($arrayfields[
'c.fk_shipping_method'][
'label'], $_SERVER[
"PHP_SELF"],
"c.fk_shipping_method",
"", $param,
'', $sortfield, $sortorder);
2220if (!empty($arrayfields[
'c.fk_cond_reglement'][
'checked'])) {
2221 print_liste_field_titre($arrayfields[
'c.fk_cond_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"c.fk_cond_reglement",
"", $param,
'', $sortfield, $sortorder);
2224if (!empty($arrayfields[
'c.fk_mode_reglement'][
'checked'])) {
2225 print_liste_field_titre($arrayfields[
'c.fk_mode_reglement'][
'label'], $_SERVER[
"PHP_SELF"],
"c.fk_mode_reglement",
"", $param,
'', $sortfield, $sortorder);
2228if (!empty($arrayfields[
'c.fk_input_reason'][
'checked'])) {
2229 print_liste_field_titre($arrayfields[
'c.fk_input_reason'][
'label'], $_SERVER[
"PHP_SELF"],
"c.fk_input_reason",
"", $param,
'', $sortfield, $sortorder);
2232if (!empty($arrayfields[
'c.module_source'][
'checked'])) {
2233 print_liste_field_titre($arrayfields[
'c.module_source'][
'label'], $_SERVER[
"PHP_SELF"],
"f.module_source",
"", $param,
"", $sortfield, $sortorder);
2236if (!empty($arrayfields[
'c.pos_source'][
'checked'])) {
2237 print_liste_field_titre($arrayfields[
'c.pos_source'][
'label'], $_SERVER[
"PHP_SELF"],
"f.pos_source",
"", $param,
"", $sortfield, $sortorder);
2240if (!empty($arrayfields[
'c.total_ht'][
'checked'])) {
2241 print_liste_field_titre($arrayfields[
'c.total_ht'][
'label'], $_SERVER[
"PHP_SELF"],
'c.total_ht',
'', $param,
'', $sortfield, $sortorder,
'right ');
2244if (!empty($arrayfields[
'c.total_vat'][
'checked'])) {
2245 print_liste_field_titre($arrayfields[
'c.total_vat'][
'label'], $_SERVER[
"PHP_SELF"],
'c.total_tva',
'', $param,
'', $sortfield, $sortorder,
'right ');
2248if (!empty($arrayfields[
'c.total_ttc'][
'checked'])) {
2249 print_liste_field_titre($arrayfields[
'c.total_ttc'][
'label'], $_SERVER[
"PHP_SELF"],
'c.total_ttc',
'', $param,
'', $sortfield, $sortorder,
'right ');
2252if (!empty($arrayfields[
'c.multicurrency_code'][
'checked'])) {
2253 print_liste_field_titre($arrayfields[
'c.multicurrency_code'][
'label'], $_SERVER[
'PHP_SELF'],
'c.multicurrency_code',
'', $param,
'', $sortfield, $sortorder);
2256if (!empty($arrayfields[
'c.multicurrency_tx'][
'checked'])) {
2257 print_liste_field_titre($arrayfields[
'c.multicurrency_tx'][
'label'], $_SERVER[
'PHP_SELF'],
'c.multicurrency_tx',
'', $param,
'', $sortfield, $sortorder);
2260if (!empty($arrayfields[
'c.multicurrency_total_ht'][
'checked'])) {
2261 print_liste_field_titre($arrayfields[
'c.multicurrency_total_ht'][
'label'], $_SERVER[
'PHP_SELF'],
'c.multicurrency_total_ht',
'', $param,
'class="right"', $sortfield, $sortorder);
2264if (!empty($arrayfields[
'c.multicurrency_total_vat'][
'checked'])) {
2265 print_liste_field_titre($arrayfields[
'c.multicurrency_total_vat'][
'label'], $_SERVER[
'PHP_SELF'],
'c.multicurrency_total_tva',
'', $param,
'class="right"', $sortfield, $sortorder);
2268if (!empty($arrayfields[
'c.multicurrency_total_ttc'][
'checked'])) {
2269 print_liste_field_titre($arrayfields[
'c.multicurrency_total_ttc'][
'label'], $_SERVER[
'PHP_SELF'],
'c.multicurrency_total_ttc',
'', $param,
'class="right"', $sortfield, $sortorder);
2272if (!empty($arrayfields[
'u.login'][
'checked'])) {
2273 print_liste_field_titre($arrayfields[
'u.login'][
'label'], $_SERVER[
"PHP_SELF"],
'u.login',
'', $param,
'', $sortfield, $sortorder);
2276if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
2277 print_liste_field_titre($arrayfields[
'sale_representative'][
'label'], $_SERVER[
"PHP_SELF"],
"",
"",
"$param",
'', $sortfield, $sortorder);
2280if (!empty($arrayfields[
'total_pa'][
'checked'])) {
2281 print_liste_field_titre($arrayfields[
'total_pa'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
2284if (!empty($arrayfields[
'total_margin'][
'checked'])) {
2285 print_liste_field_titre($arrayfields[
'total_margin'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
2288if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
2289 print_liste_field_titre($arrayfields[
'total_margin_rate'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
2292if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
2293 print_liste_field_titre($arrayfields[
'total_mark_rate'][
'label'], $_SERVER[
'PHP_SELF'],
'',
'', $param,
'class="right"', $sortfield, $sortorder);
2297if (!empty($arrayfields[
'c.datec'][
'checked'])) {
2298 print_liste_field_titre($arrayfields[
'c.datec'][
'label'], $_SERVER[
"PHP_SELF"],
"c.date_creation",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
2301if (!empty($arrayfields[
'c.tms'][
'checked'])) {
2302 print_liste_field_titre($arrayfields[
'c.tms'][
'label'], $_SERVER[
"PHP_SELF"],
"c.tms",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
2305if (!empty($arrayfields[
'c.date_cloture'][
'checked'])) {
2306 print_liste_field_titre($arrayfields[
'c.date_cloture'][
'label'], $_SERVER[
"PHP_SELF"],
"c.date_cloture",
"", $param,
'', $sortfield, $sortorder,
'center nowrap ');
2309if (!empty($arrayfields[
'c.note_public'][
'checked'])) {
2310 print_liste_field_titre($arrayfields[
'c.note_public'][
'label'], $_SERVER[
"PHP_SELF"],
"c.note_public",
"", $param,
'', $sortfield, $sortorder,
'');
2313if (!empty($arrayfields[
'c.note_private'][
'checked'])) {
2314 print_liste_field_titre($arrayfields[
'c.note_private'][
'label'], $_SERVER[
"PHP_SELF"],
"c.note_private",
"", $param,
'', $sortfield, $sortorder,
'');
2317if (!empty($arrayfields[
'shippable'][
'checked'])) {
2318 print_liste_field_titre($arrayfields[
'shippable'][
'label'], $_SERVER[
"PHP_SELF"],
'',
'', $param,
'', $sortfield, $sortorder,
'center ');
2322include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
2325$parameters = array(
'arrayfields' => $arrayfields,
'param' => $param,
'sortfield' => $sortfield,
'sortorder' => $sortorder,
'totalarray' => &
$totalarray);
2326$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
2327print $hookmanager->resPrint;
2330if (!empty($arrayfields[
'c.facture'][
'checked'])) {
2331 print_liste_field_titre($arrayfields[
'c.facture'][
'label'], $_SERVER[
"PHP_SELF"],
'c.facture',
'', $param,
'', $sortfield, $sortorder,
'center ');
2335if (!empty($arrayfields[
'c.import_key'][
'checked'])) {
2336 print_liste_field_titre($arrayfields[
'c.import_key'][
'label'], $_SERVER[
"PHP_SELF"],
"c.import_key",
"", $param,
'', $sortfield, $sortorder,
'center ');
2340if (!empty($arrayfields[
'c.fk_statut'][
'checked'])) {
2341 print_liste_field_titre($arrayfields[
'c.fk_statut'][
'label'], $_SERVER[
"PHP_SELF"],
"c.fk_statut",
"", $param,
'', $sortfield, $sortorder,
'center ');
2345if (!
$conf->main_checkbox_left_column) {
2346 print_liste_field_titre($selectedfields, $_SERVER[
"PHP_SELF"],
"",
'', $param,
'', $sortfield, $sortorder,
'maxwidthsearch center ');
2353$productstat_cache = array();
2354$productstat_cachevirtual = array();
2355$getNomUrl_cache = array();
2361$with_margin_info =
false;
2363 !empty($arrayfields[
'total_pa'][
'checked'])
2364 || !empty($arrayfields[
'total_margin'][
'checked'])
2365 || !empty($arrayfields[
'total_margin_rate'][
'checked'])
2366 || !empty($arrayfields[
'total_mark_rate'][
'checked'])
2369 $with_margin_info =
true;
2381$imaxinloop = ($limit ? min($num, $limit) : $num);
2382while ($i < $imaxinloop) {
2383 $obj =
$db->fetch_object($resql);
2388 $typenArray = $formcompany->typent_array(1);
2396 $companystatic->id = $obj->socid;
2397 $companystatic->name = $obj->name;
2398 $companystatic->name_alias = $obj->alias;
2399 $companystatic->client = $obj->client;
2400 $companystatic->fournisseur = $obj->fournisseur;
2401 $companystatic->code_client = $obj->code_client;
2402 $companystatic->email = $obj->email;
2403 $companystatic->phone = $obj->phone;
2404 $companystatic->address = $obj->address;
2405 $companystatic->zip = $obj->zip;
2406 $companystatic->town = $obj->town;
2407 $companystatic->country_code = $obj->country_code;
2408 if (!isset($getNomUrl_cache[$obj->socid])) {
2409 $getNomUrl_cache[$obj->socid] = $companystatic->getNomUrl(1,
'customer', 100, 0, 1, empty($arrayfields[
's.name_alias'][
'checked']) ? 0 : 1);
2412 $generic_commande->id = $obj->rowid;
2413 $generic_commande->ref = $obj->ref;
2414 $generic_commande->status = $obj->fk_statut;
2415 $generic_commande->statut = $obj->fk_statut;
2416 $generic_commande->status = $obj->fk_statut;
2417 $generic_commande->billed = $obj->billed;
2418 $generic_commande->date =
$db->jdate($obj->date_commande);
2419 $generic_commande->delivery_date =
$db->jdate($obj->delivery_date);
2420 $generic_commande->ref_client = $obj->ref_client;
2421 $generic_commande->total_ht = $obj->total_ht;
2422 $generic_commande->total_tva = $obj->total_tva;
2423 $generic_commande->total_ttc = $obj->total_ttc;
2424 $generic_commande->note_public = $obj->note_public;
2425 $generic_commande->note_private = $obj->note_private;
2427 $generic_commande->thirdparty = $companystatic;
2430 $projectstatic->id = $obj->project_id;
2431 $projectstatic->ref = $obj->project_ref;
2432 $projectstatic->title = $obj->project_label;
2434 $marginInfo = array();
2435 if ($with_margin_info) {
2436 $generic_commande->fetch_lines();
2437 $marginInfo = $formmargin->getMarginInfosArray($generic_commande);
2438 $total_ht += $obj->total_ht;
2439 $total_margin += $marginInfo[
'total_margin'];
2442 if ($mode ==
'kanban') {
2444 print
'<tr class="trkanban"><td colspan="'.$savnbfield.
'">';
2445 print
'<div class="box-flex-container kanban">';
2450 if ($massactionbutton || $massaction) {
2452 if (in_array(
$object->id, $arrayofselected)) {
2456 print $generic_commande->getKanbanView(
'', array(
'selected' => $selected));
2457 if ($i == ($imaxinloop - 1)) {
2464 print
'<tr data-rowid="'.$object->id.
'" class="oddeven row-with-select status'.$generic_commande->status.((getDolGlobalInt(
'MAIN_FINISHED_LINES_OPACITY') == 1 && $obj->status > 1) ?
' opacitymedium' :
'').
'">';
2467 if (
$conf->main_checkbox_left_column) {
2468 print
'<td class="nowrap center">';
2469 if ($massactionbutton || $massaction) {
2471 if (in_array($obj->rowid, $arrayofselected)) {
2474 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
2483 if (!empty($arrayfields[
'c.rowid'][
'checked'])) {
2484 print
'<td class="center" data-key="id">'.$obj->rowid.
'</td>';
2491 if (!empty($arrayfields[
'c.ref'][
'checked'])) {
2492 print
'<td class="nowraponall">';
2493 $getNomUrlOption = $search_status != 2 ? 0 : $obj->fk_statut;
2499 $getNomUrlOption =
'';
2501 print $generic_commande->getNomUrl(1, $getNomUrlOption, 0, 0, 0, 1, 1);
2505 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid;
2506 print $formfile->getDocumentsLink($generic_commande->element, $filename, $filedir);
2515 if (!empty($arrayfields[
'c.ref_ext'][
'checked'])) {
2516 print
'<td class="nowrap tdoverflowmax75" title="'.dol_escape_htmltag($obj->ref_ext).
'">';
2525 if (!empty($arrayfields[
'c.ref_client'][
'checked'])) {
2526 print
'<td class="nowrap tdoverflowmax150" title="'.dol_escape_htmltag($obj->ref_client).
'">';
2535 if (!empty($arrayfields[
'p.ref'][
'checked'])) {
2536 print
'<td class="nocellnopadd nowraponall">';
2537 if ($obj->project_id > 0) {
2538 print $projectstatic->getNomUrl(1);
2547 if (!empty($arrayfields[
'p.title'][
'checked'])) {
2548 print
'<td class="nowraponall">';
2549 if ($obj->project_id > 0) {
2550 print $projectstatic->title;
2559 if (!empty($arrayfields[
's.nom'][
'checked'])) {
2560 print
'<td class="tdoverflowmax150">';
2562 print $companystatic->getNomUrl(1,
'customer', 100, 0, 1, empty($arrayfields[
's.name_alias'][
'checked']) ? 0 : 1);
2564 print $getNomUrl_cache[$obj->socid];
2569 if ($user->hasRight(
'facture',
'creer')) {
2570 if (($obj->fk_statut > 0 && $obj->fk_statut < 3) || ($obj->fk_statut == 3 && $obj->billed == 0)) {
2571 print
' <a href="'.DOL_URL_ROOT.
'/commande/list.php?socid='.$companystatic->id.
'&search_billed=0&autoselectall=1">';
2572 print
img_picto($langs->trans(
"CreateInvoiceForThisCustomer").
' : '.$companystatic->name,
'object_bill',
'hideonsmartphone').
'</a>';
2583 if (!empty($arrayfields[
's.name_alias'][
'checked'])) {
2584 print
'<td class="nocellnopadd tdoverflowmax100" title="'.dolPrintHTMLForTextArea($obj->alias).
'">';
2593 if (!empty($arrayfields[
's2.nom'][
'checked'])) {
2594 print
'<td class="tdoverflowmax200">';
2595 if ($obj->fk_parent > 0) {
2596 if (!isset($company_url_list[$obj->fk_parent])) {
2598 $res = $companyparent->fetch($obj->fk_parent);
2600 $company_url_list[$obj->fk_parent] = $companyparent->getNomUrl(1);
2603 if (isset($company_url_list[$obj->fk_parent])) {
2604 print $company_url_list[$obj->fk_parent];
2614 if (!empty($arrayfields[
's.town'][
'checked'])) {
2615 print
'<td class="tdoverflowmax100" title="'.dolPrintHTMLForTextArea($obj->town).
'">';
2624 if (!empty($arrayfields[
's.zip'][
'checked'])) {
2625 print
'<td class="tdoverflowmax100" title="'.dolPrintHTMLForTextArea($obj->zip).
'">';
2634 if (!empty($arrayfields[
'state.nom'][
'checked'])) {
2635 print
'<td class="tdoverflowmax100" title="'.dolPrintHTMLForTextArea($obj->state_name).
'">'.
dolPrintLabel($obj->state_name).
"</td>\n";
2642 if (!empty($arrayfields[
'country.code_iso'][
'checked'])) {
2643 $tmparray =
getCountry($obj->fk_pays,
'all');
2644 print
'<td class="center tdoverflowmax100" title="'.dolPrintHTMLForAttribute($tmparray[
'label']).
'">';
2653 if (!empty($arrayfields[
'typent.code'][
'checked'])) {
2654 if (!is_array($typenArray) || count($typenArray) == 0) {
2655 $typenArray = $formcompany->typent_array(1);
2657 if (!empty($obj->typent_code)) {
2658 print
'<td class="center tdoverflowmax100" title="'.dolPrintHTMLForAttribute($typenArray[$obj->typent_code]).
'">';
2659 print $typenArray[$obj->typent_code];
2661 print
'<td class="center tdoverflowmax100">';
2671 if (!empty($arrayfields[
'c.date_commande'][
'checked'])) {
2672 print
'<td class="center nowraponall">';
2675 if ($generic_commande->hasDelay()) {
2676 print
img_picto($langs->trans(
"Late").
' : '.$generic_commande->showDelay(),
"warning");
2685 if (!empty($arrayfields[
'c.delivery_date'][
'checked'])) {
2686 print
'<td class="center nowraponall">';
2695 if (!empty($arrayfields[
'c.fk_shipping_method'][
'checked'])) {
2697 $form->formSelectShippingMethod(
'', $obj->fk_shipping_method,
'none', 1);
2705 if (!empty($arrayfields[
'c.fk_cond_reglement'][
'checked'])) {
2707 $form->form_conditions_reglement($_SERVER[
'PHP_SELF'], $obj->fk_cond_reglement,
'none', 0,
'', 1, $obj->deposit_percent);
2715 if (!empty($arrayfields[
'c.fk_mode_reglement'][
'checked'])) {
2717 $form->form_modes_reglement($_SERVER[
'PHP_SELF'], $obj->fk_mode_reglement,
'none',
'', -1);
2725 if (!empty($arrayfields[
'c.fk_input_reason'][
'checked'])) {
2727 $form->formInputReason($_SERVER[
'PHP_SELF'], $obj->fk_input_reason,
'none', 0);
2735 if (!empty($arrayfields[
'c.module_source'][
'checked'])) {
2744 if (!empty($arrayfields[
'c.pos_source'][
'checked'])) {
2754 if (!empty($arrayfields[
'c.total_ht'][
'checked'])) {
2755 print
'<td class="nowraponall right"><span class="amount">'.price($obj->total_ht).
"</span></td>\n";
2763 $totalarray[
'val'][
'c.total_ht'] += $obj->total_ht;
2765 $totalarray[
'val'][
'c.total_ht'] = $obj->total_ht;
2770 if (!empty($arrayfields[
'c.total_vat'][
'checked'])) {
2771 print
'<td class="nowrap right"><span class="amount">'.price($obj->total_tva).
"</span></td>\n";
2779 $totalarray[
'val'][
'c.total_tva'] += $obj->total_tva;
2781 $totalarray[
'val'][
'c.total_tva'] = $obj->total_tva;
2786 if (!empty($arrayfields[
'c.total_ttc'][
'checked'])) {
2787 print
'<td class="nowrap right"><span class="amount">'.price($obj->total_ttc).
"</span></td>\n";
2795 $totalarray[
'val'][
'c.total_ttc'] += $obj->total_ttc;
2797 $totalarray[
'val'][
'c.total_ttc'] = $obj->total_ttc;
2802 if (!empty($arrayfields[
'c.multicurrency_code'][
'checked'])) {
2803 print
'<td class="nowrap">'.$obj->multicurrency_code.
' - '.$langs->trans(
'Currency'.$obj->multicurrency_code).
"</td>\n";
2810 if (!empty($arrayfields[
'c.multicurrency_tx'][
'checked'])) {
2811 print
'<td class="nowrap">';
2812 $form->form_multicurrency_rate($_SERVER[
'PHP_SELF'].
'?id='.$obj->rowid, $obj->multicurrency_tx,
'none', $obj->multicurrency_code);
2820 if (!empty($arrayfields[
'c.multicurrency_total_ht'][
'checked'])) {
2821 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ht).
"</span></td>\n";
2827 if (!empty($arrayfields[
'c.multicurrency_total_vat'][
'checked'])) {
2828 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_vat).
"</span></td>\n";
2834 if (!empty($arrayfields[
'c.multicurrency_total_ttc'][
'checked'])) {
2835 print
'<td class="right nowrap"><span class="amount">'.price($obj->multicurrency_total_ttc).
"</span></td>\n";
2841 $userstatic->id = $obj->fk_user_author;
2842 $userstatic->login = $obj->login;
2843 $userstatic->lastname = $obj->lastname;
2844 $userstatic->firstname = $obj->firstname;
2845 $userstatic->email = $obj->user_email;
2846 $userstatic->status = $obj->user_statut;
2847 $userstatic->entity = $obj->entity;
2848 $userstatic->photo = $obj->photo;
2849 $userstatic->office_phone = $obj->office_phone;
2850 $userstatic->office_fax = $obj->office_fax;
2851 $userstatic->user_mobile = $obj->user_mobile;
2852 $userstatic->job = $obj->job;
2853 $userstatic->gender = $obj->gender;
2856 if (!empty($arrayfields[
'u.login'][
'checked'])) {
2857 print
'<td class="tdoverflowmax125">';
2858 if ($userstatic->id) {
2859 print $userstatic->getNomUrl(-1);
2870 if (!empty($arrayfields[
'sale_representative'][
'checked'])) {
2872 if ($obj->socid > 0) {
2873 $listsalesrepresentatives = $companystatic->getSalesRepresentatives($user);
2874 if ($listsalesrepresentatives < 0) {
2877 $nbofsalesrepresentative = count($listsalesrepresentatives);
2878 if ($nbofsalesrepresentative > 6) {
2880 print $nbofsalesrepresentative;
2881 } elseif ($nbofsalesrepresentative > 0) {
2883 foreach ($listsalesrepresentatives as $val) {
2884 $userstatic->id = $val[
'id'];
2885 $userstatic->lastname = $val[
'lastname'];
2886 $userstatic->firstname = $val[
'firstname'];
2887 $userstatic->email = $val[
'email'];
2888 $userstatic->status = $val[
'statut'];
2889 $userstatic->entity = $val[
'entity'];
2890 $userstatic->photo = $val[
'photo'];
2891 $userstatic->login = $val[
'login'];
2892 $userstatic->office_phone = $val[
'office_phone'];
2893 $userstatic->office_fax = $val[
'office_fax'];
2894 $userstatic->user_mobile = $val[
'user_mobile'];
2895 $userstatic->job = $val[
'job'];
2896 $userstatic->gender = $val[
'gender'];
2898 print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1,
'', 0, 0, 12) : $userstatic->getNomUrl(-2);
2900 if ($j < $nbofsalesrepresentative) {
2917 if (!empty($arrayfields[
'total_pa'][
'checked'])) {
2918 print
'<td class="right nowrap">'.price($marginInfo[
'pa_total']).
'</td>';
2925 if (!empty($arrayfields[
'total_margin'][
'checked'])) {
2926 print
'<td class="right nowrap">'.price($marginInfo[
'total_margin']).
'</td>';
2938 $totalarray[
'val'][
'total_margin'] += $marginInfo[
'total_margin'];
2942 if (!empty($arrayfields[
'total_margin_rate'][
'checked'])) {
2943 print
'<td class="right nowrap">'.(($marginInfo[
'total_margin_rate'] ==
'') ?
'' :
price($marginInfo[
'total_margin_rate'], 0,
'', 0, 0, 2).
'%').
'</td>';
2950 if (!empty($arrayfields[
'total_mark_rate'][
'checked'])) {
2951 print
'<td class="right nowrap">'.(($marginInfo[
'total_mark_rate'] ==
'') ?
'' :
price($marginInfo[
'total_mark_rate'], 0,
'', 0, 0, 2).
'%').
'</td>';
2958 if ($i >= $imaxinloop - 1) {
2959 if (!empty($total_ht)) {
2968 if (!empty($arrayfields[
'c.datec'][
'checked'])) {
2969 print
'<td class="center nowraponall">';
2978 if (!empty($arrayfields[
'c.tms'][
'checked'])) {
2979 print
'<td class="center nowraponall">';
2980 print
dol_print_date(
$db->jdate($obj->date_modification),
'dayhour',
'tzuserrel');
2988 if (!empty($arrayfields[
'c.date_cloture'][
'checked'])) {
2989 print
'<td class="center nowraponall">';
2998 if (!empty($arrayfields[
'c.note_public'][
'checked'])) {
2999 print
'<td class="sensiblehtmlcontent maxwidth250imp classfortooltip" title="'.dolPrintHTMLForAttribute(
dolGetFirstLineOfText($obj->note_public, 20)).
'">';
3000 print
'<div class="small lineheightsmall twolinesmax-normallineheight">'.dolPrintHTML(
dolGetFirstLineOfText($obj->note_public, 5)).
'</div>';
3008 if (!empty($arrayfields[
'c.note_private'][
'checked'])) {
3009 print
'<td class="sensiblehtmlcontent maxwidth250imp classfortooltip" title="'.dolPrintHTMLForAttribute(
dolGetFirstLineOfText($obj->note_private, 20)).
'">';
3010 print
'<div class="small lineheightsmall twolinesmax-normallineheight">'.dolPrintHTML(
dolGetFirstLineOfText($obj->note_private, 5)).
'</div>';
3018 if (!empty($arrayfields[
'shippable'][
'checked'])) {
3019 print
'<td class="center">';
3020 if (!empty($show_shippable_command) &&
isModEnabled(
'stock')) {
3022 $commande->id = (int) $obj->rowid;
3023 $commande->status = (int) $obj->fk_statut;
3024 $commande->statut = (int) $obj->fk_statut;
3026 $shippableInfos = $commande->getShippableInfos();
3028 if ($shippableInfos[
'has_product']) {
3029 print
'<a href="'.DOL_URL_ROOT.
'/expedition/shipment.php?id='.(int) $obj->rowid.
'">';
3030 print $form->textwithtooltip(
'', $shippableInfos[
'textinfo'], 2, 1, $shippableInfos[
'texticon'],
'', 2);
3033 if (!empty($shippableInfos[
'warning'])) {
3035 print $form->textwithtooltip(
'', $langs->trans(
"NotEnoughForAllOrders"), 2, 1,
img_picto(
'',
'error',
'', 0, 0, 0,
'',
'2'),
'', 2);
3046 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
3048 $parameters = array(
'arrayfields' => $arrayfields,
'obj' => $obj,
'i' => $i,
'totalarray' => &
$totalarray);
3049 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object, $action);
3050 print $hookmanager->resPrint;
3053 if (!empty($arrayfields[
'c.facture'][
'checked'])) {
3054 print
'<td class="center">';
3056 print
yn($obj->billed, $langs->trans(
"Billed"));
3065 if (!empty($arrayfields[
'c.import_key'][
'checked'])) {
3066 print
'<td class="nowrap center">'.dol_escape_htmltag($obj->import_key).
'</td>';
3073 if (!empty($arrayfields[
'c.fk_statut'][
'checked'])) {
3074 print
'<td class="nowrap center">'.$generic_commande->LibStatut($obj->fk_statut, $obj->billed, 5, 1).
'</td>';
3081 if (!
$conf->main_checkbox_left_column) {
3082 print
'<td class="nowrap center">';
3083 if ($massactionbutton || $massaction) {
3085 if (in_array($obj->rowid, $arrayofselected)) {
3088 print
'<input id="cb'.$obj->rowid.
'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$obj->rowid.
'"'.($selected ?
' checked="checked"' :
'').
'>';
3098 $total += $obj->total_ht;
3099 $subtotal += $obj->total_ht;
3105include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
3110 foreach ($arrayfields as $key => $val) {
3111 if (!empty($val[
'checked'])) {
3115 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
3120$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
3121$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
3122print $hookmanager->resPrint;
3124print
'</table>'.
"\n";
3127print
'</form>'.
"\n";
3129if (in_array(
'builddoc', array_keys($arrayofmassactions)) && ($nbtotalofrecords ===
'' || $nbtotalofrecords)) {
3130 $hidegeneratedfilelistifempty = 1;
3131 if ($massaction ==
'builddoc' || $action ==
'remove_file' || $show_files) {
3132 $hidegeneratedfilelistifempty = 0;
3136 $urlsource = $_SERVER[
'PHP_SELF'].
'?sortfield='.$sortfield.
'&sortorder='.$sortorder;
3137 $urlsource .= str_replace(
'&',
'&', $param);
3139 $filedir = $diroutputmassaction;
3140 $genallowed = $permissiontoread;
3141 $delallowed = $permissiontoadd;
3143 print $formfile->showdocuments(
'massfilesarea_orders',
'', $filedir, $urlsource, 0, $delallowed,
'', 1, 1, 0, 48, 1, $param, $title,
'',
'',
'',
null, $hidegeneratedfilelistifempty);
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $object
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage customers orders.
const STATUS_SHIPMENTONPROCESS
Shipment on process.
const STATUS_CLOSED
Closed (Sent, billed or not)
const STATUS_CANCELED
Canceled status.
const STATUS_DRAFT
Draft status.
const STATUS_VALIDATED
Validated status.
Class to manage absolute discounts.
Class to manage invoices.
Class to manage invoice lines.
Class to manage products or services.
Class to manage projects.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage Dolibarr users.
getCountry($searchkey, $withcode='', $dbtouse=null, $outputlangs=null, $entconv=1, $searchlabel='')
Return country label, code or id from an id, code or label.
$date_start
Variables from include:
dol_now($mode='gmt')
Return date for now.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
dolGetFirstLineOfText($text, $nboflines=1, $charset='UTF-8')
Return first line of text.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0, $allowdash=0)
Clean a string to use it as a file name.
price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code='')
Function to format a value into an amount for visual output Function used into PDF and HTML pages.
natural_search($fields, $value, $mode=0, $nofirstand=0, $sqltoadd='')
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by the value of a given key, which produces ascending (default) or descending out...
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
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...
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
print_liste_field_titre($name, $file="", $field="", $begin="", $param="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $selectlimitsuffix=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
dolPrintHTML($s, $allowiframe=0, $moreallowedtags=array())
Return a string (that can be on several lines) ready to be output on a HTML page.
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.
dolPrintLabel($s, $escapeonlyhtmltags=0)
Return a string label (so on 1 line only and that should not contains any HTML) ready to be output on...
yn($yesno, $format=1, $color=0)
Return yes or no in current language.
dolGetButtonTitleSeparator($moreClass="")
Add space between dolGetButtonTitle.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
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...
print $langs trans("Show") . '< td style="' . $timeColor . '" align="center"> s</td > badge status0 badge status4 badge status3 Error badge status8< td align="center">< span class="badge ' . $badge . '"></span ></td >< td align="center">< a href="#" class="button button-small" onclick="openLogModal(this)" data-req="' . dol_escape_htmltag($reqSafe) . '" data-res="' . dol_escape_htmltag($resSafe) . '" data-err="' . dol_escape_htmltag($errSafe) . '">< span class="fa fa-search-plus"></span ></a ></td ></tr >< tr >< td colspan="' . $colspan . '" class="opacitymedium"></td ></tr ></table ></div ></form > logModal none logModal none s a JSON string
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.