diff --git a/htdocs/compta/facture/fiche-rec.php b/htdocs/compta/facture/fiche-rec.php index da90ae8f9e4..d38ea012c3c 100644 --- a/htdocs/compta/facture/fiche-rec.php +++ b/htdocs/compta/facture/fiche-rec.php @@ -46,13 +46,18 @@ $langs->load('compta'); $langs->load('admin'); $langs->load('other'); +$action = GETPOST('action','alpha'); +$massaction = GETPOST('massaction','alpha'); +$show_files = GETPOST('show_files','int'); +$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 + // Security check $id=(GETPOST('facid','int')?GETPOST('facid','int'):GETPOST('id','int')); -$confirm = GETPOST('confirm', 'alpha'); -$cancel = GETPOST('cancel', 'alpha'); $lineid=GETPOST('lineid','int'); $ref=GETPOST('ref','alpha'); -$action=GETPOST('action', 'alpha'); if ($user->societe_id) $socid=$user->societe_id; $objecttype = 'facture_rec'; if ($action == "create" || $action == "add") $objecttype = ''; @@ -919,7 +924,7 @@ if ($action == 'create') print ''; print ''; - dol_fiche_head(); + dol_fiche_head(null, '', '', 0); $rowspan=4; if (! empty($conf->projet->enabled)) $rowspan++; @@ -966,10 +971,10 @@ if ($action == 'create') // Public note print ''; - print ''; + print ''; print $form->textwithpicto($langs->trans('NotePublic'), $htmltext, 1, 'help', '', 0, 2, 'notepublic'); print ''; - print ''; + print ''; $doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%'); print $doleditor->Create(1); @@ -977,7 +982,7 @@ if ($action == 'create') if (empty($user->societe_id)) { print ''; - print ''; + print ''; print $form->textwithpicto($langs->trans('NotePrivate'), $htmltext, 1, 'help', '', 0, 2, 'noteprivate'); print ''; print ''; @@ -1021,12 +1026,14 @@ if ($action == 'create') print ""; - print '

'; + dol_fiche_end(); // Autogeneration $title = $langs->trans("Recurrence"); - print load_fiche_titre($title, '', 'calendar'); + print load_fiche_titre(' '.$title, '', ''); + + dol_fiche_head(null, '', '', 0); print ''; @@ -1054,7 +1061,8 @@ if ($action == 'create') print "
"; - print '

