From 8a58c3e292d4b7c8366f67df8323af25456aed4b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 14 Feb 2023 18:48:46 +0100 Subject: [PATCH] NEW Option to show column for field and line selection on the left (MAIN_CHECKBOX_LEFT_COLUMN) --- htdocs/admin/ihm.php | 7 + .../compta/facture/invoicetemplate_list.php | 1199 +++++++++-------- htdocs/core/class/html.form.class.php | 2 +- htdocs/langs/en_US/admin.lang | 1 + 4 files changed, 672 insertions(+), 537 deletions(-) diff --git a/htdocs/admin/ihm.php b/htdocs/admin/ihm.php index 1026ea12442..5347eebd392 100644 --- a/htdocs/admin/ihm.php +++ b/htdocs/admin/ihm.php @@ -245,6 +245,7 @@ if ($action == 'update') { dolibarr_set_const($db, "MAIN_SIZE_LISTE_LIMIT", GETPOST("main_size_liste_limit", 'int'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_SIZE_SHORTLIST_LIMIT", GETPOST("main_size_shortliste_limit", 'int'), 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_CHECKBOX_LEFT_COLUMN", GETPOST("MAIN_CHECKBOX_LEFT_COLUMN", 'int'), 'chaine', 0, '', $conf->entity); //dolibarr_set_const($db, "MAIN_DISABLE_JAVASCRIPT", GETPOST("MAIN_DISABLE_JAVASCRIPT", 'aZ09'), 'chaine', 0, '', $conf->entity); //dolibarr_set_const($db, "MAIN_BUTTON_HIDE_UNAUTHORIZED", GETPOST("MAIN_BUTTON_HIDE_UNAUTHORIZED", 'aZ09'), 'chaine', 0, '', $conf->entity); @@ -408,6 +409,12 @@ if ($mode == 'other') { print '' . $langs->trans("DefaultMaxSizeShortList") . ''; print ''; + // Max size of lists + print '' . $langs->trans("MAIN_CHECKBOX_LEFT_COLUMN") . ''; + print ajax_constantonoff("MAIN_CHECKBOX_LEFT_COLUMN", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '', 'other'); + print ''; + print ''; + // show input border /* print ''.$langs->trans("showInputBorder").''; diff --git a/htdocs/compta/facture/invoicetemplate_list.php b/htdocs/compta/facture/invoicetemplate_list.php index 0471b97c038..f0d6001d892 100644 --- a/htdocs/compta/facture/invoicetemplate_list.php +++ b/htdocs/compta/facture/invoicetemplate_list.php @@ -51,7 +51,8 @@ $confirm = GETPOST('confirm', 'alpha'); $cancel = GETPOST('cancel', 'alpha'); $toselect = GETPOST('toselect', 'array'); $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'invoicetemplatelist'; // To manage different context of search -$optioncss = GETPOST('optioncss', 'alpha'); +$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') +$mode = GETPOST('mode', 'aZ'); // The output mode ('list', 'kanban', 'hierarchy', 'calendar', ...) $socid = GETPOST('socid', 'int'); @@ -66,7 +67,6 @@ $objecttype = 'facture_rec'; if ($action == "create" || $action == "add") { $objecttype = ''; } -$result = restrictedArea($user, 'facture', $id, $objecttype); $search_ref = GETPOST('search_ref'); $search_societe = GETPOST('search_societe'); @@ -101,20 +101,18 @@ $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); -if (empty($page) || $page == -1) { +if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { + // If $page is not defined, or '' or -1 or if we click on clear filters $page = 0; -} // If $page is not defined, or '' or -1 +} $offset = $limit * $page; -if (!$sortorder) { - $sortorder = 'DESC'; -} -if (!$sortfield) { - $sortfield = 'f.titre'; -} $pageprev = $page - 1; $pagenext = $page + 1; +// Initialize technical objects $object = new FactureRec($db); +$extrafields = new ExtraFields($db); + if (($id > 0 || $ref) && $action != 'create' && $action != 'add') { $ret = $object->fetch($id, $ref); if (!$ret) { @@ -124,16 +122,19 @@ if (($id > 0 || $ref) && $action != 'create' && $action != 'add') { // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('invoicereclist')); -$extrafields = new ExtraFields($db); -// fetch optionals attributes and labels +// Fetch optionals attributes and labels $extrafields->fetch_name_optionals_label($object->table_element); $search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_'); -$permissionnote = $user->rights->facture->creer; // Used by the include of actions_setnotes.inc.php -$permissiondellink = $user->rights->facture->creer; // Used by the include of actions_dellink.inc.php -$permissiontoedit = $user->rights->facture->creer; // Used by the include of actions_lineupdonw.inc.php +// Default sort order (if not yet defined by previous GETPOST) +if (!$sortorder) { + $sortorder = 'DESC'; +} +if (!$sortfield) { + $sortfield = 'f.titre'; +} $arrayfields = array( 'f.titre'=>array('label'=>"Ref", 'checked'=>1), @@ -169,7 +170,6 @@ if ($socid > 0) { } } - if ($socid > 0) { $tmpthirdparty = new Societe($db); $res = $tmpthirdparty->fetch($socid); @@ -180,6 +180,10 @@ if ($socid > 0) { $objecttype = 'facture_rec'; +$permissionnote = $user->rights->facture->creer; // Used by the include of actions_setnotes.inc.php +$permissiondellink = $user->rights->facture->creer; // Used by the include of actions_dellink.inc.php +$permissiontoedit = $user->rights->facture->creer; // Used by the include of actions_lineupdonw.inc.php + $result = restrictedArea($user, 'facture', $object->id, $objecttype); @@ -202,15 +206,15 @@ if ($reshook < 0) { } if (empty($reshook)) { - if (GETPOST('cancel', 'alpha')) { + /*if (GETPOST('cancel', 'alpha')) { $action = ''; - } + }*/ // Selection of new fields include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; - // Do we click on purge search criteria ? - if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All test are required to be compatible with all browsers + // Purge search criteria + if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers $search_ref = ''; $search_societe = ''; $search_montant_ht = ''; @@ -239,8 +243,13 @@ if (empty($reshook)) { $search_unit_frequency = ''; $search_nb_gen_done = ''; $search_status = ''; + $toselect = array(); $search_array_options = array(); } + if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha') + || GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha')) { + $massaction = ''; // Protection to avoid mass action if we force a new search during a mass action confirmation + } // Mass actions /*$objectclass='MyObject'; @@ -256,8 +265,6 @@ if (empty($reshook)) { * View */ -llxHeader('', $langs->trans("RepeatableInvoices"), 'ch-facture.html#s-fac-facture-rec'); - $form = new Form($db); $formother = new FormOther($db); if (isModEnabled('project')) { @@ -268,13 +275,17 @@ $invoicerectmp = new FactureRec($db); $tmpuser = new User($db); $now = dol_now(); + +$help_url = ''; +$title = $langs->trans("RepeatableInvoices"); +$morejs = array(); +$morecss = array(); + $tmparray = dol_getdate($now); $today = dol_mktime(23, 59, 59, $tmparray['mon'], $tmparray['mday'], $tmparray['year']); // Today is last second of current day - -/* - * List mode - */ +// Build and execute select +// -------------------------------------------------------------------- $sql = "SELECT s.nom as name, s.rowid as socid, f.rowid as facid, f.titre as title, f.total_ht, f.total_tva, f.total_ttc, f.frequency, f.unit_frequency,"; $sql .= " f.nb_gen_done, f.nb_gen_max, f.date_last_gen, f.date_when, f.suspended,"; @@ -292,11 +303,18 @@ $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $obje $sql .= preg_replace('/^,/', '', $hookmanager->resPrint); $sql = preg_replace('/,\s*$/', '', $sql); +$sqlfields = $sql; // $sql fields to remove for count total + $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_rec as f"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."facture_rec_extrafields as ef ON ef.fk_object = f.rowid"; if (empty($user->rights->societe->client->voir) && !$socid) { $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } +// Add table from hooks +$parameters = array(); +$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook +$sql .= $hookmanager->resPrint; + $sql .= " WHERE f.fk_soc = s.rowid"; $sql .= ' AND f.entity IN ('.getEntity('invoice').')'; if (empty($user->rights->societe->client->voir) && !$socid) { @@ -366,587 +384,696 @@ if ($search_date_when_end) { $sql .= " AND f.date_when <= '".$db->idate($search_date_when_end)."'"; } -$tmpsortfield = $sortfield; -if ($tmpsortfield == 'recurring') { - $tmpsortfield = 'f.frequency'; -} -$sql .= $db->order($tmpsortfield, $sortorder); - +// Count total nb of records $nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { - $result = $db->query($sql); - $nbtotalofrecords = $db->num_rows($result); + /* The fast and low memory method to get and count full list converts the sql into a sql count */ + $sqlforcount = preg_replace('/^'.preg_quote($sqlfields, '/').'/', 'SELECT COUNT(*) as nbtotalofrecords', $sql); + $sqlforcount = preg_replace('/GROUP BY .*$/', '', $sqlforcount); + $resql = $db->query($sqlforcount); + if ($resql) { + $objforcount = $db->fetch_object($resql); + $nbtotalofrecords = $objforcount->nbtotalofrecords; + } else { + dol_print_error($db); + } + if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0 $page = 0; $offset = 0; } + $db->free($resql); } -$sql .= $db->plimit($limit + 1, $offset); +$tmpsortfield = $sortfield; +if ($tmpsortfield == 'recurring') { + $tmpsortfield = 'f.frequency'; +} + +// Complete request and execute it with limit +$sql .= $db->order($tmpsortfield, $sortorder); +if ($limit) { + $sql .= $db->plimit($limit + 1, $offset); +} $resql = $db->query($sql); -if ($resql) { - $num = $db->num_rows($resql); +if (!$resql) { + dol_print_error($db); + exit; +} - $param = ''; - if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { - $param .= '&contextpage='.urlencode($contextpage); - } - if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); - } - if ($socid > 0) { - $param .= '&socid='.urlencode($socid); - } - if ($search_date_startday) { - $param .= '&search_date_startday='.urlencode($search_date_startday); - } - if ($search_date_startmonth) { - $param .= '&search_date_startmonth='.urlencode($search_date_startmonth); - } - if ($search_date_startyear) { - $param .= '&search_date_startyear='.urlencode($search_date_startyear); - } - if ($search_date_endday) { - $param .= '&search_date_endday='.urlencode($search_date_endday); - } - if ($search_date_endmonth) { - $param .= '&search_date_endmonth='.urlencode($search_date_endmonth); - } - if ($search_date_endyear) { - $param .= '&search_date_endyear='.urlencode($search_date_endyear); - } - if ($search_date_when_startday) { - $param .= '&search_date_when_startday='.urlencode($search_date_when_startday); - } - if ($search_date_when_startmonth) { - $param .= '&search_date_when_startmonth='.urlencode($search_date_when_startmonth); - } - if ($search_date_when_startyear) { - $param .= '&search_date_when_startyear='.urlencode($search_date_when_startyear); - } - if ($search_date_when_endday) { - $param .= '&search_date_when_endday='.urlencode($search_date_when_endday); - } - if ($search_date_when_endmonth) { - $param .= '&search_date_when_endmonth='.urlencode($search_date_when_endmonth); - } - if ($search_date_when_endyear) { - $param .= '&search_date_when_endyear='.urlencode($search_date_when_endyear); - } - if ($search_ref) { - $param .= '&search_ref='.urlencode($search_ref); - } - if ($search_societe) { - $param .= '&search_societe='.urlencode($search_societe); - } - if ($search_montant_ht != '') { - $param .= '&search_montant_ht='.urlencode($search_montant_ht); - } - if ($search_montant_vat != '') { - $param .= '&search_montant_vat='.urlencode($search_montant_vat); - } - if ($search_montant_ttc != '') { - $param .= '&search_montant_ttc='.urlencode($search_montant_ttc); - } - if ($search_payment_mode != '') { - $param .= '&search_payment_mode='.urlencode($search_payment_mode); - } - if ($search_payment_term != '') { - $param .= '&search_payment_term='.urlencode($search_payment_term); - } - if ($search_recurring != '' && $search_recurring != '-1') { - $param .= '&search_recurring='.urlencode($search_recurring); - } - if ($search_frequency > 0) { - $param .= '&search_frequency='.urlencode($search_frequency); - } - if ($search_unit_frequency != '') { - $param .= '&search_unit_frequency='.urlencode($search_unit_frequency); - } - if ($search_nb_gen_done != '') { - $param .= '&search_nb_gen_done='.urlencode($search_nb_gen_done); - } - if ($search_status != '') { - $param .= '&search_status='.urlencode($search_status); - } - if ($optioncss != '') { - $param .= '&optioncss='.urlencode($optioncss); - } - // Add $param from extra fields - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; +$num = $db->num_rows($resql); - $massactionbutton = $form->selectMassAction('', $massaction == 'presend' ? array() : array('presend'=>$langs->trans("SendByMail"), 'builddoc'=>$langs->trans("PDFMerge"))); - $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; - $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields - //$selectedfields.=$form->showCheckAddButtons('checkforselect', 1); +// Output page +// -------------------------------------------------------------------- - print '
'; - if ($optioncss != '') { - print ''; - } - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; +llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'bodyforlist'); - $title = $langs->trans("RepeatableInvoices"); +$arrayofselected = is_array($toselect) ? $toselect : array(); - print_barre_liste($title, $page, $_SERVER['PHP_SELF'], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'bill', 0, '', '', $limit, 0, 0, 1); +$param = ''; +if (!empty($mode)) { + $param .= '&mode='.urlencode($mode); +} +if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { + $param .= '&contextpage='.urlencode($contextpage); +} +if ($limit > 0 && $limit != $conf->liste_limit) { + $param .= '&limit='.urlencode($limit); +} +if ($socid > 0) { + $param .= '&socid='.urlencode($socid); +} +if ($search_date_startday) { + $param .= '&search_date_startday='.urlencode($search_date_startday); +} +if ($search_date_startmonth) { + $param .= '&search_date_startmonth='.urlencode($search_date_startmonth); +} +if ($search_date_startyear) { + $param .= '&search_date_startyear='.urlencode($search_date_startyear); +} +if ($search_date_endday) { + $param .= '&search_date_endday='.urlencode($search_date_endday); +} +if ($search_date_endmonth) { + $param .= '&search_date_endmonth='.urlencode($search_date_endmonth); +} +if ($search_date_endyear) { + $param .= '&search_date_endyear='.urlencode($search_date_endyear); +} +if ($search_date_when_startday) { + $param .= '&search_date_when_startday='.urlencode($search_date_when_startday); +} +if ($search_date_when_startmonth) { + $param .= '&search_date_when_startmonth='.urlencode($search_date_when_startmonth); +} +if ($search_date_when_startyear) { + $param .= '&search_date_when_startyear='.urlencode($search_date_when_startyear); +} +if ($search_date_when_endday) { + $param .= '&search_date_when_endday='.urlencode($search_date_when_endday); +} +if ($search_date_when_endmonth) { + $param .= '&search_date_when_endmonth='.urlencode($search_date_when_endmonth); +} +if ($search_date_when_endyear) { + $param .= '&search_date_when_endyear='.urlencode($search_date_when_endyear); +} +if ($search_ref) { + $param .= '&search_ref='.urlencode($search_ref); +} +if ($search_societe) { + $param .= '&search_societe='.urlencode($search_societe); +} +if ($search_montant_ht != '') { + $param .= '&search_montant_ht='.urlencode($search_montant_ht); +} +if ($search_montant_vat != '') { + $param .= '&search_montant_vat='.urlencode($search_montant_vat); +} +if ($search_montant_ttc != '') { + $param .= '&search_montant_ttc='.urlencode($search_montant_ttc); +} +if ($search_payment_mode != '') { + $param .= '&search_payment_mode='.urlencode($search_payment_mode); +} +if ($search_payment_term != '') { + $param .= '&search_payment_term='.urlencode($search_payment_term); +} +if ($search_recurring != '' && $search_recurring != '-1') { + $param .= '&search_recurring='.urlencode($search_recurring); +} +if ($search_frequency > 0) { + $param .= '&search_frequency='.urlencode($search_frequency); +} +if ($search_unit_frequency != '') { + $param .= '&search_unit_frequency='.urlencode($search_unit_frequency); +} +if ($search_nb_gen_done != '') { + $param .= '&search_nb_gen_done='.urlencode($search_nb_gen_done); +} +if ($search_status != '') { + $param .= '&search_status='.urlencode($search_status); +} +if ($optioncss != '') { + $param .= '&optioncss='.urlencode($optioncss); +} +// Add $param from extra fields +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; +// Add $param from hooks +$parameters = array(); +$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object); // Note that $action and $object may have been modified by hook +$param .= $hookmanager->resPrint; - print ''.$langs->trans("ToCreateAPredefinedInvoice", $langs->transnoentitiesnoconv("ChangeIntoRepeatableInvoice")).'

'; +// List of mass actions available +$arrayofmassactions = array( + //'validate'=>img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Validate"), + //'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"), + //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"), + //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"), +); - $i = 0; +$massactionbutton = $form->selectMassAction('', $massaction == 'presend' ? array() : array('presend'=>$langs->trans("SendByMail"), 'builddoc'=>$langs->trans("PDFMerge"))); - $moreforfilter = ''; +$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; +$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields +//$selectedfields.=$form->showCheckAddButtons('checkforselect', 1); - print '
'; - print ''."\n"; +print ''."\n"; +if ($optioncss != '') { + print ''; +} +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; - // Filters lines - print ''; - // Ref - if (!empty($arrayfields['f.titre']['checked'])) { - print ''; - } - // Thirdparty - if (!empty($arrayfields['s.nom']['checked'])) { - print ''; - } - if (!empty($arrayfields['f.total_ht']['checked'])) { - // Amount net - print ''; - } - if (!empty($arrayfields['f.total_tva']['checked'])) { - // Amount Vat - print ''; - } - if (!empty($arrayfields['f.total_ttc']['checked'])) { - // Amount - print ''; - } - if (!empty($arrayfields['f.fk_cond_reglement']['checked'])) { - // Payment term - print '"; - } - if (!empty($arrayfields['f.fk_mode_reglement']['checked'])) { - // Payment mode - print ''; - } - if (!empty($arrayfields['recurring']['checked'])) { - // Recurring or not - print ''; - } - if (!empty($arrayfields['f.frequency']['checked'])) { - // Recurring or not - print ''; - } - if (!empty($arrayfields['f.unit_frequency']['checked'])) { - // Frequency unit - print ''; - } - if (!empty($arrayfields['f.nb_gen_done']['checked'])) { - // Nb generation - print ''; - } - // Date invoice - if (!empty($arrayfields['f.date_last_gen']['checked'])) { - print ''; - } - // Date next generation - if (!empty($arrayfields['f.date_when']['checked'])) { - print ''; - } - // Extra fields - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; - // Fields from hook - $parameters = array('arrayfields'=>$arrayfields); - $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - // User creation - if (!empty($arrayfields['f.fk_user_author']['checked'])) { - print ''; - } - // User modification - if (!empty($arrayfields['f.fk_user_modif']['checked'])) { - print ''; - } - // Date creation - if (!empty($arrayfields['f.datec']['checked'])) { - print ''; - } - // Date modification - if (!empty($arrayfields['f.tms']['checked'])) { - print ''; - } - // Status - if (!empty($arrayfields['status']['checked'])) { - print ''; - } - // Action column - print ''; +} + +$db->free($resql); + + +$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql); +$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook +print $hookmanager->resPrint; + +print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print $form->getSelectConditionsPaiements($search_payment_term, 'search_payment_term', -1, 1, 1, 'maxwidth100'); - print "'; - print $form->select_types_paiements($search_payment_mode, 'search_payment_mode', '', 0, 1, 1, 0, 1, 'maxwidth100', 1); - print ''; - print $form->selectyesno('search_recurring', $search_recurring, 1, false, 1); - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print '
'; - print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); - print '
'; - print '
'; - print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to')); - print '
'; - print '
'; - print '
'; - 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')); - print '
'; - print '
'; - 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')); - print '
'; - print '
'; - print ''; - print ''; - print ''; - print ''; - $liststatus = array( - 0=>$langs->trans("Draft"), - 1=>$langs->trans("Active"), - -1=>$langs->trans("Disabled"), - ); - print $form->selectarray('search_status', $liststatus, $search_status, -2, 0, 0, '', 0, 0, 0, '', 'width100 onrightofpage'); - print ''; +print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'bill', 0, '', '', $limit, 0, 0, 1); + +print ''.$langs->trans("ToCreateAPredefinedInvoice", $langs->transnoentitiesnoconv("ChangeIntoRepeatableInvoice")).'

