Add date of last change in invoice tables
This commit is contained in:
parent
a0e3c58d2f
commit
ec5ed9f5f4
@ -339,10 +339,12 @@ if ($conf->propal->enabled && $user->rights->propale->lire)
|
||||
}
|
||||
|
||||
/*
|
||||
* Last modified prospects
|
||||
* Last modified customers prospects
|
||||
*/
|
||||
if ($user->rights->societe->lire)
|
||||
if ($conf->societe->enabled && $user->rights->societe->lire)
|
||||
{
|
||||
$langs->load("boxes");
|
||||
|
||||
$sql = "SELECT s.rowid,s.nom,s.client,s.tms";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
@ -356,24 +358,24 @@ if ($user->rights->societe->lire)
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$var=false;
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="3">'.$langs->trans("BoxTitleLastCustomersOrProspects",$max).'</td></tr>';
|
||||
if ($num)
|
||||
{
|
||||
$langs->load("boxes");
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td colspan="3">'.$langs->trans("BoxTitleLastCustomersOrProspects",$max).'</td></tr>';
|
||||
|
||||
$i = 0;
|
||||
$var=false;
|
||||
$company=new Societe($db);
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object($resql);
|
||||
print "<tr $bc[$var]>";
|
||||
print "<td nowrap>";
|
||||
if ($objp->client == 1) print "<a href=\"".DOL_URL_ROOT."/comm/fiche.php?socid=".$objp->rowid."\">".img_object($langs->trans("ShowCustomer"),"company")." ".$objp->nom."</a></td>";
|
||||
if ($objp->client == 2) print "<a href=\"".DOL_URL_ROOT."/comm/prospect/fiche.php?socid=".$objp->rowid."\">".img_object($langs->trans("ShowCustomer"),"company")." ".$objp->nom."</a></td>";
|
||||
$company->id=$objp->rowid;
|
||||
$company->nom=$objp->nom;
|
||||
$company->client=$objp->client;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td nowrap="nowrap">'.$company->getNomUrl(1,'customer',48).'</td>';
|
||||
print '<td align="right" nowrap>';
|
||||
if ($objp->client == 1) print $langs->trans("Customer");
|
||||
if ($objp->client == 2) print $langs->trans("Prospect");
|
||||
@ -388,6 +390,61 @@ if ($user->rights->societe->lire)
|
||||
|
||||
$db->free($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr '.$bc[$var].'><td colspan="2">'.$langs->trans("None").'</td></tr>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Last suppliers
|
||||
if ($conf->fournisseur->enabled && $user->rights->societe->lire)
|
||||
{
|
||||
$langs->load("boxes");
|
||||
|
||||
$sql = "SELECT s.nom, s.rowid, ".$db->pdate("s.datec")." as dc";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE s.fournisseur = 1";
|
||||
$sql.= " AND s.entity = ".$conf->entity;
|
||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
if ($socid) $sql.= " AND s.rowid = ".$socid;
|
||||
$sql.= " ORDER BY s.datec DESC";
|
||||
$sql.= $db->plimit($max, 0);
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$var=false;
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("BoxTitleLastSuppliers",min($max,$num)).'</td>';
|
||||
print '<td align="right">'.$langs->trans("DateModificationShort").'</td>';
|
||||
print '</tr>';
|
||||
if ($num)
|
||||
{
|
||||
$company=new Societe($db);
|
||||
while ($i < $num && $i < $max)
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
$company->id=$objp->rowid;
|
||||
$company->nom=$objp->nom;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td nowrap="nowrap">'.$company->getNomUrl(1,'supplier',48).'</td>';
|
||||
print '<td align="right">'.dol_print_date($objp->dc,'day').'</td>';
|
||||
print '</tr>';
|
||||
$var=!$var;
|
||||
$i++;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr '.$bc[$var].'><td colspan="2">'.$langs->trans("None").'</td></tr>';
|
||||
}
|
||||
print '</table><br>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -81,8 +81,7 @@ if (isset($_GET["action"]) && $_GET["action"] == 'del_bookmark')
|
||||
|
||||
|
||||
/*
|
||||
* Affichage page
|
||||
*
|
||||
* View
|
||||
*/
|
||||
|
||||
$now=gmmktime();
|
||||
@ -107,6 +106,9 @@ if (($conf->facture->enabled && $user->rights->facture->lire) ||
|
||||
print '<td valign="top" width="30%" class="notopnoleft">';
|
||||
}
|
||||
|
||||
$max=3;
|
||||
|
||||
|
||||
/*
|
||||
* Find invoices
|
||||
*/
|
||||
@ -291,12 +293,178 @@ else
|
||||
print '<td valign="top" width="100%" class="notopnoleftnoright">';
|
||||
}
|
||||
|
||||
// Last modified customer invoices
|
||||
if ($conf->facture->enabled && $user->rights->facture->lire)
|
||||
{
|
||||
$langs->load("boxes");
|
||||
$facstatic=new Facture($db);
|
||||
|
||||
$sql = "SELECT f.rowid, f.facnumber, f.fk_statut, f.type, f.total, f.total_ttc, f.tms,";
|
||||
$sql.= " f.date_lim_reglement as datelimite,";
|
||||
$sql.= " sum(pf.amount) as am,";
|
||||
$sql.= " s.nom, s.rowid as socid";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf on f.rowid=pf.fk_facture";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE s.rowid = f.fk_soc";
|
||||
$sql.= " AND f.entity = ".$conf->entity;
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
if ($socid) $sql.= " AND f.fk_soc = ".$socid;
|
||||
$sql.= " GROUP BY f.rowid, f.facnumber, f.fk_statut, f.total, f.total_ttc, s.nom, s.rowid";
|
||||
$sql.= " ORDER BY f.tms DESC ";
|
||||
$sql.= $db->plimit($max, 0);
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$var=false;
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("BoxTitleLastCustomerBills",min($max,$num)).'</td>';
|
||||
if ($conf->global->MAIN_SHOW_HT_ON_SUMMARY) print '<td align="right">'.$langs->trans("AmountHT").'</td>';
|
||||
print '<td align="right">'.$langs->trans("AmountTTC").'</td>';
|
||||
print '<td align="right">'.$langs->trans("DateModificationShort").'</td>';
|
||||
print '<td width="16"> </td>';
|
||||
print '</tr>';
|
||||
if ($num)
|
||||
{
|
||||
$total_ttc = $totalam = $total = 0;
|
||||
while ($i < $num && $i < $conf->liste_limit)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td nowrap="nowrap">';
|
||||
|
||||
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
|
||||
print '<td width="100" class="nobordernopadding" nowrap="nowrap">';
|
||||
$facturestatic->ref=$obj->facnumber;
|
||||
$facturestatic->id=$obj->rowid;
|
||||
$facturestatic->type=$obj->type;
|
||||
print $facturestatic->getNomUrl(1,'');
|
||||
print '</td>';
|
||||
print '<td width="20" class="nobordernopadding" nowrap="nowrap">';
|
||||
if ($obj->datelimite < ($now - $conf->facture->client->warning_delay)) print img_warning($langs->trans("Late"));
|
||||
print '</td>';
|
||||
print '<td width="16" align="right" class="nobordernopadding">';
|
||||
$filename=dol_sanitizeFileName($obj->facnumber);
|
||||
$filedir=$conf->facture->dir_output . '/' . dol_sanitizeFileName($obj->facnumber);
|
||||
$urlsource=$_SERVER['PHP_SELF'].'?facid='.$obj->rowid;
|
||||
$formfile->show_documents('facture',$filename,$filedir,$urlsource,'','','','','',1);
|
||||
print '</td></tr></table>';
|
||||
|
||||
print '</td>';
|
||||
print '<td align="left"><a href="fiche.php?socid='.$obj->socid.'">'.img_object($langs->trans("ShowCustomer"),"company").' '.dol_trunc($obj->nom,44).'</a></td>';
|
||||
if ($conf->global->MAIN_SHOW_HT_ON_SUMMARY) print '<td align="right">'.price($obj->total).'</td>';
|
||||
print '<td align="right">'.price($obj->total_ttc).'</td>';
|
||||
print '<td align="right">'.dol_print_date($db->jdate($obj->tms),'day').'</td>';
|
||||
print '<td>'.$facstatic->LibStatut($obj->paye,$obj->fk_statut,3,$obj->am).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
$total_ttc += $obj->total_ttc;
|
||||
$total += $obj->total;
|
||||
$totalam += $obj->am;
|
||||
$var=!$var;
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$colspan=5;
|
||||
if ($conf->global->MAIN_SHOW_HT_ON_SUMMARY) $colspan++;
|
||||
print '<tr '.$bc[$var].'><td colspan="'.$colspan.'">'.$langs->trans("NoInvoice").'</td></tr>';
|
||||
}
|
||||
print '</table><br>';
|
||||
$db->free($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Last modified supplier invoices
|
||||
if ($conf->fournisseur->enabled && $user->rights->fournisseur->facture->lire)
|
||||
{
|
||||
$langs->load("boxes");
|
||||
$facstatic=new FactureFournisseur($db);
|
||||
|
||||
$sql = "SELECT ff.rowid, ff.facnumber, ff.fk_statut, ff.libelle, ff.total_ht, ff.total_ttc, ff.tms,";
|
||||
$sql.= " sum(pf.amount) as am,";
|
||||
$sql.= " s.nom, s.rowid as socid";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_fourn as ff";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiementfourn_facturefourn as pf on ff.rowid=pf.fk_facturefourn";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE s.rowid = ff.fk_soc";
|
||||
$sql.= " AND s.entity = ".$conf->entity;
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
if ($socid) $sql.= " AND ff.fk_soc = ".$socid;
|
||||
$sql.= " GROUP BY ff.rowid, ff.facnumber, ff.fk_statut, ff.libelle, ff.total, ff.total_ttc, ff.tms, s.nom, s.rowid";
|
||||
$sql.= " ORDER BY ff.tms DESC ";
|
||||
$sql.= $db->plimit($max, 0);
|
||||
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$var=false;
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("BoxTitleLastSupplierBills",min($max,$num)).'</td>';
|
||||
if ($conf->global->MAIN_SHOW_HT_ON_SUMMARY) print '<td align="right">'.$langs->trans("AmountHT").'</td>';
|
||||
print '<td align="right">'.$langs->trans("AmountTTC").'</td>';
|
||||
print '<td align="right">'.$langs->trans("DateModificationShort").'</td>';
|
||||
print '<td width="16"> </td>';
|
||||
print "</tr>\n";
|
||||
if ($num)
|
||||
{
|
||||
$i = 0;
|
||||
$total = $total_ttc = $totalam = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
print '<tr '.$bc[$var].'><td>';
|
||||
$facstatic->ref=$obj->facnumber;
|
||||
$facstatic->id=$obj->rowid;
|
||||
print $facstatic->getNomUrl(1,'');
|
||||
print '</td>';
|
||||
print '<td><a href="fiche.php?socid='.$obj->socid.'">'.img_object($langs->trans("ShowSupplier"),"company").' '.dol_trunc($obj->nom,44).'</a></td>';
|
||||
if ($conf->global->MAIN_SHOW_HT_ON_SUMMARY) print '<td align="right">'.price($obj->total_ht).'</td>';
|
||||
print '<td align="right">'.price($obj->total_ttc).'</td>';
|
||||
print '<td align="right">'.dol_print_date($db->jdate($obj->tms),'day').'</td>';
|
||||
print '<td>'.$facstatic->LibStatut($obj->paye,$obj->fk_statut,3).'</td>';
|
||||
print '</tr>';
|
||||
$total += $obj->total_ht;
|
||||
$total_ttc += $obj->total_ttc;
|
||||
$totalam += $obj->am;
|
||||
$i++;
|
||||
$var = !$var;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$colspan=5;
|
||||
if ($conf->global->MAIN_SHOW_HT_ON_SUMMARY) $colspan++;
|
||||
print '<tr '.$bc[$var].'><td colspan="'.$colspan.'">'.$langs->trans("NoInvoice").'</td></tr>';
|
||||
}
|
||||
print '</table><br>';
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Last customers
|
||||
if ($conf->societe->enabled && $user->rights->societe->lire)
|
||||
{
|
||||
$langs->load("boxes");
|
||||
$max=3;
|
||||
|
||||
$sql = "SELECT s.nom, s.rowid, ".$db->pdate("s.datec")." as dc";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
@ -319,7 +487,7 @@ if ($conf->societe->enabled && $user->rights->societe->lire)
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("BoxTitleLastCustomers",min($max,$num)).'</td>';
|
||||
print '<td align="right">'.$langs->trans("Date").'</td>';
|
||||
print '<td align="right">'.$langs->trans("DateModificationShort").'</td>';
|
||||
print '</tr>';
|
||||
if ($num)
|
||||
{
|
||||
@ -356,7 +524,6 @@ if ($conf->societe->enabled && $user->rights->societe->lire)
|
||||
if ($conf->fournisseur->enabled && $user->rights->societe->lire)
|
||||
{
|
||||
$langs->load("boxes");
|
||||
$max=3;
|
||||
|
||||
$sql = "SELECT s.nom, s.rowid, ".$db->pdate("s.datec")." as dc";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
@ -378,7 +545,7 @@ if ($conf->fournisseur->enabled && $user->rights->societe->lire)
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("BoxTitleLastSuppliers",min($max,$num)).'</td>';
|
||||
print '<td align="right">'.$langs->trans("Date").'</td>';
|
||||
print '<td align="right">'.$langs->trans("DateModificationShort").'</td>';
|
||||
print '</tr>';
|
||||
if ($num)
|
||||
{
|
||||
@ -684,11 +851,11 @@ if ($conf->facture->enabled && $user->rights->facture->lire)
|
||||
/*
|
||||
* Factures fournisseurs impayées
|
||||
*/
|
||||
if ($conf->facture->enabled && $user->rights->facture->lire)
|
||||
if ($conf->fournisseur->enabled && $user->rights->fournisseur->facture->lire)
|
||||
{
|
||||
$facstatic=new FactureFournisseur($db);
|
||||
|
||||
$sql = "SELECT ff.rowid, ff.facnumber, ff.fk_statut, ff.fk_statut, ff.libelle, ff.total_ht, ff.total_ttc,";
|
||||
$sql = "SELECT ff.rowid, ff.facnumber, ff.fk_statut, ff.libelle, ff.total_ht, ff.total_ttc,";
|
||||
$sql.= " sum(pf.amount) as am,";
|
||||
$sql.= " s.nom, s.rowid as socid";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_fourn as ff";
|
||||
@ -699,7 +866,7 @@ if ($conf->facture->enabled && $user->rights->facture->lire)
|
||||
$sql.= " AND ff.paye=0 AND ff.fk_statut = 1";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
if ($socid) $sql.= " AND ff.fk_soc = ".$socid;
|
||||
$sql.= " GROUP BY ff.rowid, ff.facnumber, ff.fk_statut, ff.total, ff.total_ttc, s.nom, s.rowid";
|
||||
$sql.= " GROUP BY ff.rowid, ff.facnumber, ff.fk_statut, ff.libelle, ff.total, ff.total_ttc, s.nom, s.rowid";
|
||||
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
|
||||
@ -61,6 +61,7 @@ class Facture extends CommonObject
|
||||
var $date;
|
||||
var $date_creation;
|
||||
var $date_validation;
|
||||
var $datem;
|
||||
var $ref;
|
||||
var $ref_client;
|
||||
//! 0=Standard invoice, 1=Replacement invoice, 2=Credit note invoice, 3=Deposit invoice, 4=Proformat invoice
|
||||
@ -512,6 +513,7 @@ class Facture extends CommonObject
|
||||
$sql.= ','.$this->db->pdate('f.date_lim_reglement').' as dlr';
|
||||
$sql.= ','.$this->db->pdate('f.datec').' as datec';
|
||||
$sql.= ','.$this->db->pdate('f.date_valid').' as datev';
|
||||
$sql.= ','.$this->db->pdate('f.tms').' as datem';
|
||||
$sql.= ', f.note, f.note_public, f.fk_statut, f.paye, f.close_code, f.close_note, f.fk_user_author, f.fk_user_valid, f.model_pdf';
|
||||
$sql.= ', f.fk_facture_source';
|
||||
$sql.= ', f.fk_mode_reglement, f.fk_cond_reglement, f.fk_projet';
|
||||
@ -541,6 +543,7 @@ class Facture extends CommonObject
|
||||
$this->date = $obj->df;
|
||||
$this->date_creation = $obj->datec;
|
||||
$this->date_validation = $obj->datev;
|
||||
$this->datem = $this->db->jdate($obj->datem);
|
||||
$this->amount = $obj->amount;
|
||||
$this->remise_percent = $obj->remise_percent;
|
||||
$this->remise_absolue = $obj->remise_absolue;
|
||||
@ -2177,8 +2180,7 @@ class Facture extends CommonObject
|
||||
*/
|
||||
function info($id)
|
||||
{
|
||||
$sql = 'SELECT c.rowid, '.$this->db->pdate('datec').' as datec,';
|
||||
$sql.= ' '.$this->db->pdate('date_valid').' as datev,';
|
||||
$sql = 'SELECT c.rowid, datec, date_valid as datev, tms as datem,';
|
||||
$sql.= ' fk_user_author, fk_user_valid';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'facture as c';
|
||||
$sql.= ' WHERE c.rowid = '.$id;
|
||||
@ -2202,8 +2204,9 @@ class Facture extends CommonObject
|
||||
$vuser->fetch();
|
||||
$this->user_validation = $vuser;
|
||||
}
|
||||
$this->date_creation = $obj->datec;
|
||||
$this->date_validation = $obj->datev;
|
||||
$this->date_creation = $this->db->jdate($obj->datec);
|
||||
$this->date_modification = $this->db->jdate($obj->datem);
|
||||
$this->date_validation = $this->db->jdate($obj->datev); // Should be in log table
|
||||
}
|
||||
$this->db->free($result);
|
||||
}
|
||||
|
||||
@ -402,7 +402,7 @@ class FactureFournisseur extends Facture
|
||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.'facture_fourn';
|
||||
$sql.= ' SET paye = 1';
|
||||
$sql.= ' WHERE rowid = '.$this->id;
|
||||
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
@ -652,10 +652,10 @@ class FactureFournisseur extends Facture
|
||||
*/
|
||||
function info($id)
|
||||
{
|
||||
$sql = 'SELECT c.rowid, '.$this->db->pdate('datec').' as datec';
|
||||
$sql .= ', fk_user_author, fk_user_valid';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'facture_fourn as c';
|
||||
$sql .= ' WHERE c.rowid = '.$id;
|
||||
$sql = 'SELECT c.rowid, datec, tms as datem,';
|
||||
$sql.= ' fk_user_author, fk_user_valid';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'facture_fourn as c';
|
||||
$sql.= ' WHERE c.rowid = '.$id;
|
||||
|
||||
$result=$this->db->query($sql);
|
||||
if ($result)
|
||||
@ -677,7 +677,8 @@ class FactureFournisseur extends Facture
|
||||
$this->user_validation = $vuser;
|
||||
}
|
||||
$this->date_creation = $obj->datec;
|
||||
//$this->date_validation = $obj->datev; \todo La date de validation n'est pas encore geree
|
||||
$this->date_modification = $obj->datem;
|
||||
//$this->date_validation = $obj->datev; Should be stored in log table
|
||||
}
|
||||
$this->db->free($result);
|
||||
}
|
||||
@ -708,7 +709,7 @@ class FactureFournisseur extends Facture
|
||||
$sql.= " AND ff.entity = ".$conf->entity;
|
||||
if ($user->societe_id) $sql.=' AND ff.fk_soc = '.$user->societe_id;
|
||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND ff.fk_soc = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -763,13 +764,13 @@ class FactureFournisseur extends Facture
|
||||
|
||||
// Charge tableau des id de societe socids
|
||||
$socids = array();
|
||||
|
||||
|
||||
$sql = "SELECT rowid";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe";
|
||||
$sql.= " WHERE fournisseur = 1";
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
$sql.= " LIMIT 10";
|
||||
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -786,12 +787,12 @@ class FactureFournisseur extends Facture
|
||||
|
||||
// Charge tableau des produits prodids
|
||||
$prodids = array();
|
||||
|
||||
|
||||
$sql = "SELECT rowid";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."product";
|
||||
$sql.= " WHERE envente = 1";
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
|
||||
@ -74,7 +74,7 @@ class box_factures extends ModeleBoxes {
|
||||
if ($user->rights->facture->lire)
|
||||
{
|
||||
$sql = "SELECT f.rowid as facid, f.facnumber, f.type, f.amount, f.datef as df";
|
||||
$sql.= ", f.paye, f.fk_statut, f.datec";
|
||||
$sql.= ", f.paye, f.fk_statut, f.datec, f.tms";
|
||||
$sql.= ", s.nom, s.rowid as socid";
|
||||
$sql.= ", f.date_lim_reglement as datelimite";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f";
|
||||
@ -83,7 +83,7 @@ class box_factures extends ModeleBoxes {
|
||||
$sql.= " AND s.entity = ".$conf->entity;
|
||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id;
|
||||
$sql.= " ORDER BY f.datef DESC, f.facnumber DESC ";
|
||||
$sql.= " ORDER BY f.tms DESC";
|
||||
$sql.= $db->plimit($max, 0);
|
||||
|
||||
$result = $db->query($sql);
|
||||
|
||||
@ -76,7 +76,7 @@ class box_factures_fourn extends ModeleBoxes {
|
||||
$sql.= " f.paye, f.fk_statut,";
|
||||
$sql.= ' f.datef as df,';
|
||||
$sql.= ' f.datec as datec,';
|
||||
$sql.= ' f.date_lim_reglement as datelimite ';
|
||||
$sql.= ' f.date_lim_reglement as datelimite, f.tms';
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql.= ", ".MAIN_DB_PREFIX."facture_fourn as f";
|
||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
@ -84,7 +84,7 @@ class box_factures_fourn extends ModeleBoxes {
|
||||
$sql.= " AND s.entity = ".$conf->entity;
|
||||
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id;
|
||||
$sql.= " ORDER BY f.datef DESC, f.facnumber DESC ";
|
||||
$sql.= " ORDER BY f.tms DESC";
|
||||
$sql.= $db->plimit($max, 0);
|
||||
|
||||
$result = $db->query($sql);
|
||||
|
||||
@ -27,8 +27,8 @@ BoxTitleLastSuppliers=Les %s derniers fournisseurs modifiées
|
||||
BoxTitleLastCustomers=Les %s derniers clients modifiées
|
||||
BoxTitleLastCustomersOrProspects=Les %s derniers clients ou prospects modifiés
|
||||
BoxTitleLastPropals=Les %s dernières propositions enregistrés
|
||||
BoxTitleLastCustomerBills=Les %s dernières factures clients enregistrées
|
||||
BoxTitleLastSupplierBills=Les %s dernières factures fournisseurs enregistrées
|
||||
BoxTitleLastCustomerBills=Les %s dernières factures clients modifiées
|
||||
BoxTitleLastSupplierBills=Les %s dernières factures fournisseurs modifiées
|
||||
BoxTitleLastProspects=Les %s derniers prospects modifiés
|
||||
BoxTitleLastProductsInContract=Les %s derniers produits/services contractés
|
||||
BoxTitleOldestUnpayedCustomerBills=Les %s plus anciennes factures clients impayées
|
||||
|
||||
Loading…
Reference in New Issue
Block a user