'; + dol_fiche_end(); + $title = $langs->trans("ProductsAndServices"); if (empty($conf->service->enabled)) @@ -1092,8 +1100,6 @@ if ($action == 'create') } print "\n"; - dol_fiche_end(); - print '
'; print '     '; print ''; @@ -1572,7 +1578,8 @@ else * List mode */ $sql = "SELECT s.nom as name, s.rowid as socid, f.rowid as facid, f.titre, f.total, f.tva as total_vat, f.total_ttc, f.frequency,"; - $sql.= " f.nb_gen_done, f.nb_gen_max, f.date_last_gen, f.date_when"; + $sql.= " f.nb_gen_done, f.nb_gen_max, f.date_last_gen, f.date_when,"; + $sql.= " f.datec, f.tms"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture_rec as f"; if (! $user->rights->societe->client->voir && ! $socid) { $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -1584,10 +1591,10 @@ else } if ($search_ref) $sql .= natural_search('f.titre', $search_ref); if ($search_societe) $sql .= natural_search('s.nom', $search_societe); - if ($search_frequency) $sql .= natural_search('f.frequency', $search_frequency); if ($search_montant_ht != '') $sql.= natural_search('f.total', $search_montant_ht, 1); if ($search_montant_vat != '') $sql.= natural_search('f.tva', $search_montant_vat, 1); if ($search_montant_ttc != '') $sql.= natural_search('f.total_ttc', $search_montant_ttc, 1); + if ($search_frequency > 0) $sql.= natural_search('f.frequency', $search_frequency); if ($search_frequency == '1') $sql.= ' AND f.frequency > 0'; if ($search_frequency == '0') $sql.= ' AND (f.frequency IS NULL or f.frequency = 0)'; @@ -1619,23 +1626,24 @@ else } $nbtotalofrecords = ''; - if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) - { - $result = $db->query($sql); - $nbtotalofrecords = $db->num_rows($result); - } + if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) + { + $result = $db->query($sql); + $nbtotalofrecords = $db->num_rows($result); + } - $sql.= $db->order($sortfield, $sortorder); - $sql.= $db->plimit($limit+1,$offset); + $sql.= $db->order($sortfield, $sortorder); + $sql.= $db->plimit($limit+1,$offset); $resql = $db->query($sql); if ($resql) { $num = $db->num_rows($resql); - $param='&socid='.$socid; + $param=''; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; + if ($socid) $param.='&socid='.$socid; if ($day) $param.='&day='.$day; if ($month) $param.='&month='.$month; if ($year) $param.='&year=' .$year; @@ -1645,9 +1653,9 @@ else if ($search_ref) $param.='&search_ref=' .$search_ref; if ($search_societe) $param.='&search_societe=' .$search_societe; if ($search_montant_ht != '') $param.='&search_montant_ht='.$search_montant_ht; - if ($search_montant_vat != '') $param.='&search_montant_vat='.$search_montant_vat; + if ($search_montant_vat != '') $param.='&search_montant_vat='.$search_montant_vat; if ($search_montant_ttc != '') $param.='&search_montant_ttc='.$search_montant_ttc; - if ($search_frequency) $param.='&search_frequency=' .$search_frequency; + if ($search_frequency > 0) $param.='&search_frequency=' .$search_frequency; if ($option) $param.="&option=".$option; if ($optioncss != '') $param.='&optioncss='.$optioncss; // Add $param from extra fields @@ -1660,6 +1668,7 @@ else $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); @@ -1671,7 +1680,8 @@ else print ''; print ''; print ''; - print ''; + print ''; + print ''; print_barre_liste($langs->trans("RepeatableInvoices"),$page,$_SERVER['PHP_SELF'],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords,'title_accountancy.png',0,'','',$limit); @@ -1857,25 +1867,25 @@ else if (! empty($arrayfields['f.date_last_gen']['checked'])) { print ''; - print ($objp->frequency ? dol_print_date($objp->date_last_gen,'day') : ''.$langs->trans('NA').''); + print ($objp->frequency ? dol_print_date($db->jdate($objp->date_last_gen),'day') : ''.$langs->trans('NA').''); print ''; } if (! empty($arrayfields['f.date_when']['checked'])) { print ''; - print ($objp->frequency ? dol_print_date($objp->date_when,'day') : ''.$langs->trans('NA').''); + print ($objp->frequency ? dol_print_date($db->jdate($objp->date_when),'day') : ''.$langs->trans('NA').''); print ''; } if (! empty($arrayfields['f.datec']['checked'])) { print ''; - print dol_print_date($objp->datec,'dayhour'); + print dol_print_date($db->jdate($objp->datec),'dayhour'); print ''; } if (! empty($arrayfields['f.tms']['checked'])) { print ''; - print dol_print_date($objp->tms,'dayjour'); + print dol_print_date($db->jdate($objp->tms),'dayhour'); print ''; } // Action column diff --git a/htdocs/install/mysql/migration/5.0.0-6.0.0.sql b/htdocs/install/mysql/migration/5.0.0-6.0.0.sql index 0a32242738e..90809090423 100644 --- a/htdocs/install/mysql/migration/5.0.0-6.0.0.sql +++ b/htdocs/install/mysql/migration/5.0.0-6.0.0.sql @@ -158,6 +158,8 @@ ALTER TABLE llx_product_price_by_qty ADD COLUMN import_key varchar(14); ALTER TABLE llx_user ADD COLUMN import_key varchar(14); +ALTER TABLE llx_facture_rec ADD COLUMN tms timestamp; +UPDATE llx_facture_rec SET tms = datec where tms < '2000-01-01'; CREATE TABLE llx_product_attribute ( diff --git a/htdocs/install/mysql/tables/llx_facture_rec.sql b/htdocs/install/mysql/tables/llx_facture_rec.sql index 0e25100386b..e9764e1e575 100644 --- a/htdocs/install/mysql/tables/llx_facture_rec.sql +++ b/htdocs/install/mysql/tables/llx_facture_rec.sql @@ -25,7 +25,8 @@ create table llx_facture_rec titre varchar(50) NOT NULL, entity integer DEFAULT 1 NOT NULL, -- multi company id fk_soc integer NOT NULL, - datec datetime, -- date de creation + datec datetime, -- date de creation + tms timestamp, -- date creation/modification amount double(24,8) DEFAULT 0 NOT NULL, remise real DEFAULT 0, diff --git a/htdocs/install/pgsql/functions/functions.sql b/htdocs/install/pgsql/functions/functions.sql index 1b2d184de0f..2e4125e39e4 100644 --- a/htdocs/install/pgsql/functions/functions.sql +++ b/htdocs/install/pgsql/functions/functions.sql @@ -102,6 +102,7 @@ CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_expedition FOR EACH CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_expensereport FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_facture FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); +CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_facture_rec FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_facture_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_facture_fourn FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); CREATE TRIGGER update_customer_modtime BEFORE UPDATE ON llx_facture_fourn_det_extrafields FOR EACH ROW EXECUTE PROCEDURE update_modified_column_tms(); diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index ca2d4058768..9d1019affee 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -65,6 +65,7 @@ $action = GETPOST('action','alpha'); $massaction = GETPOST('massaction','alpha'); $show_files = GETPOST('show_files','int'); $confirm = GETPOST('confirm','alpha'); +$cancel = GETPOST('cancel', 'alpha'); $toselect = GETPOST('toselect', 'array'); $contextpage= GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'myobjectlist'; // To manage different context of search