Removed useless method. Prefer using generic method.
This commit is contained in:
parent
4d2c80a122
commit
3896cde299
@ -21,13 +21,13 @@
|
||||
/**
|
||||
* \file htdocs/compta/paiement/cheque/class/remisecheque.class.php
|
||||
* \ingroup compta
|
||||
* \brief Fichier de la classe des bordereau de remise de cheque
|
||||
* \brief File with class to manage cheque delivery receipts
|
||||
*/
|
||||
require_once DOL_DOCUMENT_ROOT .'/core/class/commonobject.class.php';
|
||||
|
||||
|
||||
/**
|
||||
* Classe permettant la gestion des remises de cheque
|
||||
* Class to manage cheque delivery receipts
|
||||
*/
|
||||
class RemiseCheque extends CommonObject
|
||||
{
|
||||
@ -580,25 +580,25 @@ class RemiseCheque extends CommonObject
|
||||
if ( $resql )
|
||||
{
|
||||
while ( $row = $this->db->fetch_row($resql) )
|
||||
{
|
||||
$total += $row[0];
|
||||
$nb++;
|
||||
}
|
||||
{
|
||||
$total += $row[0];
|
||||
$nb++;
|
||||
}
|
||||
|
||||
$this->db->free($resql);
|
||||
$this->db->free($resql);
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."bordereau_cheque";
|
||||
$sql.= " SET amount = '".price2num($total)."'";
|
||||
$sql.= ", nbcheque = ".$nb;
|
||||
$sql.= " WHERE rowid = ".$this->id;
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."bordereau_cheque";
|
||||
$sql.= " SET amount = '".price2num($total)."'";
|
||||
$sql.= ", nbcheque = ".$nb;
|
||||
$sql.= " WHERE rowid = ".$this->id;
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql)
|
||||
{
|
||||
$this->errno = -1030;
|
||||
dol_syslog("RemiseCheque::updateAmount ERREUR UPDATE ($this->errno)");
|
||||
}
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql)
|
||||
{
|
||||
$this->errno = -1030;
|
||||
dol_syslog("RemiseCheque::updateAmount ERREUR UPDATE ($this->errno)");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -724,41 +724,6 @@ class RemiseCheque extends CommonObject
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the external ref
|
||||
*
|
||||
* @param User $user Object user
|
||||
* @param timestamp $ref_rext External ref
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function set_ref_ext($user, $ref_ext)
|
||||
{
|
||||
if ($user->rights->banque->cheque)
|
||||
{
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."bordereau_cheque";
|
||||
$sql.= " SET ref_ext = '".$ref_ext."'";
|
||||
$sql.= " WHERE rowid = ".$this->id;
|
||||
|
||||
dol_syslog("RemiseCheque::set_ref_ext sql=$sql",LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$this->ref_ext = $ref_ext;
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
dol_syslog("RemiseCheque::set_ref_ext ".$this->error,LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@ -780,7 +745,7 @@ class RemiseCheque extends CommonObject
|
||||
if ($withpicto) $result.=($lien.img_object($langs->trans("ShowCheckReceipt"),'payment').$lienfin);
|
||||
if ($withpicto && $withpicto != 2) $result.=' ';
|
||||
if ($withpicto != 2) $result.=$lien.$this->ref.$lienfin;
|
||||
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
@ -100,7 +100,7 @@ if ($action == 'setrefext' && $user->rights->banque->cheque)
|
||||
{
|
||||
$ref_ext = GETPOST('ref_ext');
|
||||
|
||||
$result=$object->set_ref_ext($user, $ref_ext);
|
||||
$result=$object->setValueFrom('ref_ext', $ref_ext);
|
||||
if ($result < 0)
|
||||
{
|
||||
$mesg='<div class="error">'.$object->error.'</div>';
|
||||
@ -514,10 +514,10 @@ else
|
||||
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
// External ref
|
||||
print '<tr><td>';
|
||||
|
||||
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('RefExt');
|
||||
print '</td>';
|
||||
|
||||
@ -736,31 +736,35 @@ abstract class CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* Update a specific field from an object
|
||||
* Update a specific field into database
|
||||
*
|
||||
* @param string $field Field to update
|
||||
* @param mixte $value New value
|
||||
* @param string $table To force other table element or element line
|
||||
* @param int $id To force other object id
|
||||
* @param string $format Data format ('text' by default, 'date')
|
||||
* @param string $id_field To force rowid field name
|
||||
* @param string $table To force other table element or element line (should not be used)
|
||||
* @param int $id To force other object id (should not be used)
|
||||
* @param string $format Data format ('text', 'date'). 'text' is used if not defined
|
||||
* @param string $id_field To force rowid field name. 'rowid' is used it not defined
|
||||
* @param string $user Update last update fields also if user object provided
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function setValueFrom($field, $value, $table='', $id='', $format='text', $id_field='rowid')
|
||||
function setValueFrom($field, $value, $table='', $id='', $format='', $id_field='', $user='')
|
||||
{
|
||||
global $conf;
|
||||
|
||||
if (empty($table)) $table=$this->table_element;
|
||||
if (empty($id)) $id=$this->id;
|
||||
if (empty($table)) $table=$this->table_element;
|
||||
if (empty($id)) $id=$this->id;
|
||||
if (empty($format)) $format='text';
|
||||
if (empty($id_field)) $id_field='rowid';
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX.$table." SET ";
|
||||
if ($format == 'text') $sql.= $field." = '".$this->db->escape($value)."'";
|
||||
else if ($format == 'date') $sql.= $field." = '".$this->db->idate($value)."'";
|
||||
if (is_object($user)) $sql.=", fk_user_modif = ".$user->id;
|
||||
$sql.= " WHERE ".$id_field." = ".$id;
|
||||
|
||||
dol_syslog(get_class($this)."::setValueFrom sql=".$sql, LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::".__FUNCTION__." sql=".$sql, LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -2296,7 +2300,7 @@ abstract class CommonObject
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
setListDependencies();
|
||||
});
|
||||
</script>';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user