From 03a2fd740dd5eca71f5d1d6052579f5e5aad38cc Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Sat, 3 Oct 2015 16:58:46 +0200 Subject: [PATCH] Issue #3509: Ready for customers --- htdocs/compta/paiement.php | 3 ++- htdocs/compta/paiement/card.php | 3 ++- htdocs/compta/paiement/class/paiement.class.php | 14 +++++++------- htdocs/compta/paiement/list.php | 9 +++++---- htdocs/core/modules/payment/mod_payment_ant.php | 2 +- htdocs/core/modules/payment/mod_payment_cicada.php | 6 +++--- 6 files changed, 20 insertions(+), 17 deletions(-) diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php index 5534468da35..7466686239a 100644 --- a/htdocs/compta/paiement.php +++ b/htdocs/compta/paiement.php @@ -7,6 +7,7 @@ * Copyright (C) 2012 Cédric Salvador * Copyright (C) 2014 Raphaël Doursenaud * Copyright (C) 2014 Teddy Andreotti <125155@supinfo.com> + * Copyright (C) 2015 Juanjo Menent * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -658,7 +659,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie $text.='
'.$langs->trans("AllCompletelyPayedInvoiceWillBeClosed"); print ''; } - $form->formconfirm($_SERVER['PHP_SELF'].'?facid='.$facture->id.'&socid='.$facture->socid.'&type='.$facture->type,$langs->trans('ReceivedCustomersPayments'),$text,'confirm_paiement',$formquestion,$preselectedchoice); + print $form->formconfirm($_SERVER['PHP_SELF'].'?facid='.$facture->id.'&socid='.$facture->socid.'&type='.$facture->type,$langs->trans('ReceivedCustomersPayments'),$text,'confirm_paiement',$formquestion,$preselectedchoice); } print "\n"; diff --git a/htdocs/compta/paiement/card.php b/htdocs/compta/paiement/card.php index 71d32404c94..51a899c0748 100644 --- a/htdocs/compta/paiement/card.php +++ b/htdocs/compta/paiement/card.php @@ -4,6 +4,7 @@ * Copyright (C) 2005 Marc Barilley / Ocebo * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2013 Marcos García + * Copyright (C) 2015 Juanjo Menent * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -201,7 +202,7 @@ if ($action == 'valide') print ''; // Ref -print ''; +print ''; // Date payment print ''; diff --git a/htdocs/core/modules/payment/mod_payment_ant.php b/htdocs/core/modules/payment/mod_payment_ant.php index b4f90906c67..a09ad2355e4 100644 --- a/htdocs/core/modules/payment/mod_payment_ant.php +++ b/htdocs/core/modules/payment/mod_payment_ant.php @@ -118,7 +118,7 @@ class mod_payment_ant extends ModeleNumRefPayments return 0; } - $numFinal=get_next_value($db,$mask,'paiement','ref','',$objsoc,$object->date); + $numFinal=get_next_value($db,$mask,'paiement','ref','',$objsoc,$object->datepaye); return $numFinal; } diff --git a/htdocs/core/modules/payment/mod_payment_cicada.php b/htdocs/core/modules/payment/mod_payment_cicada.php index fb54a5fb568..aea1fb38360 100644 --- a/htdocs/core/modules/payment/mod_payment_cicada.php +++ b/htdocs/core/modules/payment/mod_payment_cicada.php @@ -104,7 +104,7 @@ class mod_payment_cicada extends ModeleNumRefPayments global $db,$conf; // D'abord on recupere la valeur max - $posindice=8; + $posindice=9; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; $sql.= " FROM ".MAIN_DB_PREFIX."paiement"; $sql.= " WHERE ref like '".$this->prefix."____-%'"; @@ -124,7 +124,7 @@ class mod_payment_cicada extends ModeleNumRefPayments } //$date=time(); - $date=$object->date; + $date=$object->datepaye; $yymm = strftime("%y%m",$date); if ($max >= (pow(10, 4) - 1)) $num=$max+1; // If counter > 9999, we do not format on 4 chars, we take number as it is @@ -142,7 +142,7 @@ class mod_payment_cicada extends ModeleNumRefPayments * @param string $objforref Object for number to search * @return string Next free value */ - function commande_get_num($objsoc,$objforref) + function payment_get_num($objsoc,$objforref) { return $this->getNextValue($objsoc,$objforref); }
'.$langs->trans('Ref').''.$object->id.'
'.$langs->trans('Ref').''.$object->ref.'
'.$form->editfieldkey("Date",'datep',$object->date,$object,$user->rights->facture->paiement).''; diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index 7064cde6e2b..04617cabd64 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -82,7 +82,7 @@ class Paiement extends CommonObject */ function fetch($id, $ref='', $fk_bank='') { - $sql = 'SELECT p.rowid, p.datep as dp, p.amount, p.statut, p.fk_bank,'; + $sql = 'SELECT p.rowid, p.ref, p.datep as dp, p.amount, p.statut, p.fk_bank,'; $sql.= ' c.code as type_code, c.libelle as type_libelle,'; $sql.= ' p.num_paiement, p.note,'; $sql.= ' b.fk_account'; @@ -105,7 +105,7 @@ class Paiement extends CommonObject { $obj = $this->db->fetch_object($result); $this->id = $obj->rowid; - $this->ref = $obj->rowid; + $this->ref = $obj->ref; $this->date = $this->db->jdate($obj->dp); $this->datepaye = $this->db->jdate($obj->dp); $this->numero = $obj->num_paiement; @@ -177,7 +177,7 @@ class Paiement extends CommonObject $ref = $this->getNextNumRef(''); $sql = "INSERT INTO ".MAIN_DB_PREFIX."paiement (entity, ref, datec, datep, amount, fk_paiement, num_paiement, note, fk_user_creat)"; - $sql.= " VALUES (".$conf->entity.", '".$ref."', ". $this->db->idate($now)."', '".$this->db->idate($this->datepaye)."', '".$totalamount."', ".$this->paiementid.", '".$this->num_paiement."', '".$this->db->escape($this->note)."', ".$user->id.")"; + $sql.= " VALUES (".$conf->entity.", '".$ref."', '". $this->db->idate($now)."', '".$this->db->idate($this->datepaye)."', '".$totalamount."', ".$this->paiementid.", '".$this->num_paiement."', '".$this->db->escape($this->note)."', ".$user->id.")"; dol_syslog(get_class($this)."::Create insert paiement", LOG_DEBUG); $resql = $this->db->query($sql); @@ -806,7 +806,7 @@ class Paiement extends CommonObject foreach ($dirmodels as $reldir) { - $dir = dol_buildpath($reldir."core/modules/facture/"); + $dir = dol_buildpath($reldir."core/modules/payment/"); // Load file with numbering class (if found) if (is_file($dir.$file) && is_readable($dir.$file)) @@ -818,8 +818,8 @@ class Paiement extends CommonObject // For compatibility if (! $mybool) { - $file = $conf->global->FACTURE_ADDON."/".$conf->global->PAYMENT_ADDON.".modules.php"; - $classname = "mod_facture_".$conf->global->PAYMENT_ADDON; + $file = $conf->global->PAYMENT_ADDON.".php"; + $classname = "mod_payment_".$conf->global->PAYMENT_ADDON; $classname = preg_replace('/\-.*$/','',$classname); // Include file with class foreach ($conf->file->dol_document_root as $dirroot) @@ -841,7 +841,7 @@ class Paiement extends CommonObject $obj = new $classname(); $numref = ""; - $numref = $obj->getNextValue($soc,$this,$mode); + $numref = $obj->getNextValue($soc,$this); /** * $numref can be empty in case we ask for the last value because if there is no invoice created with the diff --git a/htdocs/compta/paiement/list.php b/htdocs/compta/paiement/list.php index c688ca780d4..8231f607ef7 100644 --- a/htdocs/compta/paiement/list.php +++ b/htdocs/compta/paiement/list.php @@ -4,6 +4,7 @@ * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2013 Cédric Salvador * Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 2015 Juanjo Menent * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -95,7 +96,7 @@ $formother=new FormOther($db); if (GETPOST("orphelins")) { // Paiements lies a aucune facture (pour aide au diagnostic) - $sql = "SELECT p.rowid, p.datep as dp, p.amount,"; + $sql = "SELECT p.rowid, p.ref, p.datep as dp, p.amount,"; $sql.= " p.statut, p.num_paiement,"; $sql.= " c.code as paiement_code"; // Add fields for extrafields @@ -117,7 +118,7 @@ if (GETPOST("orphelins")) } else { - $sql = "SELECT DISTINCT p.rowid, p.datep as dp, p.amount,"; // DISTINCT is to avoid duplicate when there is a link to sales representatives + $sql = "SELECT DISTINCT p.rowid, p.ref, p.datep as dp, p.amount,"; // DISTINCT is to avoid duplicate when there is a link to sales representatives $sql.= " p.statut, p.num_paiement,"; $sql.= " c.code as paiement_code,"; $sql.= " ba.rowid as bid, ba.label,"; @@ -164,7 +165,7 @@ else { $sql.= " AND p.datep BETWEEN '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'"; } - if ($search_ref > 0) $sql .=" AND p.rowid=".$search_ref; + if ($search_ref) $sql .=natural_search('p.ref', $search_ref); if ($search_account > 0) $sql .=" AND b.fk_account=".$search_account; if ($search_paymenttype != "") $sql .=" AND c.code='".$db->escape($search_paymenttype)."'"; if ($search_amount) $sql .=" AND p.amount='".$db->escape(price2num($search_amount))."'"; @@ -253,7 +254,7 @@ if ($resql) print ''; $paymentstatic->id=$objp->rowid; - $paymentstatic->ref=$objp->rowid; + $paymentstatic->ref=$objp->ref; print $paymentstatic->getNomUrl(1); print '