Clean code from using deprecated field amount
This commit is contained in:
parent
be9ac4f959
commit
4765198af2
@ -1032,7 +1032,7 @@ if ($object->id > 0)
|
||||
*/
|
||||
if (!empty($conf->facture->enabled) && $user->rights->facture->lire)
|
||||
{
|
||||
$sql = 'SELECT f.rowid as id, f.titre as ref, f.amount';
|
||||
$sql = 'SELECT f.rowid as id, f.titre as ref';
|
||||
$sql .= ', f.total as total_ht';
|
||||
$sql .= ', f.tva as total_tva';
|
||||
$sql .= ', f.total_ttc';
|
||||
@ -1045,7 +1045,7 @@ if ($object->id > 0)
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture_rec as f";
|
||||
$sql .= " WHERE f.fk_soc = s.rowid AND s.rowid = ".$object->id;
|
||||
$sql .= " AND f.entity = ".$conf->entity;
|
||||
$sql .= ' GROUP BY f.rowid, f.titre, f.amount, f.total, f.tva, f.total_ttc,';
|
||||
$sql .= ' GROUP BY f.rowid, f.titre, f.total, f.tva, f.total_ttc,';
|
||||
$sql .= ' f.date_last_gen, f.datec, f.frequency, f.unit_frequency,';
|
||||
$sql .= ' f.suspended, f.date_when,';
|
||||
$sql .= ' s.nom, s.rowid';
|
||||
@ -1140,7 +1140,7 @@ if ($object->id > 0)
|
||||
*/
|
||||
if (!empty($conf->facture->enabled) && $user->rights->facture->lire)
|
||||
{
|
||||
$sql = 'SELECT f.rowid as facid, f.ref, f.type, f.amount';
|
||||
$sql = 'SELECT f.rowid as facid, f.ref, f.type';
|
||||
$sql .= ', f.total as total_ht';
|
||||
$sql .= ', f.tva as total_tva';
|
||||
$sql .= ', f.total_ttc';
|
||||
@ -1151,7 +1151,7 @@ if ($object->id > 0)
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiement_facture as pf ON f.rowid=pf.fk_facture';
|
||||
$sql .= " WHERE f.fk_soc = s.rowid AND s.rowid = ".$object->id;
|
||||
$sql .= " AND f.entity IN (".getEntity('invoice').")";
|
||||
$sql .= ' GROUP BY f.rowid, f.ref, f.type, f.amount, f.total, f.tva, f.total_ttc,';
|
||||
$sql .= ' GROUP BY f.rowid, f.ref, f.type, f.total, f.tva, f.total_ttc,';
|
||||
$sql .= ' f.datef, f.datec, f.paye, f.fk_statut,';
|
||||
$sql .= ' s.nom, s.rowid';
|
||||
$sql .= " ORDER BY f.datef DESC, f.datec DESC";
|
||||
|
||||
@ -75,6 +75,8 @@ if ($facid > 0)
|
||||
// Initialize technical object to manage hooks of paiements. Note that conf->hooks_modules contains array array
|
||||
$hookmanager->initHooks(array('paiementcard', 'globalcard'));
|
||||
|
||||
$formquestion = array();
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
@ -859,7 +861,7 @@ if (!GETPOST('action', 'aZ09'))
|
||||
if (!$sortorder) $sortorder = 'DESC';
|
||||
if (!$sortfield) $sortfield = 'p.datep';
|
||||
|
||||
$sql = 'SELECT p.datep as dp, p.amount, f.amount as fa_amount, f.ref';
|
||||
$sql = 'SELECT p.datep as dp, p.amount, f.total_ttc as fa_amount, f.ref';
|
||||
$sql .= ', f.rowid as facid, c.libelle as paiement_type, p.num_paiement';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'paiement as p LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as c ON p.fk_paiement = c.id';
|
||||
$sql .= ', '.MAIN_DB_PREFIX.'facture as f';
|
||||
@ -882,10 +884,10 @@ if (!GETPOST('action', 'aZ09'))
|
||||
print_barre_liste($langs->trans('Payments'), $page, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', $num);
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre('Invoice', $_SERVER["PHP_SELF"], 'ref', '', '', '', $sortfield, $sortorder);
|
||||
print_liste_field_titre('Date', $_SERVER["PHP_SELF"], 'dp', '', '', '', $sortfield, $sortorder);
|
||||
print_liste_field_titre('Type', $_SERVER["PHP_SELF"], 'libelle', '', '', '', $sortfield, $sortorder);
|
||||
print_liste_field_titre('Amount', $_SERVER["PHP_SELF"], 'fa_amount', '', '', '', $sortfield, $sortorder, 'right ');
|
||||
print_liste_field_titre('Invoice', $_SERVER["PHP_SELF"], 'f.ref', '', '', '', $sortfield, $sortorder);
|
||||
print_liste_field_titre('Date', $_SERVER["PHP_SELF"], 'p.datep', '', '', '', $sortfield, $sortorder);
|
||||
print_liste_field_titre('Type', $_SERVER["PHP_SELF"], 'c.libelle', '', '', '', $sortfield, $sortorder);
|
||||
print_liste_field_titre('Amount', $_SERVER["PHP_SELF"], 'p.amount', '', '', '', $sortfield, $sortorder, 'right ');
|
||||
print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch ');
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
@ -117,7 +117,7 @@ if ($id > 0)
|
||||
|
||||
$TData = array();
|
||||
|
||||
$sql = "SELECT s.nom, s.rowid as socid, f.ref, f.amount, f.datef as df,";
|
||||
$sql = "SELECT s.nom, s.rowid as socid, f.ref, f.total_ttc, f.datef as df,";
|
||||
$sql .= " f.paye as paye, f.fk_statut as statut, f.rowid as facid,";
|
||||
$sql .= " u.login, u.rowid as userid";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f,".MAIN_DB_PREFIX."user as u";
|
||||
|
||||
@ -84,7 +84,7 @@ 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.datef as df,";
|
||||
$sql.= " f.total_ht as total_ht,";
|
||||
$sql.= " f.tva as total_tva,";
|
||||
$sql.= " f.total_ttc,";
|
||||
|
||||
@ -93,7 +93,7 @@ class box_factures_imp extends ModeleBoxes
|
||||
$sql .= " s.logo,";
|
||||
$sql .= " f.ref, f.date_lim_reglement as datelimite,";
|
||||
$sql .= " f.type,";
|
||||
$sql .= " f.amount, f.datef as df,";
|
||||
$sql .= " f.datef as df,";
|
||||
$sql .= " f.total as total_ht,";
|
||||
$sql .= " f.tva as total_tva,";
|
||||
$sql .= " f.total_ttc,";
|
||||
@ -110,7 +110,7 @@ class box_factures_imp extends ModeleBoxes
|
||||
if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
if ($user->socid) $sql .= " AND s.rowid = ".$user->socid;
|
||||
$sql .= " GROUP BY s.nom, s.rowid, s.email, s.code_client, s.logo, f.ref, f.date_lim_reglement,";
|
||||
$sql .= " f.type, f.amount, f.datef, f.total, f.tva, f.total_ttc, f.paye, f.fk_statut, f.rowid";
|
||||
$sql .= " f.type, f.datef, f.total, f.tva, f.total_ttc, f.paye, f.fk_statut, f.rowid";
|
||||
//$sql.= " ORDER BY f.datef DESC, f.ref DESC ";
|
||||
$sql .= " ORDER BY datelimite ASC, f.ref ASC ";
|
||||
$sql .= $this->db->plimit($max, 0);
|
||||
|
||||
@ -370,7 +370,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
|
||||
$dateinvoice = ($datefacture == '' ? (empty($conf->global->MAIN_AUTOFILL_DATE) ?-1 : '') : $datefacture);
|
||||
|
||||
$sql = 'SELECT s.nom as name, s.rowid as socid,';
|
||||
$sql .= ' f.rowid, f.ref, f.ref_supplier, f.amount, f.total_ttc as total, f.fk_mode_reglement, f.fk_account';
|
||||
$sql .= ' f.rowid, f.ref, f.ref_supplier, f.total_ttc as total, f.fk_mode_reglement, f.fk_account';
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user ";
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'societe as s, '.MAIN_DB_PREFIX.'facture_fourn as f';
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
@ -821,7 +821,7 @@ if (empty($action) || $action == 'list')
|
||||
$sql .= ' c.code as paiement_type, c.libelle as paiement_libelle,';
|
||||
$sql .= ' ba.rowid as bid, ba.label,';
|
||||
if (!$user->rights->societe->client->voir) $sql .= ' sc.fk_soc, sc.fk_user,';
|
||||
$sql .= ' SUM(f.amount)';
|
||||
$sql .= ' SUM(pf.amount)';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'paiementfourn AS p';
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiementfourn_facturefourn AS pf ON p.rowid=pf.fk_paiementfourn';
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'facture_fourn AS f ON f.rowid=pf.fk_facturefourn';
|
||||
@ -1013,9 +1013,9 @@ if (empty($action) || $action == 'list')
|
||||
|
||||
// Amount
|
||||
print '<td class="right">'.price($objp->pamount).'</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
$totalarray['pos'][7] = 'amount';
|
||||
$totalarray['pos'][$totalarray['nbfield']] = 'amount';
|
||||
$totalarray['val']['amount'] += $objp->pamount;
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
|
||||
// Ref invoice
|
||||
/*$invoicesupplierstatic->ref=$objp->ref_supplier;
|
||||
|
||||
@ -72,7 +72,7 @@ if ($socid > 0)
|
||||
|
||||
print '<table class="noborder tagtable liste centpercent">';
|
||||
|
||||
$sql = "SELECT s.nom, s.rowid as socid, f.ref_supplier, f.amount, f.datef as df,";
|
||||
$sql = "SELECT s.nom, s.rowid as socid, f.ref_supplier, f.datef as df,";
|
||||
$sql .= " f.paye as paye, f.fk_statut as statut, f.rowid as facid,";
|
||||
$sql .= " u.login, u.rowid as userid";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture_fourn as f,".MAIN_DB_PREFIX."user as u";
|
||||
|
||||
@ -1087,8 +1087,8 @@ if (!GETPOST('action'))
|
||||
if (!$sortorder) $sortorder = 'DESC';
|
||||
if (!$sortfield) $sortfield = 'p.datep';
|
||||
|
||||
$sql = 'SELECT p.datep as dp, p.amount, f.amount as fa_amount, f.ref';
|
||||
$sql .= ', f.rowid as facid, c.libelle as paiement_type, p.num_paiement';
|
||||
$sql = 'SELECT p.datep as dp, p.amount, f.ref,';
|
||||
$sql .= ' f.rowid as facid, c.libelle as paiement_type, p.num_paiement';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'paiement as p, '.MAIN_DB_PREFIX.'facture as f, '.MAIN_DB_PREFIX.'c_paiement as c';
|
||||
$sql .= ' WHERE p.fk_facture = f.rowid AND p.fk_paiement = c.id';
|
||||
$sql .= ' AND f.entity IN ('.getEntity('invoice').")";
|
||||
@ -1109,10 +1109,10 @@ if (!GETPOST('action'))
|
||||
print_barre_liste($langs->trans('Payments'), $page, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', $num);
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre('Invoice', $_SERVER["PHP_SELF"], 'ref', '', '', '', $sortfield, $sortorder);
|
||||
print_liste_field_titre('Date', $_SERVER["PHP_SELF"], 'dp', '', '', '', $sortfield, $sortorder);
|
||||
print_liste_field_titre('Type', $_SERVER["PHP_SELF"], 'libelle', '', '', '', $sortfield, $sortorder);
|
||||
print_liste_field_titre('Amount', $_SERVER["PHP_SELF"], 'fa_amount', '', '', '', $sortfield, $sortorder, 'right ');
|
||||
print_liste_field_titre('Invoice', $_SERVER["PHP_SELF"], 'f.ref', '', '', '', $sortfield, $sortorder);
|
||||
print_liste_field_titre('Date', $_SERVER["PHP_SELF"], 'p.datep', '', '', '', $sortfield, $sortorder);
|
||||
print_liste_field_titre('Type', $_SERVER["PHP_SELF"], 'c.paiement_type', '', '', '', $sortfield, $sortorder);
|
||||
print_liste_field_titre('Amount', $_SERVER["PHP_SELF"], 'p.amount', '', '', '', $sortfield, $sortorder, 'right ');
|
||||
|
||||
$tmpobject = new Paiement($db);
|
||||
$parameters = array();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user