Fix: If a customer has 2000 invoices, creating next one make 2000
requests instead of 1.
This commit is contained in:
parent
a98de7ef02
commit
3a98f6903e
@ -1851,15 +1851,20 @@ if ($action == 'create')
|
||||
exit;
|
||||
}
|
||||
$optionsav="";
|
||||
foreach ($facids as $key => $value)
|
||||
$newinvoice_static=new Facture($db);
|
||||
foreach ($facids as $key => $valarray)
|
||||
{
|
||||
$newinvoice=new Facture($db);
|
||||
$newinvoice->fetch($key);
|
||||
$newinvoice_static->id=$key;
|
||||
$newinvoice_static->ref=$valarray['ref'];
|
||||
$newinvoice_static->statut=$valarray['status'];
|
||||
$newinvoice_static->type=$valarray['type'];
|
||||
$newinvoice_static->paye=$valarray['paye'];
|
||||
|
||||
$optionsav.='<option value="'.$key.'"';
|
||||
if ($key == $_POST['fac_avoir']) $optionsav.=' selected="selected"';
|
||||
$optionsav.='>';
|
||||
$optionsav.=$newinvoice->ref;
|
||||
$optionsav.=' ('.$newinvoice->getLibStatut(1,$value).')';
|
||||
$optionsav.=$newinvoice_static->ref;
|
||||
$optionsav.=' ('.$newinvoice_static->getLibStatut(1,$valarray['paymentornot']).')';
|
||||
$optionsav.='</option>';
|
||||
}
|
||||
|
||||
|
||||
@ -2618,7 +2618,7 @@ class Facture extends CommonInvoice
|
||||
* (validee + paiement en cours) ou classee (payee completement ou payee partiellement) + pas deja remplacee + pas deja avoir
|
||||
*
|
||||
* @param int $socid Id societe
|
||||
* @return array Tableau des factures ($id => $ref)
|
||||
* @return array Tableau des factures ($id => array('ref'=>,'paymentornot'=>,'status'=>,'paye'=>)
|
||||
*/
|
||||
function list_qualified_avoir_invoices($socid=0)
|
||||
{
|
||||
@ -2626,7 +2626,7 @@ class Facture extends CommonInvoice
|
||||
|
||||
$return = array();
|
||||
|
||||
$sql = "SELECT f.rowid as rowid, f.facnumber, f.fk_statut, pf.fk_paiement";
|
||||
$sql = "SELECT f.rowid as rowid, f.facnumber, f.fk_statut, f.type, f.paye, pf.fk_paiement";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON f.rowid = pf.fk_facture";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture as ff ON (f.rowid = ff.fk_facture_source AND ff.type=1)";
|
||||
@ -2640,7 +2640,7 @@ class Facture extends CommonInvoice
|
||||
if ($socid > 0) $sql.=" AND f.fk_soc = ".$socid;
|
||||
$sql.= " ORDER BY f.facnumber";
|
||||
|
||||
dol_syslog(get_class($this)."::list_qualified_avoir_invoices sql=$sql");
|
||||
dol_syslog(get_class($this)."::list_qualified_avoir_invoices sql=".$sql);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -2653,7 +2653,7 @@ class Facture extends CommonInvoice
|
||||
{
|
||||
//$ref=$obj->facnumber;
|
||||
$paymentornot=($obj->fk_paiement?1:0);
|
||||
$return[$obj->rowid]=$paymentornot;
|
||||
$return[$obj->rowid]=array('ref'=>$obj->facnumber,'status'=>$obj->fk_statut,'type'=>$obj->type,'paye'=>$obj->paye,'paymentornot'=>$paymentornot);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user