2
0
forked from Wavyzz/dolibarr

Uniformize code

This commit is contained in:
Laurent Destailleur
2015-07-04 04:34:14 +02:00
parent 3520c94641
commit 9321272838
3 changed files with 32 additions and 35 deletions

View File

@@ -655,8 +655,7 @@ else
print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"b.amount", "",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("LineRecord"),$_SERVER["PHP_SELF"],"b.rowid", "",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Payment"),$_SERVER["PHP_SELF"],"p.rowid", "",$param,'align="center"',$sortfield,$sortorder);
print_liste_field_titre('');
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
print "</tr>\n";
$i=1;
$var=false;
@@ -699,17 +698,11 @@ else
print '</td>';
if ($object->statut == 0)
{
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=remove&amp;lineid='.$objp->rowid.'">'.img_delete().'</a></td>';
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=remove&amp;lineid='.$objp->rowid.'">'.img_delete().'</a>';
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=reject_check&amp;lineid='.$objp->rowid.'">'.img_picto($langs->trans("RejectCheck"),'disable').'</a></td>';
}
else
{
if($objp->statut == 0)
{
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=reject_check&amp;lineid='.$objp->rowid.'">'.img_picto($langs->trans("RejectCheck"),'disable').'</a></td>';
}
else if($objp->statut == 2) {
print '<td align="right">'.img_picto($langs->trans('CheckRejected'),'statut8').'</a></td>';
}
else if($objp->statut == 2) {
print '<td align="right">'.img_picto($langs->trans('CheckRejected'),'statut8').'</a></td>';
}
print '</tr>';
$var=!$var;

View File

@@ -673,7 +673,7 @@ class RemiseCheque extends CommonObject
global $db, $user;
$payment = new Paiement($db);
$payment->fetch(0,$bank_id);
$payment->fetch(0,0,$bank_id);
$bankaccount = $payment->fk_account;
@@ -688,10 +688,11 @@ class RemiseCheque extends CommonObject
$rejectedPayment = new Paiement($db);
$rejectedPayment->amounts = array();
$rejectedPayment->datepaye = $rejection_date;
$rejectedPayment->paiementid = 7; // type of payment: check
$rejectedPayment->paiementid = dol_getIdFromCode($this->db, 'CHQ', 'c_paiement');
$rejectedPayment->num_paiement = $payment->numero;
while($obj = $db->fetch_object($resql)) {
while($obj = $db->fetch_object($resql))
{
$invoice = new Facture($db);
$invoice->fetch($obj->fk_facture);
$invoice->set_unpaid($user);

View File

@@ -79,10 +79,11 @@ class Paiement extends CommonObject
* Load payment from database
*
* @param int $id Id of payment to get
* @param string $ref Ref of payment to get (currently ref = id but this may change in future)
* @param int $fk_bank Id of bank line associated to payment
* @return int <0 if KO, 0 if not found, >0 if OK
*/
function fetch($id, $fk_bank='')
function fetch($id, $ref='', $fk_bank='')
{
$sql = 'SELECT p.rowid, p.datep as dp, p.amount, p.statut, p.fk_bank,';
$sql.= ' c.code as type_code, c.libelle as type_libelle,';
@@ -91,10 +92,12 @@ class Paiement extends CommonObject
$sql.= ' FROM '.MAIN_DB_PREFIX.'c_paiement as c, '.MAIN_DB_PREFIX.'paiement as p';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON p.fk_bank = b.rowid ';
$sql.= ' WHERE p.fk_paiement = c.id';
if ($fk_bank)
$sql.= ' AND p.fk_bank = '.$fk_bank;
else
if ($id > 0)
$sql.= ' AND p.rowid = '.$id;
else if ($ref)
$sql.= ' AND p.rowid = '.$ref;
else if ($fk_bank)
$sql.= ' AND p.fk_bank = '.$fk_bank;
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
$result = $this->db->query($sql);