36require
'../../main.inc.php';
44require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture-rec.class.php';
45require_once DOL_DOCUMENT_ROOT.
'/product/class/product.class.php';
46require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
47require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
48require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
49require_once DOL_DOCUMENT_ROOT.
'/core/class/doleditor.class.php';
50require_once DOL_DOCUMENT_ROOT.
'/core/lib/invoice.lib.php';
51require_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
52require_once DOL_DOCUMENT_ROOT.
'/core/class/extrafields.class.php';
55$langs->loadLangs(array(
'companies',
'bills',
'compta',
'admin',
'other'));
57$search_all = trim(
GETPOST(
'search_all',
'alphanohtml'));
59$action =
GETPOST(
'action',
'alpha');
60$massaction =
GETPOST(
'massaction',
'alpha');
62$confirm =
GETPOST(
'confirm',
'alpha');
63$cancel =
GETPOST(
'cancel',
'alpha');
64$toselect =
GETPOST(
'toselect',
'array:int');
65$contextpage =
GETPOST(
'contextpage',
'aZ') ?
GETPOST(
'contextpage',
'aZ') :
'invoicetemplatelist';
66$optioncss =
GETPOST(
'optioncss',
'aZ');
68$groupby =
GETPOST(
'groupby',
'aZ09');
76 $socid = $user->socid;
78$objecttype =
'facture_rec';
79if ($action ==
"create" || $action ==
"add") {
83$search_ref =
GETPOST(
'search_ref');
84$search_societe =
GETPOST(
'search_societe');
85$search_montant_ht =
GETPOST(
'search_montant_ht');
86$search_montant_vat =
GETPOST(
'search_montant_vat');
87$search_montant_ttc =
GETPOST(
'search_montant_ttc');
88$search_payment_mode =
GETPOST(
'search_payment_mode');
89$search_payment_term =
GETPOST(
'search_payment_term');
90$search_date_startday =
GETPOSTINT(
'search_date_startday');
91$search_date_startmonth =
GETPOSTINT(
'search_date_startmonth');
92$search_date_startyear =
GETPOSTINT(
'search_date_startyear');
93$search_date_endday =
GETPOSTINT(
'search_date_endday');
94$search_date_endmonth =
GETPOSTINT(
'search_date_endmonth');
95$search_date_endyear =
GETPOSTINT(
'search_date_endyear');
96$search_date_start =
dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear);
97$search_date_end =
dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
98$search_date_when_startday =
GETPOSTINT(
'search_date_when_startday');
99$search_date_when_startmonth =
GETPOSTINT(
'search_date_when_startmonth');
100$search_date_when_startyear =
GETPOSTINT(
'search_date_when_startyear');
101$search_date_when_endday =
GETPOSTINT(
'search_date_when_endday');
102$search_date_when_endmonth =
GETPOSTINT(
'search_date_when_endmonth');
103$search_date_when_endyear =
GETPOSTINT(
'search_date_when_endyear');
104$search_date_when_start =
dol_mktime(0, 0, 0, $search_date_when_startmonth, $search_date_when_startday, $search_date_when_startyear);
105$search_date_when_end =
dol_mktime(23, 59, 59, $search_date_when_endmonth, $search_date_when_endday, $search_date_when_endyear);
106$search_recurring =
GETPOST(
'search_recurring',
'intcomma');
107$search_frequency =
GETPOST(
'search_frequency',
'alpha');
108$search_unit_frequency =
GETPOST(
'search_unit_frequency',
'alpha');
109$search_nb_gen_done =
GETPOST(
'search_nb_gen_done',
'alpha');
110$search_status =
GETPOST(
'search_status',
'intcomma');
113$sortfield =
GETPOST(
'sortfield',
'aZ09comma');
114$sortorder =
GETPOST(
'sortorder',
'aZ09comma');
116if (empty($page) || $page < 0 ||
GETPOST(
'button_search',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
120$offset = $limit * $page;
121$pageprev = $page - 1;
122$pagenext = $page + 1;
129$fieldstosearchall = array(
131 's.nom' =>
"ThirdParty",
132 's.code_client' =>
"CustomerCodeShort",
133 'fdc.description' =>
'Description',
136if (($id > 0 || $ref) && $action !=
'create' && $action !=
'add') {
137 $ret =
$object->fetch($id, $ref);
144$hookmanager->initHooks(array(
'invoicereclist'));
147$extrafields->fetch_name_optionals_label(
$object->table_element);
149$search_array_options = $extrafields->getOptionalsFromPost(
$object->table_element,
'',
'search_');
156 $sortfield =
'f.titre';
160 'f.titre' => array(
'label' =>
"Ref",
'checked' =>
'1'),
161 's.nom' => array(
'label' =>
"ThirdParty",
'checked' =>
'1'),
162 'f.total_ht' => array(
'label' =>
"AmountHT",
'checked' =>
'1'),
163 'f.total_tva' => array(
'label' =>
"AmountVAT",
'checked' =>
'-1'),
164 'f.total_ttc' => array(
'label' =>
"AmountTTC",
'checked' =>
'1'),
165 'f.fk_mode_reglement' => array(
'label' =>
"PaymentMode",
'checked' =>
'0'),
166 'f.fk_cond_reglement' => array(
'label' =>
"PaymentTerm",
'checked' =>
'0'),
167 'recurring' => array(
'label' =>
"RecurringInvoice",
'checked' =>
'1'),
168 'f.frequency' => array(
'label' =>
"Frequency",
'checked' =>
'1'),
169 'f.unit_frequency' => array(
'label' =>
"FrequencyUnit",
'checked' =>
'1'),
170 'f.nb_gen_done' => array(
'label' =>
"NbOfGenerationDoneShort",
'checked' =>
'1'),
171 'f.date_last_gen' => array(
'label' =>
"DateLastGenerationShort",
'checked' =>
'1'),
172 'f.date_when' => array(
'label' =>
"NextDateToExecutionShort",
'checked' =>
'1'),
173 'f.fk_user_author' => array(
'label' =>
"UserCreation",
'checked' =>
'0',
'position' => 500),
174 'f.fk_user_modif' => array(
'label' =>
"UserModification",
'checked' =>
'0',
'position' => 505),
175 'f.datec' => array(
'label' =>
"DateCreation",
'checked' =>
'0',
'position' => 520),
176 'f.tms' => array(
'label' =>
"DateModificationShort",
'checked' =>
'0',
'position' => 525),
177 'status' => array(
'label' =>
"Status",
'checked' =>
'1',
'position' => 1000),
180include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_array_fields.tpl.php';
187 $res = $tmpthirdparty->fetch($socid);
189 $search_societe = $tmpthirdparty->name;
193$objecttype =
'facture_rec';
195$permissiontoread = $user->hasRight(
"facture",
"read");
196$permissionnote = $user->hasRight(
'facture',
'creer');
197$permissiondellink = $user->hasRight(
'facture',
'creer');
198$permissiontoedit = $user->hasRight(
'facture',
'creer');
199$permissiontodelete = $user->hasRight(
"facture",
"delete");
201$uploaddir =
$conf->facture->dir_output;
211if (
GETPOST(
'cancel',
'alpha')) {
215if (!
GETPOST(
'confirmmassaction',
'alpha') && $massaction !=
'presend' && $massaction !=
'confirm_presend') {
219$parameters = array(
'arrayfields' => &$arrayfields,
'socid' => $socid);
220$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
225if (empty($reshook)) {
231 include DOL_DOCUMENT_ROOT.
'/core/actions_changeselectedfields.inc.php';
234 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
236 $search_societe =
'';
237 $search_montant_ht =
'';
238 $search_montant_vat =
'';
239 $search_montant_ttc =
'';
240 $search_payment_mode =
'';
241 $search_payment_term =
'';
242 $search_date_startday =
'';
243 $search_date_startmonth =
'';
244 $search_date_startyear =
'';
245 $search_date_endday =
'';
246 $search_date_endmonth =
'';
247 $search_date_endyear =
'';
248 $search_date_start =
'';
249 $search_date_end =
'';
250 $search_date_when_startday =
'';
251 $search_date_when_startmonth =
'';
252 $search_date_when_startyear =
'';
253 $search_date_when_endday =
'';
254 $search_date_when_endmonth =
'';
255 $search_date_when_endyear =
'';
256 $search_date_when_start =
'';
257 $search_date_when_end =
'';
258 $search_recurring =
'';
259 $search_frequency =
'';
260 $search_unit_frequency =
'';
261 $search_nb_gen_done =
'';
265 $search_array_options = array();
267 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')
268 ||
GETPOST(
'button_search_x',
'alpha') ||
GETPOST(
'button_search.x',
'alpha') ||
GETPOST(
'button_search',
'alpha')) {
295$title = $langs->trans(
"RepeatableInvoices");
300$today =
dol_mktime(23, 59, 59, $tmparray[
'mon'], $tmparray[
'mday'], $tmparray[
'year']);
305$sql =
"SELECT s.nom as name, s.rowid as socid, f.rowid as facid, f.entity, f.titre as title, f.total_ht, f.total_tva, f.total_ttc, f.frequency, f.unit_frequency,";
306$sql .=
" f.nb_gen_done, f.nb_gen_max, f.date_last_gen, f.date_when, f.suspended,";
307$sql .=
" f.datec, f.fk_user_author, f.tms, f.fk_user_modif,";
308$sql .=
" f.fk_cond_reglement, f.fk_mode_reglement";
310if (!empty($extrafields->attributes[
$object->table_element][
'label'])) {
311 foreach ($extrafields->attributes[
$object->table_element][
'label'] as $key => $val) {
312 $sql .= ($extrafields->attributes[
$object->table_element][
'type'][$key] !=
'separate' ?
", ef.".$key.
" as options_".$key :
'');
316$parameters = array();
317$reshook = $hookmanager->executeHooks(
'printFieldListSelect', $parameters, $object);
318$sql .= $hookmanager->resPrint;
319$sql = preg_replace(
'/,\s*$/',
'', $sql);
323$sql .=
" FROM ".MAIN_DB_PREFIX.
"societe as s, ".MAIN_DB_PREFIX.
"facture_rec as f";
324$sql .=
" LEFT JOIN ".MAIN_DB_PREFIX.
"facture_rec_extrafields as ef ON ef.fk_object = f.rowid";
325if (!$user->hasRight(
'societe',
'client',
'voir')) {
326 $sql .=
", ".MAIN_DB_PREFIX.
"societe_commerciaux as sc";
329$parameters = array();
330$reshook = $hookmanager->executeHooks(
'printFieldListFrom', $parameters, $object);
331$sql .= $hookmanager->resPrint;
333$sql .=
" WHERE f.fk_soc = s.rowid";
334$sql .=
' AND f.entity IN ('.getEntity(
'invoice').
')';
335if (!$user->hasRight(
"societe",
"client",
"voir") && !$socid) {
336 $sql .=
" AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
342 $sql .=
' AND s.rowid = '.(int) $socid;
344if ($search_societe) {
347if ($search_montant_ht !=
'') {
350if ($search_montant_vat !=
'') {
353if ($search_montant_ttc !=
'') {
356if (!empty($search_payment_mode) && $search_payment_mode !=
'-1') {
357 $sql .=
natural_search(
'f.fk_mode_reglement', $search_payment_mode, 1);
359if (!empty($search_payment_term) && $search_payment_term !=
'-1') {
360 $sql .=
natural_search(
'f.fk_cond_reglement', $search_payment_term, 1);
362if ($search_recurring ==
'1') {
363 $sql .=
' AND f.frequency > 0';
365if ($search_recurring ==
'0') {
366 $sql .=
' AND (f.frequency IS NULL or f.frequency = 0)';
368if ($search_frequency !=
'') {
371if ($search_unit_frequency !=
'') {
372 $sql .=
' AND f.frequency > 0';
373 $sql .=
natural_search(
'f.unit_frequency', $search_unit_frequency);
375if ($search_nb_gen_done !=
'') {
378if ($search_status !=
'' && $search_status >= -1) {
379 if ($search_status == 0) {
380 $sql .=
' AND frequency = 0 AND suspended = 0';
382 if ($search_status == 1) {
383 $sql .=
' AND frequency != 0 AND suspended = 0';
385 if ($search_status == -1) {
386 $sql .=
' AND suspended = 1';
389if ($search_date_start) {
390 $sql .=
" AND f.date_last_gen >= '".$db->idate($search_date_start).
"'";
392if ($search_date_end) {
393 $sql .=
" AND f.date_last_gen <= '".$db->idate($search_date_end).
"'";
395if ($search_date_when_start) {
396 $sql .=
" AND f.date_when >= '".$db->idate($search_date_when_start).
"'";
398if ($search_date_when_end) {
399 $sql .=
" AND f.date_when <= '".$db->idate($search_date_when_end).
"'";
402include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_sql.tpl.php';
405$parameters = array();
406$reshook = $hookmanager->executeHooks(
'printFieldListWhere', $parameters, $object, $action);
407$sql .= $hookmanager->resPrint;
410 $sql .=
" AND EXISTS (SELECT fdc.rowid FROM ".MAIN_DB_PREFIX.
"facturedet_rec as fdc WHERE f.rowid = fdc.fk_facture ".
natural_search(array_keys($fieldstosearchall), $search_all).
")";
414$nbtotalofrecords =
'';
417 $sqlforcount = preg_replace(
'/^'.preg_quote($sqlfields,
'/').
'/',
'SELECT COUNT(*) as nbtotalofrecords', $sql);
418 $sqlforcount = preg_replace(
'/GROUP BY .*$/',
'', $sqlforcount);
419 $resql =
$db->query($sqlforcount);
421 $objforcount =
$db->fetch_object($resql);
422 $nbtotalofrecords = $objforcount->nbtotalofrecords;
427 if (($page * $limit) > (
int) $nbtotalofrecords) {
434$tmpsortfield = $sortfield;
435if ($tmpsortfield ==
'recurring') {
436 $tmpsortfield =
'f.frequency';
440$sql .=
$db->order($tmpsortfield, $sortorder);
442 $sql .=
$db->plimit($limit + 1, $offset);
445$resql =
$db->query($sql);
451$num =
$db->num_rows($resql);
453if ($num == 1 &&
getDolGlobalString(
'MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE') && $search_all) {
454 $obj =
$db->fetch_object($resql);
456 header(
"Location: ".DOL_URL_ROOT.
'/compta/facture/card-rec.php?facid='.$id);
463llxHeader(
'', $title, $help_url,
'', 0, 0, $morejs, $morecss,
'',
'bodyforlist');
465$arrayofselected = is_array($toselect) ? $toselect : array();
469 $param .=
'&mode='.urlencode($mode);
471if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
472 $param .=
'&contextpage='.urlencode($contextpage);
474if ($limit > 0 && $limit !=
$conf->liste_limit) {
475 $param .=
'&limit='.((int) $limit);
477if ($optioncss !=
'') {
478 $param .=
'&optioncss='.urlencode($optioncss);
481 $param .=
'&groupby='.urlencode($groupby);
484 $param .=
'&search_all='.urlencode($search_all);
487 $param .=
'&socid='.urlencode((
string) ($socid));
489if ($search_date_startday) {
490 $param .=
'&search_date_startday='.urlencode((
string) ($search_date_startday));
492if ($search_date_startmonth) {
493 $param .=
'&search_date_startmonth='.urlencode((
string) ($search_date_startmonth));
495if ($search_date_startyear) {
496 $param .=
'&search_date_startyear='.urlencode((
string) ($search_date_startyear));
498if ($search_date_endday) {
499 $param .=
'&search_date_endday='.urlencode((
string) ($search_date_endday));
501if ($search_date_endmonth) {
502 $param .=
'&search_date_endmonth='.urlencode((
string) ($search_date_endmonth));
504if ($search_date_endyear) {
505 $param .=
'&search_date_endyear='.urlencode((
string) ($search_date_endyear));
507if ($search_date_when_startday) {
508 $param .=
'&search_date_when_startday='.urlencode((
string) ($search_date_when_startday));
510if ($search_date_when_startmonth) {
511 $param .=
'&search_date_when_startmonth='.urlencode((
string) ($search_date_when_startmonth));
513if ($search_date_when_startyear) {
514 $param .=
'&search_date_when_startyear='.urlencode((
string) ($search_date_when_startyear));
516if ($search_date_when_endday) {
517 $param .=
'&search_date_when_endday='.urlencode((
string) ($search_date_when_endday));
519if ($search_date_when_endmonth) {
520 $param .=
'&search_date_when_endmonth='.urlencode((
string) ($search_date_when_endmonth));
522if ($search_date_when_endyear) {
523 $param .=
'&search_date_when_endyear='.urlencode((
string) ($search_date_when_endyear));
526 $param .=
'&search_ref='.urlencode($search_ref);
528if ($search_societe) {
529 $param .=
'&search_societe='.urlencode($search_societe);
531if ($search_montant_ht !=
'') {
532 $param .=
'&search_montant_ht='.urlencode($search_montant_ht);
534if ($search_montant_vat !=
'') {
535 $param .=
'&search_montant_vat='.urlencode($search_montant_vat);
537if ($search_montant_ttc !=
'') {
538 $param .=
'&search_montant_ttc='.urlencode($search_montant_ttc);
540if ($search_payment_mode !=
'') {
541 $param .=
'&search_payment_mode='.urlencode($search_payment_mode);
543if ($search_payment_term !=
'') {
544 $param .=
'&search_payment_term='.urlencode($search_payment_term);
546if ($search_recurring !=
'' && $search_recurring !=
'-1') {
547 $param .=
'&search_recurring='.urlencode($search_recurring);
549if ($search_frequency > 0) {
550 $param .=
'&search_frequency='.urlencode($search_frequency);
552if ($search_unit_frequency !=
'') {
553 $param .=
'&search_unit_frequency='.urlencode($search_unit_frequency);
555if ($search_nb_gen_done !=
'') {
556 $param .=
'&search_nb_gen_done='.urlencode($search_nb_gen_done);
558if ($search_status !=
'') {
559 $param .=
'&search_status='.urlencode($search_status);
562include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_param.tpl.php';
564$parameters = array(
'param' => &$param);
565$reshook = $hookmanager->executeHooks(
'printFieldListSearchParam', $parameters, $object, $action);
566$param .= $hookmanager->resPrint;
569$arrayofmassactions = array(
576$massactionbutton = $form->selectMassAction(
'', $massaction ==
'presend' ? array() : array(
'presend' => $langs->trans(
"SendByMail"),
'builddoc' => $langs->trans(
"PDFMerge")));
578$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
579$htmlofselectarray = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
$conf->main_checkbox_left_column);
580$selectedfields = ($mode !=
'kanban' ? $htmlofselectarray :
'');
583print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">'.
"\n";
584if ($optioncss !=
'') {
585 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
587print
'<input type="hidden" name="token" value="'.newToken().
'">';
588print
'<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
589print
'<input type="hidden" name="action" value="list">';
590print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
591print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
592print
'<input type="hidden" name="page" value="'.$page.
'">';
593print
'<input type="hidden" name="contextpage" value="'.$contextpage.
'">';
594print
'<input type="hidden" name="page_y" value="">';
595print
'<input type="hidden" name="mode" value="'.$mode.
'">';
598print_barre_liste($title, $page, $_SERVER[
"PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords,
'bill', 0,
'',
'', $limit, 0, 0, 1);
600print
'<div class="info">'.$langs->trans(
"ToCreateAPredefinedInvoice", $langs->transnoentitiesnoconv(
"ChangeIntoRepeatableInvoice")).
'</div>';
603 foreach ($fieldstosearchall as $key => $val) {
604 $fieldstosearchall[$key] = $langs->trans($val);
606 print
'<div class="divsearchfieldfilter">'.$langs->trans(
"FilterOnInto", $search_all).implode(
', ', $fieldstosearchall).
'</div>';
613$parameters = array();
614$reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters, $object, $action);
615if (empty($reshook)) {
616 $moreforfilter .= $hookmanager->resPrint;
618 $moreforfilter = $hookmanager->resPrint;
621if (!empty($moreforfilter)) {
622 print
'<div class="liste_titre liste_titre_bydiv centpercent">';
623 print $moreforfilter;
627$varpage = empty($contextpage) ? $_SERVER[
"PHP_SELF"] : $contextpage;
628$selectedfields = $form->multiSelectArrayWithCheckbox(
'selectedfields', $arrayfields, $varpage,
$conf->main_checkbox_left_column);
629$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons(
'checkforselect', 1) :
'');
631print
'<div class="div-table-responsive">';
632print
'<table class="tagtable nobottomiftotal liste'.($moreforfilter ?
" listwithfilterbefore" :
"").
'">'.
"\n";
637print
'<tr class="liste_titre_filter">';
639if (
$conf->main_checkbox_left_column) {
640 print
'<td class="liste_titre center maxwidthsearch">';
641 $searchpicto = $form->showFilterButtons(
'left');
646if (!empty($arrayfields[
'f.titre'][
'checked'])) {
647 print
'<td class="liste_titre left">';
648 print
'<input class="flat maxwidth100" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).
'">';
652if (!empty($arrayfields[
's.nom'][
'checked'])) {
653 print
'<td class="liste_titre left"><input class="flat" type="text" size="8" name="search_societe" value="'.dol_escape_htmltag((
string) $search_societe).
'"></td>';
655if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
657 print
'<td class="liste_titre right">';
658 print
'<input class="flat width50" type="text"" name="search_montant_ht" value="'.dol_escape_htmltag($search_montant_ht).
'">';
661if (!empty($arrayfields[
'f.total_tva'][
'checked'])) {
663 print
'<td class="liste_titre right">';
664 print
'<input class="flat width50" type="text" name="search_montant_vat" value="'.dol_escape_htmltag($search_montant_vat).
'">';
667if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
669 print
'<td class="liste_titre right">';
670 print
'<input class="flat width50" type="text" name="search_montant_ttc" value="'.dol_escape_htmltag($search_montant_ttc).
'">';
673if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
675 print
'<td class="liste_titre">';
676 print $form->getSelectConditionsPaiements((
int) $search_payment_term,
'search_payment_term', -1, 1, 1,
'maxwidth100');
679if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
681 print
'<td class="liste_titre">';
682 print $form->select_types_paiements($search_payment_mode,
'search_payment_mode',
'', 0, 1, 1, 0, 1,
'maxwidth100', 1);
685if (!empty($arrayfields[
'recurring'][
'checked'])) {
687 print
'<td class="liste_titre center">';
688 print $form->selectyesno(
'search_recurring', $search_recurring, 1,
false, 1);
691if (!empty($arrayfields[
'f.frequency'][
'checked'])) {
693 print
'<td class="liste_titre center">';
694 print
'<input class="flat" type="text" size="1" name="search_frequency" value="'.dol_escape_htmltag($search_frequency).
'">';
697if (!empty($arrayfields[
'f.unit_frequency'][
'checked'])) {
699 print
'<td class="liste_titre center">';
700 print
'<input class="flat" type="text" size="1" name="search_unit_frequency" value="'.dol_escape_htmltag($search_unit_frequency).
'">';
703if (!empty($arrayfields[
'f.nb_gen_done'][
'checked'])) {
705 print
'<td class="liste_titre" align="center">';
706 print
'<input class="flat" type="text" size="1" name="search_nb_gen_done" value="'.dol_escape_htmltag($search_nb_gen_done).
'">';
710if (!empty($arrayfields[
'f.date_last_gen'][
'checked'])) {
711 print
'<td class="liste_titre center">';
712 print
'<div class="nowrapfordate">';
713 print $form->selectDate($search_date_start ? $search_date_start : -1,
'search_date_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
715 print
'<div class="nowrapfordate">';
716 print $form->selectDate($search_date_end ? $search_date_end : -1,
'search_date_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
721if (!empty($arrayfields[
'f.date_when'][
'checked'])) {
722 print
'<td class="liste_titre center">';
723 print
'<div class="nowrapfordate">';
724 print $form->selectDate($search_date_when_start ? $search_date_when_start : -1,
'search_date_when_start', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'From'));
726 print
'<div class="nowrapfordate">';
727 print $form->selectDate($search_date_when_end ? $search_date_when_end : -1,
'search_date_when_end', 0, 0, 1,
'', 1, 0, 0,
'',
'',
'',
'', 1,
'', $langs->trans(
'to'));
732include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_input.tpl.php';
735$parameters = array(
'arrayfields' => $arrayfields);
736$reshook = $hookmanager->executeHooks(
'printFieldListOption', $parameters, $object);
737print $hookmanager->resPrint;
739if (!empty($arrayfields[
'f.fk_user_author'][
'checked'])) {
740 print
'<td class="liste_titre">';
744if (!empty($arrayfields[
'f.fk_user_modif'][
'checked'])) {
745 print
'<td class="liste_titre">';
749if (!empty($arrayfields[
'f.datec'][
'checked'])) {
750 print
'<td class="liste_titre">';
754if (!empty($arrayfields[
'f.tms'][
'checked'])) {
755 print
'<td class="liste_titre">';
759if (!empty($arrayfields[
'status'][
'checked'])) {
760 print
'<td class="liste_titre center minwidth75imp parentonrightofpage">';
762 0 => $langs->trans(
"Draft"),
763 1 => $langs->trans(
"Active"),
764 -1 => $langs->trans(
"Disabled"),
767 print $form->selectarray(
'search_status', $liststatus, $search_status, -2, 0, 0,
'', 0, 0, 0,
'',
'width100 onrightofpage');
771if (!
$conf->main_checkbox_left_column) {
772 print
'<td class="liste_titre center maxwidthsearch">';
773 $searchpicto = $form->showFilterButtons();
784print
'<tr class="liste_titre">';
786if (
$conf->main_checkbox_left_column) {
787 print
getTitleFieldOfList(($mode !=
'kanban' ? $selectedfields :
''), 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
790if (!empty($arrayfields[
'f.titre'][
'checked'])) {
792 print_liste_field_titre($arrayfields[
'f.titre'][
'label'], $_SERVER[
'PHP_SELF'],
"f.titre",
"", $param,
"", $sortfield, $sortorder);
795if (!empty($arrayfields[
's.nom'][
'checked'])) {
796 print_liste_field_titre($arrayfields[
's.nom'][
'label'], $_SERVER[
'PHP_SELF'],
"s.nom",
"", $param,
"", $sortfield, $sortorder);
799if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
800 print_liste_field_titre($arrayfields[
'f.total_ht'][
'label'], $_SERVER[
'PHP_SELF'],
"f.total_ht",
"", $param,
'', $sortfield, $sortorder,
'right ');
803if (!empty($arrayfields[
'f.total_tva'][
'checked'])) {
804 print_liste_field_titre($arrayfields[
'f.total_tva'][
'label'], $_SERVER[
'PHP_SELF'],
"f.total_tva",
"", $param,
'', $sortfield, $sortorder,
'right ');
807if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
808 print_liste_field_titre($arrayfields[
'f.total_ttc'][
'label'], $_SERVER[
'PHP_SELF'],
"f.total_ttc",
"", $param,
'', $sortfield, $sortorder,
'right ');
811if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
812 print_liste_field_titre($arrayfields[
'f.fk_cond_reglement'][
'label'], $_SERVER[
'PHP_SELF'],
"f.fk_cond_reglement",
"", $param,
'', $sortfield, $sortorder);
815if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
816 print_liste_field_titre($arrayfields[
'f.fk_mode_reglement'][
'label'], $_SERVER[
'PHP_SELF'],
"f.fk_mode_reglement",
"", $param,
'', $sortfield, $sortorder);
819if (!empty($arrayfields[
'recurring'][
'checked'])) {
820 print_liste_field_titre($arrayfields[
'recurring'][
'label'], $_SERVER[
'PHP_SELF'],
"recurring",
"", $param,
'', $sortfield, $sortorder,
'center ');
823if (!empty($arrayfields[
'f.frequency'][
'checked'])) {
824 print_liste_field_titre($arrayfields[
'f.frequency'][
'label'], $_SERVER[
'PHP_SELF'],
"f.frequency",
"", $param,
'', $sortfield, $sortorder,
'center ');
827if (!empty($arrayfields[
'f.unit_frequency'][
'checked'])) {
828 print_liste_field_titre($arrayfields[
'f.unit_frequency'][
'label'], $_SERVER[
'PHP_SELF'],
"f.unit_frequency",
"", $param,
'', $sortfield, $sortorder,
'center ');
831if (!empty($arrayfields[
'f.nb_gen_done'][
'checked'])) {
832 print_liste_field_titre($arrayfields[
'f.nb_gen_done'][
'label'], $_SERVER[
'PHP_SELF'],
"f.nb_gen_done",
"", $param,
'', $sortfield, $sortorder,
'center ');
835if (!empty($arrayfields[
'f.date_last_gen'][
'checked'])) {
836 print_liste_field_titre($arrayfields[
'f.date_last_gen'][
'label'], $_SERVER[
'PHP_SELF'],
"f.date_last_gen",
"", $param,
'', $sortfield, $sortorder,
'center ');
839if (!empty($arrayfields[
'f.date_when'][
'checked'])) {
840 print_liste_field_titre($arrayfields[
'f.date_when'][
'label'], $_SERVER[
'PHP_SELF'],
"f.date_when",
"", $param,
'', $sortfield, $sortorder,
'center ');
843if (!empty($arrayfields[
'f.fk_user_author'][
'checked'])) {
844 print_liste_field_titre($arrayfields[
'f.fk_user_author'][
'label'], $_SERVER[
'PHP_SELF'],
"f.fk_user_author",
"", $param,
'', $sortfield, $sortorder,
'center ');
847if (!empty($arrayfields[
'f.fk_user_modif'][
'checked'])) {
848 print_liste_field_titre($arrayfields[
'f.fk_user_modif'][
'label'], $_SERVER[
'PHP_SELF'],
"f.fk_user_modif",
"", $param,
'', $sortfield, $sortorder,
'center ');
851if (!empty($arrayfields[
'f.datec'][
'checked'])) {
852 print_liste_field_titre($arrayfields[
'f.datec'][
'label'], $_SERVER[
'PHP_SELF'],
"f.datec",
"", $param,
'', $sortfield, $sortorder,
'center ');
855if (!empty($arrayfields[
'f.tms'][
'checked'])) {
856 print_liste_field_titre($arrayfields[
'f.tms'][
'label'], $_SERVER[
'PHP_SELF'],
"f.tms",
"", $param,
'', $sortfield, $sortorder,
'center ');
860include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_search_title.tpl.php';
863$parameters = array(
'arrayfields'=>$arrayfields,
'param'=>$param,
'sortfield'=>$sortfield,
'sortorder'=>$sortorder,
'totalarray'=>$totalarray);
864$reshook = $hookmanager->executeHooks(
'printFieldListTitle', $parameters, $object, $action);
865print $hookmanager->resPrint;
867if (!empty($arrayfields[
'status'][
'checked'])) {
868 print_liste_field_titre($arrayfields[
'status'][
'label'], $_SERVER[
'PHP_SELF'],
"f.suspended,f.frequency",
"", $param,
'', $sortfield, $sortorder,
'center ');
872if (!
$conf->main_checkbox_left_column) {
873 print
getTitleFieldOfList(($mode !=
'kanban' ? $selectedfields :
''), 0, $_SERVER[
"PHP_SELF"],
'',
'',
'',
'', $sortfield, $sortorder,
'center maxwidthsearch ').
"\n";
885$imaxinloop = ($limit ? min($num, $limit) : $num);
886while ($i < $imaxinloop) {
887 $objp =
$db->fetch_object($resql);
892 $companystatic->id = $objp->socid;
893 $companystatic->name = $objp->name;
895 $invoicerectmp->id = !empty($objp->id) ? $objp->id : $objp->facid;
896 $invoicerectmp->frequency = $objp->frequency;
897 $invoicerectmp->suspended = $objp->suspended;
898 $invoicerectmp->unit_frequency = $objp->unit_frequency;
899 $invoicerectmp->nb_gen_max = $objp->nb_gen_max;
900 $invoicerectmp->nb_gen_done = $objp->nb_gen_done;
901 $invoicerectmp->ref = $objp->title;
902 $invoicerectmp->total_ht = $objp->total_ht;
903 $invoicerectmp->total_tva = $objp->total_tva;
904 $invoicerectmp->total_ttc = $objp->total_ttc;
908 print
'<tr data-rowid="'.$object->id.
'" class="oddeven">';
910 if (
$conf->main_checkbox_left_column) {
911 print
'<td class="center tdoverflowmax125">';
912 if ($user->hasRight(
'facture',
'creer') && empty($invoicerectmp->suspended)) {
913 if ($invoicerectmp->isMaxNbGenReached()) {
914 print $langs->trans(
"MaxNumberOfGenerationReached");
915 } elseif (empty($objp->frequency) ||
$db->jdate($objp->date_when) <= $today) {
916 print
'<a href="'.DOL_URL_ROOT.
'/compta/facture/card.php?action=create&socid='.$objp->socid.
'&fac_rec='.$objp->facid.
'">';
917 print
img_picto($langs->trans(
"CreateBill"),
'add',
'class="none"');
920 print $form->textwithpicto(
'', $langs->trans(
"DateIsNotEnough"));
928 if (!empty($arrayfields[
'f.titre'][
'checked'])) {
929 print
'<td class="nowrap tdoverflowmax200">';
930 print $invoicerectmp->getNomUrl(1);
936 if (!empty($arrayfields[
's.nom'][
'checked'])) {
937 print
'<td class="tdoverflowmax150">'.$companystatic->getNomUrl(1,
'customer').
'</td>';
942 if (!empty($arrayfields[
'f.total_ht'][
'checked'])) {
943 print
'<td class="nowrap right amount">'.price($objp->total_ht).
'</td>'.
"\n";
950 $totalarray[
'val'][
'f.total_ht'] += $objp->total_ht;
952 if (!empty($arrayfields[
'f.total_tva'][
'checked'])) {
953 print
'<td class="nowrap right amount">'.price($objp->total_tva).
'</td>'.
"\n";
960 $totalarray[
'val'][
'f.total_tva'] += $objp->total_tva;
962 if (!empty($arrayfields[
'f.total_ttc'][
'checked'])) {
963 print
'<td class="nowrap right amount">'.price($objp->total_ttc).
'</td>'.
"\n";
970 $totalarray[
'val'][
'f.total_ttc'] += $objp->total_ttc;
973 if (!empty($arrayfields[
'f.fk_cond_reglement'][
'checked'])) {
974 print
'<td class="tdoverflowmax150">';
975 $form->form_conditions_reglement(
'0', $objp->fk_cond_reglement,
'none');
982 if (!empty($arrayfields[
'f.fk_mode_reglement'][
'checked'])) {
983 print
'<td class="tdoverflowmax150">';
984 $form->form_modes_reglement(
'', $objp->fk_mode_reglement,
'none');
991 if (!empty($arrayfields[
'recurring'][
'checked'])) {
992 print
'<td class="center">'.($objp->frequency ?
img_picto($langs->trans(
"Frequency").
': '.$objp->frequency.
' '.$objp->unit_frequency,
'recurring',
'class="opacitymedium"').
' ' :
'').
yn($objp->frequency ? 1 : 0).
'</td>';
997 if (!empty($arrayfields[
'f.frequency'][
'checked'])) {
998 print
'<td class="center">';
999 print($objp->frequency > 0 ? $objp->frequency :
'');
1005 if (!empty($arrayfields[
'f.unit_frequency'][
'checked'])) {
1006 print
'<td class="center">';
1007 if ($objp->frequency > 1) {
1008 $dur = array(
"i" => $langs->trans(
"Minutes"),
"h" => $langs->trans(
"Hours"),
"d" => $langs->trans(
"Days"),
"w" => $langs->trans(
"Weeks"),
"m" => $langs->trans(
"Months"),
"y" => $langs->trans(
"Years"));
1010 $dur = array(
"i" => $langs->trans(
"Minute"),
"h" => $langs->trans(
"Hour"),
"d" => $langs->trans(
"Day"),
"w" => $langs->trans(
"Week"),
"m" => $langs->trans(
"Month"),
"y" => $langs->trans(
"Year"));
1012 print($objp->frequency > 0 ? $dur[$objp->unit_frequency] :
'');
1018 if (!empty($arrayfields[
'f.nb_gen_done'][
'checked'])) {
1019 print
'<td class="center">';
1020 print($objp->frequency > 0 ? $objp->nb_gen_done.($objp->nb_gen_max > 0 ?
' / '.$objp->nb_gen_max :
'') :
'<span class="opacitymedium">'.$langs->trans(
'NA').
'</span>');
1027 if (!empty($arrayfields[
'f.date_last_gen'][
'checked'])) {
1028 print
'<td class="center">';
1029 print($objp->frequency > 0 ?
dol_print_date(
$db->jdate($objp->date_last_gen),
'day') :
'<span class="opacitymedium">'.$langs->trans(
'NA').
'</span>');
1036 if (!empty($arrayfields[
'f.date_when'][
'checked'])) {
1037 print
'<td class="center">';
1038 print
'<div class="nowraponall">';
1039 print($objp->frequency ? ($invoicerectmp->isMaxNbGenReached() ?
'<strike>' :
'').
dol_print_date(
$db->jdate($objp->date_when),
'day').($invoicerectmp->isMaxNbGenReached() ?
'</strike>' :
'') :
'<span class="opacitymedium">'.$langs->trans(
'NA').
'</span>');
1040 if (!$invoicerectmp->isMaxNbGenReached()) {
1041 if (!$objp->suspended && $objp->frequency > 0 &&
$db->jdate($objp->date_when) &&
$db->jdate($objp->date_when) < $now) {
1045 print
img_info($langs->trans(
"MaxNumberOfGenerationReached"));
1053 if (!empty($arrayfields[
'f.fk_user_author'][
'checked'])) {
1054 print
'<td class="center tdoverflowmax150">';
1055 if ($objp->fk_user_author > 0) {
1056 $tmpuser->fetch($objp->fk_user_author);
1057 print $tmpuser->getNomUrl(1);
1064 if (!empty($arrayfields[
'f.fk_user_modif'][
'checked'])) {
1065 print
'<td class="center tdoverflowmax150">';
1066 if ($objp->fk_user_author > 0) {
1067 $tmpuser->fetch($objp->fk_user_author);
1068 print $tmpuser->getNomUrl(1);
1075 if (!empty($arrayfields[
'f.datec'][
'checked'])) {
1076 print
'<td class="center nowraponall">';
1083 if (!empty($arrayfields[
'f.tms'][
'checked'])) {
1084 print
'<td class="center nowraponall">';
1094 include DOL_DOCUMENT_ROOT.
'/core/tpl/extrafields_list_print_fields.tpl.php';
1096 $parameters = array(
'arrayfields' => $arrayfields,
'object' => $object,
'obj' => $obj,
'i' => $i,
'totalarray' => &$totalarray);
1097 $reshook = $hookmanager->executeHooks(
'printFieldListValue', $parameters, $object);
1098 print $hookmanager->resPrint;
1100 if (!empty($arrayfields[
'status'][
'checked'])) {
1101 print
'<td class="center">';
1102 print $invoicerectmp->getLibStatut(5, 0);
1109 if (!
$conf->main_checkbox_left_column) {
1110 print
'<td class="nowrap center tdoverflowmax125">';
1111 if ($user->hasRight(
'facture',
'creer') && empty($invoicerectmp->suspended)) {
1112 if ($invoicerectmp->isMaxNbGenReached()) {
1113 print $langs->trans(
"MaxNumberOfGenerationReached");
1114 } elseif (empty($objp->frequency) ||
$db->jdate($objp->date_when) <= $today) {
1115 print
'<a href="'.DOL_URL_ROOT.
'/compta/facture/card.php?action=create&socid='.$objp->socid.
'&fac_rec='.$objp->facid.
'">';
1116 print
img_picto($langs->trans(
"CreateBill"),
'add',
'class="paddingrightonly"');
1120 print $form->textwithpicto(
'', $langs->trans(
"DateIsNotEnough"));
1135include DOL_DOCUMENT_ROOT.
'/core/tpl/list_print_total.tpl.php';
1140 foreach ($arrayfields as $key => $val) {
1141 if (!empty($val[
'checked'])) {
1145 print
'<tr><td colspan="'.$colspan.
'"><span class="opacitymedium">'.$langs->trans(
"NoRecordFound").
'</span></td></tr>';
1151$parameters = array(
'arrayfields' => $arrayfields,
'sql' => $sql);
1152$reshook = $hookmanager->executeHooks(
'printFieldListFooter', $parameters, $object, $action);
1153print $hookmanager->resPrint;
1155print
'</table>'.
"\n";
1158print
'</form>'.
"\n";
$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 invoice templates.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage Dolibarr users.
dol_now($mode='gmt')
Return date for now.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
print_liste_field_titre($name, $file="", $field="", $begin="", $param="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $tooltip="", $forcenowrapcolumntitle=0)
Show title line of an array.
print_barre_liste($title, $page, $file, $options='', $sortfield='', $sortorder='', $morehtmlcenter='', $num=-1, $totalnboflines='', $picto='generic', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limit=-1, $selectlimitsuffix=0, $hidenavigation=0, $pagenavastextinput=0, $morehtmlrightbeforearrow='')
Print a title with navigation controls for pagination.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
natural_search($fields, $value, $mode=0, $nofirstand=0, $sqltoadd='')
Generate natural SQL search string for a criteria (this criteria can be tested on one or several fiel...
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by the value of a given key, which produces ascending (default) or descending out...
yn($yesno, $format=1, $color=0)
Return yes or no in current language.
getTitleFieldOfList($name, $thead=0, $file="", $field="", $begin="", $moreparam="", $moreattrib="", $sortfield="", $sortorder="", $prefix="", $disablesortlink=0, $tooltip='', $forcenowrapcolumntitle=0)
Get title line of an array.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
dol_getdate($timestamp, $fast=false, $forcetimezone='')
Return an array with locale date info.
img_info($titlealt='default')
Show info logo.
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.