Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2021-02-09 14:00:11 +01:00
commit 1c99eaedbc
60 changed files with 581 additions and 174 deletions

View File

@ -1749,7 +1749,7 @@ class Adherent extends CommonObject
if (!$error) { if (!$error) {
// Set invoice as paid // Set invoice as paid
$invoice->set_paid($user); $invoice->setPaid($user);
} }
} }

View File

@ -319,7 +319,7 @@ switch ($action)
&& $obj_facturation->getSetPaymentMode() != 'DIFF') && $obj_facturation->getSetPaymentMode() != 'DIFF')
{ {
// We set status to paid // We set status to paid
$result = $invoice->set_paid($user); $result = $invoice->setPaid($user);
//print 'set paid';exit; //print 'set paid';exit;
} }
} }

View File

@ -1630,7 +1630,7 @@ class Propal extends CommonObject
$sql .= " fk_input_reason=".(isset($this->demand_reason_id) ? $this->demand_reason_id : "null").","; $sql .= " fk_input_reason=".(isset($this->demand_reason_id) ? $this->demand_reason_id : "null").",";
$sql .= " note_private=".(isset($this->note_private) ? "'".$this->db->escape($this->note_private)."'" : "null").","; $sql .= " note_private=".(isset($this->note_private) ? "'".$this->db->escape($this->note_private)."'" : "null").",";
$sql .= " note_public=".(isset($this->note_public) ? "'".$this->db->escape($this->note_public)."'" : "null").","; $sql .= " note_public=".(isset($this->note_public) ? "'".$this->db->escape($this->note_public)."'" : "null").",";
$sql .= " model_pdf=".(isset($this->modelpdf) ? "'".$this->db->escape($this->modelpdf)."'" : "null").","; $sql .= " model_pdf=".(isset($this->model_pdf) ? "'".$this->db->escape($this->model_pdf)."'" : "null").",";
$sql .= " import_key=".(isset($this->import_key) ? "'".$this->db->escape($this->import_key)."'" : "null").""; $sql .= " import_key=".(isset($this->import_key) ? "'".$this->db->escape($this->import_key)."'" : "null")."";
$sql .= " WHERE rowid=".$this->id; $sql .= " WHERE rowid=".$this->id;

View File

