Issue #3509: Ready for customers

This commit is contained in:
Juanjo Menent 2015-10-03 16:58:46 +02:00
parent 92f4c0d015
commit 03a2fd740d
6 changed files with 20 additions and 17 deletions

View File

@ -7,6 +7,7 @@
* Copyright (C) 2012 Cédric Salvador <csalvador@gpcsolutions.fr> * Copyright (C) 2012 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr> * Copyright (C) 2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2014 Teddy Andreotti <125155@supinfo.com> * Copyright (C) 2014 Teddy Andreotti <125155@supinfo.com>
* Copyright (C) 2015 Juanjo Menent <jmenent@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * 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 * 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.='<br>'.$langs->trans("AllCompletelyPayedInvoiceWillBeClosed"); $text.='<br>'.$langs->trans("AllCompletelyPayedInvoiceWillBeClosed");
print '<input type="hidden" name="closepaidinvoices" value="'.GETPOST('closepaidinvoices').'">'; print '<input type="hidden" name="closepaidinvoices" value="'.GETPOST('closepaidinvoices').'">';
} }
$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 "</form>\n"; print "</form>\n";

View File

@ -4,6 +4,7 @@
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com> * Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2013 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2013 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Juanjo Menent <jmenent@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -201,7 +202,7 @@ if ($action == 'valide')
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Ref // Ref
print '<tr><td width="20%">'.$langs->trans('Ref').'</td><td colspan="3">'.$object->id.'</td></tr>'; print '<tr><td width="20%">'.$langs->trans('Ref').'</td><td colspan="3">'.$object->ref.'</td></tr>';
// Date payment // Date payment
print '<tr><td>'.$form->editfieldkey("Date",'datep',$object->date,$object,$user->rights->facture->paiement).'</td><td colspan="3">'; print '<tr><td>'.$form->editfieldkey("Date",'datep',$object->date,$object,$user->rights->facture->paiement).'</td><td colspan="3">';

View File

@ -82,7 +82,7 @@ class Paiement extends CommonObject
*/ */
function fetch($id, $ref='', $fk_bank='') 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.= ' c.code as type_code, c.libelle as type_libelle,';
$sql.= ' p.num_paiement, p.note,'; $sql.= ' p.num_paiement, p.note,';
$sql.= ' b.fk_account'; $sql.= ' b.fk_account';
@ -105,7 +105,7 @@ class Paiement extends CommonObject
{ {
$obj = $this->db->fetch_object($result); $obj = $this->db->fetch_object($result);
$this->id = $obj->rowid; $this->id = $obj->rowid;
$this->ref = $obj->rowid; $this->ref = $obj->ref;
$this->date = $this->db->jdate($obj->dp); $this->date = $this->db->jdate($obj->dp);
$this->datepaye = $this->db->jdate($obj->dp); $this->datepaye = $this->db->jdate($obj->dp);
$this->numero = $obj->num_paiement; $this->numero = $obj->num_paiement;
@ -177,7 +177,7 @@ class Paiement extends CommonObject
$ref = $this->getNextNumRef(''); $ref = $this->getNextNumRef('');
$sql = "INSERT INTO ".MAIN_DB_PREFIX."paiement (entity, ref, datec, datep, amount, fk_paiement, num_paiement, note, fk_user_creat)"; $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); dol_syslog(get_class($this)."::Create insert paiement", LOG_DEBUG);
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
@ -806,7 +806,7 @@ class Paiement extends CommonObject
foreach ($dirmodels as $reldir) { 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) // Load file with numbering class (if found)
if (is_file($dir.$file) && is_readable($dir.$file)) if (is_file($dir.$file) && is_readable($dir.$file))
@ -818,8 +818,8 @@ class Paiement extends CommonObject
// For compatibility // For compatibility
if (! $mybool) if (! $mybool)
{ {
$file = $conf->global->FACTURE_ADDON."/".$conf->global->PAYMENT_ADDON.".modules.php"; $file = $conf->global->PAYMENT_ADDON.".php";
$classname = "mod_facture_".$conf->global->PAYMENT_ADDON; $classname = "mod_payment_".$conf->global->PAYMENT_ADDON;
$classname = preg_replace('/\-.*$/','',$classname); $classname = preg_replace('/\-.*$/','',$classname);
// Include file with class // Include file with class
foreach ($conf->file->dol_document_root as $dirroot) foreach ($conf->file->dol_document_root as $dirroot)
@ -841,7 +841,7 @@ class Paiement extends CommonObject
$obj = new $classname(); $obj = new $classname();
$numref = ""; $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 * $numref can be empty in case we ask for the last value because if there is no invoice created with the

View File

@ -4,6 +4,7 @@
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr> * Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr> * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2015 Juanjo Menent <jmenent@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -95,7 +96,7 @@ $formother=new FormOther($db);
if (GETPOST("orphelins")) if (GETPOST("orphelins"))
{ {
// Paiements lies a aucune facture (pour aide au diagnostic) // 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.= " p.statut, p.num_paiement,";
$sql.= " c.code as paiement_code"; $sql.= " c.code as paiement_code";
// Add fields for extrafields // Add fields for extrafields
@ -117,7 +118,7 @@ if (GETPOST("orphelins"))
} }
else 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.= " p.statut, p.num_paiement,";
$sql.= " c.code as paiement_code,"; $sql.= " c.code as paiement_code,";
$sql.= " ba.rowid as bid, ba.label,"; $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))."'"; $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_account > 0) $sql .=" AND b.fk_account=".$search_account;
if ($search_paymenttype != "") $sql .=" AND c.code='".$db->escape($search_paymenttype)."'"; if ($search_paymenttype != "") $sql .=" AND c.code='".$db->escape($search_paymenttype)."'";
if ($search_amount) $sql .=" AND p.amount='".$db->escape(price2num($search_amount))."'"; if ($search_amount) $sql .=" AND p.amount='".$db->escape(price2num($search_amount))."'";
@ -253,7 +254,7 @@ if ($resql)
print '<td>'; print '<td>';
$paymentstatic->id=$objp->rowid; $paymentstatic->id=$objp->rowid;
$paymentstatic->ref=$objp->rowid; $paymentstatic->ref=$objp->ref;
print $paymentstatic->getNomUrl(1); print $paymentstatic->getNomUrl(1);
print '</td>'; print '</td>';

View File

@ -118,7 +118,7 @@ class mod_payment_ant extends ModeleNumRefPayments
return 0; 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; return $numFinal;
} }

View File

@ -104,7 +104,7 @@ class mod_payment_cicada extends ModeleNumRefPayments
global $db,$conf; global $db,$conf;
// D'abord on recupere la valeur max // D'abord on recupere la valeur max
$posindice=8; $posindice=9;
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
$sql.= " FROM ".MAIN_DB_PREFIX."paiement"; $sql.= " FROM ".MAIN_DB_PREFIX."paiement";
$sql.= " WHERE ref like '".$this->prefix."____-%'"; $sql.= " WHERE ref like '".$this->prefix."____-%'";
@ -124,7 +124,7 @@ class mod_payment_cicada extends ModeleNumRefPayments
} }
//$date=time(); //$date=time();
$date=$object->date; $date=$object->datepaye;
$yymm = strftime("%y%m",$date); $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 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 * @param string $objforref Object for number to search
* @return string Next free value * @return string Next free value
*/ */
function commande_get_num($objsoc,$objforref) function payment_get_num($objsoc,$objforref)
{ {
return $this->getNextValue($objsoc,$objforref); return $this->getNextValue($objsoc,$objforref);
} }