From 4eaa1d4f46541cca297a83e2229f20d63ec126b5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 11 Apr 2017 20:07:35 +0200 Subject: [PATCH] Add nb of generation into list of template invoices --- htdocs/compta/facture/card.php | 4 +-- htdocs/compta/facture/fiche-rec.php | 47 ++++++++++++++++++--------- htdocs/core/class/html.form.class.php | 4 +-- 3 files changed, 35 insertions(+), 20 deletions(-) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 663c0374b9a..9592f17a188 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -2645,7 +2645,7 @@ if ($action == 'create') // Public note print ''; - print ''; + print ''; print $form->textwithpicto($langs->trans('NotePublic'), $htmltext); print ''; print ''; @@ -2656,7 +2656,7 @@ if ($action == 'create') if (empty($user->societe_id)) { print ''; - print ''; + print ''; print $form->textwithpicto($langs->trans('NotePrivate'), $htmltext); print ''; print ''; diff --git a/htdocs/compta/facture/fiche-rec.php b/htdocs/compta/facture/fiche-rec.php index 90938242f5f..db10f0c1ca0 100644 --- a/htdocs/compta/facture/fiche-rec.php +++ b/htdocs/compta/facture/fiche-rec.php @@ -110,6 +110,7 @@ $arrayfields=array( 'f.tva'=>array('label'=>$langs->trans("AmountVAT"), 'checked'=>1), 'f.total_ttc'=>array('label'=>$langs->trans("AmountTTC"), 'checked'=>1), 'f.frequency'=>array('label'=>$langs->trans("RecurringInvoiceTemplate"), 'checked'=>1), + 'f.nb_gen_done'=>array('label'=>$langs->trans("NbGeneration"), 'checked'=>1), 'f.date_last_gen'=>array('label'=>$langs->trans("DateLastGeneration"), 'checked'=>1), 'f.date_when'=>array('label'=>$langs->trans("NextDateToExecution"), 'checked'=>1), 'f.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500), @@ -948,7 +949,7 @@ if ($action == 'create') // Public note print ''; print ''; - print $form->textwithpicto($langs->trans('NotePublic'), $htmltext); + print $form->textwithpicto($langs->trans('NotePublic'), $htmltext, 1, 'help', '', 0, 2, 'notepublic'); print ''; print ''; $doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%'); @@ -959,7 +960,7 @@ if ($action == 'create') { print ''; print ''; - print $form->textwithpicto($langs->trans('NotePrivate'), $htmltext); + print $form->textwithpicto($langs->trans('NotePrivate'), $htmltext, 1, 'help', '', 0, 2, 'noteprivate'); print ''; print ''; $doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%'); @@ -1250,7 +1251,7 @@ else // Note public print ''; - print $form->editfieldkey($form->textwithpicto($langs->trans('NotePublic'), $htmltext), 'note_public', $object->note_public, $object, $user->rights->facture->creer); + print $form->editfieldkey($form->textwithpicto($langs->trans('NotePublic'), $htmltext, 1, 'help', '', 0, 2, 'notepublic'), 'note_public', $object->note_public, $object, $user->rights->facture->creer); print ''; print $form->editfieldval($langs->trans("NotePublic"), 'note_public', $object->note_public, $object, $user->rights->facture->creer, 'textarea:'.ROWS_4.':60'); print ''; @@ -1258,7 +1259,7 @@ else // Note private print ''; - print $form->editfieldkey($form->textwithpicto($langs->trans("NotePrivate"), $htmltext), 'note_private', $object->note_private, $object, $user->rights->facture->creer); + print $form->editfieldkey($form->textwithpicto($langs->trans("NotePrivate"), $htmltext, 1, 'help', '', 0, 2, 'noteprivate'), 'note_private', $object->note_private, $object, $user->rights->facture->creer); print ''; print $form->editfieldval($langs->trans("NotePrivate"), 'note_private', $object->note_private, $object, $user->rights->facture->creer, 'textarea:'.ROWS_4.':60'); print ''; @@ -1291,16 +1292,17 @@ else print '
'; print '
'; - print ''; /* * Recurrence */ $title = $langs->trans("Recurrence"); - print load_fiche_titre($title, '', 'calendar'); + //print load_fiche_titre($title, '', 'calendar'); print '
'; + print ''; + // if "frequency" is empty or = 0, the reccurence is disabled print '
'.$title.'
'; print ''; } // Thirpdarty if (! empty($arrayfields['s.nom']['checked'])) { - print ''; + print ''; } if (! empty($arrayfields['f.total']['checked'])) { // Amount print ''; } if (! empty($arrayfields['f.tva']['checked'])) { // Amount print ''; } if (! empty($arrayfields['f.total_ttc']['checked'])) { // Amount print ''; } if (! empty($arrayfields['f.frequency']['checked'])) { - // Amount + // Recurring or not print ''; } + if (! empty($arrayfields['f.nb_gen_done']['checked'])) + { + // Nb generation + print ''; + } // Date invoice if (! empty($arrayfields['f.date_last_gen']['checked'])) { @@ -1753,6 +1761,10 @@ else print_liste_field_titre($langs->trans("AmountVAT"),$_SERVER['PHP_SELF'],"f.tva","",$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("AmountTTC"),$_SERVER['PHP_SELF'],"f.total_ttc","",$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("RecurringInvoiceTemplate"),$_SERVER['PHP_SELF'],"f.frequency","",$param,'align="center"',$sortfield,$sortorder); + if (! empty($arrayfields['f.nb_gen_done']['checked'])) + { + print_liste_field_titre($langs->trans("NbOfGenerationDone"),$_SERVER['PHP_SELF'],"f.nb_gen_done","",$param,'align="center"',$sortfield,$sortorder); + } print_liste_field_titre($langs->trans("DateLastGeneration"),$_SERVER['PHP_SELF'],"f.date_last_gen","",$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("NextDateToExecution"),$_SERVER['PHP_SELF'],"f.date_when","",$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre(''); // Field may contains ling text @@ -1765,21 +1777,24 @@ else while ($i < min($num,$limit)) { $objp = $db->fetch_object($resql); - $var=!$var; - print ""; + print ''; print '\n"; $companystatic->id=$objp->socid; $companystatic->name=$objp->name; - print ''; + print ''; print ''."\n"; print ''."\n"; print ''."\n"; print ''; + if (! empty($arrayfields['f.nb_gen_done']['checked'])) + { + print ''; + } print ''; print ''; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index b9f9a6115ee..35edc1178dc 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -404,7 +404,7 @@ class Form * @param int $notabs 0=Include table and tr tags, 1=Do not include table and tr tags, 2=use div, 3=use span * @param string $incbefore Include code before the text * @param int $noencodehtmltext Do not encode into html entity the htmltext - * @param int $tooltiptrigger ''=Tooltip on hover, 'abc'=Tooltip on click (abc is a unique key) + * @param string $tooltiptrigger ''=Tooltip on hover, 'abc'=Tooltip on click (abc is a unique key) * @return string Code html du tooltip (texte+picto) * @see Use function textwithpicto if you can. * TODO Move this as static as soon as everybody use textwithpicto or @Form::textwithtooltip @@ -487,7 +487,7 @@ class Form * @param string $extracss Add a CSS style to td, div or span tag * @param int $noencodehtmltext Do not encode into html entity the htmltext * @param int $notabs 0=Include table and tr tags, 1=Do not include table and tr tags, 2=use div, 3=use span - * @param int $tooltiptrigger ''=Tooltip on hover, 'abc'=Tooltip on click (abc is a unique key) + * @param string $tooltiptrigger ''=Tooltip on hover, 'abc'=Tooltip on click (abc is a unique key) * @return string HTML code of text, picto, tooltip */ function textwithpicto($text, $htmltext, $direction = 1, $type = 'help', $extracss = '', $noencodehtmltext = 0, $notabs = 2, $tooltiptrigger='')
'; @@ -1535,7 +1537,7 @@ 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.date_last_gen, f.date_when"; + $sql.= " f.nb_gen_done, f.nb_gen_max, f.date_last_gen, f.date_when"; $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"; @@ -1646,42 +1648,48 @@ else if (! empty($arrayfields['f.titre']['checked'])) { print ''; - print ''; + print ''; print ''; - print ''; + print ''; print ''; - print ''; + print ''; print ''; - print ''; + print ''; print ''; print $form->selectyesno('search_frequency', $search_frequency, 1, false, 1); print ''; + print '
'.img_object($langs->trans("ShowBill"),"bill").' '.$objp->titre; print "'.$companystatic->getNomUrl(1,'customer').''.$companystatic->getNomUrl(1,'customer').''.price($objp->total).''.price($objp->total_vat).''.price($objp->total_ttc).''.yn($objp->frequency?1:0).''.($objp->frequency ? $objp->nb_gen_done.($objp->nb_gen_max>0?' / '. $objp->nb_gen_max:'') : '').''.($objp->frequency ? dol_print_date($objp->date_last_gen,'day') : '').''.($objp->frequency ? dol_print_date($objp->date_when,'day') : '').'