This commit is contained in:
Laurent Destailleur 2022-05-15 22:29:19 +02:00
parent 775a8c5334
commit 508cbee1a5
22 changed files with 84 additions and 71 deletions

View File

@ -395,8 +395,8 @@ $sql .= $db->order($sortfield, $sortorder);
$nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
$result = $db->query($sql);
$nbtotalofrecords = $db->num_rows($result);
$resql = $db->query($sql);
$nbtotalofrecords = $db->num_rows($resql);
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
$page = 0;
$offset = 0;
@ -406,9 +406,9 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
$sql .= $db->plimit($limit + 1, $offset);
dol_syslog("/accountancy/admin/productaccount.php", LOG_DEBUG);
$result = $db->query($sql);
if ($result) {
$num = $db->num_rows($result);
$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);
$i = 0;
$param = '';
@ -608,7 +608,7 @@ if ($result) {
$i = 0;
while ($i < min($num, $limit)) {
$obj = $db->fetch_object($result);
$obj = $db->fetch_object($resql);
// Ref produit as link
$product_static->ref = $obj->ref;
@ -891,7 +891,7 @@ if ($result) {
print '</form>';
$db->free($result);
$db->free($resql);
} else {
dol_print_error($db);
}

View File

@ -586,11 +586,11 @@ class AccountingAccount extends CommonObject
$sql .= ' WHERE a.rowid = ' . ((int) $id);
dol_syslog(get_class($this) . '::info sql=' . $sql);
$result = $this->db->query($sql);
$resql = $this->db->query($sql);
if ($result) {
if ($this->db->num_rows($result)) {
$obj = $this->db->fetch_object($result);
if ($resql) {
if ($this->db->num_rows($resql)) {
$obj = $this->db->fetch_object($resql);
$this->id = $obj->rowid;
if ($obj->fk_user_author) {
$cuser = new User($this->db);
@ -605,7 +605,7 @@ class AccountingAccount extends CommonObject
$this->date_creation = $this->db->jdate($obj->datec);
$this->date_modification = $this->db->jdate($obj->tms);
}
$this->db->free($result);
$this->db->free($resql);
} else {
dol_print_error($this->db);
}

View File

@ -266,14 +266,14 @@ class Lettering extends BookKeeping
$sql .= " ORDER BY ab2.lettering_code DESC";
$sql .= " LIMIT 1 ";
$result = $this->db->query($sql);
if ($result) {
$obj = $this->db->fetch_object($result);
$resqla = $this->db->query($sql);
if ($resqla) {
$obj = $this->db->fetch_object($resqla);
$lettre = (empty($obj->lettering_code) ? 'AAA' : $obj->lettering_code);
if (!empty($obj->lettering_code)) {
$lettre++;
}
$this->db->free($result);
$this->db->free($resqla);
} else {
$this->errors[] = 'Error'.$this->db->lasterror();
$error++;
@ -281,14 +281,14 @@ class Lettering extends BookKeeping
$sql = "SELECT SUM(ABS(debit)) as deb, SUM(ABS(credit)) as cred FROM ".MAIN_DB_PREFIX."accounting_bookkeeping WHERE ";
$sql .= " rowid IN (".$this->db->sanitize(implode(',', $ids)).") AND lettering_code IS NULL AND subledger_account != ''";
$result = $this->db->query($sql);
if ($result) {
$obj = $this->db->fetch_object($result);
$resqlb = $this->db->query($sql);
if ($resqlb) {
$obj = $this->db->fetch_object($resqlb);
if (!(round(abs($obj->deb), 2) === round(abs($obj->cred), 2))) {
$this->errors[] = 'Total not exacts '.round(abs($obj->deb), 2).' vs '.round(abs($obj->cred), 2);
$error++;
}
$this->db->free($result);
$this->db->free($resqlb);
} else {
$this->errors[] = 'Erreur sql'.$this->db->lasterror();
$error++;

View File

@ -490,17 +490,17 @@ class Subscription extends CommonObject
$sql .= ' FROM '.MAIN_DB_PREFIX.'subscription as c';
$sql .= ' WHERE c.rowid = '.((int) $id);
$result = $this->db->query($sql);
if ($result) {
if ($this->db->num_rows($result)) {
$obj = $this->db->fetch_object($result);
$resql = $this->db->query($sql);
if ($resql) {
if ($this->db->num_rows($resql)) {
$obj = $this->db->fetch_object($resql);
$this->id = $obj->rowid;
$this->date_creation = $this->db->jdate($obj->datec);
$this->date_modification = $this->db->jdate($obj->datem);
}
$this->db->free($result);
$this->db->free($resql);
} else {
dol_print_error($this->db);
}

View File

@ -99,12 +99,12 @@ $sql .= " WHERE t.entity IN (".getEntity('member_type').")";
$sql .= " GROUP BY t.rowid, t.libelle, t.subscription, d.statut";
dol_syslog("index.php::select nb of members per type", LOG_DEBUG);
$result = $db->query($sql);
if ($result) {
$num = $db->num_rows($result);
$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);
$i = 0;
while ($i < $num) {
$objp = $db->fetch_object($result);
$objp = $db->fetch_object($resql);
$adhtype = new AdherentType($db);
$adhtype->id = $objp->rowid;
@ -127,7 +127,7 @@ if ($result) {
$i++;
}
$db->free($result);
$db->free($resql);
}
$now = dol_now();
@ -143,16 +143,16 @@ $sql .= " AND t.rowid = d.fk_adherent_type";
$sql .= " GROUP BY d.fk_adherent_type";
dol_syslog("index.php::select nb of uptodate members by type", LOG_DEBUG);
$result = $db->query($sql);
if ($result) {
$num = $db->num_rows($result);
$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);
$i = 0;
while ($i < $num) {
$objp = $db->fetch_object($result);
$objp = $db->fetch_object($resql);
$MembersUpToDate[$objp->fk_adherent_type] = $objp->somme;
$i++;
}
$db->free();
$db->free($resql);
}
/*

View File

@ -310,9 +310,9 @@ if ($object->id > 0) {
$sql .= " AND pfd.ext_payment_id IS NULL";
$sql .= " ORDER BY pfd.date_demande DESC";
$result_sql = $db->query($sql);
if ($result_sql) {
$num = $db->num_rows($result_sql);
$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);
$numopen = $num;
} else {
dol_print_error($db);
@ -695,9 +695,9 @@ if ($object->id > 0) {
$sql .= " AND pfd.traite = 0";
$sql .= " AND pfd.ext_payment_id IS NULL";
$result_sql = $db->query($sql);
if ($result_sql) {
$obj = $db->fetch_object($result_sql);
$resql = $db->query($sql);
if ($resql) {
$obj = $db->fetch_object($resql);
if ($obj) {
$pending = $obj->amount;
}
@ -797,17 +797,17 @@ if ($object->id > 0) {
$sql .= " AND pfd.ext_payment_id IS NULL";
$sql .= " ORDER BY pfd.date_demande DESC";
$result_sql = $db->query($sql);
$resql = $db->query($sql);
$num = 0;
if ($result_sql) {
if ($resql) {
$i = 0;
$tmpuser = new User($db);
$num = $db->num_rows($result);
while ($i < $num) {
$obj = $db->fetch_object($result_sql);
$obj = $db->fetch_object($resql);
$tmpuser->id = $obj->user_id;
$tmpuser->login = $obj->login;
@ -840,7 +840,7 @@ if ($object->id > 0) {
$i++;
}
$db->free($result_sql);
$db->free($resql);
} else {
dol_print_error($db);
}

View File

@ -198,7 +198,7 @@ if ($action == 'create') {
if ($resql) {
$obj = $db->fetch_object($resql);
$sumpaid = $obj->total;
$db->free();
$db->free($resql);
}
/*print '<tr><td>'.$langs->trans("AlreadyPaid").'</td><td>'.price($sumpaid,0,$outputlangs,1,-1,-1,$conf->currency).'</td></tr>';
print '<tr><td class="tdtop">'.$langs->trans("RemainderToPay").'</td><td>'.price($total-$sumpaid,0,$outputlangs,1,-1,-1,$conf->currency).'</td></tr>';*/

View File

@ -194,7 +194,7 @@ if ($action == 'create') {
if ($resql) {
$obj = $db->fetch_object($resql);
$sumpaid = $obj->total;
$db->free();
$db->free($resql);
}
/*print '<tr><td>'.$langs->trans("AlreadyPaid").'</td><td>'.price($sumpaid,0,$outputlangs,1,-1,-1,$conf->currency).'</td></tr>';
print '<tr><td class="tdtop">'.$langs->trans("RemainderToPay").'</td><td>'.price($total-$sumpaid,0,$outputlangs,1,-1,-1,$conf->currency).'</td></tr>';*/

View File

@ -143,7 +143,8 @@ if ($resql) {
print price($total);
print '</td><td class="right">&nbsp;</td>';
print "</tr></table>";
$db->free();
$db->free($resql);
} else {
dol_print_error($db);
}

View File

@ -346,22 +346,27 @@ if ($result) {
while ($i < $num) {
$obj = $db->fetch_object($result);
$datem = $db->jdate($obj->tms);
$staticcontrat->ref = ($obj->ref ? $obj->ref : $obj->cid);
$staticcontrat->id = $obj->cid;
$staticcompany->id = $obj->socid;
$staticcompany->name = $obj->name;
print '<tr class="oddeven">';
print '<td class="nowraponall">';
$staticcontrat->ref = ($obj->ref ? $obj->ref : $obj->cid);
$staticcontrat->id = $obj->cid;
print $staticcontrat->getNomUrl(1, 16);
if ($obj->nb_late) {
print img_warning($langs->trans("Late"));
}
print '</td>';
print '<td>';
$staticcompany->id = $obj->socid;
$staticcompany->name = $obj->name;
print $staticcompany->getNomUrl(1, '', 20);
print '</td>';
print '<td class="center">'.dol_print_date($db->jdate($obj->tms), 'dayhour').'</td>';
print '<td class="center nowraponall" title="'.dol_escape_htmltag($langs->trans("DateModification").': '.dol_print_date($datem, 'dayhour', 'tzuserrel')).'">';
print dol_print_date($datem, 'dayhour');
print '</td>';
//print '<td class="left">'.$staticcontrat->LibStatut($obj->statut,2).'</td>';
print '<td class="right nowraponall" width="32">'.($obj->nb_initial > 0 ? '<span class="paddingright">'.$obj->nb_initial.'</span>'.$staticcontratligne->LibStatut(0, 3, -1, 'class="paddingleft"') : '').'</td>';
print '<td class="right nowraponall" width="32">'.($obj->nb_running > 0 ? '<span class="paddingright">'.$obj->nb_running.'</span>'.$staticcontratligne->LibStatut(4, 3, 0, 'class="marginleft"') : '').'</td>';
@ -451,7 +456,7 @@ if ($resql) {
print "</tr>\n";
$i++;
}
$db->free();
$db->free($resql);
print "</table></div>";
} else {
@ -532,7 +537,8 @@ if ($resql) {
print "</tr>\n";
$i++;
}
$db->free();
$db->free($resql);
print "</table></div>";
} else {
@ -614,7 +620,7 @@ if ($resql) {
print "</tr>\n";
$i++;
}
$db->free();
$db->free($resql);
print "</table></div>";
} else {

View File

@ -147,7 +147,7 @@ class box_boms extends ModeleBoxes
}
$this->info_box_contents[$line][] = array(
'td' => 'class="right"',
'td' => 'class="center nowraponall" title="'.dol_escape_htmltag($langs->trans("DateModification").': '.dol_print_date($datem, 'dayhour', 'tzuserrel')).'"',
'text' => dol_print_date($datem, 'day', 'tzuserrel'),
);

View File

@ -140,7 +140,7 @@ class box_clients extends ModeleBoxes
);
$this->info_box_contents[$line][] = array(
'td' => 'class="center nowraponall"',
'td' => 'class="center nowraponall" title="'.dol_escape_htmltag($langs->trans("DateModification").': '.dol_print_date($datem, 'dayhour', 'tzuserrel')).'"',
'text' => dol_print_date($datem, "day", 'tzuserrel')
);

View File

@ -177,7 +177,7 @@ class box_contacts extends ModeleBoxes
);
$this->info_box_contents[$line][] = array(
'td' => 'class="right"',
'td' => 'class="center nowraponall" title="'.dol_escape_htmltag($langs->trans("DateModification").': '.dol_print_date($datem, 'dayhour', 'tzuserrel')).'"',
'text' => dol_print_date($datem, "day", 'tzuserrel'),
);

View File

@ -83,8 +83,8 @@ class box_contracts extends ModeleBoxes
$thirdpartytmp = new Societe($this->db);
$sql = "SELECT s.nom as name, s.rowid as socid, s.email, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,";
$sql .= " c.rowid, c.ref, c.statut as fk_statut, c.date_contrat, c.datec, c.fin_validite, c.date_cloture";
$sql .= ", c.ref_customer, c.ref_supplier";
$sql .= " c.rowid, c.ref, c.statut as fk_statut, c.date_contrat, c.datec, c.tms as date_modification, c.fin_validite, c.date_cloture,";
$sql .= " c.ref_customer, c.ref_supplier";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as c";
if (empty($user->rights->societe->client->voir) && !$user->socid) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
@ -117,6 +117,7 @@ class box_contracts extends ModeleBoxes
$objp = $this->db->fetch_object($resql);
$datec = $this->db->jdate($objp->datec);
$datem = $this->db->jdate($objp->date_modification);
$dateterm = $this->db->jdate($objp->fin_validite);
$dateclose = $this->db->jdate($objp->date_cloture);
$late = '';
@ -155,8 +156,8 @@ class box_contracts extends ModeleBoxes
);
$this->info_box_contents[$line][] = array(
'td' => 'class="right"',
'text' => dol_print_date($datec, 'day', 'tzuserrel'),
'td' => 'class="center nowraponall" title="'.dol_escape_htmltag($langs->trans("DateModification").': '.dol_print_date($datem, 'dayhour', 'tzuserrel')).'"',
'text' => dol_print_date($datem, 'day', 'tzuserrel'),
);
$this->info_box_contents[$line][] = array(

View File

@ -145,7 +145,7 @@ class box_members extends ModeleBoxes
);
$this->info_box_contents[$line][] = array(
'td' => 'class="center nowraponall"',
'td' => 'class="center nowraponall" title="'.dol_escape_htmltag($langs->trans("DateModification").': '.dol_print_date($datem, 'dayhour', 'tzuserrel')).'"',
'text' => dol_print_date($datem, "day", 'tzuserrel'),
);

View File

@ -144,7 +144,7 @@ class box_mos extends ModeleBoxes
}
$this->info_box_contents[$line][] = array(
'td' => 'class="center nowraponall"',
'td' => 'class="center nowraponall" title="'.dol_escape_htmltag($langs->trans("DateModification").': '.dol_print_date($datem, 'dayhour', 'tzuserrel')).'"',
'text' => dol_print_date($datem, 'day', 'tzuserrel'),
);

View File

@ -165,7 +165,7 @@ class box_propales extends ModeleBoxes
);
$this->info_box_contents[$line][] = array(
'td' => 'class="center nowraponall"',
'td' => 'class="center nowraponall" title="'.dol_escape_htmltag($langs->trans("Date").': '.dol_print_date($datem, 'day', 'tzuserrel')).'"',
'text' => dol_print_date($date, 'day', 'tzuserrel'),
);

View File

@ -149,7 +149,7 @@ $resql = $db->query($sql);
if ($resql) {
$obj = $db->fetch_object($resql);
$sumpaid = $obj->total;
$db->free();
$db->free($resql);
}

View File

@ -212,7 +212,7 @@ if ($action == 'create' || empty($action)) {
if ($resql) {
$obj = $db->fetch_object($resql);
$sumpaid = $obj->total;
$db->free();
$db->free($resql);
}
print '<tr><td>'.$langs->trans("AlreadyPaid").'</td><td>'.price($sumpaid, 0, $outputlangs, 1, -1, -1, $conf->currency).'</td></tr>';
print '<tr><td class="tdtop">'.$langs->trans("RemainderToPay").'</td><td>'.price($total - $sumpaid, 0, $outputlangs, 1, -1, -1, $conf->currency).'</td></tr>';

View File

@ -3523,7 +3523,7 @@ class CommandeFournisseur extends CommonOrder
empty($this->receptions[$obj->rowid]) ? $this->receptions[$obj->rowid] = $obj->qty : $this->receptions[$obj->rowid] += $obj->qty;
$i++;
}
$this->db->free();
$this->db->free($resql);
return $num;
} else {

View File

@ -244,7 +244,7 @@ if ($action == 'create') {
if ($resql) {
$obj = $db->fetch_object($resql);
$sumpaid = $obj->total;
$db->free();
$db->free($resql);
}
print '<form name="add_payment" action="'.$_SERVER['PHP_SELF'].'" method="post">';

View File

@ -1372,7 +1372,12 @@ class Ticket extends CommonObject
$label .= '<b>'.$langs->trans('Ref').':</b> '.$this->ref.'<br>';
$label .= '<b>'.$langs->trans('TicketTrackId').':</b> '.$this->track_id.'<br>';
$label .= '<b>'.$langs->trans('Subject').':</b> '.$this->subject;
if ($this->date_creation) {
$label .= '<br><b>'.$langs->trans('DateCreation').':</b> '.$this->date_creation;
}
if ($this->date_modification) {
$label .= '<br><b>'.$langs->trans('DateModification').':</b> '.$this->date_modification;
}
$url = DOL_URL_ROOT.'/ticket/card.php?id='.$this->id;
if ($option != 'nolink') {