Fix warning

This commit is contained in:
Laurent Destailleur 2023-01-01 23:50:37 +01:00
parent 4c85236243
commit 5c8dc4ed58
6 changed files with 9 additions and 45 deletions

View File

@ -142,7 +142,7 @@ class box_graph_invoices_peryear extends ModeleBoxes
$px2->SetData($data2); $px2->SetData($data2);
unset($data2); unset($data2);
$i = $startyear; $i = $startyear;
$legend = array(); /*$legend = array();
while ($i <= $endyear) { while ($i <= $endyear) {
if ($startmonth != 1) { if ($startmonth != 1) {
$legend[] = sprintf("%d/%d", $i - 2001, $i - 2000); $legend[] = sprintf("%d/%d", $i - 2001, $i - 2000);
@ -150,7 +150,7 @@ class box_graph_invoices_peryear extends ModeleBoxes
$legend[] = $i; $legend[] = $i;
} }
$i++; $i++;
} }*/
$px2->SetLegend([$langs->trans("AmountOfBillsHT")]); $px2->SetLegend([$langs->trans("AmountOfBillsHT")]);
$px2->SetMaxValue($px2->GetCeilMaxValue()); $px2->SetMaxValue($px2->GetCeilMaxValue());
$px2->SetWidth($WIDTH); $px2->SetWidth($WIDTH);

View File

@ -82,7 +82,7 @@ class modLoan extends DolibarrModules
"chaine", "chaine",
"6611" "6611"
); );
$this->const[1] = array( $this->const[2] = array(
"LOAN_ACCOUNTING_ACCOUNT_INSURANCE", "LOAN_ACCOUNTING_ACCOUNT_INSURANCE",
"chaine", "chaine",
"6162" "6162"

View File

@ -206,7 +206,7 @@ class Don extends CommonObject
*/ */
public function initAsSpecimen() public function initAsSpecimen()
{ {
global $conf, $user, $langs; global $conf;
$now = dol_now(); $now = dol_now();
@ -224,10 +224,10 @@ class Don extends CommonObject
$num_socs = $this->db->num_rows($resql); $num_socs = $this->db->num_rows($resql);
$i = 0; $i = 0;
while ($i < $num_socs) { while ($i < $num_socs) {
$i++;
$row = $this->db->fetch_row($resql); $row = $this->db->fetch_row($resql);
$socids[$i] = $row[0]; $socids[$i] = $row[0];
$i++;
} }
} }
@ -237,7 +237,7 @@ class Don extends CommonObject
$this->specimen = 1; $this->specimen = 1;
$this->lastname = 'Doe'; $this->lastname = 'Doe';
$this->firstname = 'John'; $this->firstname = 'John';
$this->socid = 1; $this->socid = empty($socids[0]) ? 0 : $socids[0];
$this->date = $now; $this->date = $now;
$this->date_valid = $now; $this->date_valid = $now;
$this->amount = 100.90; $this->amount = 100.90;

View File

@ -1911,23 +1911,6 @@ class Expedition extends CommonObject
dol_syslog(get_class($this)."::initAsSpecimen"); dol_syslog(get_class($this)."::initAsSpecimen");
// Load array of products prodids
$num_prods = 0;
$prodids = array();
$sql = "SELECT rowid";
$sql .= " FROM ".MAIN_DB_PREFIX."product";
$sql .= " WHERE entity IN (".getEntity('product').")";
$resql = $this->db->query($sql);
if ($resql) {
$num_prods = $this->db->num_rows($resql);
$i = 0;
while ($i < $num_prods) {
$i++;
$row = $this->db->fetch_row($resql);
$prodids[$i] = $row[0];
}
}
$order = new Commande($this->db); $order = new Commande($this->db);
$order->initAsSpecimen(); $order->initAsSpecimen();
@ -1940,7 +1923,7 @@ class Expedition extends CommonObject
$this->date = $now; $this->date = $now;
$this->date_creation = $now; $this->date_creation = $now;
$this->date_valid = $now; $this->date_valid = $now;
$this->date_delivery = $now; $this->date_delivery = $now + 24 * 3600;
$this->date_expedition = $now + 24 * 3600; $this->date_expedition = $now + 24 * 3600;
$this->entrepot_id = 0; $this->entrepot_id = 0;

View File

@ -1348,25 +1348,6 @@ class Reception extends CommonObject
dol_syslog(get_class($this)."::initAsSpecimen"); dol_syslog(get_class($this)."::initAsSpecimen");
// Load array of products prodids
$num_prods = 0;
$prodids = array();
$sql = "SELECT rowid";
$sql .= " FROM ".MAIN_DB_PREFIX."product";
$sql .= " WHERE entity IN (".getEntity('product').")";
$sql .= $this->db->plimit(100);
$resql = $this->db->query($sql);
if ($resql) {
$num_prods = $this->db->num_rows($resql);
$i = 0;
while ($i < $num_prods) {
$i++;
$row = $this->db->fetch_row($resql);
$prodids[$i] = $row[0];
}
}
$order = new CommandeFournisseur($this->db); $order = new CommandeFournisseur($this->db);
$order->initAsSpecimen(); $order->initAsSpecimen();

View File

@ -75,5 +75,5 @@ exclude:
- name: PhpObjectFieldsAreOnlyWrittenInspection - name: PhpObjectFieldsAreOnlyWrittenInspection
- name: PhpMissingParentConstructorInspection - name: PhpMissingParentConstructorInspection
- name: PhpWriteAccessToReferencedArrayValueWithoutUnsetInspection - name: PhpWriteAccessToReferencedArrayValueWithoutUnsetInspection
- name: PhpArrayUsedOnlyForWriteInspection