本文整理汇总了PHP中Societe::load_ban方法的典型用法代码示例。如果您正苦于以下问题:PHP Societe::load_ban方法的具体用法?PHP Societe::load_ban怎么用?PHP Societe::load_ban使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Societe
的用法示例。
在下文中一共展示了Societe::load_ban方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Societe
/**
* Create a withdrawal request for a standing order
*
* @param User $user User asking standing order
* @return int <0 if KO, >0 if OK
*/
function demande_prelevement($user)
{
dol_syslog(get_class($this) . "::demande_prelevement", LOG_DEBUG);
$soc = new Societe($this->db);
$soc->id = $this->socid;
$soc->load_ban();
if ($this->statut > 0 && $this->paye == 0) {
$sql = 'SELECT count(*)';
$sql .= ' FROM ' . MAIN_DB_PREFIX . 'prelevement_facture_demande';
$sql .= ' WHERE fk_facture = ' . $this->id;
$sql .= ' AND traite = 0';
$resql = $this->db->query($sql);
if ($resql) {
$row = $this->db->fetch_row($resql);
if ($row[0] == 0) {
$now = dol_now();
$sql = 'INSERT INTO ' . MAIN_DB_PREFIX . 'prelevement_facture_demande';
$sql .= ' (fk_facture, amount, date_demande, fk_user_demande, code_banque, code_guichet, number, cle_rib)';
$sql .= ' VALUES (' . $this->id;
$sql .= ",'" . price2num($this->total_ttc) . "'";
$sql .= "," . $this->db->idate($now) . "," . $user->id;
$sql .= ",'" . $soc->bank_account->code_banque . "'";
$sql .= ",'" . $soc->bank_account->code_guichet . "'";
$sql .= ",'" . $soc->bank_account->number . "'";
$sql .= ",'" . $soc->bank_account->cle_rib . "')";
if ($this->db->query($sql)) {
return 1;
} else {
$this->error = $this->db->error();
dol_syslog(get_class($this) . '::demandeprelevement Erreur');
return -1;
}
} else {
$this->error = "A request already exists";
dol_syslog(get_class($this) . '::demandeprelevement Impossible de creer une demande, demande deja en cours');
}
} else {
$this->error = $this->db->error();
dol_syslog(get_class($this) . '::demandeprelevement Erreur -2');
return -2;
}
} else {
$this->error = "Status of invoice does not allow this";
dol_syslog(get_class($this) . "::demandeprelevement " . $this->error . " {$this->statut}, {$this->paye}, {$this->mode_reglement_id}");
return -3;
}
}