@ -501,7 +501,7 @@ if (empty($reshook))
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
} elseif ($action == 'setremise' && $usercancreate) { } elseif ($action == 'setremise' && $usercancreate) {
$result = $object->set_remise($user, GETPOST('remise')); $result = $object->setDiscount($user, GETPOST('remise'));
if ($result < 0) if ($result < 0)
{ {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
@ -607,7 +607,7 @@ if (empty($reshook))
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
} elseif ($action == 'setremisepercent' && $usercancreate) { } elseif ($action == 'setremisepercent' && $usercancreate) {
$result = $object->set_remise($user, price2num(GETPOST('remise_percent'), 2)); $result = $object->setDiscount($user, price2num(GETPOST('remise_percent'), 2));
} elseif ($action == 'setremiseabsolue' && $usercancreate) { } elseif ($action == 'setremiseabsolue' && $usercancreate) {
$result = $object->set_remise_absolue($user, price2num(GETPOST('remise_absolue'), 'MU')); $result = $object->set_remise_absolue($user, price2num(GETPOST('remise_absolue'), 'MU'));
} elseif ($action == 'addline' && GETPOST('submitforalllines', 'alpha') && GETPOST('vatforalllines', 'alpha')) { } elseif ($action == 'addline' && GETPOST('submitforalllines', 'alpha') && GETPOST('vatforalllines', 'alpha')) {

View File

@ -2359,6 +2359,8 @@ class Commande extends CommonOrder
/** /**
* Applique une remise relative * Applique une remise relative
* *
* @deprecated
* @see setDiscount()
* @param User $user User qui positionne la remise * @param User $user User qui positionne la remise
* @param float $remise Discount (percent) * @param float $remise Discount (percent)
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @param int $notrigger 1=Does not execute triggers, 0= execute triggers
@ -2367,6 +2369,20 @@ class Commande extends CommonOrder
public function set_remise($user, $remise, $notrigger = 0) public function set_remise($user, $remise, $notrigger = 0)
{ {
// phpcs:enable // phpcs:enable
dol_syslog(get_class($this)."::set_remise is deprecated, use setDiscount instead", LOG_NOTICE);
return $this->setDiscount($user, $remise, $notrigger);
}
/**
* Applique une remise relative
*
* @param User $user User qui positionne la remise
* @param float $remise Discount (percent)
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int <0 if KO, >0 if OK
*/
public function setDiscount($user, $remise, $notrigger = 0)
{
$remise = trim($remise) ?trim($remise) : 0; $remise = trim($remise) ?trim($remise) : 0;
if ($user->rights->commande->creer) if ($user->rights->commande->creer)
@ -3271,7 +3287,7 @@ class Commande extends CommonOrder
$sql .= " fk_input_reason=".($this->demand_reason_id > 0 ? $this->demand_reason_id : "null").","; $sql .= " fk_input_reason=".($this->demand_reason_id > 0 ? $this->demand_reason_id : "null").",";
$sql .= " note_private=".(isset($this->note_private) ? "'".$this->db->escape($this->note_private)."'" : "null").","; $sql .= " note_private=".(isset($this->note_private) ? "'".$this->db->escape($this->note_private)."'" : "null").",";
$sql .= " note_public=".(isset($this->note_public) ? "'".$this->db->escape($this->note_public)."'" : "null").","; $sql .= " note_public=".(isset($this->note_public) ? "'".$this->db->escape($this->note_public)."'" : "null").",";
$sql .= " model_pdf=".(isset($this->modelpdf) ? "'".$this->db->escape($this->modelpdf)."'" : "null").","; $sql .= " model_pdf=".(isset($this->model_pdf) ? "'".$this->db->escape($this->model_pdf)."'" : "null").",";
$sql .= " import_key=".(isset($this->import_key) ? "'".$this->db->escape($this->import_key)."'" : "null").""; $sql .= " import_key=".(isset($this->import_key) ? "'".$this->db->escape($this->import_key)."'" : "null")."";
$sql .= " WHERE rowid=".$this->id; $sql .= " WHERE rowid=".$this->id;
@ -3921,7 +3937,7 @@ class Commande extends CommonOrder
if (!empty($this->model_pdf)) { if (!empty($this->model_pdf)) {
$modele = $this->model_pdf; $modele = $this->model_pdf;
} elseif (!empty($this->modelpdf)) { // dperecated } elseif (!empty($this->modelpdf)) { // deprecated
$modele = $this->modelpdf; $modele = $this->modelpdf;
} elseif (!empty($conf->global->COMMANDE_ADDON_PDF)) { } elseif (!empty($conf->global->COMMANDE_ADDON_PDF)) {
$modele = $conf->global->COMMANDE_ADDON_PDF; $modele = $conf->global->COMMANDE_ADDON_PDF;

View File

@ -14,7 +14,7 @@
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr> * Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2014-2019 Ferran Marcet <fmarcet@2byte.es> * Copyright (C) 2014-2019 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2015-2016 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2015-2016 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2018-2019 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2018-2021 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -193,7 +193,7 @@ if (empty($reshook))
$result = $object->fetch($id); $result = $object->fetch($id);
if ($object->statut == Facture::STATUS_CLOSED || ($object->statut == Facture::STATUS_ABANDONED && ($object->close_code != 'replaced' || $object->getIdReplacingInvoice() == 0)) || ($object->statut == Facture::STATUS_VALIDATED && $object->paye == 1)) { // ($object->statut == 1 && $object->paye == 1) should not happened but can be found when data are corrupted if ($object->statut == Facture::STATUS_CLOSED || ($object->statut == Facture::STATUS_ABANDONED && ($object->close_code != 'replaced' || $object->getIdReplacingInvoice() == 0)) || ($object->statut == Facture::STATUS_VALIDATED && $object->paye == 1)) { // ($object->statut == 1 && $object->paye == 1) should not happened but can be found when data are corrupted
$result = $object->set_unpaid($user); $result = $object->setUnpaid($user);
if ($result > 0) { if ($result > 0) {
header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$id); header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$id);
exit(); exit();
@ -483,7 +483,7 @@ if (empty($reshook))
$result = $object->setBankAccount(GETPOST('fk_account', 'int')); $result = $object->setBankAccount(GETPOST('fk_account', 'int'));
} elseif ($action == 'setremisepercent' && $usercancreate) { } elseif ($action == 'setremisepercent' && $usercancreate) {
$object->fetch($id); $object->fetch($id);
$result = $object->set_remise($user, price2num(GETPOST('remise_percent'), 2)); $result = $object->setDiscount($user, price2num(GETPOST('remise_percent'), 2));
} elseif ($action == "setabsolutediscount" && $usercancreate) { } elseif ($action == "setabsolutediscount" && $usercancreate) {
// POST[remise_id] or POST[remise_id_for_payment] // POST[remise_id] or POST[remise_id_for_payment]
@ -747,7 +747,7 @@ if (empty($reshook))
elseif ($action == 'confirm_paid' && $confirm == 'yes' && $usercanissuepayment) elseif ($action == 'confirm_paid' && $confirm == 'yes' && $usercanissuepayment)
{ {
$object->fetch($id); $object->fetch($id);
$result = $object->set_paid($user); $result = $object->setPaid($user);
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors'); if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
} // Classif "paid partialy" } // Classif "paid partialy"
elseif ($action == 'confirm_paid_partially' && $confirm == 'yes' && $usercanissuepayment) elseif ($action == 'confirm_paid_partially' && $confirm == 'yes' && $usercanissuepayment)
@ -756,7 +756,7 @@ if (empty($reshook))
$close_code = GETPOST("close_code", 'restricthtml'); $close_code = GETPOST("close_code", 'restricthtml');
$close_note = GETPOST("close_note", 'restricthtml'); $close_note = GETPOST("close_note", 'restricthtml');
if ($close_code) { if ($close_code) {
$result = $object->set_paid($user, $close_code, $close_note); $result = $object->setPaid($user, $close_code, $close_note);
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors'); if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
} else { } else {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Reason")), null, 'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Reason")), null, 'errors');
@ -767,7 +767,7 @@ if (empty($reshook))
$close_code = GETPOST("close_code", 'restricthtml'); $close_code = GETPOST("close_code", 'restricthtml');
$close_note = GETPOST("close_note", 'restricthtml'); $close_note = GETPOST("close_note", 'restricthtml');
if ($close_code) { if ($close_code) {
$result = $object->set_canceled($user, $close_code, $close_note); $result = $object->setCanceled($user, $close_code, $close_note);
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors'); if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
} else { } else {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Reason")), null, 'errors'); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Reason")), null, 'errors');
@ -921,7 +921,7 @@ if (empty($reshook))
{ {
if ($object->type != Facture::TYPE_DEPOSIT) { if ($object->type != Facture::TYPE_DEPOSIT) {
// Classe facture // Classe facture
$result = $object->set_paid($user); $result = $object->setPaid($user);
if ($result >= 0) if ($result >= 0)
{ {
$db->commit(); $db->commit();

View File

@ -910,7 +910,7 @@ class Invoices extends DolibarrApi
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
} }
$result = $this->invoice->set_paid(DolibarrApiAccess::$user, $close_code, $close_note); $result = $this->invoice->setPaid(DolibarrApiAccess::$user, $close_code, $close_note);
if ($result == 0) { if ($result == 0) {
throw new RestException(304, 'Error nothing done. May be object is already validated'); throw new RestException(304, 'Error nothing done. May be object is already validated');
} }
@ -960,7 +960,7 @@ class Invoices extends DolibarrApi
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
} }
$result = $this->invoice->set_unpaid(DolibarrApiAccess::$user); $result = $this->invoice->setUnpaid(DolibarrApiAccess::$user);
if ($result == 0) { if ($result == 0) {
throw new RestException(304, 'Nothing done'); throw new RestException(304, 'Nothing done');
} }
@ -1167,7 +1167,7 @@ class Invoices extends DolibarrApi
{ {
if ($this->invoice->type != Facture::TYPE_DEPOSIT) { if ($this->invoice->type != Facture::TYPE_DEPOSIT) {
// Classe facture // Classe facture
$result = $this->invoice->set_paid(DolibarrApiAccess::$user); $result = $this->invoice->setPaid(DolibarrApiAccess::$user);
if ($result >= 0) if ($result >= 0)
{ {
$this->db->commit(); $this->db->commit();

View File

@ -280,7 +280,7 @@ class FactureRec extends CommonInvoice
$sql .= ", ".(!empty($facsrc->remise) ? $this->remise : '0'); $sql .= ", ".(!empty($facsrc->remise) ? $this->remise : '0');
$sql .= ", ".(!empty($this->note_private) ? ("'".$this->db->escape($this->note_private)."'") : "NULL"); $sql .= ", ".(!empty($this->note_private) ? ("'".$this->db->escape($this->note_private)."'") : "NULL");
$sql .= ", ".(!empty($this->note_public) ? ("'".$this->db->escape($this->note_public)."'") : "NULL"); $sql .= ", ".(!empty($this->note_public) ? ("'".$this->db->escape($this->note_public)."'") : "NULL");
$sql .= ", ".(!empty($this->modelpdf) ? ("'".$this->db->escape($this->modelpdf)."'") : "NULL"); $sql .= ", ".(!empty($this->model_pdf) ? ("'".$this->db->escape($this->model_pdf)."'") : "NULL");
$sql .= ", '".$this->db->escape($user->id)."'"; $sql .= ", '".$this->db->escape($user->id)."'";
$sql .= ", ".(!empty($facsrc->fk_project) ? "'".$this->db->escape($facsrc->fk_project)."'" : "null"); $sql .= ", ".(!empty($facsrc->fk_project) ? "'".$this->db->escape($facsrc->fk_project)."'" : "null");
$sql .= ", ".(!empty($facsrc->fk_account) ? "'".$this->db->escape($facsrc->fk_account)."'" : "null"); $sql .= ", ".(!empty($facsrc->fk_account) ? "'".$this->db->escape($facsrc->fk_account)."'" : "null");
@ -347,7 +347,7 @@ class FactureRec extends CommonInvoice
{ {
// Extrafields // Extrafields
if (method_exists($facsrc->lines[$i], 'fetch_optionals')) { if (method_exists($facsrc->lines[$i], 'fetch_optionals')) {
$facsrc->lines[$i]->fetch_optionals($facsrc->lines[$i]->rowid); $facsrc->lines[$i]->fetch_optionals($facsrc->lines[$i]->id);
$objectline->array_options = $facsrc->lines[$i]->array_options; $objectline->array_options = $facsrc->lines[$i]->array_options;
} }
@ -562,7 +562,7 @@ class FactureRec extends CommonInvoice
$this->note_private = $obj->note_private; $this->note_private = $obj->note_private;
$this->note_public = $obj->note_public; $this->note_public = $obj->note_public;
$this->user_author = $obj->fk_user_author; $this->user_author = $obj->fk_user_author;
$this->modelpdf = $obj->model_pdf; // deprecatd $this->modelpdf = $obj->model_pdf; // deprecated
$this->model_pdf = $obj->model_pdf; $this->model_pdf = $obj->model_pdf;
$this->rang = $obj->rang; $this->rang = $obj->rang;
$this->special_code = $obj->special_code; $this->special_code = $obj->special_code;
@ -1280,9 +1280,8 @@ class FactureRec extends CommonInvoice
{ {
// We refresh the object in order to have all necessary data (like date_lim_reglement) // We refresh the object in order to have all necessary data (like date_lim_reglement)
$facture->fetch($facture->id); $facture->fetch($facture->id);
$result = $facture->generateDocument($facturerec->modelpdf, $langs); $result = $facture->generateDocument($facturerec->model_pdf, $langs);
if ($result <= 0) if ($result <= 0) {
{
$this->errors = $facture->errors; $this->errors = $facture->errors;
$this->error = $facture->error; $this->error = $facture->error;
$error++; $error++;
@ -1873,7 +1872,7 @@ class FactureRec extends CommonInvoice
dol_syslog(get_class($this)."::setModelPdf", LOG_DEBUG); dol_syslog(get_class($this)."::setModelPdf", LOG_DEBUG);
if ($this->db->query($sql)) if ($this->db->query($sql))
{ {
$this->modelpdf = $model; $this->model_pdf = $model;
return 1; return 1;
} else { } else {
dol_print_error($this->db); dol_print_error($this->db);

View File

@ -498,7 +498,7 @@ class Facture extends CommonInvoice
$this->fk_project = GETPOST('projectid', 'int') > 0 ? ((int) GETPOST('projectid', 'int')) : $_facrec->fk_project; $this->fk_project = GETPOST('projectid', 'int') > 0 ? ((int) GETPOST('projectid', 'int')) : $_facrec->fk_project;
$this->note_public = GETPOST('note_public', 'none') ? GETPOST('note_public', 'restricthtml') : $_facrec->note_public; $this->note_public = GETPOST('note_public', 'none') ? GETPOST('note_public', 'restricthtml') : $_facrec->note_public;
$this->note_private = GETPOST('note_private', 'none') ? GETPOST('note_private', 'restricthtml') : $_facrec->note_private; $this->note_private = GETPOST('note_private', 'none') ? GETPOST('note_private', 'restricthtml') : $_facrec->note_private;
$this->modelpdf = GETPOST('model', 'alpha') ? GETPOST('model', 'alpha') : $_facrec->modelpdf; $this->model_pdf = GETPOST('model', 'alpha') ? GETPOST('model', 'alpha') : $_facrec->model_pdf;
$this->cond_reglement_id = GETPOST('cond_reglement_id', 'int') > 0 ? ((int) GETPOST('cond_reglement_id', 'int')) : $_facrec->cond_reglement_id; $this->cond_reglement_id = GETPOST('cond_reglement_id', 'int') > 0 ? ((int) GETPOST('cond_reglement_id', 'int')) : $_facrec->cond_reglement_id;
$this->mode_reglement_id = GETPOST('mode_reglement_id', 'int') > 0 ? ((int) GETPOST('mode_reglement_id', 'int')) : $_facrec->mode_reglement_id; $this->mode_reglement_id = GETPOST('mode_reglement_id', 'int') > 0 ? ((int) GETPOST('mode_reglement_id', 'int')) : $_facrec->mode_reglement_id;
$this->fk_account = GETPOST('fk_account') > 0 ? ((int) GETPOST('fk_account')) : $_facrec->fk_account; $this->fk_account = GETPOST('fk_account') > 0 ? ((int) GETPOST('fk_account')) : $_facrec->fk_account;
@ -1062,8 +1062,8 @@ class Facture extends CommonInvoice
$facture->note_public = $this->note_public; $facture->note_public = $this->note_public;
$facture->note_private = $this->note_private; $facture->note_private = $this->note_private;
$facture->ref_client = $this->ref_client; $facture->ref_client = $this->ref_client;
$facture->modelpdf = $this->modelpdf; // deprecated $facture->modelpdf = $this->model_pdf; // deprecated
$facture->model_pdf = $this->modelpdf; $facture->model_pdf = $this->model_pdf;
$facture->fk_project = $this->fk_project; $facture->fk_project = $this->fk_project;
$facture->cond_reglement_id = $this->cond_reglement_id; $facture->cond_reglement_id = $this->cond_reglement_id;
$facture->mode_reglement_id = $this->mode_reglement_id; $facture->mode_reglement_id = $this->mode_reglement_id;
@ -2293,6 +2293,8 @@ class Facture extends CommonInvoice
* Tag the invoice as paid completely (if close_code is filled) => this->fk_statut=2, this->paye=1 * Tag the invoice as paid completely (if close_code is filled) => this->fk_statut=2, this->paye=1
* or partialy (if close_code filled) + appel trigger BILL_PAYED => this->fk_statut=2, this->paye stay 0 * or partialy (if close_code filled) + appel trigger BILL_PAYED => this->fk_statut=2, this->paye stay 0
* *
* @deprecated
* @see setPaid()
* @param User $user Object user that modify * @param User $user Object user that modify
* @param string $close_code Code renseigne si on classe a payee completement alors que paiement incomplet (cas escompte par exemple) * @param string $close_code Code renseigne si on classe a payee completement alors que paiement incomplet (cas escompte par exemple)
* @param string $close_note Commentaire renseigne si on classe a payee alors que paiement incomplet (cas escompte par exemple) * @param string $close_note Commentaire renseigne si on classe a payee alors que paiement incomplet (cas escompte par exemple)
@ -2301,6 +2303,21 @@ class Facture extends CommonInvoice
public function set_paid($user, $close_code = '', $close_note = '') public function set_paid($user, $close_code = '', $close_note = '')
{ {
// phpcs:enable // phpcs:enable
dol_syslog(get_class($this)."::set_paid is deprecated, use setPaid instead", LOG_NOTICE);
return $this->setPaid($user, $close_code, $close_note);
}
/**
* Tag the invoice as paid completely (if close_code is filled) => this->fk_statut=2, this->paye=1
* or partialy (if close_code filled) + appel trigger BILL_PAYED => this->fk_statut=2, this->paye stay 0
*
* @param User $user Object user that modify
* @param string $close_code Code renseigne si on classe a payee completement alors que paiement incomplet (cas escompte par exemple)
* @param string $close_note Commentaire renseigne si on classe a payee alors que paiement incomplet (cas escompte par exemple)
* @return int <0 if KO, >0 if OK
*/
public function setPaid($user, $close_code = '', $close_note = '')
{
$error = 0; $error = 0;
if ($this->paye != 1) if ($this->paye != 1)
@ -2352,12 +2369,28 @@ class Facture extends CommonInvoice
* Fonction utilisee quand un paiement prelevement est refuse, * Fonction utilisee quand un paiement prelevement est refuse,
* ou quand une facture annulee et reouverte. * ou quand une facture annulee et reouverte.
* *
* @deprecated
* @see setUnpaid()
* @param User $user Object user that change status * @param User $user Object user that change status
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
public function set_unpaid($user) public function set_unpaid($user)
{ {
// phpcs:enable // phpcs:enable
dol_syslog(get_class($this)."::set_unpaid is deprecated, use setUnpaid instead", LOG_NOTICE);
return $this->setUnpaid($user);
}
/**
* Tag la facture comme non payee completement + appel trigger BILL_UNPAYED
* Fonction utilisee quand un paiement prelevement est refuse,
* ou quand une facture annulee et reouverte.
*
* @param User $user Object user that change status
* @return int <0 if KO, >0 if OK
*/
public function setUnpaid($user)
{
$error = 0; $error = 0;
$this->db->begin(); $this->db->begin();
@ -2399,6 +2432,8 @@ class Facture extends CommonInvoice
* Warning, if option to decrease stock on invoice was set, this function does not change stock (it might be a cancel because * Warning, if option to decrease stock on invoice was set, this function does not change stock (it might be a cancel because
* of no payment even if merchandises were sent). * of no payment even if merchandises were sent).
* *
* @deprecated
* @see setCanceled()
* @param User $user Object user making change * @param User $user Object user making change
* @param string $close_code Code of closing invoice (CLOSECODE_REPLACED, CLOSECODE_...) * @param string $close_code Code of closing invoice (CLOSECODE_REPLACED, CLOSECODE_...)
* @param string $close_note Comment * @param string $close_note Comment
@ -2407,8 +2442,23 @@ class Facture extends CommonInvoice
public function set_canceled($user, $close_code = '', $close_note = '') public function set_canceled($user, $close_code = '', $close_note = '')
{ {
// phpcs:enable // phpcs:enable
dol_syslog(get_class($this)."::set_canceled is deprecated, use setCanceled instead", LOG_NOTICE);
return $this->setCanceled($user, $close_code, $close_note);
}
dol_syslog(get_class($this)."::set_canceled rowid=".$this->id, LOG_DEBUG); /**
* Tag invoice as canceled, with no payment on it (example for replacement invoice or payment never received) + call trigger BILL_CANCEL
* Warning, if option to decrease stock on invoice was set, this function does not change stock (it might be a cancel because
* of no payment even if merchandises were sent).
*
* @param User $user Object user making change
* @param string $close_code Code of closing invoice (CLOSECODE_REPLACED, CLOSECODE_...)
* @param string $close_note Comment
* @return int <0 if KO, >0 if OK
*/
public function setCanceled($user, $close_code = '', $close_note = '')
{
dol_syslog(get_class($this)."::setCanceled rowid=".$this->id, LOG_DEBUG);
$this->db->begin(); $this->db->begin();
@ -2542,7 +2592,7 @@ class Facture extends CommonInvoice
return -12; return -12;
} }
$result = $facreplaced->set_canceled($user, self::CLOSECODE_REPLACED, ''); $result = $facreplaced->setCanceled($user, self::CLOSECODE_REPLACED, '');
if ($result < 0) if ($result < 0)
{ {
$this->error = $facreplaced->error; $this->error = $facreplaced->error;
@ -3567,6 +3617,8 @@ class Facture extends CommonInvoice
/** /**
* Set percent discount * Set percent discount
* *
* @deprecated
* @see setDiscount()
* @param User $user User that set discount * @param User $user User that set discount
* @param double $remise Discount * @param double $remise Discount
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @param int $notrigger 1=Does not execute triggers, 0= execute triggers
@ -3575,6 +3627,20 @@ class Facture extends CommonInvoice
public function set_remise($user, $remise, $notrigger = 0) public function set_remise($user, $remise, $notrigger = 0)
{ {
// phpcs:enable // phpcs:enable
dol_syslog(get_class($this)."::set_remise is deprecated, use setDiscount instead", LOG_NOTICE);
return $this->setDiscount($user, $remise, $notrigger);
}
/**
* Set percent discount
*
* @param User $user User that set discount
* @param double $remise Discount
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int <0 if ko, >0 if ok
*/
public function setDiscount($user, $remise, $notrigger = 0)
{
// Clean parameters // Clean parameters
if (empty($remise)) $remise = 0; if (empty($remise)) $remise = 0;
@ -3732,7 +3798,7 @@ class Facture extends CommonInvoice
} }
if (!empty($addon)) { if (!empty($addon)) {
dol_syslog("Call getNextNumRef with ".$addonConstName." = ".$conf->global->FACTURE_ADDON.", thirdparty=".$soc->nom.", type=".$soc->typent_code, LOG_DEBUG); dol_syslog("Call getNextNumRef with ".$addonConstName." = ".$conf->global->FACTURE_ADDON.", thirdparty=".$soc->name.", type=".$soc->typent_code, LOG_DEBUG);
$mybool = false; $mybool = false;

View File

@ -119,7 +119,7 @@ if ($action == 'confirm_validate' && $confirm == 'yes' && $user->rights->facture
$outputlangs->setDefaultLang($_REQUEST['lang_id']); $outputlangs->setDefaultLang($_REQUEST['lang_id']);
} }
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
$fac->generateDocument($fac->modelpdf, $outputlangs); $fac->generateDocument($fac->model_pdf, $outputlangs);
} }
} }

View File

@ -788,7 +788,7 @@ class RemiseCheque extends CommonObject
{ {
$invoice = new Facture($this->db); $invoice = new Facture($this->db);
$invoice->fetch($obj->fk_facture); $invoice->fetch($obj->fk_facture);
$invoice->set_unpaid($user); $invoice->setUnpaid($user);
$rejectedPayment->amounts[$obj->fk_facture] = price2num($obj->amount) * -1; $rejectedPayment->amounts[$obj->fk_facture] = price2num($obj->amount) * -1;
} }

View File

@ -398,7 +398,7 @@ class Paiement extends CommonObject
// Set invoice to paid // Set invoice to paid
if (!$error) if (!$error)
{ {
$result = $invoice->set_paid($user, '', ''); $result = $invoice->setPaid($user, '', '');
if ($result < 0) if ($result < 0)
{ {
$this->error = $invoice->error; $this->error = $invoice->error;
@ -425,7 +425,7 @@ class Paiement extends CommonObject
$outputlangs->setDefaultLang($newlang); $outputlangs->setDefaultLang($newlang);
} }
$ret = $invoice->fetch($facid); // Reload to get new records $ret = $invoice->fetch($facid); // Reload to get new records
$result = $invoice->generateDocument($invoice->modelpdf, $outputlangs); $result = $invoice->generateDocument($invoice->model_pdf, $outputlangs);
if ($result < 0) { if ($result < 0) {
setEventMessages($invoice->error, $invoice->errors, 'errors'); setEventMessages($invoice->error, $invoice->errors, 'errors');
$error++; $error++;

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2016-2018 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2016-2021 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr> * Copyright (C) 2021 Gauthier VERDOL <gauthier.verdol@atm-consulting.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -111,11 +111,10 @@ if ($action == 'add_payment' || ($action == 'confirm_paiement' && $confirm == 'y
$paiement->amounts = $amounts; // Tableau de montant $paiement->amounts = $amounts; // Tableau de montant
$paiement->paiementtype = GETPOST("paiementtype", 'alphanohtml'); $paiement->paiementtype = GETPOST("paiementtype", 'alphanohtml');
$paiement->num_payment = GETPOST("num_payment", 'alphanohtml'); $paiement->num_payment = GETPOST("num_payment", 'alphanohtml');
$paiement->note = GETPOST("note", 'restricthtml'); $paiement->note = (string) GETPOST("note", 'restricthtml');
$paiement->note_private = GETPOST("note", 'restricthtml'); $paiement->note_private = (string) GETPOST("note", 'restricthtml');
if (!$error) if (!$error) {
{
$paymentid = $paiement->create($user, (GETPOST('closepaidvat') == 'on' ? 1 : 0)); $paymentid = $paiement->create($user, (GETPOST('closepaidvat') == 'on' ? 1 : 0));
if ($paymentid < 0) if ($paymentid < 0)
{ {
@ -193,7 +192,7 @@ if ($action == 'create')
print '<input type="hidden" name="chid" value="'.$chid.'">'; print '<input type="hidden" name="chid" value="'.$chid.'">';
print '<input type="hidden" name="action" value="add_payment">'; print '<input type="hidden" name="action" value="add_payment">';
dol_fiche_head('', ''); print dol_get_fiche_head('', '');
print '<table class="border centpercent">'; print '<table class="border centpercent">';
@ -208,8 +207,7 @@ if ($action == 'create')
$sql .= " FROM ".MAIN_DB_PREFIX."payment_vat as p"; $sql .= " FROM ".MAIN_DB_PREFIX."payment_vat as p";
$sql .= " WHERE p.fk_tva = ".$chid; $sql .= " WHERE p.fk_tva = ".$chid;
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql) {
{
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
$sumpaid = $obj->total; $sumpaid = $obj->total;
$db->free(); $db->free();
@ -248,7 +246,7 @@ if ($action == 'create')
print '</table>'; print '</table>';
dol_fiche_end(); print dol_get_fiche_end();
/* /*
* Autres charges impayees * Autres charges impayees
@ -314,8 +312,7 @@ if ($action == 'create')
$totalrecu += $objp->am; $totalrecu += $objp->am;
$i++; $i++;
} }
if ($i > 1) if ($i > 1) {
{
// Print total // Print total
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td colspan="2" class="left">'.$langs->trans("Total").':</td>'; print '<td colspan="2" class="left">'.$langs->trans("Total").':</td>';

View File

@ -138,13 +138,12 @@ $h++;
*/ */
dol_fiche_head($head, $hselected, $langs->trans("VATPayment"), -1, 'payment'); print dol_get_fiche_head($head, $hselected, $langs->trans("VATPayment"), -1, 'payment');
/* /*
* Deletion confirmation of payment * Deletion confirmation of payment
*/ */
if ($action == 'delete') if ($action == 'delete') {
{
print $form->formconfirm('card.php?id='.$object->id, $langs->trans("DeletePayment"), $langs->trans("ConfirmDeletePayment"), 'confirm_delete', '', 0, 2); print $form->formconfirm('card.php?id='.$object->id, $langs->trans("DeletePayment"), $langs->trans("ConfirmDeletePayment"), 'confirm_delete', '', 0, 2);
} }
@ -213,7 +212,7 @@ print '</table>';
print '</div>'; print '</div>';
dol_fiche_end(); print dol_get_fiche_end();
/* /*

View File

@ -375,7 +375,7 @@ class BonPrelevement extends CommonObject
dol_syslog(get_class($this)."::set_credite set_paid fac ".$facs[$i]); dol_syslog(get_class($this)."::set_credite set_paid fac ".$facs[$i]);
$fac = new Facture($this->db); $fac = new Facture($this->db);
$fac->fetch($facs[$i]); $fac->fetch($facs[$i]);
$result = $fac->set_paid($user); $result = $fac->setPaid($user);
} }
} }
@ -482,7 +482,7 @@ class BonPrelevement extends CommonObject
// @TODO Move this after creation of payment // @TODO Move this after creation of payment
if (price2num($alreadypayed + $facs[$i][1], 'MT') == $fac->total_ttc) { if (price2num($alreadypayed + $facs[$i][1], 'MT') == $fac->total_ttc) {
$result = $fac->set_paid($user); $result = $fac->setPaid($user);
if ($result < 0) { if ($result < 0) {
$this->error = $fac->error; $this->error = $fac->error;
$this->errors = $fac->errors; $this->errors = $fac->errors;

View File

@ -184,7 +184,7 @@ class RejetPrelevement
//Tag invoice as unpaid //Tag invoice as unpaid
dol_syslog("RejetPrelevement::Create set_unpaid fac ".$fac->ref); dol_syslog("RejetPrelevement::Create set_unpaid fac ".$fac->ref);
$fac->set_unpaid($user); $fac->setUnpaid($user);
//TODO: Must be managed by notifications module //TODO: Must be managed by notifications module
// Send email to sender of the standing order request // Send email to sender of the standing order request

View File

@ -74,14 +74,14 @@ $object = new ChargeSociales($db);
if ($action == 'confirm_paid' && $user->rights->tax->charges->creer && $confirm == 'yes') if ($action == 'confirm_paid' && $user->rights->tax->charges->creer && $confirm == 'yes')
{ {
$object->fetch($id); $object->fetch($id);
$result = $object->set_paid($user); $result = $object->setPaid($user);
} }
if ($action == 'reopen' && $user->rights->tax->charges->creer) { if ($action == 'reopen' && $user->rights->tax->charges->creer) {
$result = $object->fetch($id); $result = $object->fetch($id);
if ($object->paye) if ($object->paye)
{ {
$result = $object->set_unpaid($user); $result = $object->setUnpaid($user);
if ($result > 0) if ($result > 0)
{ {
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id); header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id);

View File

@ -432,12 +432,26 @@ class ChargeSociales extends CommonObject
/** /**
* Tag social contribution as paid completely * Tag social contribution as paid completely
* *
* @deprecated
* @see setPaid()
* @param User $user Object user making change * @param User $user Object user making change
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
public function set_paid($user) public function set_paid($user)
{ {
// phpcs:enable // phpcs:enable
dol_syslog(get_class($this)."::set_paid is deprecated, use setPaid instead", LOG_NOTICE);
return $this->setPaid($user);
}
/**
* Tag social contribution as paid completely
*
* @param User $user Object user making change
* @return int <0 if KO, >0 if OK
*/
public function setPaid($user)
{
$sql = "UPDATE ".MAIN_DB_PREFIX."chargesociales SET"; $sql = "UPDATE ".MAIN_DB_PREFIX."chargesociales SET";
$sql .= " paye = 1"; $sql .= " paye = 1";
$sql .= " WHERE rowid = ".$this->id; $sql .= " WHERE rowid = ".$this->id;
@ -450,12 +464,26 @@ class ChargeSociales extends CommonObject
/** /**
* Remove tag paid on social contribution * Remove tag paid on social contribution
* *
* @deprecated
* @see setUnpaid()
* @param User $user Object user making change * @param User $user Object user making change
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
public function set_unpaid($user) public function set_unpaid($user)
{ {
// phpcs:enable // phpcs:enable
dol_syslog(get_class($this)."::set_unpaid is deprecated, use setUnpaid instead", LOG_NOTICE);
return $this->setUnpaid($user);
}
/**
* Remove tag paid on social contribution
*
* @param User $user Object user making change
* @return int <0 if KO, >0 if OK
*/
public function setUnpaid($user)
{
$sql = "UPDATE ".MAIN_DB_PREFIX."chargesociales SET"; $sql = "UPDATE ".MAIN_DB_PREFIX."chargesociales SET";
$sql .= " paye = 0"; $sql .= " paye = 0";
$sql .= " WHERE rowid = ".$this->id; $sql .= " WHERE rowid = ".$this->id;

View File

@ -197,7 +197,7 @@ class PaymentSocialContribution extends CommonObject
$remaintopay = price2num($contrib->amount - $paiement - $creditnotes - $deposits, 'MT'); $remaintopay = price2num($contrib->amount - $paiement - $creditnotes - $deposits, 'MT');
if ($remaintopay == 0) if ($remaintopay == 0)
{ {
$result = $contrib->set_paid($user); $result = $contrib->setPaid($user);
} else dol_syslog("Remain to pay for conrib ".$contribid." not null. We do nothing."); } else dol_syslog("Remain to pay for conrib ".$contribid." not null. We do nothing.");
} }
} }

View File

@ -111,14 +111,14 @@ if ($action == 'setbankaccount' && $user->rights->tax->charges->creer) {
if ($action == 'confirm_paid' && $user->rights->tax->charges->creer && $confirm == 'yes') if ($action == 'confirm_paid' && $user->rights->tax->charges->creer && $confirm == 'yes')
{ {
$object->fetch($id); $object->fetch($id);
$result = $object->set_paid($user); $result = $object->setPaid($user);
} }
if ($action == 'reopen' && $user->rights->tax->charges->creer) { if ($action == 'reopen' && $user->rights->tax->charges->creer) {
$result = $object->fetch($id); $result = $object->fetch($id);
if ($object->paye) if ($object->paye)
{ {
$result = $object->set_unpaid($user); $result = $object->setUnpaid($user);
if ($result > 0) if ($result > 0)
{ {
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id); header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id);

View File

@ -194,7 +194,7 @@ class PaymentVAT extends CommonObject
$remaintopay = price2num($contrib->amount - $paiement - $creditnotes - $deposits, 'MT'); $remaintopay = price2num($contrib->amount - $paiement - $creditnotes - $deposits, 'MT');
if ($remaintopay == 0) if ($remaintopay == 0)
{ {
$result = $contrib->set_paid($user); $result = $contrib->setPaid($user);
} }
else dol_syslog("Remain to pay for conrib ".$contribid." not null. We do nothing."); else dol_syslog("Remain to pay for conrib ".$contribid." not null. We do nothing.");
} }
@ -480,7 +480,7 @@ class PaymentVAT extends CommonObject
{ {
$this->id = 0; $this->id = 0;
$this->fk_tva = ''; $this->fk_tva = 0;
$this->datec = ''; $this->datec = '';
$this->tms = ''; $this->tms = '';
$this->datep = ''; $this->datep = '';
@ -489,9 +489,9 @@ class PaymentVAT extends CommonObject
$this->num_payment = ''; $this->num_payment = '';
$this->note_private = ''; $this->note_private = '';
$this->note_public = ''; $this->note_public = '';
$this->fk_bank = ''; $this->fk_bank = 0;
$this->fk_user_creat = ''; $this->fk_user_creat = 0;
$this->fk_user_modif = ''; $this->fk_user_modif = 0;
} }

View File

@ -246,14 +246,14 @@ class Tva extends CommonObject
* @param User $user Object user making change * @param User $user Object user making change
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
public function set_paid($user) public function setPaid($user)
{ {
// phpcs:enable // phpcs:enable
$sql = "UPDATE ".MAIN_DB_PREFIX."tva SET"; $sql = "UPDATE ".MAIN_DB_PREFIX."tva SET";
$sql .= " paye = 1"; $sql .= " paye = 1";
$sql .= " WHERE rowid = ".$this->id; $sql .= " WHERE rowid = ".$this->id;
$return = $this->db->query($sql); $resql = $this->db->query($sql);
if ($return) return 1; if ($resql) return 1;
else return -1; else return -1;
} }
@ -263,14 +263,14 @@ class Tva extends CommonObject
* @param User $user Object user making change * @param User $user Object user making change
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
public function set_unpaid($user) public function setUnpaid($user)
{ {
// phpcs:enable // phpcs:enable
$sql = "UPDATE ".MAIN_DB_PREFIX."tva SET"; $sql = "UPDATE ".MAIN_DB_PREFIX."tva SET";
$sql .= " paye = 0"; $sql .= " paye = 0";
$sql .= " WHERE rowid = ".$this->id; $sql .= " WHERE rowid = ".$this->id;
$return = $this->db->query($sql); $resql = $this->db->query($sql);
if ($return) return 1; if ($resql) return 1;
else return -1; else return -1;
} }

View File

@ -304,7 +304,7 @@ if (!$error && $massaction == 'confirm_presend')
if ($_POST['addmaindocfile']) if ($_POST['addmaindocfile'])
{ {
// TODO Use future field $objectobj->fullpathdoc to know where is stored default file // TODO Use future field $objectobj->fullpathdoc to know where is stored default file
// TODO If not defined, use $objectobj->modelpdf (or defaut invoice config) to know what is template to use to regenerate doc. // TODO If not defined, use $objectobj->model_pdf (or defaut invoice config) to know what is template to use to regenerate doc.
$filename = dol_sanitizeFileName($objectobj->ref).'.pdf'; $filename = dol_sanitizeFileName($objectobj->ref).'.pdf';
$subdir = ''; $subdir = '';
// TODO Set subdir to be compatible with multi levels dir trees // TODO Set subdir to be compatible with multi levels dir trees
@ -1281,7 +1281,7 @@ if (!$error && $massaction == 'generate_doc' && $permissiontoread)
if (empty($hideref)) $hideref = 0; if (empty($hideref)) $hideref = 0;
if (empty($moreparams)) $moreparams = null; if (empty($moreparams)) $moreparams = null;
$result = $objecttmp->generateDocument($objecttmp->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams); $result = $objecttmp->generateDocument($objecttmp->model_pdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams);
if ($result <= 0) if ($result <= 0)
{ {

View File

@ -55,6 +55,11 @@ abstract class CommonDocGenerator
*/ */
public $extrafieldsCache; public $extrafieldsCache;
/**
* @var int If set to 1, save the fullname of generated file with path as the main doc when generating a doc with this template.
*/
public $update_main_doc_field;
/** /**
* Constructor * Constructor
* *

View File

@ -355,6 +355,13 @@ abstract class CommonObject
*/ */
public $model_pdf; public $model_pdf;
/**
* @var string
* @deprecated
* @see model_pdf
*/
public $modelpdf;
/** /**
* @var string * @var string
* Contains relative path of last generated main file * Contains relative path of last generated main file

View File

@ -757,30 +757,36 @@ class FormCompany extends Form
* @param string $sortorder Sort criteria ('position', 'code', ...) * @param string $sortorder Sort criteria ('position', 'code', ...)
* @param int $showempty 1=Add en empty line * @param int $showempty 1=Add en empty line
* @param string $morecss Add more css to select component * @param string $morecss Add more css to select component
* @param int $output 0=return HTML, 1= direct print
* @return void * @return void
*/ */
public function selectTypeContact($object, $selected, $htmlname = 'type', $source = 'internal', $sortorder = 'position', $showempty = 0, $morecss = '') public function selectTypeContact($object, $selected, $htmlname = 'type', $source = 'internal', $sortorder = 'position', $showempty = 0, $morecss = '', $output = 1)
{ {
global $user, $langs; global $user, $langs;
$out = '';
if (is_object($object) && method_exists($object, 'liste_type_contact')) if (is_object($object) && method_exists($object, 'liste_type_contact'))
{ {
$lesTypes = $object->liste_type_contact($source, $sortorder, 0, 1); $lesTypes = $object->liste_type_contact($source, $sortorder, 0, 1);
print '<select class="flat valignmiddle'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">'; $out .= '<select class="flat valignmiddle'.($morecss ? ' '.$morecss : '').'" name="'.$htmlname.'" id="'.$htmlname.'">';
if ($showempty) print '<option value="0"></option>'; if ($showempty) $out .= '<option value="0"></option>';
foreach ($lesTypes as $key=>$value) foreach ($lesTypes as $key=>$value)
{ {
print '<option value="'.$key.'"'; $out .= '<option value="'.$key.'"';
if ($key == $selected) print ' selected'; if ($key == $selected) $out .= ' selected';
print '>'.$value.'</option>'; $out .= '>'.$value.'</option>';
} }
print "</select>"; $out .= "</select>";
if ($user->admin) print ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); if ($user->admin) $out .= ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
print ajax_combobox($htmlname); $out .= ajax_combobox($htmlname);
print "\n"; $out .= "\n";
}
if (empty($output)) {
return $out;
} else {
print $out;
} }
} }

View File

@ -175,7 +175,7 @@ function rebuild_merge_pdf($db, $langs, $conf, $diroutputpdf, $newlangid, $filte
if ($regenerate || !dol_is_file($filename)) if ($regenerate || !dol_is_file($filename))
{ {
if ($usestdout) print "Build PDF for invoice ".$obj->ref." - Lang = ".$outputlangs->defaultlang."\n"; if ($usestdout) print "Build PDF for invoice ".$obj->ref." - Lang = ".$outputlangs->defaultlang."\n";
$result = $fac->generateDocument($regenerate ? $regenerate : $fac->modelpdf, $outputlangs); $result = $fac->generateDocument($regenerate ? $regenerate : $fac->model_pdf, $outputlangs);
} else { } else {
if ($usestdout) print "PDF for invoice ".$obj->ref." already exists\n"; if ($usestdout) print "PDF for invoice ".$obj->ref." already exists\n";
} }

View File

@ -133,6 +133,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
$this->db = $db; $this->db = $db;
$this->name = "canelle"; $this->name = "canelle";
$this->description = $langs->trans('SuppliersInvoiceModel'); $this->description = $langs->trans('SuppliersInvoiceModel');
$this->update_main_doc_field = 1; // Save the name of generated file as the main doc when generating a doc with this template
// Page dimensions // Page dimensions
$this->type = 'pdf'; $this->type = 'pdf';

View File

@ -56,6 +56,11 @@ class pdf_cornas extends ModelePDFSuppliersOrders
*/ */
public $description; public $description;
/**
* @var int Save the name of generated file as the main doc when generating a doc with this template
*/
public $update_main_doc_field;
/** /**
* @var string document type * @var string document type
*/ */
@ -130,6 +135,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders
$this->db = $db; $this->db = $db;
$this->name = "cornas"; $this->name = "cornas";
$this->description = $langs->trans('SuppliersCommandModel'); $this->description = $langs->trans('SuppliersCommandModel');
$this->update_main_doc_field = 1; // Save the name of generated file as the main doc when generating a doc with this template
// Page size for A4 format // Page size for A4 format
$this->type = 'pdf'; $this->type = 'pdf';

View File

@ -56,6 +56,11 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
*/ */
public $description; public $description;
/**
* @var int Save the name of generated file as the main doc when generating a doc with this template
*/
public $update_main_doc_field;
/** /**
* @var string document type * @var string document type
*/ */
@ -130,6 +135,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
$this->db = $db; $this->db = $db;
$this->name = "muscadet"; $this->name = "muscadet";
$this->description = $langs->trans('SuppliersCommandModelMuscadet'); $this->description = $langs->trans('SuppliersCommandModelMuscadet');
$this->update_main_doc_field = 1; // Save the name of generated file as the main doc when generating a doc with this template
// Page size for A4 format // Page size for A4 format
$this->type = 'pdf'; $this->type = 'pdf';

View File

@ -53,6 +53,11 @@ class pdf_standard extends ModelePDFSuppliersPayments
*/ */
public $description; public $description;
/**
* @var int Save the name of generated file as the main doc when generating a doc with this template
*/
public $update_main_doc_field;
/** /**
* @var string document type * @var string document type
*/ */
@ -127,6 +132,7 @@ class pdf_standard extends ModelePDFSuppliersPayments
$this->db = $db; $this->db = $db;
$this->name = "standard"; $this->name = "standard";
$this->description = $langs->trans('DocumentModelStandardPDF'); $this->description = $langs->trans('DocumentModelStandardPDF');
$this->update_main_doc_field = 1; // Save the name of generated file as the main doc when generating a doc with this template
// Page size for A4 format // Page size for A4 format
$this->type = 'pdf'; $this->type = 'pdf';

View File

@ -53,6 +53,11 @@ class pdf_aurore extends ModelePDFSupplierProposal
*/ */
public $description; public $description;
/**
* @var int Save the name of generated file as the main doc when generating a doc with this template
*/
public $update_main_doc_field;
/** /**
* @var string document type * @var string document type
*/ */
@ -127,6 +132,7 @@ class pdf_aurore extends ModelePDFSupplierProposal
$this->db = $db; $this->db = $db;
$this->name = "aurore"; $this->name = "aurore";
$this->description = $langs->trans('DocModelAuroreDescription'); $this->description = $langs->trans('DocModelAuroreDescription');
$this->update_main_doc_field = 1; // Save the name of generated file as the main doc when generating a doc with this template
// Page size for A4 format // Page size for A4 format
$this->type = 'pdf'; $this->type = 'pdf';

View File

@ -705,6 +705,13 @@ if (!empty($usemargins) && $user->rights->margins->creer)
} ?> } ?>
<?php <?php
} ?> } ?>
<?php
if (!empty($conf->global->PRODUCT_LOAD_EXTRAFIELD_INTO_OBJECTLINES)) { ?>
jQuery.each(data.array_options, function( key, value ) {
jQuery('div[class$="det'+key.replace('options_','_extras_')+'"] > #'+key).val(value);
});
<?php
}?>
}, },
'json' 'json'
); );

View File

@ -307,7 +307,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers
dol_syslog("Amount of linked proposals = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht), LOG_DEBUG); dol_syslog("Amount of linked proposals = ".$totalonlinkedelements.", of invoice = ".$object->total_ht.", egality is ".($totalonlinkedelements == $object->total_ht), LOG_DEBUG);
if ($totalonlinkedelements == $object->total_ht) { if ($totalonlinkedelements == $object->total_ht) {
foreach ($object->linkedObjects['reception'] as $element) { foreach ($object->linkedObjects['reception'] as $element) {
$ret = $element->set_billed(); $ret = $element->setBilled();
} }
} }
} }

View File

@ -255,7 +255,7 @@ if ($action == 'set_cancel') {
} }
if ($action == 'set_paid') { if ($action == 'set_paid') {
$object->fetch($id); $object->fetch($id);
if ($object->set_paid($id, $modepayment) >= 0) { if ($object->setPaid($id, $modepayment) >= 0) {
$action = ''; $action = '';
} else { } else {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');

View File

@ -761,6 +761,8 @@ class Don extends CommonObject
/** /**
* Classify the donation as paid, the donation was received * Classify the donation as paid, the donation was received
* *
* @deprecated
* @see setPaid()
* @param int $id id of donation * @param int $id id of donation
* @param int $modepayment mode of payment * @param int $modepayment mode of payment
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
@ -768,6 +770,19 @@ class Don extends CommonObject
public function set_paid($id, $modepayment = 0) public function set_paid($id, $modepayment = 0)
{ {
// phpcs:enable // phpcs:enable
dol_syslog(get_class($this)."::set_paid is deprecated, use setPaid instead", LOG_NOTICE);
return $this->setPaid($id, $modepayment);
}
/**
* Classify the donation as paid, the donation was received
*
* @param int $id id of donation
* @param int $modepayment mode of payment
* @return int <0 if KO, >0 if OK
*/
public function setPaid($id, $modepayment = 0)
{
$sql = "UPDATE ".MAIN_DB_PREFIX."don SET fk_statut = 2"; $sql = "UPDATE ".MAIN_DB_PREFIX."don SET fk_statut = 2";
if ($modepayment) if ($modepayment)
{ {

View File

@ -523,7 +523,7 @@ if (empty($reshook))
} elseif ($action == 'classifybilled') } elseif ($action == 'classifybilled')
{ {
$object->fetch($id); $object->fetch($id);
$result = $object->set_billed(); $result = $object->setBilled();
if ($result >= 0) { if ($result >= 0) {
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
exit(); exit();

View File

@ -581,7 +581,7 @@ class Expedition extends CommonObject
$this->date_delivery = $this->db->jdate($obj->date_delivery); // Date planed $this->date_delivery = $this->db->jdate($obj->date_delivery); // Date planed
$this->fk_delivery_address = $obj->fk_address; $this->fk_delivery_address = $obj->fk_address;
$this->model_pdf = $obj->model_pdf; $this->model_pdf = $obj->model_pdf;
$this->modelpdf = $obj->model_pdf; $this->modelpdf = $obj->model_pdf; // deprecated
$this->shipping_method_id = $obj->fk_shipping_method; $this->shipping_method_id = $obj->fk_shipping_method;
$this->shipping_method = $obj->shipping_method; $this->shipping_method = $obj->shipping_method;
$this->tracking_number = $obj->tracking_number; $this->tracking_number = $obj->tracking_number;
@ -1116,7 +1116,7 @@ class Expedition extends CommonObject
$sql .= " weight=".(($this->trueWeight != '') ? $this->trueWeight : "null").","; $sql .= " weight=".(($this->trueWeight != '') ? $this->trueWeight : "null").",";
$sql .= " note_private=".(isset($this->note_private) ? "'".$this->db->escape($this->note_private)."'" : "null").","; $sql .= " note_private=".(isset($this->note_private) ? "'".$this->db->escape($this->note_private)."'" : "null").",";
$sql .= " note_public=".(isset($this->note_public) ? "'".$this->db->escape($this->note_public)."'" : "null").","; $sql .= " note_public=".(isset($this->note_public) ? "'".$this->db->escape($this->note_public)."'" : "null").",";
$sql .= " model_pdf=".(isset($this->modelpdf) ? "'".$this->db->escape($this->modelpdf)."'" : "null").","; $sql .= " model_pdf=".(isset($this->model_pdf) ? "'".$this->db->escape($this->model_pdf)."'" : "null").",";
$sql .= " entity=".$conf->entity; $sql .= " entity=".$conf->entity;
$sql .= " WHERE rowid=".$this->id; $sql .= " WHERE rowid=".$this->id;
@ -2307,11 +2307,24 @@ class Expedition extends CommonObject
/** /**
* Classify the shipping as invoiced (used when WORKFLOW_BILL_ON_SHIPMENT is on) * Classify the shipping as invoiced (used when WORKFLOW_BILL_ON_SHIPMENT is on)
* *
* @deprecated
* @see setBilled()
* @return int <0 if ko, >0 if ok * @return int <0 if ko, >0 if ok
*/ */
public function set_billed() public function set_billed()
{ {
// phpcs:enable // phpcs:enable
dol_syslog(get_class($this)."::set_billed is deprecated, use setBilled instead", LOG_NOTICE);
return $this->setBilled();
}
/**
* Classify the shipping as invoiced (used when WORKFLOW_BILL_ON_SHIPMENT is on)
*
* @return int <0 if ko, >0 if ok
*/
public function setBilled()
{
global $user; global $user;
$error = 0; $error = 0;

View File

@ -953,7 +953,7 @@ if (empty($reshook))
$object = new ExpenseReport($db); $object = new ExpenseReport($db);
$object->fetch($id); $object->fetch($id);
$result = $object->set_unpaid($user); $result = $object->setUnpaid($user);
if ($result > 0) if ($result > 0)
{ {
@ -981,7 +981,7 @@ if (empty($reshook))
$object = new ExpenseReport($db); $object = new ExpenseReport($db);
$object->fetch($id); $object->fetch($id);
$result = $object->set_paid($id, $user); $result = $object->setPaid($id, $user);
if ($result > 0) if ($result > 0)
{ {

View File

@ -637,6 +637,8 @@ class ExpenseReport extends CommonObject
/** /**
* Classify the expense report as paid * Classify the expense report as paid
* *
* @deprecated
* @see setPaid()
* @param int $id Id of expense report * @param int $id Id of expense report
* @param user $fuser User making change * @param user $fuser User making change
* @param int $notrigger Disable triggers * @param int $notrigger Disable triggers
@ -645,6 +647,20 @@ class ExpenseReport extends CommonObject
public function set_paid($id, $fuser, $notrigger = 0) public function set_paid($id, $fuser, $notrigger = 0)
{ {
// phpcs:enable // phpcs:enable
dol_syslog(get_class($this)."::set_paid is deprecated, use setPaid instead", LOG_NOTICE);
return $this->setPaid($id, $fuser, $notrigger);
}
/**
* Classify the expense report as paid
*
* @param int $id Id of expense report
* @param user $fuser User making change
* @param int $notrigger Disable triggers
* @return int <0 if KO, >0 if OK
*/
public function setPaid($id, $fuser, $notrigger = 0)
{
$error = 0; $error = 0;
$this->db->begin(); $this->db->begin();
@ -1492,6 +1508,8 @@ class ExpenseReport extends CommonObject
/** /**
* set_unpaid * set_unpaid
* *
* @deprecated
* @see setUnpaid()
* @param User $fuser User * @param User $fuser User
* @param int $notrigger Disable triggers * @param int $notrigger Disable triggers
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
@ -1499,6 +1517,19 @@ class ExpenseReport extends CommonObject
public function set_unpaid($fuser, $notrigger = 0) public function set_unpaid($fuser, $notrigger = 0)
{ {
// phpcs:enable // phpcs:enable
dol_syslog(get_class($this)."::set_unpaid is deprecated, use setUnpaid instead", LOG_NOTICE);
return $this->setUnpaid($fuser, $notrigger);
}
/**
* set_unpaid
*
* @param User $fuser User
* @param int $notrigger Disable triggers
* @return int <0 if KO, >0 if OK
*/
public function setUnpaid($fuser, $notrigger = 0)
{
$error = 0; $error = 0;
if ($this->paid) if ($this->paid)

View File

@ -144,7 +144,7 @@ if ($action == 'add_payment')
if (!$error) { if (!$error) {
$payment->fetch($paymentid); $payment->fetch($paymentid);
if ($expensereport->total_ttc - $payment->amount == 0) { if ($expensereport->total_ttc - $payment->amount == 0) {
$result = $expensereport->set_paid($expensereport->id, $user); $result = $expensereport->setPaid($expensereport->id, $user);
if (!$result > 0) { if (!$result > 0) {
setEventMessages($payment->error, $payment->errors, 'errors'); setEventMessages($payment->error, $payment->errors, 'errors');
$error++; $error++;

View File

@ -200,6 +200,7 @@ if (empty($reshook))
$mesg = $object->error; $mesg = $object->error;
} }
} elseif ($action == 'add' && $user->rights->ficheinter->creer) { } elseif ($action == 'add' && $user->rights->ficheinter->creer) {
$selectedLines = GETPOST('toselect', 'array');
$object->socid = $socid; $object->socid = $socid;
$object->duration = (int) GETPOST('duration', 'int'); $object->duration = (int) GETPOST('duration', 'int');
$object->fk_project = (int) GETPOST('projectid', 'int'); $object->fk_project = (int) GETPOST('projectid', 'int');
@ -284,6 +285,8 @@ if (empty($reshook))
for ($i = 0; $i < $num; $i++) for ($i = 0; $i < $num; $i++)
{ {
if (!in_array($lines[$i]->id, $selectedLines)) continue; // Skip unselected lines
$product_type = ($lines[$i]->product_type ? $lines[$i]->product_type : Product::TYPE_PRODUCT); $product_type = ($lines[$i]->product_type ? $lines[$i]->product_type : Product::TYPE_PRODUCT);
if ($product_type == Product::TYPE_SERVICE || !empty($conf->global->FICHINTER_PRINT_PRODUCTS)) { //only services except if config includes products if ($product_type == Product::TYPE_SERVICE || !empty($conf->global->FICHINTER_PRINT_PRODUCTS)) { //only services except if config includes products
@ -1023,8 +1026,6 @@ if ($action == 'create')
print '<input type="button" class="button button-cancel" value="'.$langs->trans("Cancel").'" onClick="javascript:history.go(-1)">'; print '<input type="button" class="button button-cancel" value="'.$langs->trans("Cancel").'" onClick="javascript:history.go(-1)">';
print '</div>'; print '</div>';
print '</form>';
// Show origin lines // Show origin lines
if (!empty($origin) && !empty($originid) && is_object($objectsrc)) { if (!empty($origin) && !empty($originid) && is_object($objectsrc)) {
$title = $langs->trans('Services'); $title = $langs->trans('Services');
@ -1036,6 +1037,8 @@ if ($action == 'create')
print '</table>'; print '</table>';
} }
print '</form>';
} else { } else {
print '<form name="fichinter" action="'.$_SERVER['PHP_SELF'].'" method="POST">'; print '<form name="fichinter" action="'.$_SERVER['PHP_SELF'].'" method="POST">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';

View File

@ -1250,6 +1250,8 @@ class FactureFournisseur extends CommonInvoice
/** /**
* Tag invoice as a paid invoice * Tag invoice as a paid invoice
* *
* @deprecated
* @see setPaid()
* @param User $user Object user * @param User $user Object user
* @param string $close_code Code indicates whether the class has paid in full while payment is incomplete. Not implementd yet. * @param string $close_code Code indicates whether the class has paid in full while payment is incomplete. Not implementd yet.
* @param string $close_note Comment informs if the class has been paid while payment is incomplete. Not implementd yet. * @param string $close_note Comment informs if the class has been paid while payment is incomplete. Not implementd yet.
@ -1258,6 +1260,20 @@ class FactureFournisseur extends CommonInvoice
public function set_paid($user, $close_code = '', $close_note = '') public function set_paid($user, $close_code = '', $close_note = '')
{ {
// phpcs:enable // phpcs:enable
dol_syslog(get_class($this)."::set_paid is deprecated, use setPaid instead", LOG_NOTICE);
return $this->setPaid($user, $close_code, $close_note);
}
/**
* Tag invoice as a paid invoice
*
* @param User $user Object user
* @param string $close_code Code indicates whether the class has paid in full while payment is incomplete. Not implementd yet.
* @param string $close_note Comment informs if the class has been paid while payment is incomplete. Not implementd yet.
* @return int <0 si ko, >0 si ok
*/
public function setPaid($user, $close_code = '', $close_note = '')
{
global $conf, $langs; global $conf, $langs;
$error = 0; $error = 0;
@ -1291,8 +1307,24 @@ class FactureFournisseur extends CommonInvoice
} }
} }
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Tag the invoice as not fully paid + trigger call BILL_UNPAYED
* Function used when a direct debit payment is refused,
* or when the invoice was canceled and reopened.
*
* @deprecated
* @see setUnpaid()
* @param User $user Object user that change status
* @return int <0 si ok, >0 si ok
*/
public function set_unpaid($user)
{
// phpcs:enable
dol_syslog(get_class($this)."::set_unpaid is deprecated, use setUnpaid instead", LOG_NOTICE);
return $this->setUnpaid($user);
}
/** /**
* Tag the invoice as not fully paid + trigger call BILL_UNPAYED * Tag the invoice as not fully paid + trigger call BILL_UNPAYED
* Function used when a direct debit payment is refused, * Function used when a direct debit payment is refused,
@ -1301,9 +1333,8 @@ class FactureFournisseur extends CommonInvoice
* @param User $user Object user that change status * @param User $user Object user that change status
* @return int <0 si ok, >0 si ok * @return int <0 si ok, >0 si ok
*/ */
public function set_unpaid($user) public function setUnpaid($user)
{ {
// phpcs:enable
global $conf, $langs; global $conf, $langs;
$error = 0; $error = 0;

View File

@ -241,7 +241,7 @@ class PaiementFourn extends Paiement
$remaintopay = price2num($invoice->total_ttc - $paiement - $creditnotes - $deposits, 'MT'); $remaintopay = price2num($invoice->total_ttc - $paiement - $creditnotes - $deposits, 'MT');
if ($remaintopay == 0) if ($remaintopay == 0)
{ {
$result = $invoice->set_paid($user, '', ''); $result = $invoice->setPaid($user, '', '');
} else dol_syslog("Remain to pay for invoice ".$facid." not null. We do nothing."); } else dol_syslog("Remain to pay for invoice ".$facid." not null. We do nothing.");
} }

View File

@ -277,7 +277,7 @@ if (empty($reshook))
$discount->unlink_invoice(); $discount->unlink_invoice();
} elseif ($action == 'confirm_paid' && $confirm == 'yes' && $usercancreate) { } elseif ($action == 'confirm_paid' && $confirm == 'yes' && $usercancreate) {
$object->fetch($id); $object->fetch($id);
$result = $object->set_paid($user); $result = $object->setPaid($user);
if ($result < 0) { if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
@ -605,7 +605,7 @@ if (empty($reshook))
{ {
if ($object->type != FactureFournisseur::TYPE_DEPOSIT) { if ($object->type != FactureFournisseur::TYPE_DEPOSIT) {
// Classe facture // Classe facture
$result = $object->set_paid($user); $result = $object->setPaid($user);
if ($result >= 0) if ($result >= 0)
{ {
$db->commit(); $db->commit();
@ -1545,7 +1545,7 @@ if (empty($reshook))
if ($object->statut == FactureFournisseur::STATUS_CLOSED if ($object->statut == FactureFournisseur::STATUS_CLOSED
|| ($object->statut == FactureFournisseur::STATUS_ABANDONED && $object->close_code != 'replaced')) || ($object->statut == FactureFournisseur::STATUS_ABANDONED && $object->close_code != 'replaced'))
{ {
$result = $object->set_unpaid($user); $result = $object->setUnpaid($user);
if ($result > 0) if ($result > 0)
{ {
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id); header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id);

View File

@ -268,3 +268,4 @@ OneLinePerTask=One line per task
OneLinePerPeriod=One line per period OneLinePerPeriod=One line per period
RefTaskParent=Ref. Parent Task RefTaskParent=Ref. Parent Task
ProfitIsCalculatedWith=Profit is calculated using ProfitIsCalculatedWith=Profit is calculated using
AddPersonToTask=Add also to tasks

View File

@ -67,7 +67,7 @@ if (empty($reshook))
if ($action == 'confirm_paid' && $confirm == 'yes' && $user->rights->loan->write) if ($action == 'confirm_paid' && $confirm == 'yes' && $user->rights->loan->write)
{ {
$object->fetch($id); $object->fetch($id);
$result = $object->set_paid($user); $result = $object->setPaid($user);
if ($result > 0) if ($result > 0)
{ {
setEventMessages($langs->trans('LoanPaid'), null, 'mesgs'); setEventMessages($langs->trans('LoanPaid'), null, 'mesgs');

View File

@ -379,12 +379,26 @@ class Loan extends CommonObject
/** /**
* Tag loan as paid completely * Tag loan as paid completely
* *
* @deprecated
* @see setPaid()
* @param User $user Object user making change * @param User $user Object user making change
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
public function set_paid($user) public function set_paid($user)
{ {
// phpcs:enable // phpcs:enable
dol_syslog(get_class($this)."::set_paid is deprecated, use setPaid instead", LOG_NOTICE);
return $this->setPaid($user);
}
/**
* Tag loan as paid completely
*
* @param User $user Object user making change
* @return int <0 if KO, >0 if OK
*/
public function setPaid($user)
{
$sql = "UPDATE ".MAIN_DB_PREFIX."loan SET"; $sql = "UPDATE ".MAIN_DB_PREFIX."loan SET";
$sql .= " paid = ".$this::STATUS_PAID; $sql .= " paid = ".$this::STATUS_PAID;
$sql .= " WHERE rowid = ".$this->id; $sql .= " WHERE rowid = ".$this->id;
@ -399,14 +413,28 @@ class Loan extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Tag loan as payement started * Tag loan as payment started
* *
* @deprecated
* @see setStarted()
* @param User $user Object user making change * @param User $user Object user making change
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
public function set_started($user) public function set_started($user)
{ {
// phpcs:enable // phpcs:enable
dol_syslog(get_class($this)."::set_started is deprecated, use setStarted instead", LOG_NOTICE);
return $this->setStarted($user);
}
/**
* Tag loan as payment started
*
* @param User $user Object user making change
* @return int <0 if KO, >0 if OK
*/
public function setStarted($user)
{
$sql = "UPDATE ".MAIN_DB_PREFIX."loan SET"; $sql = "UPDATE ".MAIN_DB_PREFIX."loan SET";
$sql .= " paid = ".$this::STATUS_STARTED; $sql .= " paid = ".$this::STATUS_STARTED;
$sql .= " WHERE rowid = ".$this->id; $sql .= " WHERE rowid = ".$this->id;
@ -422,13 +450,26 @@ class Loan extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Tag loan as payement as unpaid * Tag loan as payement as unpaid
* * @deprecated
* @see setUnpaid()
* @param User $user Object user making change * @param User $user Object user making change
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
public function set_unpaid($user) public function set_unpaid($user)
{ {
// phpcs:enable // phpcs:enable
dol_syslog(get_class($this)."::set_unpaid is deprecated, use setUnpaid instead", LOG_NOTICE);
return $this->setUnpaid($user);
}
/**
* Tag loan as payement as unpaid
*
* @param User $user Object user making change
* @return int <0 if KO, >0 if OK
*/
public function setUnpaid($user)
{
$sql = "UPDATE ".MAIN_DB_PREFIX."loan SET"; $sql = "UPDATE ".MAIN_DB_PREFIX."loan SET";
$sql .= " paid = ".$this::STATUS_UNPAID; $sql .= " paid = ".$this::STATUS_UNPAID;
$sql .= " WHERE rowid = ".$this->id; $sql .= " WHERE rowid = ".$this->id;

View File

@ -377,8 +377,7 @@ class PaymentLoan extends CommonObject
if ($sum_payment == 0) if ($sum_payment == 0)
{ {
dol_syslog(get_class($this)."::delete : set loan to unpaid", LOG_DEBUG); dol_syslog(get_class($this)."::delete : set loan to unpaid", LOG_DEBUG);
if ($loan->set_unpaid($user) < 1) if ($loan->setUnpaid($user) < 1) {
{
$error++; $error++;
dol_print_error($this->db); dol_print_error($this->db);
} }
@ -532,7 +531,7 @@ class PaymentLoan extends CommonObject
if ($loan->paid == $loan::STATUS_UNPAID) if ($loan->paid == $loan::STATUS_UNPAID)
{ {
dol_syslog(get_class($this)."::addPaymentToBank : set loan payment to started", LOG_DEBUG); dol_syslog(get_class($this)."::addPaymentToBank : set loan payment to started", LOG_DEBUG);
if ($loan->set_started($user) < 1) if ($loan->setStarted($user) < 1)
{ {
$error++; $error++;
dol_print_error($this->db); dol_print_error($this->db);

View File

@ -230,7 +230,7 @@ if ($dirins && $action == 'initmodule' && $modulename)
dol_delete_dir_recursive($destdir.'/core/tpl'); dol_delete_dir_recursive($destdir.'/core/tpl');
dol_delete_dir_recursive($destdir.'/core/triggers'); dol_delete_dir_recursive($destdir.'/core/triggers');
dol_delete_dir_recursive($destdir.'/doc'); dol_delete_dir_recursive($destdir.'/doc');
dol_delete_dir_recursive($destdir.'/.tx'); //dol_delete_dir_recursive($destdir.'/.tx');
dol_delete_dir_recursive($destdir.'/core/boxes'); dol_delete_dir_recursive($destdir.'/core/boxes');
dol_delete_file($destdir.'/admin/myobject_extrafields.php'); dol_delete_file($destdir.'/admin/myobject_extrafields.php');

View File

@ -192,7 +192,7 @@ if (!empty($action) && $action == 'fetch' && !empty($id))
'tva_tx' => $outtva_tx, 'tva_tx' => $outtva_tx,
'qty' => $outqty, 'qty' => $outqty,
'discount' => $outdiscount, 'discount' => $outdiscount,
'array_option'=>$object->array_options); 'array_options'=>$object->array_options);
} }
echo json_encode($outjson); echo json_encode($outjson);

View File

@ -58,7 +58,7 @@ $hookmanager->initHooks(array('projectcontactcard', 'globalcard'));
*/ */
// Add new contact // Add new contact
if ($action == 'addcontact' && $user->rights->projet->creer) if ($action == 'addcontact_confirm' && $user->rights->projet->creer)
{ {
$result = 0; $result = 0;
$result = $object->fetch($id); $result = $object->fetch($id);
@ -68,13 +68,7 @@ if ($action == 'addcontact' && $user->rights->projet->creer)
$contactid = (GETPOST('userid') ? GETPOST('userid', 'int') : GETPOST('contactid', 'int')); $contactid = (GETPOST('userid') ? GETPOST('userid', 'int') : GETPOST('contactid', 'int'));
$typeid = (GETPOST('typecontact') ? GETPOST('typecontact') : GETPOST('type')); $typeid = (GETPOST('typecontact') ? GETPOST('typecontact') : GETPOST('type'));
$result = $object->add_contact($contactid, $typeid, GETPOST("source", 'aZ09')); $result = $object->add_contact($contactid, $typeid, GETPOST("source", 'aZ09'));
} if ( $result < 0) {
if ($result >= 0)
{
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
exit;
} else {
if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS')
{ {
$langs->load("errors"); $langs->load("errors");
@ -83,6 +77,40 @@ if ($action == 'addcontact' && $user->rights->projet->creer)
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
} }
$affecttotask=GETPOST('tasksavailable', 'intcomma');
if (!empty($affecttotask)) {
require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
$task_to_affect = explode(',', $affecttotask);
if (!empty($task_to_affect)) {
foreach ($task_to_affect as $task_id) {
if (GETPOSTISSET('person_'.$task_id, 'san_alpha') && GETPOST('person_'.$task_id, 'san_alpha')=='on') {
$tasksToAffect = new Task($db);
$result=$tasksToAffect->fetch($task_id);
if ($result < 0) {
setEventMessage($tasksToAffect->error, 'errors');
} else {
$result = $tasksToAffect->add_contact($contactid, GETPOST('person_role_'.$task_id), GETPOST("source", 'aZ09'));
if ($result < 0) {
if ($tasksToAffect->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
$langs->load("errors");
setEventMessages($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), null, 'errors');
} else {
setEventMessages($tasksToAffect->error, $tasksToAffect->errors, 'errors');
}
}
}
}
}
}
}
}
if ($result >= 0)
{
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
exit;
}
} }
// Change contact's status // Change contact's status
@ -145,6 +173,85 @@ if ($id > 0 || !empty($ref))
$head = project_prepare_head($object); $head = project_prepare_head($object);
print dol_get_fiche_head($head, 'contact', $langs->trans("Project"), -1, ($object->public ? 'projectpub' : 'project')); print dol_get_fiche_head($head, 'contact', $langs->trans("Project"), -1, ($object->public ? 'projectpub' : 'project'));
$formconfirm = '';
// Test if we can add contact to task at the same times
if ($action == 'addcontact') {
$source=GETPOST("source", 'aZ09');
$taskstatic = new Task($db);
$task_array = $taskstatic->getTasksArray(0, 0, $object->id, 0, 0);
$nbTasks = count($task_array);
//If no task avaiblable, redirec to to add confirm
$type_to = (GETPOST('typecontact') ? 'typecontact='.GETPOST('typecontact') : 'type='.GETPOST('type'));
$personToAffect = (GETPOST('userid') ? GETPOST('userid', 'int') : GETPOST('contactid', 'int'));
$affect_to = (GETPOST('userid') ? 'userid='.$personToAffect : 'contactid='.$personToAffect);
$url_redirect='?id='.$object->id.'&'.$affect_to.'&'.$type_to.'&source='.$source;
if (empty($conf->global->PROJECT_HIDE_TASKS) || $nbTasks > 0) {
$text = $langs->trans('AddPersonToTask');
$formquestion = array('text' => $text);
$task_to_affect = array();
foreach ($task_array as $task) {
$task_already_affected=false;
$personsLinked = $task->liste_contact(-1, $source);
if (!is_array($personsLinked) && coun($personsLinked) < 0) {
setEventMessage($object->error, 'errors');
} else {
foreach ($personsLinked as $person) {
if ($person['id']==$personToAffect) {
$task_already_affected = true;
break;
}
}
if (!$task_already_affected) {
$task_to_affect[$task->id] = $task->ref . ' '.dol_trunc($task->label);
}
}
}
if (empty($task_to_affect)) {
//If person is already add to all task (how it can happen ????, anyway), redirect to to add confirm
header("Location: ".$_SERVER['PHP_SELF'].$url_redirect);
exit;
} else {
foreach ($task_to_affect as $key=>$val) {
$formquestion[] = array('type' => 'checkbox', 'name' => 'person_'.$key, 'label' => $val, 'value' => true);
$formquestion[] = array(
'type' => 'other',
'name' => 'person_role_'. $key,
'label' => $langs->trans("ContactType"),
'value' => $formcompany->selectTypeContact($taskstatic, '', 'person_role_' . $key, $source, 'position', 0, 'minwidth100imp', 0));
}
$formquestion[] = array('type'=> 'other', 'name'=>'tasksavailable', 'label'=>'', 'value' => '<input type="hidden" id="tasksavailable" name="tasksavailable" value="'.implode(',', array_keys($task_to_affect)).'">');
}
$formconfirm = $form->formconfirm($_SERVER['PHP_SELF'] . $url_redirect, $text, '', 'addcontact_confirm', $formquestion, '', 1, 300, 590);
$formconfirm .='
<script>
$(document).ready(function(){
$("input:checkbox[name^=\'person_\']").change(function(){
let taskid=$(this).attr("name").replace("person_","");
$("#person_role_"+taskid).parents("div.tagtr").toggle();
});
});
</script>';
} else {
//If no task avaiblable, redirec to to add confirm
header("Location: ".$_SERVER['PHP_SELF'].$url_redirect.'&action=addcontact_confirm');
exit;
}
}
// Call Hook formConfirm
$parameters = array('formConfirm' => $formconfirm);
$reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if (empty($reshook)) $formconfirm .= $hookmanager->resPrint;
elseif ($reshook > 0) $formconfirm = $hookmanager->resPrint;
// Print form confirm
print $formconfirm;
// Project card // Project card

View File

@ -506,7 +506,7 @@ if (empty($reshook))
} elseif ($action == 'classifybilled') } elseif ($action == 'classifybilled')
{ {
$object->fetch($id); $object->fetch($id);
$result = $object->set_billed(); $result = $object->setBilled();
if ($result >= 0) { if ($result >= 0) {
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
exit(); exit();

View File

@ -1551,11 +1551,24 @@ class Reception extends CommonObject
/** /**
* Classify the reception as invoiced (used when WORKFLOW_BILL_ON_RECEPTION is on) * Classify the reception as invoiced (used when WORKFLOW_BILL_ON_RECEPTION is on)
* *
* @deprecated
* @see setBilled()
* @return int <0 if ko, >0 if ok * @return int <0 if ko, >0 if ok
*/ */
public function set_billed() public function set_billed()
{ {
// phpcs:enable // phpcs:enable
dol_syslog(get_class($this)."::set_billed is deprecated, use setBilled instead", LOG_NOTICE);
return $this->setBilled();
}
/**
* Classify the reception as invoiced (used when WORKFLOW_BILL_ON_RECEPTION is on)
*
* @return int <0 if ko, >0 if ok
*/
public function setBilled()
{
global $user; global $user;
$error = 0; $error = 0;

View File

@ -1699,13 +1699,13 @@ class SupplierProposal extends CommonObject
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
if ($resql) if ($resql)
{ {
$modelpdf = $conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_CLOSED ? $conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_CLOSED : (empty($this->modelpdf) ? '' : $this->modelpdf); $modelpdf = $conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_CLOSED ? $conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_CLOSED : (empty($this->model_pdf) ? '' : $this->model_pdf);
$triggerName = 'PROPOSAL_SUPPLIER_CLOSE_REFUSED'; $triggerName = 'PROPOSAL_SUPPLIER_CLOSE_REFUSED';
if ($status == 2) if ($status == 2)
{ {
$triggerName = 'PROPOSAL_SUPPLIER_CLOSE_SIGNED'; $triggerName = 'PROPOSAL_SUPPLIER_CLOSE_SIGNED';
$modelpdf = $conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_TOBILL ? $conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_TOBILL : (empty($this->modelpdf) ? '' : $this->modelpdf); $modelpdf = $conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_TOBILL ? $conf->global->SUPPLIER_PROPOSAL_ADDON_PDF_ODT_TOBILL : (empty($this->model_pdf) ? '' : $this->model_pdf);
if (!empty($conf->global->SUPPLIER_PROPOSAL_UPDATE_PRICE_ON_SUPPlIER_PROPOSAL)) // TODO This option was not tested correctly. Error if product ref does not exists if (!empty($conf->global->SUPPLIER_PROPOSAL_UPDATE_PRICE_ON_SUPPlIER_PROPOSAL)) // TODO This option was not tested correctly. Error if product ref does not exists
{ {

View File

@ -270,7 +270,7 @@ if ($action == 'valid' && $user->rights->facture->creer)
if ($remaintopay == 0) { if ($remaintopay == 0) {
dol_syslog("Invoice is paid, so we set it to status Paid"); dol_syslog("Invoice is paid, so we set it to status Paid");
$result = $invoice->set_paid($user); $result = $invoice->setPaid($user);
if ($result > 0) $invoice->paye = 1; if ($result > 0) $invoice->paye = 1;
// set payment method // set payment method
$invoice->setPaymentMethods($paiementid); $invoice->setPaymentMethods($paiementid);

View File

@ -778,15 +778,15 @@ function updateInvoice($authentication, $invoice)
} }
} }
if ($invoice['status'] == Facture::STATUS_CLOSED) { if ($invoice['status'] == Facture::STATUS_CLOSED) {
$result = $object->set_paid($fuser, $invoice['close_code'], $invoice['close_note']); $result = $object->setPaid($fuser, $invoice['close_code'], $invoice['close_note']);
}
if ($invoice['status'] == Facture::STATUS_ABANDONED) {
$result = $object->setCanceled($fuser, $invoice['close_code'], $invoice['close_note']);
} }
if ($invoice['status'] == Facture::STATUS_ABANDONED)
$result = $object->set_canceled($fuser, $invoice['close_code'], $invoice['close_note']);
} }
} }
if ((!$error) && ($objectfound)) if ((!$error) && ($objectfound)) {
{
$db->commit(); $db->commit();
$objectresp = array( $objectresp = array(
'result'=>array('result_code'=>'OK', 'result_label'=>''), 'result'=>array('result_code'=>'OK', 'result_label'=>''),
@ -794,9 +794,7 @@ function updateInvoice($authentication, $invoice)
'ref'=>$object->ref, 'ref'=>$object->ref,
'ref_ext'=>$object->ref_ext 'ref_ext'=>$object->ref_ext
); );
} } elseif ($objectfound) {
elseif ($objectfound)
{
$db->rollback(); $db->rollback();
$error++; $error++;
$errorcode = 'KO'; $errorcode = 'KO';

View File

@ -200,56 +200,56 @@ class BuildDocTest extends PHPUnit\Framework\TestCase
$localobject->date_lim_reglement = dol_now() + 3600 * 24 *30; $localobject->date_lim_reglement = dol_now() + 3600 * 24 *30;
// Crabe (english) // Crabe (english)
$localobject->modelpdf='crabe'; $localobject->model_pdf='crabe';
$result = $localobject->generateDocument($localobject->modelpdf, $langs); $result = $localobject->generateDocument($localobject->model_pdf, $langs);
$this->assertLessThan($result, 0); $this->assertLessThan($result, 0);
print __METHOD__." result=".$result."\n"; print __METHOD__." result=".$result."\n";
// Crabe (japanese) // Crabe (japanese)
$newlangs1=new Translate("", $conf); $newlangs1=new Translate("", $conf);
$newlangs1->setDefaultLang('ja_JP'); $newlangs1->setDefaultLang('ja_JP');
$localobject->modelpdf='crabe'; $localobject->model_pdf='crabe';
$result = $localobject->generateDocument($localobject->modelpdf, $newlangs1); $result = $localobject->generateDocument($localobject->model_pdf, $newlangs1);
$this->assertLessThan($result, 0); $this->assertLessThan($result, 0);
print __METHOD__." result=".$result."\n"; print __METHOD__." result=".$result."\n";
// Crabe (saudiarabia) // Crabe (saudiarabia)
$newlangs2a=new Translate("", $conf); $newlangs2a=new Translate("", $conf);
$newlangs2a->setDefaultLang('sa_SA'); $newlangs2a->setDefaultLang('sa_SA');
$localobject->modelpdf='crabe'; $localobject->model_pdf='crabe';
$result = $localobject->generateDocument($localobject->modelpdf, $newlangs2a); $result = $localobject->generateDocument($localobject->model_pdf, $newlangs2a);
$this->assertLessThan($result, 0); $this->assertLessThan($result, 0);
print __METHOD__." result=".$result."\n"; print __METHOD__." result=".$result."\n";
// Crabe (english_saudiarabia) // Crabe (english_saudiarabia)
$newlangs2b=new Translate("", $conf); $newlangs2b=new Translate("", $conf);
$newlangs2b->setDefaultLang('en_SA'); $newlangs2b->setDefaultLang('en_SA');
$localobject->modelpdf='crabe'; $localobject->model_pdf='crabe';
$result = $localobject->generateDocument($localobject->modelpdf, $newlangs2b); $result = $localobject->generateDocument($localobject->model_pdf, $newlangs2b);
$this->assertLessThan($result, 0); $this->assertLessThan($result, 0);
print __METHOD__." result=".$result."\n"; print __METHOD__." result=".$result."\n";
// Crabe (greek) // Crabe (greek)
$newlangs3=new Translate("", $conf); $newlangs3=new Translate("", $conf);
$newlangs3->setDefaultLang('el_GR'); $newlangs3->setDefaultLang('el_GR');
$localobject->modelpdf='crabe'; $localobject->model_pdf='crabe';
$result = $localobject->generateDocument($localobject->modelpdf, $newlangs3); $result = $localobject->generateDocument($localobject->model_pdf, $newlangs3);
$this->assertLessThan($result, 0); $this->assertLessThan($result, 0);
print __METHOD__." result=".$result."\n"; print __METHOD__." result=".$result."\n";
// Crabe (chinese) // Crabe (chinese)
$newlangs4=new Translate("", $conf); $newlangs4=new Translate("", $conf);
$newlangs4->setDefaultLang('zh_CN'); $newlangs4->setDefaultLang('zh_CN');
$localobject->modelpdf='crabe'; $localobject->model_pdf='crabe';
$result = $localobject->generateDocument($localobject->modelpdf, $newlangs4); $result = $localobject->generateDocument($localobject->model_pdf, $newlangs4);
$this->assertLessThan($result, 0); $this->assertLessThan($result, 0);
print __METHOD__." result=".$result."\n"; print __METHOD__." result=".$result."\n";
// Crabe (russian) // Crabe (russian)
$newlangs5=new Translate("", $conf); $newlangs5=new Translate("", $conf);
$newlangs5->setDefaultLang('ru_RU'); $newlangs5->setDefaultLang('ru_RU');
$localobject->modelpdf='crabe'; $localobject->model_pdf='crabe';
$result = $localobject->generateDocument($localobject->modelpdf, $newlangs5); $result = $localobject->generateDocument($localobject->model_pdf, $newlangs5);
$this->assertLessThan($result, 0); $this->assertLessThan($result, 0);
print __METHOD__." result=".$result."\n"; print __METHOD__." result=".$result."\n";
@ -274,8 +274,8 @@ class BuildDocTest extends PHPUnit\Framework\TestCase
$localobject->initAsSpecimen(); $localobject->initAsSpecimen();
// Canelle // Canelle
$localobject->modelpdf='canelle'; $localobject->model_pdf='canelle';
$result = $localobject->generateDocument($localobject->modelpdf, $langs); $result = $localobject->generateDocument($localobject->model_pdf, $langs);
$this->assertLessThan($result, 0); $this->assertLessThan($result, 0);
print __METHOD__." result=".$result."\n"; print __METHOD__." result=".$result."\n";
@ -301,8 +301,8 @@ class BuildDocTest extends PHPUnit\Framework\TestCase
$localobject->initAsSpecimen(); $localobject->initAsSpecimen();
// Einstein // Einstein
$localobject->modelpdf='einstein'; $localobject->model_pdf='einstein';
$result = $localobject->generateDocument($localobject->modelpdf, $langs); $result = $localobject->generateDocument($localobject->model_pdf, $langs);
$this->assertLessThan($result, 0); $this->assertLessThan($result, 0);
print __METHOD__." result=".$result."\n"; print __METHOD__." result=".$result."\n";
@ -329,8 +329,8 @@ class BuildDocTest extends PHPUnit\Framework\TestCase
$localobject->initAsSpecimen(); $localobject->initAsSpecimen();
// Muscadet // Muscadet
$localobject->modelpdf='muscadet'; $localobject->model_pdf='muscadet';
$result= $localobject->generateDocument($localobject->modelpdf, $langs); $result= $localobject->generateDocument($localobject->model_pdf, $langs);
$this->assertLessThan($result, 0); $this->assertLessThan($result, 0);
print __METHOD__." result=".$result."\n"; print __METHOD__." result=".$result."\n";
@ -356,8 +356,8 @@ class BuildDocTest extends PHPUnit\Framework\TestCase
$localobject->initAsSpecimen(); $localobject->initAsSpecimen();
// Azur // Azur
$localobject->modelpdf='azur'; $localobject->model_pdf='azur';
$result = $localobject->generateDocument($localobject->modelpdf, $langs); $result = $localobject->generateDocument($localobject->model_pdf, $langs);
$this->assertLessThan($result, 0); $this->assertLessThan($result, 0);
print __METHOD__." result=".$result."\n"; print __METHOD__." result=".$result."\n";
@ -382,8 +382,8 @@ class BuildDocTest extends PHPUnit\Framework\TestCase
$localobject->initAsSpecimen(); $localobject->initAsSpecimen();
// Baleine // Baleine
$localobject->modelpdf='baleine'; $localobject->model_pdf='baleine';
$result = $localobject->generateDocument($localobject->modelpdf, $langs); $result = $localobject->generateDocument($localobject->model_pdf, $langs);
$this->assertLessThan($result, 0); $this->assertLessThan($result, 0);
print __METHOD__." result=".$result."\n"; print __METHOD__." result=".$result."\n";
@ -409,8 +409,8 @@ class BuildDocTest extends PHPUnit\Framework\TestCase
$localobject->initAsSpecimen(); $localobject->initAsSpecimen();
// Soleil // Soleil
$localobject->modelpdf='soleil'; $localobject->model_pdf='soleil';
$result=fichinter_create($db, $localobject, $localobject->modelpdf, $langs); $result=fichinter_create($db, $localobject, $localobject->model_pdf, $langs);
$this->assertLessThan($result, 0); $this->assertLessThan($result, 0);
print __METHOD__." result=".$result."\n"; print __METHOD__." result=".$result."\n";
@ -436,15 +436,15 @@ class BuildDocTest extends PHPUnit\Framework\TestCase
$localobject->initAsSpecimen(); $localobject->initAsSpecimen();
// Merou // Merou
$localobject->modelpdf='merou'; $localobject->model_pdf='merou';
$result= $localobject->generateDocument($localobject->modelpdf, $langs); $result= $localobject->generateDocument($localobject->model_pdf, $langs);
$this->assertLessThan($result, 0); $this->assertLessThan($result, 0);
print __METHOD__." result=".$result."\n"; print __METHOD__." result=".$result."\n";
// Rouget // Rouget
$localobject->modelpdf='rouget'; $localobject->model_pdf='rouget';
$result= $localobject->generateDocument($localobject->modelpdf, $langs); $result= $localobject->generateDocument($localobject->model_pdf, $langs);
$this->assertLessThan($result, 0); $this->assertLessThan($result, 0);
print __METHOD__." result=".$result."\n"; print __METHOD__." result=".$result."\n";

View File

@ -174,7 +174,7 @@ class ChargeSocialesTest extends PHPUnit\Framework\TestCase
/** /**
* testChargeSocialesValid * testChargeSocialesValid
* *
* @param Object $localobject Social contribution * @param ChargeSociales $localobject Social contribution
* @return void * @return void
* *
* @depends testChargeSocialesFetch * @depends testChargeSocialesFetch
@ -188,7 +188,7 @@ class ChargeSocialesTest extends PHPUnit\Framework\TestCase
$langs=$this->savlangs; $langs=$this->savlangs;
$db=$this->savdb; $db=$this->savdb;
$result=$localobject->set_paid($user); $result=$localobject->setPaid($user);
print __METHOD__." id=".$localobject->id." result=".$result."\n"; print __METHOD__." id=".$localobject->id." result=".$result."\n";
$this->assertLessThan($result, 0); $this->assertLessThan($result, 0);
@ -198,7 +198,7 @@ class ChargeSocialesTest extends PHPUnit\Framework\TestCase
/** /**
* testChargeSocialesOther * testChargeSocialesOther
* *
* @param Object $localobject Social contribution * @param ChargeSociales $localobject Social contribution
* @return void * @return void
* *
* @depends testChargeSocialesValid * @depends testChargeSocialesValid

View File

@ -189,7 +189,7 @@ class LoanTest extends PHPUnit\Framework\TestCase
$langs=$this->savlangs; $langs=$this->savlangs;
$db=$this->savdb; $db=$this->savdb;
$result=$localobject->set_paid($user); $result=$localobject->setPaid($user);
print __METHOD__." id=".$localobject->id." result=".$result."\n"; print __METHOD__." id=".$localobject->id." result=".$result."\n";
$this->assertLessThan($result, 0); $this->assertLessThan($result, 0);