'; + +$i = 0; + +$moreforfilter = ''; + +$parameters = array(); +$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook +if (empty($reshook)) { + $moreforfilter .= $hookmanager->resPrint; +} else { + $moreforfilter = $hookmanager->resPrint; +} + +if (!empty($moreforfilter)) { + print '
'; + print $moreforfilter; + print '
'; +} + +$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; +$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')); // This also change content of $arrayfields +$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); + +print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table +print ''."\n"; + + +// Fields title search +// -------------------------------------------------------------------- +print ''; +// Action column +if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; +} +// Ref +if (!empty($arrayfields['f.titre']['checked'])) { + print ''; +} +// Thirdparty +if (!empty($arrayfields['s.nom']['checked'])) { + print ''; +} +if (!empty($arrayfields['f.total_ht']['checked'])) { + // Amount net + print ''; +} +if (!empty($arrayfields['f.total_tva']['checked'])) { + // Amount Vat + print ''; +} +if (!empty($arrayfields['f.total_ttc']['checked'])) { + // Amount + print ''; +} +if (!empty($arrayfields['f.fk_cond_reglement']['checked'])) { + // Payment term + print '"; +} +if (!empty($arrayfields['f.fk_mode_reglement']['checked'])) { + // Payment mode + print ''; +} +if (!empty($arrayfields['recurring']['checked'])) { + // Recurring or not + print ''; +} +if (!empty($arrayfields['f.frequency']['checked'])) { + // Recurring or not + print ''; +} +if (!empty($arrayfields['f.unit_frequency']['checked'])) { + // Frequency unit + print ''; +} +if (!empty($arrayfields['f.nb_gen_done']['checked'])) { + // Nb generation + print ''; +} +// Date invoice +if (!empty($arrayfields['f.date_last_gen']['checked'])) { + print ''; +} +// Date next generation +if (!empty($arrayfields['f.date_when']['checked'])) { + print ''; +} +// Extra fields +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; + +// Fields from hook +$parameters = array('arrayfields'=>$arrayfields); +$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook +print $hookmanager->resPrint; +// User creation +if (!empty($arrayfields['f.fk_user_author']['checked'])) { + print ''; +} +// User modification +if (!empty($arrayfields['f.fk_user_modif']['checked'])) { + print ''; +} +// Date creation +if (!empty($arrayfields['f.datec']['checked'])) { + print ''; +} +// Date modification +if (!empty($arrayfields['f.tms']['checked'])) { + print ''; +} +// Status +if (!empty($arrayfields['status']['checked'])) { + print ''; +} +// Action column +if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; - print "\n"; +} +print ''."\n"; - print ''; +$totalarray = array(); +$totalarray['nbfield'] = 0; + +// Fields title label +// -------------------------------------------------------------------- +print ''; +if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; +} +if (!empty($arrayfields['f.titre']['checked'])) { + print_liste_field_titre($arrayfields['f.titre']['label'], $_SERVER['PHP_SELF'], "f.titre", "", $param, "", $sortfield, $sortorder); +} +if (!empty($arrayfields['s.nom']['checked'])) { + print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER['PHP_SELF'], "s.nom", "", $param, "", $sortfield, $sortorder); +} +if (!empty($arrayfields['f.total_ht']['checked'])) { + print_liste_field_titre($arrayfields['f.total_ht']['label'], $_SERVER['PHP_SELF'], "f.total_ht", "", $param, 'class="right"', $sortfield, $sortorder); +} +if (!empty($arrayfields['f.total_tva']['checked'])) { + print_liste_field_titre($arrayfields['f.total_tva']['label'], $_SERVER['PHP_SELF'], "f.total_tva", "", $param, 'class="right"', $sortfield, $sortorder); +} +if (!empty($arrayfields['f.total_ttc']['checked'])) { + print_liste_field_titre($arrayfields['f.total_ttc']['label'], $_SERVER['PHP_SELF'], "f.total_ttc", "", $param, 'class="right"', $sortfield, $sortorder); +} +if (!empty($arrayfields['f.fk_cond_reglement']['checked'])) { + print_liste_field_titre($arrayfields['f.fk_cond_reglement']['label'], $_SERVER['PHP_SELF'], "f.fk_cond_reglement", "", $param, '', $sortfield, $sortorder); +} +if (!empty($arrayfields['f.fk_mode_reglement']['checked'])) { + print_liste_field_titre($arrayfields['f.fk_mode_reglement']['label'], $_SERVER['PHP_SELF'], "f.fk_mode_reglement", "", $param, '', $sortfield, $sortorder); +} +if (!empty($arrayfields['recurring']['checked'])) { + print_liste_field_titre($arrayfields['recurring']['label'], $_SERVER['PHP_SELF'], "recurring", "", $param, 'class="center"', $sortfield, $sortorder); +} +if (!empty($arrayfields['f.frequency']['checked'])) { + print_liste_field_titre($arrayfields['f.frequency']['label'], $_SERVER['PHP_SELF'], "f.frequency", "", $param, 'align="center"', $sortfield, $sortorder); +} +if (!empty($arrayfields['f.unit_frequency']['checked'])) { + print_liste_field_titre($arrayfields['f.unit_frequency']['label'], $_SERVER['PHP_SELF'], "f.unit_frequency", "", $param, 'align="center"', $sortfield, $sortorder); +} +if (!empty($arrayfields['f.nb_gen_done']['checked'])) { + print_liste_field_titre($arrayfields['f.nb_gen_done']['label'], $_SERVER['PHP_SELF'], "f.nb_gen_done", "", $param, 'align="center"', $sortfield, $sortorder); +} +if (!empty($arrayfields['f.date_last_gen']['checked'])) { + print_liste_field_titre($arrayfields['f.date_last_gen']['label'], $_SERVER['PHP_SELF'], "f.date_last_gen", "", $param, 'align="center"', $sortfield, $sortorder); +} +if (!empty($arrayfields['f.date_when']['checked'])) { + print_liste_field_titre($arrayfields['f.date_when']['label'], $_SERVER['PHP_SELF'], "f.date_when", "", $param, 'align="center"', $sortfield, $sortorder); +} +if (!empty($arrayfields['f.fk_user_author']['checked'])) { + print_liste_field_titre($arrayfields['f.fk_user_author']['label'], $_SERVER['PHP_SELF'], "f.fk_user_author", "", $param, 'align="center"', $sortfield, $sortorder); +} +if (!empty($arrayfields['f.fk_user_modif']['checked'])) { + print_liste_field_titre($arrayfields['f.fk_user_modif']['label'], $_SERVER['PHP_SELF'], "f.fk_user_modif", "", $param, 'align="center"', $sortfield, $sortorder); +} +if (!empty($arrayfields['f.datec']['checked'])) { + print_liste_field_titre($arrayfields['f.datec']['label'], $_SERVER['PHP_SELF'], "f.datec", "", $param, 'align="center"', $sortfield, $sortorder); +} +if (!empty($arrayfields['f.tms']['checked'])) { + print_liste_field_titre($arrayfields['f.tms']['label'], $_SERVER['PHP_SELF'], "f.tms", "", $param, 'align="center"', $sortfield, $sortorder); +} +// Extra fields +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; +if (!empty($arrayfields['status']['checked'])) { + print_liste_field_titre($arrayfields['status']['label'], $_SERVER['PHP_SELF'], "f.suspended,f.frequency", "", $param, 'align="center"', $sortfield, $sortorder); +} +// Action column +if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; +} +$totalarray['nbfield']++; // For the column action +print ''."\n"; + + $i = 0; + $savnbfield = $totalarray['nbfield']; + $totalarray = array(); + $totalarray['nbfield'] = 0; + $totalarray['val']['f.total_ht'] = 0; + $totalarray['val']['f.total_tva'] = 0; + $totalarray['val']['f.total_ttc'] = 0; + $imaxinloop = ($limit ? min($num, $limit) : $num); +while ($i < $imaxinloop) { + $objp = $db->fetch_object($resql); + if (empty($objp)) { + break; + } + + $companystatic->id = $objp->socid; + $companystatic->name = $objp->name; + + $invoicerectmp->id = !empty($objp->id) ? $objp->id : $objp->facid; + $invoicerectmp->frequency = $objp->frequency; + $invoicerectmp->suspended = $objp->suspended; + $invoicerectmp->unit_frequency = $objp->unit_frequency; + $invoicerectmp->nb_gen_max = $objp->nb_gen_max; + $invoicerectmp->nb_gen_done = $objp->nb_gen_done; + $invoicerectmp->ref = $objp->title; + $invoicerectmp->total_ht = $objp->total_ht; + $invoicerectmp->total_tva = $objp->total_tva; + $invoicerectmp->total_ttc = $objp->total_ttc; + + // Show here line of result + $j = 0; + print ''; + // Action column + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } if (!empty($arrayfields['f.titre']['checked'])) { - print_liste_field_titre($arrayfields['f.titre']['label'], $_SERVER['PHP_SELF'], "f.titre", "", $param, "", $sortfield, $sortorder); + print '\n"; + if (!$i) { + $totalarray['nbfield']++; + } } if (!empty($arrayfields['s.nom']['checked'])) { - print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER['PHP_SELF'], "s.nom", "", $param, "", $sortfield, $sortorder); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } } if (!empty($arrayfields['f.total_ht']['checked'])) { - print_liste_field_titre($arrayfields['f.total_ht']['label'], $_SERVER['PHP_SELF'], "f.total_ht", "", $param, 'class="right"', $sortfield, $sortorder); + print ''."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'f.total_ht'; + } + $totalarray['val']['f.total_ht'] += $objp->total_ht; } if (!empty($arrayfields['f.total_tva']['checked'])) { - print_liste_field_titre($arrayfields['f.total_tva']['label'], $_SERVER['PHP_SELF'], "f.total_tva", "", $param, 'class="right"', $sortfield, $sortorder); + print ''."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'f.total_tva'; + } + $totalarray['val']['f.total_tva'] += $objp->total_tva; } if (!empty($arrayfields['f.total_ttc']['checked'])) { - print_liste_field_titre($arrayfields['f.total_ttc']['label'], $_SERVER['PHP_SELF'], "f.total_ttc", "", $param, 'class="right"', $sortfield, $sortorder); + print ''."\n"; + if (!$i) { + $totalarray['nbfield']++; + } + if (!$i) { + $totalarray['pos'][$totalarray['nbfield']] = 'f.total_ttc'; + } + $totalarray['val']['f.total_ttc'] += $objp->total_ttc; } + // Payment term if (!empty($arrayfields['f.fk_cond_reglement']['checked'])) { - print_liste_field_titre($arrayfields['f.fk_cond_reglement']['label'], $_SERVER['PHP_SELF'], "f.fk_cond_reglement", "", $param, '', $sortfield, $sortorder); + print ''."\n"; + if (!$i) { + $totalarray['nbfield']++; + } } + // Payment mode if (!empty($arrayfields['f.fk_mode_reglement']['checked'])) { - print_liste_field_titre($arrayfields['f.fk_mode_reglement']['label'], $_SERVER['PHP_SELF'], "f.fk_mode_reglement", "", $param, '', $sortfield, $sortorder); + print ''."\n"; + if (!$i) { + $totalarray['nbfield']++; + } } + // Is it a recurring invoice if (!empty($arrayfields['recurring']['checked'])) { - print_liste_field_titre($arrayfields['recurring']['label'], $_SERVER['PHP_SELF'], "recurring", "", $param, 'class="center"', $sortfield, $sortorder); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } } if (!empty($arrayfields['f.frequency']['checked'])) { - print_liste_field_titre($arrayfields['f.frequency']['label'], $_SERVER['PHP_SELF'], "f.frequency", "", $param, 'align="center"', $sortfield, $sortorder); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } } if (!empty($arrayfields['f.unit_frequency']['checked'])) { - print_liste_field_titre($arrayfields['f.unit_frequency']['label'], $_SERVER['PHP_SELF'], "f.unit_frequency", "", $param, 'align="center"', $sortfield, $sortorder); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } } if (!empty($arrayfields['f.nb_gen_done']['checked'])) { - print_liste_field_titre($arrayfields['f.nb_gen_done']['label'], $_SERVER['PHP_SELF'], "f.nb_gen_done", "", $param, 'align="center"', $sortfield, $sortorder); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } } + // Date last generation if (!empty($arrayfields['f.date_last_gen']['checked'])) { - print_liste_field_titre($arrayfields['f.date_last_gen']['label'], $_SERVER['PHP_SELF'], "f.date_last_gen", "", $param, 'align="center"', $sortfield, $sortorder); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } } + // Date next generation if (!empty($arrayfields['f.date_when']['checked'])) { - print_liste_field_titre($arrayfields['f.date_when']['label'], $_SERVER['PHP_SELF'], "f.date_when", "", $param, 'align="center"', $sortfield, $sortorder); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } } if (!empty($arrayfields['f.fk_user_author']['checked'])) { - print_liste_field_titre($arrayfields['f.fk_user_author']['label'], $_SERVER['PHP_SELF'], "f.fk_user_author", "", $param, 'align="center"', $sortfield, $sortorder); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } } if (!empty($arrayfields['f.fk_user_modif']['checked'])) { - print_liste_field_titre($arrayfields['f.fk_user_modif']['label'], $_SERVER['PHP_SELF'], "f.fk_user_modif", "", $param, 'align="center"', $sortfield, $sortorder); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } } if (!empty($arrayfields['f.datec']['checked'])) { - print_liste_field_titre($arrayfields['f.datec']['label'], $_SERVER['PHP_SELF'], "f.datec", "", $param, 'align="center"', $sortfield, $sortorder); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } } if (!empty($arrayfields['f.tms']['checked'])) { - print_liste_field_titre($arrayfields['f.tms']['label'], $_SERVER['PHP_SELF'], "f.tms", "", $param, 'align="center"', $sortfield, $sortorder); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } } + + $obj = $objp; // Extra fields - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; + // Fields from hook + $parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); + $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + // Status if (!empty($arrayfields['status']['checked'])) { - print_liste_field_titre($arrayfields['status']['label'], $_SERVER['PHP_SELF'], "f.suspended,f.frequency", "", $param, 'align="center"', $sortfield, $sortorder); + print ''; + if (!$i) { + $totalarray['nbfield']++; + } } - print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'center maxwidthsearch '); - print "\n"; - - if ($num > 0) { - $i = 0; - $totalarray = array(); - $totalarray['nbfield'] = 0; - $totalarray['val']['f.total_ht'] = 0; - $totalarray['val']['f.total_tva'] = 0; - $totalarray['val']['f.total_ttc'] = 0; - while ($i < min($num, $limit)) { - $objp = $db->fetch_object($resql); - if (empty($objp)) { - break; - } - - $companystatic->id = $objp->socid; - $companystatic->name = $objp->name; - - $invoicerectmp->id = !empty($objp->id) ? $objp->id : $objp->facid; - $invoicerectmp->frequency = $objp->frequency; - $invoicerectmp->suspended = $objp->suspended; - $invoicerectmp->unit_frequency = $objp->unit_frequency; - $invoicerectmp->nb_gen_max = $objp->nb_gen_max; - $invoicerectmp->nb_gen_done = $objp->nb_gen_done; - $invoicerectmp->ref = $objp->title; - $invoicerectmp->total_ht = $objp->total_ht; - $invoicerectmp->total_tva = $objp->total_tva; - $invoicerectmp->total_ttc = $objp->total_ttc; - - print ''; - - if (!empty($arrayfields['f.titre']['checked'])) { - print '\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - if (!empty($arrayfields['s.nom']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - if (!empty($arrayfields['f.total_ht']['checked'])) { - print ''."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'f.total_ht'; - } - $totalarray['val']['f.total_ht'] += $objp->total_ht; - } - if (!empty($arrayfields['f.total_tva']['checked'])) { - print ''."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'f.total_tva'; - } - $totalarray['val']['f.total_tva'] += $objp->total_tva; - } - if (!empty($arrayfields['f.total_ttc']['checked'])) { - print ''."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - if (!$i) { - $totalarray['pos'][$totalarray['nbfield']] = 'f.total_ttc'; - } - $totalarray['val']['f.total_ttc'] += $objp->total_ttc; - } - // Payment term - if (!empty($arrayfields['f.fk_cond_reglement']['checked'])) { - print ''."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Payment mode - if (!empty($arrayfields['f.fk_mode_reglement']['checked'])) { - print ''."\n"; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Is it a recurring invoice - if (!empty($arrayfields['recurring']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - if (!empty($arrayfields['f.frequency']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - if (!empty($arrayfields['f.unit_frequency']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - if (!empty($arrayfields['f.nb_gen_done']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Date last generation - if (!empty($arrayfields['f.date_last_gen']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Date next generation - if (!empty($arrayfields['f.date_when']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - if (!empty($arrayfields['f.fk_user_author']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - if (!empty($arrayfields['f.fk_user_modif']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - if (!empty($arrayfields['f.datec']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - if (!empty($arrayfields['f.tms']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - $obj = $objp; - // Extra fields - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; - // Fields from hook - $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$objp, 'i'=>$i, 'totalarray'=>&$totalarray); - $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - // Status - if (!empty($arrayfields['status']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Action column - print '"; - - print "\n"; - - $i++; - } - } else { - $colspan = 1; - foreach ($arrayfields as $key => $val) { - if (!empty($val['checked'])) { - $colspan++; + print $form->textwithpicto('', $langs->trans("DateIsNotEnough")); } } - print ''; + print ''; + if (!$i) { + $totalarray['nbfield']++; + } } - // Show total line - include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php'; + print ''."\n"; - - print "
'; + $searchpicto = $form->showFilterButtons('left'); + print $searchpicto; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print $form->getSelectConditionsPaiements($search_payment_term, 'search_payment_term', -1, 1, 1, 'maxwidth100'); + print "'; + print $form->select_types_paiements($search_payment_mode, 'search_payment_mode', '', 0, 1, 1, 0, 1, 'maxwidth100', 1); + print ''; + print $form->selectyesno('search_recurring', $search_recurring, 1, false, 1); + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print '
'; + print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); + print '
'; + print '
'; + print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to')); + print '
'; + print '
'; + print '
'; + 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')); + print '
'; + print '
'; + 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')); + print '
'; + print '
'; + print ''; + print ''; + print ''; + print ''; + $liststatus = array( + 0=>$langs->trans("Draft"), + 1=>$langs->trans("Active"), + -1=>$langs->trans("Disabled"), + ); + print $form->selectarray('search_status', $liststatus, $search_status, -2, 0, 0, '', 0, 0, 0, '', 'width100 onrightofpage'); + print ''; $searchpicto = $form->showFilterButtons(); print $searchpicto; print '
'; + if ($user->rights->facture->creer && empty($invoicerectmp->suspended)) { + if ($invoicerectmp->isMaxNbGenReached()) { + print $langs->trans("MaxNumberOfGenerationReached"); + } elseif (empty($objp->frequency) || $db->jdate($objp->date_when) <= $today) { + print ''; + print img_picto($langs->trans("CreateBill"), 'add', 'class="paddingrightonly"'); + print $langs->trans("CreateBill").''; + } else { + print $form->textwithpicto('', $langs->trans("DateIsNotEnough")); + } + } + print ''; + print $invoicerectmp->getNomUrl(1); + print "'.$companystatic->getNomUrl(1, 'customer').''.price($objp->total_ht).''.price($objp->total_tva).''.price($objp->total_ttc).''; + $form->form_conditions_reglement('', $objp->fk_cond_reglement, 'none'); + print ''; + $form->form_modes_reglement('', $objp->fk_mode_reglement, 'none'); + print ''.($objp->frequency ? img_picto($langs->trans("Frequency").': '.$objp->frequency.' '.$objp->unit_frequency, 'recurring', 'class="opacitymedium"').' ' : '').yn($objp->frequency ? 1 : 0).''.($objp->frequency > 0 ? $objp->frequency : '').''.($objp->frequency > 0 ? $objp->unit_frequency : '').''; + print ($objp->frequency > 0 ? $objp->nb_gen_done.($objp->nb_gen_max > 0 ? ' / '.$objp->nb_gen_max : '') : ''.$langs->trans('NA').''); + print ''; + print ($objp->frequency > 0 ? dol_print_date($db->jdate($objp->date_last_gen), 'day') : ''.$langs->trans('NA').''); + print ''; + print '
'; + print ($objp->frequency ? ($invoicerectmp->isMaxNbGenReached() ? '' : '').dol_print_date($db->jdate($objp->date_when), 'day').($invoicerectmp->isMaxNbGenReached() ? '' : '') : ''.$langs->trans('NA').''); + if (!$invoicerectmp->isMaxNbGenReached()) { + if (!$objp->suspended && $objp->frequency > 0 && $db->jdate($objp->date_when) && $db->jdate($objp->date_when) < $now) { + print img_warning($langs->trans("Late")); + } + } else { + print img_info($langs->trans("MaxNumberOfGenerationReached")); + } + print '
'; + print '
'; + if ($objp->fk_user_author > 0) { + $tmpuser->fetch($objp->fk_user_author); + print $tmpuser->getNomUrl(1); + } + print ''; + if ($objp->fk_user_author > 0) { + $tmpuser->fetch($objp->fk_user_author); + print $tmpuser->getNomUrl(1); + } + print ''; + print dol_print_date($db->jdate($objp->datec), 'dayhour'); + print ''; + print dol_print_date($db->jdate($objp->tms), 'dayhour'); + print ''; + print $invoicerectmp->getLibStatut(3, 0); + print '
'; - print $invoicerectmp->getNomUrl(1); - print "'.$companystatic->getNomUrl(1, 'customer').''.price($objp->total_ht).''.price($objp->total_tva).''.price($objp->total_ttc).''; - $form->form_conditions_reglement('', $objp->fk_cond_reglement, 'none'); - print ''; - $form->form_modes_reglement('', $objp->fk_mode_reglement, 'none'); - print ''.($objp->frequency ? img_picto($langs->trans("Frequency").': '.$objp->frequency.' '.$objp->unit_frequency, 'recurring', 'class="opacitymedium"').' ' : '').yn($objp->frequency ? 1 : 0).''.($objp->frequency > 0 ? $objp->frequency : '').''.($objp->frequency > 0 ? $objp->unit_frequency : '').''; - print ($objp->frequency > 0 ? $objp->nb_gen_done.($objp->nb_gen_max > 0 ? ' / '.$objp->nb_gen_max : '') : ''.$langs->trans('NA').''); - print ''; - print ($objp->frequency > 0 ? dol_print_date($db->jdate($objp->date_last_gen), 'day') : ''.$langs->trans('NA').''); - print ''; - print '
'; - print ($objp->frequency ? ($invoicerectmp->isMaxNbGenReached() ? '' : '').dol_print_date($db->jdate($objp->date_when), 'day').($invoicerectmp->isMaxNbGenReached() ? '' : '') : ''.$langs->trans('NA').''); - if (!$invoicerectmp->isMaxNbGenReached()) { - if (!$objp->suspended && $objp->frequency > 0 && $db->jdate($objp->date_when) && $db->jdate($objp->date_when) < $now) { - print img_warning($langs->trans("Late")); - } - } else { - print img_info($langs->trans("MaxNumberOfGenerationReached")); - } - print '
'; - print '
'; - if ($objp->fk_user_author > 0) { - $tmpuser->fetch($objp->fk_user_author); - print $tmpuser->getNomUrl(1); - } - print ''; - if ($objp->fk_user_author > 0) { - $tmpuser->fetch($objp->fk_user_author); - print $tmpuser->getNomUrl(1); - } - print ''; - print dol_print_date($db->jdate($objp->datec), 'dayhour'); - print ''; - print dol_print_date($db->jdate($objp->tms), 'dayhour'); - print ''; - print $invoicerectmp->getLibStatut(3, 0); - print ''; - if ($user->rights->facture->creer && empty($invoicerectmp->suspended)) { - if ($invoicerectmp->isMaxNbGenReached()) { - print $langs->trans("MaxNumberOfGenerationReached"); - } elseif (empty($objp->frequency) || $db->jdate($objp->date_when) <= $today) { - print ''; - print img_picto($langs->trans("CreateBill"), 'add', 'class="paddingrightonly"'); - print $langs->trans("CreateBill").''; - } else { - print $form->textwithpicto('', $langs->trans("DateIsNotEnough")); - } + // Action column + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + if ($user->rights->facture->creer && empty($invoicerectmp->suspended)) { + if ($invoicerectmp->isMaxNbGenReached()) { + print $langs->trans("MaxNumberOfGenerationReached"); + } elseif (empty($objp->frequency) || $db->jdate($objp->date_when) <= $today) { + print ''; + print img_picto($langs->trans("CreateBill"), 'add', 'class="paddingrightonly"'); + print $langs->trans("CreateBill").''; } else { - print " "; - } - if (!$i) { - $totalarray['nbfield']++; - } - print "
'.$langs->trans("NoRecordFound").'
"; - print "
"; - print ""; - - $db->free($resql); -} else { - dol_print_error($db); + $i++; } +// Show total line +include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php'; + +// If no record found +if ($num == 0) { + $colspan = 1; + foreach ($arrayfields as $key => $val) { + if (!empty($val['checked'])) { + $colspan++; + } + } + print '
'.$langs->trans("NoRecordFound").'
'."\n"; +print '
'."\n"; + +print ''."\n"; + + // End of page llxFooter(); $db->close(); diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 1255586b2dc..5ef76f9ef88 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -9784,7 +9784,7 @@ class Form /** * Return HTML to show the search and clear seach button * - * @param string $pos position colon on liste value left or right + * @param string $pos Position of colon on the list. Value 'left' or 'right' * @return string */ public function showFilterButtons($pos = '') diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 3c5991128d7..d9e12731022 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -2372,3 +2372,4 @@ WarningModuleHasChangedLastVersionCheckParameter=Warning: the module %s has set WarningModuleHasChangedSecurityCsrfParameter=Warning: the module %s has disabled the CSRF security of your instance. This action is suspect and your installation may no more be secured. Please contact the author of the module for explanation. EMailsInGoingDesc=Incoming emails are managed by the module %s. You must enable and configure it if you need to support ingoing emails. MAIN_IMAP_USE_PHPIMAP=Use the PHP-IMAP library for IMAP instead of native PHP IMAP. This also allows the use of an OAuth2 connection for IMAP (module OAuth must also be activated). +MAIN_CHECKBOX_LEFT_COLUMN=Show the column for field and line selection on the left (on the right by default) \ No newline at end of file