From 3906cb79c5bb49236721558c44d76ce48197bacf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 7 Nov 2015 23:41:45 +0100 Subject: [PATCH] NEW: Add parameter to add a link to use "date of invoice" in one click when fille a payment card. --- htdocs/compta/facture/class/facture.class.php | 1 + htdocs/compta/paiement.php | 2 +- htdocs/core/class/html.form.class.php | 10 +++++++++- htdocs/fourn/facture/paiement.php | 8 ++++---- 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index ede68b39324..ca7afeb7959 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -63,6 +63,7 @@ class Facture extends CommonInvoice var $author; var $fk_user_author; var $fk_user_valid; + var $date; // Date invoice var $date_creation; // Creation date var $date_validation; // Validation date var $datem; diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php index 7466686239a..8c028b23aaa 100644 --- a/htdocs/compta/paiement.php +++ b/htdocs/compta/paiement.php @@ -415,7 +415,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie print ''.$langs->trans('Date').''; $datepayment = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); $datepayment= ($datepayment == '' ? (empty($conf->global->MAIN_AUTOFILL_DATE)?-1:'') : $datepayment); - $form->select_date($datepayment,'','','',0,"add_paiement",1,1); + $form->select_date($datepayment,'','','',0,"add_paiement",1,1,0,0,'','',$facture->date); print ''; print ''.$langs->trans('Comments').''; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 6c586ffe9b7..d64b9971a27 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -4057,10 +4057,11 @@ class Form * @param int $disabled Disable input fields * @param int $fullday When a checkbox with this html name is on, hour and day are set with 00:00 or 23:59 * @param string $addplusone Add a link "+1 hour". Value must be name of another select_date field. + * @param datetime $adddateof Add a link "Date of invoice" using the following date. * @return mixed Nothing or string if nooutput is 1 * @see form_date */ - function select_date($set_time='', $prefix='re', $h=0, $m=0, $empty=0, $form_name="", $d=1, $addnowlink=0, $nooutput=0, $disabled=0, $fullday='', $addplusone='') + function select_date($set_time='', $prefix='re', $h=0, $m=0, $empty=0, $form_name="", $d=1, $addnowlink=0, $nooutput=0, $disabled=0, $fullday='', $addplusone='', $adddateof='') { global $conf,$langs; @@ -4318,6 +4319,13 @@ class Form } } + // Add a "Plus one hour" link + if ($conf->use_javascript_ajax && $adddateof) + { + $tmparray=dol_getdate($adddateof); + $retstring.=' -