fix travis

This commit is contained in:
florian HENRY 2017-10-02 09:04:22 +02:00
parent 6fcfe89565
commit 18bd2c4445

View File

@ -52,59 +52,6 @@ class lettering extends BookKeeping
$object->code_compta_fournisseur = ''; $object->code_compta_fournisseur = '';
} }
/*$sql = "SELECT DISTINCT bk.rowid, bk.lettering_code";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk";
$sql .= " WHERE code_journal IN (SELECT code FROM ".MAIN_DB_PREFIX."accounting_journal WHERE nature=4) AND ( ";
if (! empty($object->code_compta))
$sql .= " bk.thirdparty_code = '" . $object->code_compta . "' ";
if (! empty($object->code_compta) && ! empty($object->code_compta_fournisseur))
$sql .= " OR ";
if (! empty($object->code_compta_fournisseur))
$sql .= " bk.thirdparty_code = '" . $object->code_compta_fournisseur . "' ";
$sql .= " ) AND (bk.date_lettering ='' OR bk.date_lettering IS NULL) ";
$sql .= " AND (bk.lettering_code != '' OR bk.lettering_code IS NULL) ";
$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);
$i = 0;
while ( $i < $num ) {
$obj = $db->fetch_object($resql);
$i ++;
$sql = "SELECT bk.rowid ";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk";
$sql .= " WHERE bk.lettering_code = '" . $obj->lettering_code . "' ";
$sql .= " AND ( ";
if (! empty($object->code_compta))
$sql .= " bk.thirdparty_code = '" . $object->code_compta . "' ";
if (! empty($object->code_compta) && ! empty($object->code_compta_fournisseur))
$sql .= " OR ";
if (! empty($object->code_compta_fournisseur))
$sql .= " bk.thirdparty_code = '" . $object->code_compta_fournisseur . "' ";
$sql .= " ) ";
// echo $sql;
$resql2 = $db->query($sql);
if ($resql2) {
$num2 = $db->num_rows($resql2);
$i2 = 0;
$ids = array();
while ( $obj2 = $db->fetch_object($resql2) ) {
$ids[] = $obj2->rowid;
}
if (count($ids) > 1) {
$result = $this->updatelettrage($ids);
}
}
}
} else {
setEventMessage($this->db->lasterror,'errors');
return -1;
}*/
/** /**
* Prise en charge des lettering complexe avec prelevment , virement * Prise en charge des lettering complexe avec prelevment , virement
*/ */
@ -156,14 +103,12 @@ class lettering extends BookKeeping
} }
$sql .= " ) "; $sql .= " ) ";
$resql2 = $db->query($sql); $resql2 = $db->query($sql);
if ($resql2) { if ($resql2) {
while ( $obj2 = $db->fetch_object($resql2) ) { while ( $obj2 = $db->fetch_object($resql2) ) {
$ids[$obj2->rowid] = $obj2->rowid; $ids[$obj2->rowid] = $obj2->rowid;
$ids_fact[] = $obj2->fact_id; $ids_fact[] = $obj2->fact_id;
} }
} else { } else {
$this->errors[] = $this->db->lasterror; $this->errors[] = $this->db->lasterror;
return - 1; return - 1;
@ -190,16 +135,13 @@ class lettering extends BookKeeping
while ( $obj2 = $db->fetch_object($resql2) ) { while ( $obj2 = $db->fetch_object($resql2) ) {
$ids[$obj2->rowid] = $obj2->rowid; $ids[$obj2->rowid] = $obj2->rowid;
} }
} else { } else {
$this->errors[] = $this->db->lasterror; $this->errors[] = $this->db->lasterror;
return - 1; return - 1;
} }
} }
} elseif ($obj->type == 'payment') { } elseif ($obj->type == 'payment') {
$sql = 'SELECT DISTINCT bk.rowid, fac.ref, fac.ref, pay.fk_bank, fac.rowid as fact_id'; $sql = 'SELECT DISTINCT bk.rowid, fac.ref, fac.ref, pay.fk_bank, fac.rowid as fact_id';
$sql .= " FROM " . MAIN_DB_PREFIX . "facture fac "; $sql .= " FROM " . MAIN_DB_PREFIX . "facture fac ";
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "paiement_facture as payfac ON payfac.fk_facture=fac.rowid"; $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "paiement_facture as payfac ON payfac.fk_facture=fac.rowid";
@ -219,14 +161,12 @@ class lettering extends BookKeeping
} }
$sql .= " ) "; $sql .= " ) ";
$resql2 = $db->query($sql); $resql2 = $db->query($sql);
if ($resql2) { if ($resql2) {
while ( $obj2 = $db->fetch_object($resql2) ) { while ( $obj2 = $db->fetch_object($resql2) ) {
$ids[$obj2->rowid] = $obj2->rowid; $ids[$obj2->rowid] = $obj2->rowid;
$ids_fact[] = $obj2->fact_id; $ids_fact[] = $obj2->fact_id;
} }
} else { } else {
$this->errors[] = $this->db->lasterror; $this->errors[] = $this->db->lasterror;
return - 1; return - 1;
@ -253,7 +193,6 @@ class lettering extends BookKeeping
while ( $obj2 = $db->fetch_object($resql2) ) { while ( $obj2 = $db->fetch_object($resql2) ) {
$ids[$obj2->rowid] = $obj2->rowid; $ids[$obj2->rowid] = $obj2->rowid;
} }
} else { } else {
$this->errors[] = $this->db->lasterror; $this->errors[] = $this->db->lasterror;
return - 1; return - 1;
@ -264,7 +203,6 @@ class lettering extends BookKeeping
if (count($ids) > 1) { if (count($ids) > 1) {
$result = $this->updatelettrage($ids); $result = $this->updatelettrage($ids);
} }
} }
} }
if ($error) { if ($error) {
@ -281,7 +219,7 @@ class lettering extends BookKeeping
/** /**
* *
* @param array $ids * @param array $ids
* @param string $notrigger * @param boolean $notrigger
* @return number * @return number
*/ */
public function updateLettrage($ids = array(), $notrigger = false) { public function updateLettrage($ids = array(), $notrigger = false) {