Uniformize code of boxes

This commit is contained in:
Laurent Destailleur 2015-05-04 13:10:45 +02:00
parent e73526b29c
commit f84ea6f960
8 changed files with 116 additions and 101 deletions

View File

@ -128,7 +128,7 @@ class box_commandes extends ModeleBoxes
$this->info_box_contents[$line][] = array(
'td' => 'align="right"',
'text' => price($objp->total_ht),
'text' => price($objp->total_ht, 0, $langs, 0, -1, -1, $conf->currency),
);
if (! empty($conf->global->ORDER_BOX_LAST_ORDERS_SHOW_VALIDATE_USER)) {

View File

@ -94,10 +94,10 @@ class box_factures extends ModeleBoxes
$num = $db->num_rows($result);
$now=dol_now();
$i = 0;
$line = 0;
$l_due_date = $langs->trans('Late').' ('.strtolower($langs->trans('DateEcheance')).': %s)';
while ($i < $num) {
while ($line < $num) {
$objp = $db->fetch_object($result);
$datelimite = $db->jdate($objp->datelimite);
$date = $db->jdate($objp->df);
@ -115,39 +115,39 @@ class box_factures extends ModeleBoxes
$late = '';
if ($objp->paye == 0 && ($objp->fk_statut != 2 && $objp->fk_statut != 3) && $datelimite < ($now - $conf->facture->client->warning_delay)) { $late = img_warning(sprintf($l_due_date,dol_print_date($datelimite,'day')));}
$this->info_box_contents[$i][] = array(
$this->info_box_contents[$line][] = array(
'td' => 'align="left"',
'text' => $facturestatic->getNomUrl(1),
'text2'=> $late,
'asis' => 1,
);
$this->info_box_contents[$i][] = array(
$this->info_box_contents[$line][] = array(
'td' => 'align="left"',
'text' => $societestatic->getNomUrl(1, '', 40),
'asis' => 1,
);
$this->info_box_contents[$i][] = array(
$this->info_box_contents[$line][] = array(
'td' => 'align="right"',
'text' => price($objp->total_ht),
'text' => price($objp->total_ht, 0, $langs, 0, -1, -1, $conf->currency),
);
$this->info_box_contents[$i][] = array(
$this->info_box_contents[$line][] = array(
'td' => 'align="right"',
'text' => dol_print_date($date,'day'),
);
$this->info_box_contents[$i][] = array(
$this->info_box_contents[$line][] = array(
'td' => 'align="right" width="18"',
'text' => $facturestatic->LibStatut($objp->paye,$objp->fk_statut,3),
);
$i++;
$line++;
}
if ($num==0)
$this->info_box_contents[$i][0] = array(
$this->info_box_contents[$line][0] = array(
'td' => 'align="center"',
'text'=>$langs->trans("NoRecordedInvoices"),
);

View File

@ -56,10 +56,10 @@ class box_factures_fourn extends ModeleBoxes
$this->max=$max;
include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php';
$facturestatic = new FactureFournisseur($db);
$societestatic = new Societe($db);
$thirdpartytmp = new Fournisseur($db);
$this->info_box_head = array(
'text' => $langs->trans("BoxTitleLast".($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE?"":"Modified")."SupplierBills",$max)
@ -95,10 +95,10 @@ class box_factures_fourn extends ModeleBoxes
$num = $db->num_rows($result);
$now=dol_now();
$i = 0;
$line = 0;
$l_due_date = $langs->trans('Late').' ('.$langs->trans('DateEcheance').': %s)';
while ($i < $num) {
while ($line < $num) {
$objp = $db->fetch_object($result);
$datelimite=$db->jdate($objp->datelimite);
$date=$db->jdate($objp->df);
@ -108,36 +108,41 @@ class box_factures_fourn extends ModeleBoxes
$facturestatic->total_ht = $objp->total_ht;
$facturestatic->total_tva = $objp->total_tva;
$facturestatic->total_ttc = $objp->total_ttc;
$societestatic->id = $objp->socid;
$societestatic->name = $objp->name;
$societestatic->fournisseur = 1;
$societestatic->code_fournisseur = $objp->code_fournisseur;
$societestatic->logo = $objp->logo;
$thirdpartytmp->id = $objp->socid;
$thirdpartytmp->name = $objp->name;
$thirdpartytmp->fournisseur = 1;
$thirdpartytmp->code_fournisseur = $objp->code_fournisseur;
$thirdpartytmp->logo = $objp->logo;
$late = '';
if ($objp->paye == 0 && $datelimite && $datelimite < ($now - $conf->facture->fournisseur->warning_delay)) $late=img_warning(sprintf($l_due_date, dol_print_date($datelimite,'day')));
$this->info_box_contents[$i][] = array(
$this->info_box_contents[$line][] = array(
'td' => 'align="left"',
'text' => $facturestatic->getNomUrl(1),
'text2'=> $late,
'asis' => 1,
);
$this->info_box_contents[$i][] = array(
$this->info_box_contents[$line][] = array(
'td' => 'align="left"',
'text' => $objp->ref_supplier,
'tooltip' => $langs->trans('SupplierInvoice').': '.($objp->ref?$objp->ref:$objp->facid).'<br>'.$langs->trans('RefSupplier').': '.$objp->ref_supplier,
'url' => DOL_URL_ROOT."/fourn/facture/card.php?facid=".$objp->facid,
);
$this->info_box_contents[$i][] = array(
$this->info_box_contents[$line][] = array(
'td' => 'align="left"',
'text' => $societestatic->getNomUrl(1, 'supplier'),
'text' => $thirdpartytmp->getNomUrl(1, 'supplier'),
'asis' => 1,
);
$this->info_box_contents[$i][] = array(
$this->info_box_contents[$line][] = array(
'td' => 'align="right"',
'text' => price($objp->total_ht, 0, $langs, 0, -1, -1, $conf->currency),
);
$this->info_box_contents[$line][] = array(
'td' => 'align="right"',
'text' => dol_print_date($date,'day'),
);
@ -145,16 +150,16 @@ class box_factures_fourn extends ModeleBoxes
$fac = new FactureFournisseur($db);
$fac->fetch($objp->facid);
$alreadypaid=$fac->getSommePaiement();
$this->info_box_contents[$i][6] = array(
$this->info_box_contents[$line][] = array(
'td' => 'align="right" width="18"',
'text' => $facturestatic->LibStatut($objp->paye,$objp->fk_statut,3,$alreadypaid,$objp->type),
);
$i++;
$line++;
}
if ($num==0)
$this->info_box_contents[$i][0] = array(
$this->info_box_contents[$line][0] = array(
'td' => 'align="center"',
'text'=>$langs->trans("NoModifiedSupplierBills"),
);

View File

@ -56,6 +56,8 @@ class box_factures_fourn_imp extends ModeleBoxes
include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
$facturestatic=new FactureFournisseur($db);
include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php';
$thirdpartytmp=new Fournisseur($db);
$this->info_box_head = array('text' => $langs->trans("BoxTitleOldestUnpaidSupplierBills",$max));
@ -64,6 +66,9 @@ class box_factures_fourn_imp extends ModeleBoxes
$sql = "SELECT s.nom as name, s.rowid as socid,";
$sql.= " f.rowid as facid, f.ref, f.ref_supplier, f.date_lim_reglement as datelimite,";
$sql.= " f.amount, f.datef as df,";
$sql.= " f.total_ht as total_ht,";
$sql.= " f.tva as total_tva,";
$sql.= " f.total_ttc,";
$sql.= " f.paye, f.fk_statut, f.type";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql.= ",".MAIN_DB_PREFIX."facture_fourn as f";
@ -83,26 +88,30 @@ class box_factures_fourn_imp extends ModeleBoxes
$num = $db->num_rows($result);
$now=dol_now();
$i = 0;
$line = 0;
$l_due_date = $langs->trans('Late').' ('.$langs->trans('DateEcheance').': %s)';
while ($i < $num)
while ($line < $num)
{
$objp = $db->fetch_object($result);
$datelimite=$db->jdate($objp->datelimite);
$thirdpartytmp->id = $objp->socid;
$thirdpartytmp->name = $objp->name;
$thirdpartytmp->code_client = $objp->code_client;
$thirdpartytmp->logo = $objp->logo;
$late='';
if ($datelimite && $datelimite < ($now - $conf->facture->fournisseur->warning_delay)) $late=img_warning(sprintf($l_due_date,dol_print_date($datelimite,'day')));
$tooltip = $langs->trans('SupplierInvoice') . ': ' . ($objp->ref?$objp->ref:$objp->facid) . '<br>' . $langs->trans('RefSupplier') . ': ' . $objp->ref_supplier;
$this->info_box_contents[$i][0] = array(
$this->info_box_contents[$line][] = array(
'td' => 'align="left" width="16"',
'logo' => $this->boximg,
'tooltip' => $tooltip,
'url' => DOL_URL_ROOT."/fourn/facture/card.php?facid=".$objp->facid,
);
$this->info_box_contents[$i][1] = array(
$this->info_box_contents[$line][] = array(
'td' => 'align="left"',
'text' => ($objp->ref?$objp->ref:$objp->facid),
'text2'=> $late,
@ -110,29 +119,18 @@ class box_factures_fourn_imp extends ModeleBoxes
'url' => DOL_URL_ROOT."/fourn/facture/card.php?facid=".$objp->facid,
);
$this->info_box_contents[$i][2] = array(
$this->info_box_contents[$line][] = array(
'td' => 'align="left"',
'text' => $objp->ref_supplier,
'tooltip' => $tooltip,
'url' => DOL_URL_ROOT."/fourn/facture/card.php?facid=".$objp->facid,
'text' => $thirdpartytmp->getNomUrl(1, '', 40),
'asis' => 1,
);
$tooltip = $langs->trans('Supplier') . ': '. $objp->name;
$this->info_box_contents[$i][3] = array(
'td' => 'align="left" width="16"',
'logo' => 'company',
'tooltip' => $tooltip,
'url' => DOL_URL_ROOT."/fourn/card.php?socid=".$objp->socid,
$this->info_box_contents[$line][] = array(
'td' => 'align="right"',
'text' => price($objp->total_ht, 0, $langs, 0, -1, -1, $conf->currency),
);
$this->info_box_contents[$i][4] = array(
'td' => 'align="left"',
'text' => $objp->name,
'tooltip' => $tooltip,
'url' => DOL_URL_ROOT."/fourn/card.php?socid=".$objp->socid,
);
$this->info_box_contents[$i][5] = array(
$this->info_box_contents[$line][] = array(
'td' => 'align="right"',
'text' => dol_print_date($datelimite,'day'),
);
@ -140,16 +138,16 @@ class box_factures_fourn_imp extends ModeleBoxes
$fac = new FactureFournisseur($db);
$fac->fetch($objp->facid);
$alreadypaid=$fac->getSommePaiement();
$this->info_box_contents[$i][6] = array(
$this->info_box_contents[$line][] = array(
'td' => 'align="right" width="18"',
'text' => $facturestatic->LibStatut($objp->paye,$objp->fk_statut,3,$alreadypaid,$objp->type),
);
$i++;
$line++;
}
if ($num==0)
$this->info_box_contents[$i][0] = array(
$this->info_box_contents[$line][0] = array(
'td' => 'align="center"',
'text'=>$langs->trans("NoUnpaidSupplierBills"),
);

View File

@ -95,10 +95,10 @@ class box_factures_imp extends ModeleBoxes
$num = $db->num_rows($result);
$now=dol_now();
$i = 0;
$line = 0;
$l_due_date = $langs->trans('Late').' ('.strtolower($langs->trans('DateEcheance')).': %s)';
while ($i < $num)
while ($line < $num)
{
$objp = $db->fetch_object($result);
$datelimite=$db->jdate($objp->datelimite);
@ -117,33 +117,38 @@ class box_factures_imp extends ModeleBoxes
$late='';
if ($datelimite < ($now - $conf->facture->client->warning_delay)) $late = img_warning(sprintf($l_due_date,dol_print_date($datelimite,'day')));
$this->info_box_contents[$i][] = array(
$this->info_box_contents[$line][] = array(
'td' => 'align="left"',
'text' => $facturestatic->getNomUrl(1),
'text2'=> $late,
'asis' => 1,
);
$this->info_box_contents[$i][] = array(
$this->info_box_contents[$line][] = array(
'td' => 'align="left"',
'text' => $societestatic->getNomUrl(1, '', 44),
'asis' => 1,
);
$this->info_box_contents[$i][] = array(
$this->info_box_contents[$line][] = array(
'td' => 'align="right"',
'text' => price($objp->total_ht, 0, $langs, 0, -1, -1, $conf->currency),
);
$this->info_box_contents[$line][] = array(
'td' => 'align="right"',
'text' => dol_print_date($datelimite,'day'),
);
$this->info_box_contents[$i][] = array(
$this->info_box_contents[$line][] = array(
'td' => 'align="right" width="18"',
'text' => $facturestatic->LibStatut($objp->paye,$objp->fk_statut,3),
);
$i++;
$line++;
}
if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoUnpaidCustomerBills"));
if ($num==0) $this->info_box_contents[$line][0] = array('td' => 'align="center"','text'=>$langs->trans("NoUnpaidCustomerBills"));
$db->free($result);
}

View File

@ -58,12 +58,16 @@ class box_fournisseurs extends ModeleBoxes
include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
$thirdpartystatic=new Societe($db);
include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php';
$thirdpartytmp=new Fournisseur($db);
$this->info_box_head = array('text' => $langs->trans("BoxTitleLastModifiedSuppliers",$max));
if ($user->rights->societe->lire)
{
$sql = "SELECT s.nom as name, s.rowid as socid, s.datec, s.tms, s.status";
$sql = "SELECT s.nom as name, s.rowid as socid, s.datec, s.tms, s.status,";
$sql.= " s.code_fournisseur,";
$sql.= " s.logo";
$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";
@ -78,42 +82,37 @@ class box_fournisseurs extends ModeleBoxes
{
$num = $db->num_rows($result);
$i = 0;
while ($i < $num)
$line = 0;
while ($line < $num)
{
$objp = $db->fetch_object($result);
$datec=$db->jdate($objp->datec);
$datem=$db->jdate($objp->tms);
$thirdpartytmp->id = $objp->socid;
$thirdpartytmp->name = $objp->name;
$thirdpartytmp->code_client = $objp->code_client;
$thirdpartytmp->logo = $objp->logo;
$tooltip = $langs->trans('Supplier') . ': ' . $objp->name;
$this->info_box_contents[$i][0] = array(
'td' => 'align="left" width="16"',
'logo' => $this->boximg,
'tooltip' => $tooltip,
'url' => DOL_URL_ROOT."/fourn/card.php?socid=".$objp->socid,
);
$this->info_box_contents[$i][1] = array(
$this->info_box_contents[$line][] = array(
'td' => 'align="left"',
'text' => $objp->name,
'tooltip' => $tooltip,
'url' => DOL_URL_ROOT."/fourn/card.php?socid=".$objp->socid,
'text' => $thirdpartytmp->getNomUrl(1, '', 40),
'asis' => 1,
);
$this->info_box_contents[$i][2] = array(
$this->info_box_contents[$line][] = array(
'td' => 'align="right"',
'text' => dol_print_date($datem, "day"),
);
$this->info_box_contents[$i][3] = array(
$this->info_box_contents[$line][] = array(
'td' => 'align="right" width="18"',
'text' => $thirdpartystatic->LibStatut($objp->status,3),
);
$i++;
$line++;
}
if ($num==0) $this->info_box_contents[$i][0] = array(
if ($num==0) $this->info_box_contents[$line][0] = array(
'td' => 'align="center"',
'text'=>$langs->trans("NoRecordedSuppliers"),
);

View File

@ -123,7 +123,7 @@ class box_propales extends ModeleBoxes
$this->info_box_contents[$line][] = array(
'td' => 'align="right"',
'text' => price($objp->total_ht),
'text' => price($objp->total_ht, 0, $langs, 0, -1, -1, $conf->currency),
);
$this->info_box_contents[$line][] = array(

View File

@ -58,13 +58,20 @@ class box_supplier_orders extends ModeleBoxes
include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
$supplierorderstatic=new CommandeFournisseur($db);
include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php';
$thirdpartytmp = new Fournisseur($db);
$this->info_box_head = array('text' => $langs->trans("BoxTitleLatest".($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE?"":"Modified")."SupplierOrders", $max));
if ($user->rights->fournisseur->commande->lire)
{
$sql = "SELECT s.nom as name, s.rowid as socid,";
$sql.= " s.code_client, s.code_fournisseur,";
$sql.= " s.logo,";
$sql.= " c.ref, c.tms, c.rowid, c.date_commande,";
$sql.= " c.total_ht,";
$sql.= " c.tva as total_tva,";
$sql.= " c.total_ttc,";
$sql.= " c.fk_statut";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql.= ", ".MAIN_DB_PREFIX."commande_fournisseur as c";
@ -82,60 +89,61 @@ class box_supplier_orders extends ModeleBoxes
{
$num = $db->num_rows($result);
$i = 0;
while ($i < $num) {
$line = 0;
while ($line < $num) {
$objp = $db->fetch_object($result);
$date=$db->jdate($objp->date_commande);
$datem=$db->jdate($objp->tms);
$thirdpartytmp->id = $objp->socid;
$thirdpartytmp->name = $objp->name;
$thirdpartytmp->fournisseur = 1;
$thirdpartytmp->code_fournisseur = $objp->code_fournisseur;
$thirdpartytmp->logo = $objp->logo;
$urlo = DOL_URL_ROOT."/fourn/commande/card.php?id=".$objp->rowid;
$urls = DOL_URL_ROOT."/fourn/card.php?socid=".$objp->socid;
$tooltip = $langs->trans('SupplierOrder') . ': ' . $objp->ref;
$this->info_box_contents[$i][0] = array(
$this->info_box_contents[$line][] = array(
'td' => 'align="left" width="16"',
'logo' => $this->boximg,
'tooltip' => $tooltip,
'url' => $urlo,
);
$this->info_box_contents[$i][1] = array(
$this->info_box_contents[$line][] = array(
'td' => 'align="left"',
'text' => $objp->ref,
'tooltip' => $tooltip,
'url' => $urlo,
);
$tooltip = $langs->trans('Supplier') . ': ' . $objp->name;
$this->info_box_contents[$i][2] = array(
'td' => 'align="left" width="16"',
'logo' => 'company',
'tooltip' => $tooltip,
'url' => $urls,
);
$this->info_box_contents[$i][3] = array(
$this->info_box_contents[$line][] = array(
'td' => 'align="left"',
'text' => $objp->name,
'tooltip' => $tooltip,
'url' => $urls,
'text' => $thirdpartytmp->getNomUrl(1, 'supplier'),
'asis' => 1,
);
$this->info_box_contents[$i][4] = array(
$this->info_box_contents[$line][] = array(
'td' => 'align="right"',
'text' => price($objp->total_ht, 0, $langs, 0, -1, -1, $conf->currency),
);
$this->info_box_contents[$line][] = array(
'td' => 'align="right"',
'text' => dol_print_date($date,'day'),
);
$this->info_box_contents[$i][5] = array(
$this->info_box_contents[$line][] = array(
'td' => 'align="right" width="18"',
'text' => $supplierorderstatic->LibStatut($objp->fk_statut,3),
);
$i++;
$line++;
}
if ($num == 0)
$this->info_box_contents[$i][0] = array(
$this->info_box_contents[$line][0] = array(
'td' => 'align="center"',
'text' => $langs->trans("NoSupplierOrder"),
);