wip
This commit is contained in:
parent
72ef70dbd7
commit
346d1f410c
@ -83,7 +83,7 @@ class Deplacement extends CommonObject
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
function __construct($db)
|
||||
public function __construct($db)
|
||||
{
|
||||
$this->db = $db;
|
||||
|
||||
@ -98,7 +98,7 @@ class Deplacement extends CommonObject
|
||||
* @param User $user User that creates
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function create($user)
|
||||
public function create($user)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
@ -183,7 +183,7 @@ class Deplacement extends CommonObject
|
||||
* @param User $user User making update
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function update($user)
|
||||
public function update($user)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
@ -245,7 +245,7 @@ class Deplacement extends CommonObject
|
||||
* @param string $ref Ref of record
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function fetch($id, $ref = '')
|
||||
public function fetch($id, $ref = '')
|
||||
{
|
||||
$sql = "SELECT rowid, fk_user, type, fk_statut, km, fk_soc, dated, note_private, note_public, fk_projet, extraparams";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."deplacement";
|
||||
@ -288,7 +288,7 @@ class Deplacement extends CommonObject
|
||||
* @param int $id Id of record to delete
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function delete($id)
|
||||
public function delete($id)
|
||||
{
|
||||
$this->db->begin();
|
||||
|
||||
@ -316,12 +316,12 @@ class Deplacement extends CommonObject
|
||||
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto
|
||||
* @return string Libelle
|
||||
*/
|
||||
function getLibStatut($mode = 0)
|
||||
public function getLibStatut($mode = 0)
|
||||
{
|
||||
return $this->LibStatut($this->statut, $mode);
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Renvoi le libelle d'un statut donne
|
||||
*
|
||||
@ -329,7 +329,7 @@ class Deplacement extends CommonObject
|
||||
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto
|
||||
* @return string Libelle
|
||||
*/
|
||||
function LibStatut($statut, $mode = 0)
|
||||
public function LibStatut($statut, $mode = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $langs;
|
||||
@ -345,26 +345,26 @@ class Deplacement extends CommonObject
|
||||
elseif ($mode == 2)
|
||||
{
|
||||
if ($statut==0) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut0').' '.$langs->trans($this->statuts_short[$statut]);
|
||||
if ($statut==1) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut4').' '.$langs->trans($this->statuts_short[$statut]);
|
||||
if ($statut==2) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut6').' '.$langs->trans($this->statuts_short[$statut]);
|
||||
elseif ($statut==1) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut4').' '.$langs->trans($this->statuts_short[$statut]);
|
||||
elseif ($statut==2) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut6').' '.$langs->trans($this->statuts_short[$statut]);
|
||||
}
|
||||
elseif ($mode == 3)
|
||||
{
|
||||
if ($statut==0 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut0');
|
||||
if ($statut==1 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut4');
|
||||
if ($statut==2 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut6');
|
||||
elseif ($statut==1 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut4');
|
||||
elseif ($statut==2 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut6');
|
||||
}
|
||||
elseif ($mode == 4)
|
||||
{
|
||||
if ($statut==0 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut0').' '.$langs->trans($this->statuts[$statut]);
|
||||
if ($statut==1 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut4').' '.$langs->trans($this->statuts[$statut]);
|
||||
if ($statut==2 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut6').' '.$langs->trans($this->statuts[$statut]);
|
||||
elseif ($statut==1 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut4').' '.$langs->trans($this->statuts[$statut]);
|
||||
elseif ($statut==2 && ! empty($this->statuts_short[$statut])) return img_picto($langs->trans($this->statuts_short[$statut]), 'statut6').' '.$langs->trans($this->statuts[$statut]);
|
||||
}
|
||||
elseif ($mode == 5)
|
||||
{
|
||||
if ($statut==0 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]), 'statut0');
|
||||
if ($statut==1 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]), 'statut4');
|
||||
if ($statut==2 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]), 'statut6');
|
||||
elseif ($statut==1 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]), 'statut4');
|
||||
elseif ($statut==2 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]), 'statut6');
|
||||
}
|
||||
}
|
||||
|
||||
@ -374,7 +374,7 @@ class Deplacement extends CommonObject
|
||||
* @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto
|
||||
* @return string Chaine avec URL
|
||||
*/
|
||||
function getNomUrl($withpicto = 0)
|
||||
public function getNomUrl($withpicto = 0)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
@ -400,7 +400,7 @@ class Deplacement extends CommonObject
|
||||
* @param int $active Active or not
|
||||
* @return array
|
||||
*/
|
||||
function listOfTypes($active = 1)
|
||||
public function listOfTypes($active = 1)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
@ -437,7 +437,7 @@ class Deplacement extends CommonObject
|
||||
* @param int $id Id of record
|
||||
* @return void
|
||||
*/
|
||||
function info($id)
|
||||
public function info($id)
|
||||
{
|
||||
$sql = 'SELECT c.rowid, c.datec, c.fk_user_author, c.fk_user_modif,';
|
||||
$sql.= ' c.tms';
|
||||
|
||||
@ -35,12 +35,12 @@ class DeplacementStats extends Stats
|
||||
*/
|
||||
public $table_element;
|
||||
|
||||
var $socid;
|
||||
var $userid;
|
||||
public $socid;
|
||||
public $userid;
|
||||
|
||||
var $from;
|
||||
var $field;
|
||||
var $where;
|
||||
public $from;
|
||||
public $field;
|
||||
public $where;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
@ -50,7 +50,7 @@ class DeplacementStats extends Stats
|
||||
* @param mixed $userid Id user for filter or array of user ids
|
||||
* @return void
|
||||
*/
|
||||
function __construct($db, $socid = 0, $userid = 0)
|
||||
public function __construct($db, $socid = 0, $userid = 0)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
@ -78,7 +78,7 @@ class DeplacementStats extends Stats
|
||||
*
|
||||
* @return array Array of values
|
||||
*/
|
||||
function getNbByYear()
|
||||
public function getNbByYear()
|
||||
{
|
||||
$sql = "SELECT YEAR(dated) as dm, count(*)";
|
||||
$sql.= " FROM ".$this->from;
|
||||
@ -96,7 +96,7 @@ class DeplacementStats extends Stats
|
||||
* @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month
|
||||
* @return array Array of values
|
||||
*/
|
||||
function getNbByMonth($year, $format = 0)
|
||||
public function getNbByMonth($year, $format = 0)
|
||||
{
|
||||
$sql = "SELECT MONTH(dated) as dm, count(*)";
|
||||
$sql.= " FROM ".$this->from;
|
||||
@ -118,7 +118,7 @@ class DeplacementStats extends Stats
|
||||
* @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month
|
||||
* @return array Array of values
|
||||
*/
|
||||
function getAmountByMonth($year, $format = 0)
|
||||
public function getAmountByMonth($year, $format = 0)
|
||||
{
|
||||
$sql = "SELECT date_format(dated,'%m') as dm, sum(".$this->field.")";
|
||||
$sql.= " FROM ".$this->from;
|
||||
@ -138,7 +138,7 @@ class DeplacementStats extends Stats
|
||||
* @param int $year Year to scan
|
||||
* @return array Array of values
|
||||
*/
|
||||
function getAverageByMonth($year)
|
||||
public function getAverageByMonth($year)
|
||||
{
|
||||
$sql = "SELECT date_format(dated,'%m') as dm, avg(".$this->field.")";
|
||||
$sql.= " FROM ".$this->from;
|
||||
@ -155,14 +155,14 @@ class DeplacementStats extends Stats
|
||||
*
|
||||
* @return array Array of values
|
||||
*/
|
||||
function getAllByYear()
|
||||
{
|
||||
$sql = "SELECT date_format(dated,'%Y') as year, count(*) as nb, sum(".$this->field.") as total, avg(".$this->field.") as avg";
|
||||
$sql.= " FROM ".$this->from;
|
||||
$sql.= " WHERE ".$this->where;
|
||||
$sql.= " GROUP BY year";
|
||||
public function getAllByYear()
|
||||
{
|
||||
$sql = "SELECT date_format(dated,'%Y') as year, count(*) as nb, sum(".$this->field.") as total, avg(".$this->field.") as avg";
|
||||
$sql.= " FROM ".$this->from;
|
||||
$sql.= " WHERE ".$this->where;
|
||||
$sql.= " GROUP BY year";
|
||||
$sql.= $this->db->order('year', 'DESC');
|
||||
|
||||
return $this->_getAllByYear($sql);
|
||||
}
|
||||
return $this->_getAllByYear($sql);
|
||||
}
|
||||
}
|
||||
|
||||
@ -43,10 +43,10 @@ class Invoices extends DolibarrApi
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
function __construct()
|
||||
public function __construct()
|
||||
{
|
||||
global $db, $conf;
|
||||
$this->db = $db;
|
||||
global $db, $conf;
|
||||
$this->db = $db;
|
||||
$this->invoice = new Facture($this->db);
|
||||
}
|
||||
|
||||
@ -61,7 +61,7 @@ class Invoices extends DolibarrApi
|
||||
*
|
||||
* @throws RestException
|
||||
*/
|
||||
function get($id, $contact_list = 1)
|
||||
public function get($id, $contact_list = 1)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->facture->lire) {
|
||||
throw new RestException(401);
|
||||
@ -105,7 +105,7 @@ class Invoices extends DolibarrApi
|
||||
*
|
||||
* @throws RestException
|
||||
*/
|
||||
function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $status = '', $sqlfilters = '')
|
||||
public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $status = '', $sqlfilters = '')
|
||||
{
|
||||
global $db, $conf;
|
||||
|
||||
@ -204,7 +204,7 @@ class Invoices extends DolibarrApi
|
||||
* @param array $request_data Request datas
|
||||
* @return int ID of invoice
|
||||
*/
|
||||
function post($request_data = null)
|
||||
public function post($request_data = null)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->facture->creer) {
|
||||
throw new RestException(401, "Insuffisant rights");
|
||||
@ -247,29 +247,29 @@ class Invoices extends DolibarrApi
|
||||
* @throws 404
|
||||
* @throws 405
|
||||
*/
|
||||
function createInvoiceFromOrder($orderid)
|
||||
public function createInvoiceFromOrder($orderid)
|
||||
{
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT . '/commande/class/commande.class.php';
|
||||
|
||||
if(! DolibarrApiAccess::$user->rights->commande->lire) {
|
||||
if (! DolibarrApiAccess::$user->rights->commande->lire) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
if(! DolibarrApiAccess::$user->rights->facture->creer) {
|
||||
if (! DolibarrApiAccess::$user->rights->facture->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
if(empty($orderid)) {
|
||||
if (empty($orderid)) {
|
||||
throw new RestException(400, 'Order ID is mandatory');
|
||||
}
|
||||
|
||||
$order = new Commande($this->db);
|
||||
$result = $order->fetch($orderid);
|
||||
if( ! $result ) {
|
||||
if ( ! $result ) {
|
||||
throw new RestException(404, 'Order not found');
|
||||
}
|
||||
|
||||
$result = $this->invoice->createFromOrder($order, DolibarrApiAccess::$user);
|
||||
if( $result < 0) {
|
||||
if ( $result < 0) {
|
||||
throw new RestException(405, $this->invoice->error);
|
||||
}
|
||||
$this->invoice->fetchObjectLinked();
|
||||
@ -285,7 +285,7 @@ class Invoices extends DolibarrApi
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
function getLines($id)
|
||||
public function getLines($id)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->facture->lire) {
|
||||
throw new RestException(401);
|
||||
@ -323,7 +323,7 @@ class Invoices extends DolibarrApi
|
||||
* @throws 401
|
||||
* @throws 404
|
||||
*/
|
||||
function putLine($id, $lineid, $request_data = null)
|
||||
public function putLine($id, $lineid, $request_data = null)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->facture->creer) {
|
||||
throw new RestException(401);
|
||||
@ -386,7 +386,7 @@ class Invoices extends DolibarrApi
|
||||
* @throws 401
|
||||
* @throws 404
|
||||
*/
|
||||
function postContact($id, $contactid, $type)
|
||||
public function postContact($id, $contactid, $type)
|
||||
{
|
||||
if(!DolibarrApiAccess::$user->rights->facture->creer) {
|
||||
throw new RestException(401);
|
||||
@ -428,7 +428,7 @@ class Invoices extends DolibarrApi
|
||||
* @throws 404
|
||||
* @throws 500
|
||||
*/
|
||||
function deleteContact($id, $rowid)
|
||||
public function deleteContact($id, $rowid)
|
||||
{
|
||||
if(!DolibarrApiAccess::$user->rights->facture->creer) {
|
||||
throw new RestException(401);
|
||||
@ -468,7 +468,7 @@ class Invoices extends DolibarrApi
|
||||
* @throws 404
|
||||
* @throws 405
|
||||
*/
|
||||
function deleteLine($id, $lineid)
|
||||
public function deleteLine($id, $lineid)
|
||||
{
|
||||
|
||||
if(! DolibarrApiAccess::$user->rights->facture->creer) {
|
||||
@ -506,7 +506,7 @@ class Invoices extends DolibarrApi
|
||||
* @param array $request_data Datas
|
||||
* @return int
|
||||
*/
|
||||
function put($id, $request_data = null)
|
||||
public function put($id, $request_data = null)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->facture->creer) {
|
||||
throw new RestException(401);
|
||||
@ -547,7 +547,7 @@ class Invoices extends DolibarrApi
|
||||
* @param int $id Invoice ID
|
||||
* @return array
|
||||
*/
|
||||
function delete($id)
|
||||
public function delete($id)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->facture->supprimer) {
|
||||
throw new RestException(401);
|
||||
@ -597,7 +597,7 @@ class Invoices extends DolibarrApi
|
||||
* @throws 404
|
||||
* @throws 400
|
||||
*/
|
||||
function postLine($id, $request_data = null)
|
||||
public function postLine($id, $request_data = null)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->facture->creer) {
|
||||
throw new RestException(401);
|
||||
@ -681,23 +681,23 @@ class Invoices extends DolibarrApi
|
||||
* @throws 500
|
||||
*
|
||||
*/
|
||||
function addContact($id, $fk_socpeople, $type_contact, $source, $notrigger = 0)
|
||||
public function addContact($id, $fk_socpeople, $type_contact, $source, $notrigger = 0)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->facture->creer) {
|
||||
throw new RestException(401);
|
||||
throw new RestException(401);
|
||||
}
|
||||
$result = $this->invoice->fetch($id);
|
||||
if( ! $result ) {
|
||||
throw new RestException(404, 'Invoice not found');
|
||||
throw new RestException(404, 'Invoice not found');
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('facture', $this->invoice->id)) {
|
||||
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->add_contact($fk_socpeople, $type_contact, $source, $notrigger);
|
||||
if ($result < 0) {
|
||||
throw new RestException(500, 'Error : '.$this->invoice->error);
|
||||
throw new RestException(500, 'Error : '.$this->invoice->error);
|
||||
}
|
||||
|
||||
$result = $this->invoice->fetch($id);
|
||||
@ -731,7 +731,7 @@ class Invoices extends DolibarrApi
|
||||
* @throws 500
|
||||
*
|
||||
*/
|
||||
function settodraft($id, $idwarehouse = -1)
|
||||
public function settodraft($id, $idwarehouse = -1)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->facture->creer) {
|
||||
throw new RestException(401);
|
||||
@ -783,7 +783,7 @@ class Invoices extends DolibarrApi
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function validate($id, $idwarehouse = 0, $notrigger = 0)
|
||||
public function validate($id, $idwarehouse = 0, $notrigger = 0)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->facture->creer) {
|
||||
throw new RestException(401);
|
||||
@ -834,7 +834,7 @@ class Invoices extends DolibarrApi
|
||||
* @throws 404
|
||||
* @throws 500
|
||||
*/
|
||||
function settopaid($id, $close_code = '', $close_note = '')
|
||||
public function settopaid($id, $close_code = '', $close_note = '')
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->facture->creer) {
|
||||
throw new RestException(401);
|
||||
@ -885,7 +885,7 @@ class Invoices extends DolibarrApi
|
||||
* @throws 404
|
||||
* @throws 500
|
||||
*/
|
||||
function settounpaid($id)
|
||||
public function settounpaid($id)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->facture->creer) {
|
||||
throw new RestException(401);
|
||||
@ -934,24 +934,24 @@ class Invoices extends DolibarrApi
|
||||
* @throws 404
|
||||
* @throws 500
|
||||
*/
|
||||
function markAsCreditAvailable($id)
|
||||
public function markAsCreditAvailable($id)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->facture->creer) {
|
||||
throw new RestException(401);
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->invoice->fetch($id);
|
||||
if( ! $result ) {
|
||||
throw new RestException(404, 'Invoice not found');
|
||||
throw new RestException(404, 'Invoice not found');
|
||||
}
|
||||
|
||||
if( ! DolibarrApi::_checkAccessToResource('facture', $this->invoice->id)) {
|
||||
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->fetch_thirdparty();
|
||||
if( ! $result ) {
|
||||
throw new RestException(404, 'Thirdparty not found');
|
||||
throw new RestException(404, 'Thirdparty not found');
|
||||
}
|
||||
|
||||
if (! $this->invoice->paye) // protection against multiple submit
|
||||
@ -1053,7 +1053,7 @@ class Invoices extends DolibarrApi
|
||||
* @throws 404
|
||||
* @throws 405
|
||||
*/
|
||||
function useDiscount($id, $discountid)
|
||||
public function useDiscount($id, $discountid)
|
||||
{
|
||||
|
||||
if(! DolibarrApiAccess::$user->rights->facture->creer) {
|
||||
@ -1144,7 +1144,7 @@ class Invoices extends DolibarrApi
|
||||
* @throws 404
|
||||
* @throws 405
|
||||
*/
|
||||
function getPayments($id)
|
||||
public function getPayments($id)
|
||||
{
|
||||
|
||||
if(! DolibarrApiAccess::$user->rights->facture->lire) {
|
||||
@ -1192,7 +1192,7 @@ class Invoices extends DolibarrApi
|
||||
* @throws 401
|
||||
* @throws 404
|
||||
*/
|
||||
function addPayment($id, $datepaye, $paiementid, $closepaidinvoices, $accountid, $num_paiement = '', $comment = '', $chqemetteur = '', $chqbank = '')
|
||||
public function addPayment($id, $datepaye, $paiementid, $closepaidinvoices, $accountid, $num_paiement = '', $comment = '', $chqemetteur = '', $chqbank = '')
|
||||
{
|
||||
global $conf;
|
||||
|
||||
@ -1257,10 +1257,10 @@ class Invoices extends DolibarrApi
|
||||
$paiement->datepaye = $datepaye;
|
||||
$paiement->amounts = $amounts; // Array with all payments dispatching with invoice id
|
||||
$paiement->multicurrency_amounts = $multicurrency_amounts; // Array with all payments dispatching
|
||||
$paiement->paiementid = $paiementid;
|
||||
$paiement->paiementid = $paiementid;
|
||||
$paiement->paiementcode = dol_getIdFromCode($this->db, $paiementid, 'c_paiement', 'id', 'code', 1);
|
||||
$paiement->num_paiement = $num_paiement;
|
||||
$paiement->note = $comment;
|
||||
$paiement->note = $comment;
|
||||
|
||||
$paiement_id = $paiement->create(DolibarrApiAccess::$user, ($closepaidinvoices=='yes'?1:0)); // This include closing invoices
|
||||
if ($paiement_id < 0)
|
||||
@ -1312,7 +1312,7 @@ class Invoices extends DolibarrApi
|
||||
* @throws 403
|
||||
* @throws 404
|
||||
*/
|
||||
function addPaymentDistributed($arrayofamounts, $datepaye, $paiementid, $closepaidinvoices, $accountid, $num_paiement = '', $comment = '', $chqemetteur = '', $chqbank = '')
|
||||
public function addPaymentDistributed($arrayofamounts, $datepaye, $paiementid, $closepaidinvoices, $accountid, $num_paiement = '', $comment = '', $chqemetteur = '', $chqbank = '')
|
||||
{
|
||||
global $conf;
|
||||
|
||||
@ -1423,7 +1423,7 @@ class Invoices extends DolibarrApi
|
||||
* @param object $object Object to clean
|
||||
* @return array Array of cleaned object properties
|
||||
*/
|
||||
function _cleanObjectDatas($object)
|
||||
private function _cleanObjectDatas($object)
|
||||
{
|
||||
|
||||
$object = parent::_cleanObjectDatas($object);
|
||||
@ -1446,7 +1446,7 @@ class Invoices extends DolibarrApi
|
||||
*
|
||||
* @throws RestException
|
||||
*/
|
||||
function _validate($data)
|
||||
private function _validate($data)
|
||||
{
|
||||
$invoice = array();
|
||||
foreach (Invoices::$FIELDS as $field) {
|
||||
|
||||
@ -115,7 +115,7 @@ class FactureRec extends CommonInvoice
|
||||
* @param int $facid Id of source invoice
|
||||
* @return int <0 if KO, id of invoice created if OK
|
||||
*/
|
||||
function create($user, $facid)
|
||||
public function create($user, $facid)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
@ -225,7 +225,7 @@ class FactureRec extends CommonInvoice
|
||||
$tva_tx = $facsrc->lines[$i]->tva_tx;
|
||||
if (! empty($facsrc->lines[$i]->vat_src_code) && ! preg_match('/\(/', $tva_tx)) $tva_tx .= ' ('.$facsrc->lines[$i]->vat_src_code.')';
|
||||
|
||||
$result_insert = $this->addline(
|
||||
$result_insert = $this->addline(
|
||||
$facsrc->lines[$i]->desc,
|
||||
$facsrc->lines[$i]->subprice,
|
||||
$facsrc->lines[$i]->qty,
|
||||
@ -321,7 +321,7 @@ class FactureRec extends CommonInvoice
|
||||
* @param int $ref_int Internal reference of other object
|
||||
* @return int >0 if OK, <0 if KO, 0 if not found
|
||||
*/
|
||||
function fetch($rowid, $ref = '', $ref_ext = '', $ref_int = '')
|
||||
public function fetch($rowid, $ref = '', $ref_ext = '', $ref_int = '')
|
||||
{
|
||||
$sql = 'SELECT f.rowid, f.entity, f.titre, f.suspended, f.fk_soc, f.amount, f.tva, f.localtax1, f.localtax2, f.total, f.total_ttc';
|
||||
$sql.= ', f.remise_percent, f.remise_absolue, f.remise';
|
||||
@ -449,7 +449,7 @@ class FactureRec extends CommonInvoice
|
||||
*
|
||||
* @return int >0 if OK, <0 if KO
|
||||
*/
|
||||
function getLinesArray()
|
||||
public function getLinesArray()
|
||||
{
|
||||
return $this->fetch_lines();
|
||||
}
|
||||
@ -461,7 +461,7 @@ class FactureRec extends CommonInvoice
|
||||
*
|
||||
* @return int 1 if OK, < 0 if KO
|
||||
*/
|
||||
function fetch_lines()
|
||||
public function fetch_lines()
|
||||
{
|
||||
// phpcs:enable
|
||||
$this->lines=array();
|
||||
@ -573,7 +573,7 @@ class FactureRec extends CommonInvoice
|
||||
* @param int $idwarehouse Id warehouse to use for stock change.
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function delete(User $user, $notrigger = 0, $idwarehouse = -1)
|
||||
public function delete(User $user, $notrigger = 0, $idwarehouse = -1)
|
||||
{
|
||||
$rowid=$this->id;
|
||||
|
||||
@ -644,7 +644,7 @@ class FactureRec extends CommonInvoice
|
||||
* @param int $date_end_fill 1=Flag to fill end date when generating invoice
|
||||
* @return int <0 if KO, Id of line if OK
|
||||
*/
|
||||
function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1 = 0, $txlocaltax2 = 0, $fk_product = 0, $remise_percent = 0, $price_base_type = 'HT', $info_bits = 0, $fk_remise_except = '', $pu_ttc = 0, $type = 0, $rang = -1, $special_code = 0, $label = '', $fk_unit = null, $pu_ht_devise = 0, $date_start_fill = 0, $date_end_fill = 0)
|
||||
public function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1 = 0, $txlocaltax2 = 0, $fk_product = 0, $remise_percent = 0, $price_base_type = 'HT', $info_bits = 0, $fk_remise_except = '', $pu_ttc = 0, $type = 0, $rang = -1, $special_code = 0, $label = '', $fk_unit = null, $pu_ht_devise = 0, $date_start_fill = 0, $date_end_fill = 0)
|
||||
{
|
||||
global $mysoc;
|
||||
|
||||
@ -826,7 +826,7 @@ class FactureRec extends CommonInvoice
|
||||
* @param int $date_end_fill 1=Flag to fill end date when generating invoice
|
||||
* @return int <0 if KO, Id of line if OK
|
||||
*/
|
||||
function updateline($rowid, $desc, $pu_ht, $qty, $txtva, $txlocaltax1 = 0, $txlocaltax2 = 0, $fk_product = 0, $remise_percent = 0, $price_base_type = 'HT', $info_bits = 0, $fk_remise_except = '', $pu_ttc = 0, $type = 0, $rang = -1, $special_code = 0, $label = '', $fk_unit = null, $pu_ht_devise = 0, $notrigger = 0, $date_start_fill = 0, $date_end_fill = 0)
|
||||
public function updateline($rowid, $desc, $pu_ht, $qty, $txtva, $txlocaltax1 = 0, $txlocaltax2 = 0, $fk_product = 0, $remise_percent = 0, $price_base_type = 'HT', $info_bits = 0, $fk_remise_except = '', $pu_ttc = 0, $type = 0, $rang = -1, $special_code = 0, $label = '', $fk_unit = null, $pu_ht_devise = 0, $notrigger = 0, $date_start_fill = 0, $date_end_fill = 0)
|
||||
{
|
||||
global $mysoc;
|
||||
|
||||
@ -962,7 +962,7 @@ class FactureRec extends CommonInvoice
|
||||
*
|
||||
* @return int|false false if KO, timestamp if OK
|
||||
*/
|
||||
function getNextDate()
|
||||
public function getNextDate()
|
||||
{
|
||||
if (empty($this->date_when)) return false;
|
||||
return dol_time_plus_duree($this->date_when, $this->frequency, $this->unit_frequency);
|
||||
@ -973,7 +973,7 @@ class FactureRec extends CommonInvoice
|
||||
*
|
||||
* @return boolean False by default, True if maximum number of generation is reached
|
||||
*/
|
||||
function isMaxNbGenReached()
|
||||
public function isMaxNbGenReached()
|
||||
{
|
||||
$ret = false;
|
||||
if ($this->nb_gen_max > 0 && ($this->nb_gen_done >= $this->nb_gen_max)) $ret = true;
|
||||
@ -986,7 +986,7 @@ class FactureRec extends CommonInvoice
|
||||
* @param string $ret Default value to output
|
||||
* @return boolean False by default, True if maximum number of generation is reached
|
||||
*/
|
||||
function strikeIfMaxNbGenReached($ret)
|
||||
public function strikeIfMaxNbGenReached($ret)
|
||||
{
|
||||
// Special case to strike the date
|
||||
return ($this->isMaxNbGenReached()?'<strike>':'').$ret.($this->isMaxNbGenReached()?'</strike>':'');
|
||||
@ -1002,7 +1002,7 @@ class FactureRec extends CommonInvoice
|
||||
* @param int $forcevalidation 1=Force validation of invoice whatever is template auto_validate flag.
|
||||
* @return int 0 if OK, < 0 if KO (this function is used also by cron so only 0 is OK)
|
||||
*/
|
||||
function createRecurringInvoices($restrictioninvoiceid = 0, $forcevalidation = 0)
|
||||
public function createRecurringInvoices($restrictioninvoiceid = 0, $forcevalidation = 0)
|
||||
{
|
||||
global $conf, $langs, $db, $user, $hookmanager;
|
||||
|
||||
@ -1159,7 +1159,7 @@ class FactureRec extends CommonInvoice
|
||||
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
|
||||
* @return string String with URL
|
||||
*/
|
||||
function getNomUrl($withpicto = 0, $option = '', $max = 0, $short = 0, $moretitle = '', $notooltip = '', $save_lastsearch_value = -1)
|
||||
public function getNomUrl($withpicto = 0, $option = '', $max = 0, $short = 0, $moretitle = '', $notooltip = '', $save_lastsearch_value = -1)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
@ -1210,13 +1210,13 @@ class FactureRec extends CommonInvoice
|
||||
* @param integer $alreadypaid Not used on recurring invoices
|
||||
* @return string Label of status
|
||||
*/
|
||||
function getLibStatut($mode = 0, $alreadypaid = -1)
|
||||
public function getLibStatut($mode = 0, $alreadypaid = -1)
|
||||
{
|
||||
|
||||
return $this->LibStatut($this->frequency?1:0, $this->suspended, $mode, $alreadypaid, empty($this->type)?0:$this->type);
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Return label of a status
|
||||
*
|
||||
@ -1227,7 +1227,7 @@ class FactureRec extends CommonInvoice
|
||||
* @param int $type Type invoice
|
||||
* @return string Label of status
|
||||
*/
|
||||
function LibStatut($recur, $status, $mode = 0, $alreadypaid = -1, $type = 0)
|
||||
public function LibStatut($recur, $status, $mode = 0, $alreadypaid = -1, $type = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $langs;
|
||||
@ -1328,7 +1328,7 @@ class FactureRec extends CommonInvoice
|
||||
* @param string $option ''=Create a specimen invoice with lines, 'nolines'=No lines
|
||||
* @return void
|
||||
*/
|
||||
function initAsSpecimen($option = '')
|
||||
public function initAsSpecimen($option = '')
|
||||
{
|
||||
global $user,$langs,$conf;
|
||||
|
||||
@ -1477,10 +1477,10 @@ class FactureRec extends CommonInvoice
|
||||
* Update frequency and unit
|
||||
*
|
||||
* @param int $frequency value of frequency
|
||||
* @param string $unit unit of frequency (d, m, y)
|
||||
* @param string $unit unit of frequency (d, m, y)
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function setFrequencyAndUnit($frequency, $unit)
|
||||
public function setFrequencyAndUnit($frequency, $unit)
|
||||
{
|
||||
if (! $this->table_element)
|
||||
{
|
||||
@ -1523,7 +1523,7 @@ class FactureRec extends CommonInvoice
|
||||
* @param int $increment_nb_gen_done 0 do nothing more, >0 increment nb_gen_done
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function setNextDate($date, $increment_nb_gen_done = 0)
|
||||
public function setNextDate($date, $increment_nb_gen_done = 0)
|
||||
{
|
||||
if (! $this->table_element)
|
||||
{
|
||||
@ -1555,7 +1555,7 @@ class FactureRec extends CommonInvoice
|
||||
* @param int $nb number of maximum period
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function setMaxPeriod($nb)
|
||||
public function setMaxPeriod($nb)
|
||||
{
|
||||
if (! $this->table_element)
|
||||
{
|
||||
@ -1588,7 +1588,7 @@ class FactureRec extends CommonInvoice
|
||||
* @param int $validate 0 to create in draft, 1 to create and validate invoice
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function setAutoValidate($validate)
|
||||
public function setAutoValidate($validate)
|
||||
{
|
||||
if (! $this->table_element)
|
||||
{
|
||||
@ -1619,7 +1619,7 @@ class FactureRec extends CommonInvoice
|
||||
* @param int $validate 0 no document, 1 to generate document
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function setGeneratePdf($validate)
|
||||
public function setGeneratePdf($validate)
|
||||
{
|
||||
if (! $this->table_element)
|
||||
{
|
||||
@ -1645,12 +1645,12 @@ class FactureRec extends CommonInvoice
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the model for documents
|
||||
* Update the model for documents
|
||||
*
|
||||
* @param string $model model of document generator
|
||||
* @return int <0 if KO, >0 if OK
|
||||
* @param string $model model of document generator
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function setModelPdf($model)
|
||||
public function setModelPdf($model)
|
||||
{
|
||||
if (! $this->table_element)
|
||||
{
|
||||
@ -1694,8 +1694,8 @@ class FactureLigneRec extends CommonInvoiceLine
|
||||
*/
|
||||
public $table_element='facturedet_rec';
|
||||
|
||||
var $date_start_fill;
|
||||
var $date_end_fill;
|
||||
public $date_start_fill;
|
||||
public $date_end_fill;
|
||||
|
||||
|
||||
/**
|
||||
@ -1705,7 +1705,7 @@ class FactureLigneRec extends CommonInvoiceLine
|
||||
* @param int $notrigger Disable triggers
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function delete(User $user, $notrigger = false)
|
||||
public function delete(User $user, $notrigger = false)
|
||||
{
|
||||
$error=0;
|
||||
|
||||
@ -1748,7 +1748,7 @@ class FactureLigneRec extends CommonInvoiceLine
|
||||
* @param int $rowid Id of invoice
|
||||
* @return int 1 if OK, < 0 if KO
|
||||
*/
|
||||
function fetch($rowid)
|
||||
public function fetch($rowid)
|
||||
{
|
||||
$sql = 'SELECT l.rowid, l.fk_facture ,l.fk_product, l.product_type, l.label as custom_label, l.description, l.product_type, l.price, l.qty, l.vat_src_code, l.tva_tx,';
|
||||
$sql.= ' l.localtax1_tx, l.localtax2_tx, l.localtax1_type, l.localtax2_type, l.remise, l.remise_percent, l.subprice,';
|
||||
@ -1823,7 +1823,7 @@ class FactureLigneRec extends CommonInvoiceLine
|
||||
* @param int $notrigger No trigger
|
||||
* @return int <0 if KO, Id of line if OK
|
||||
*/
|
||||
function update(User $user, $notrigger = 0)
|
||||
public function update(User $user, $notrigger = 0)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
@ -1888,12 +1888,12 @@ class FactureLigneRec extends CommonInvoiceLine
|
||||
}
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
$this->db->rollback();
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
$this->db->rollback();
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -69,7 +69,7 @@ class PaymentTerm // extends CommonObject
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
function __construct($db)
|
||||
public function __construct($db)
|
||||
{
|
||||
$this->db = $db;
|
||||
}
|
||||
@ -82,7 +82,7 @@ class PaymentTerm // extends CommonObject
|
||||
* @param int $notrigger 0=launch triggers after, 1=disable triggers
|
||||
* @return int <0 if KO, Id of created object if OK
|
||||
*/
|
||||
function create($user, $notrigger = 0)
|
||||
public function create($user, $notrigger = 0)
|
||||
{
|
||||
global $conf, $langs;
|
||||
$error=0;
|
||||
@ -173,7 +173,7 @@ class PaymentTerm // extends CommonObject
|
||||
* @param int $id Id object
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function fetch($id)
|
||||
public function fetch($id)
|
||||
{
|
||||
global $langs;
|
||||
$sql = "SELECT";
|
||||
@ -229,7 +229,7 @@ class PaymentTerm // extends CommonObject
|
||||
*
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function getDefaultId()
|
||||
public function getDefaultId()
|
||||
{
|
||||
global $langs;
|
||||
|
||||
@ -262,13 +262,13 @@ class PaymentTerm // extends CommonObject
|
||||
|
||||
|
||||
/**
|
||||
* Update database
|
||||
* Update database
|
||||
*
|
||||
* @param User $user User that modify
|
||||
* @param int $notrigger 0=launch triggers after, 1=disable triggers
|
||||
* @return int <0 if KO, >0 if OK
|
||||
* @param User $user User that modify
|
||||
* @param int $notrigger 0=launch triggers after, 1=disable triggers
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function update($user = null, $notrigger = 0)
|
||||
public function update($user = null, $notrigger = 0)
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
@ -345,7 +345,7 @@ class PaymentTerm // extends CommonObject
|
||||
* @param int $notrigger 0=launch triggers after, 1=disable triggers
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function delete($user, $notrigger = 0)
|
||||
public function delete($user, $notrigger = 0)
|
||||
{
|
||||
global $conf, $langs;
|
||||
$error=0;
|
||||
@ -391,12 +391,12 @@ class PaymentTerm // extends CommonObject
|
||||
|
||||
|
||||
/**
|
||||
* Load an object from its id and create a new one in database
|
||||
* Load an object from its id and create a new one in database
|
||||
*
|
||||
* @param int $fromid Id of object to clone
|
||||
* @return int New id of clone
|
||||
* @param int $fromid Id of object to clone
|
||||
* @return int New id of clone
|
||||
*/
|
||||
function createFromClone($fromid)
|
||||
public function createFromClone($fromid)
|
||||
{
|
||||
global $user,$langs;
|
||||
|
||||
@ -425,10 +425,6 @@ class PaymentTerm // extends CommonObject
|
||||
$error++;
|
||||
}
|
||||
|
||||
//if (! $error)
|
||||
//{
|
||||
//}
|
||||
|
||||
unset($object->context['createfromclone']);
|
||||
|
||||
// End
|
||||
@ -445,15 +441,15 @@ class PaymentTerm // extends CommonObject
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
/**
|
||||
* Initialise an instance with random values.
|
||||
* Used to build previews or test instances.
|
||||
* id must be 0 if object instance is a specimen.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function initAsSpecimen()
|
||||
{
|
||||
*/
|
||||
public function initAsSpecimen()
|
||||
{
|
||||
$this->id=0;
|
||||
|
||||
$this->code='';
|
||||
|
||||
@ -100,13 +100,13 @@ class modLabel extends DolibarrModules
|
||||
* @param string $options Options when enabling module ('', 'noboxes')
|
||||
* @return int 1 if OK, 0 if KO
|
||||
*/
|
||||
function init($options = '')
|
||||
{
|
||||
public function init($options = '')
|
||||
{
|
||||
// Permissions
|
||||
$this->remove($options);
|
||||
|
||||
$sql = array();
|
||||
|
||||
return $this->_init($sql, $options);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -243,7 +243,7 @@ class modReception extends DolibarrModules
|
||||
* @param string $options Options when enabling module ('', 'noboxes')
|
||||
* @return int 1 if OK, 0 if KO
|
||||
*/
|
||||
function init($options = '')
|
||||
public function init($options = '')
|
||||
{
|
||||
global $conf,$langs;
|
||||
|
||||
|
||||
@ -108,7 +108,7 @@ class Cronjob extends CommonObject
|
||||
*
|
||||
* @param DoliDb $db Database handler
|
||||
*/
|
||||
function __construct($db)
|
||||
public function __construct($db)
|
||||
{
|
||||
$this->db = $db;
|
||||
}
|
||||
@ -121,7 +121,7 @@ class Cronjob extends CommonObject
|
||||
* @param int $notrigger 0=launch triggers after, 1=disable triggers
|
||||
* @return int <0 if KO, Id of created object if OK
|
||||
*/
|
||||
function create($user, $notrigger = 0)
|
||||
public function create($user, $notrigger = 0)
|
||||
{
|
||||
global $conf, $langs;
|
||||
$error=0;
|
||||
@ -302,7 +302,7 @@ class Cronjob extends CommonObject
|
||||
* @param int $id Id object
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function fetch($id)
|
||||
public function fetch($id)
|
||||
{
|
||||
$sql = "SELECT";
|
||||
$sql.= " t.rowid,";
|
||||
@ -393,7 +393,7 @@ class Cronjob extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Load object in memory from the database
|
||||
*
|
||||
@ -406,7 +406,7 @@ class Cronjob extends CommonObject
|
||||
* @param int $processing Processing or not
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function fetch_all($sortorder = 'DESC', $sortfield = 't.rowid', $limit = 0, $offset = 0, $status = 1, $filter = '', $processing = -1)
|
||||
public function fetch_all($sortorder = 'DESC', $sortfield = 't.rowid', $limit = 0, $offset = 0, $status = 1, $filter = '', $processing = -1)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $langs;
|
||||
@ -541,7 +541,7 @@ class Cronjob extends CommonObject
|
||||
* @param int $notrigger 0=launch triggers after, 1=disable triggers
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function update($user = null, $notrigger = 0)
|
||||
public function update($user = null, $notrigger = 0)
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
@ -697,31 +697,15 @@ class Cronjob extends CommonObject
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
// if (! $error)
|
||||
// {
|
||||
// if (! $notrigger)
|
||||
// {
|
||||
// Uncomment this and change MYOBJECT to your own tag if you
|
||||
// want this action calls a trigger.
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."cronjob";
|
||||
$sql.= " WHERE rowid=".$this->id;
|
||||
|
||||
//// Call triggers
|
||||
//include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||
//$interface=new Interfaces($this->db);
|
||||
//$result=$interface->run_triggers('MYOBJECT_DELETE',$this,$user,$langs,$conf);
|
||||
//if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||
//// End call triggers
|
||||
// }
|
||||
// }
|
||||
|
||||
// if (! $error)
|
||||
// {
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."cronjob";
|
||||
$sql.= " WHERE rowid=".$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
|
||||
// }
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql) {
|
||||
$error++;
|
||||
$this->errors[]="Error ".$this->db->lasterror();
|
||||
}
|
||||
|
||||
// Commit or rollback
|
||||
if ($error)
|
||||
@ -749,7 +733,7 @@ class Cronjob extends CommonObject
|
||||
* @param int $fromid Id of object to clone
|
||||
* @return int New id of clone
|
||||
*/
|
||||
function createFromClone($fromid)
|
||||
public function createFromClone($fromid)
|
||||
{
|
||||
global $user,$langs;
|
||||
|
||||
@ -805,7 +789,7 @@ class Cronjob extends CommonObject
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function initAsSpecimen()
|
||||
public function initAsSpecimen()
|
||||
{
|
||||
$this->id=0;
|
||||
$this->ref=0;
|
||||
@ -852,7 +836,7 @@ class Cronjob extends CommonObject
|
||||
* @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
|
||||
* @return string String with URL
|
||||
*/
|
||||
function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1)
|
||||
public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1)
|
||||
{
|
||||
global $db, $conf, $langs;
|
||||
global $dolibarr_main_authentication, $dolibarr_main_demo;
|
||||
@ -909,7 +893,7 @@ class Cronjob extends CommonObject
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
function info()
|
||||
public function info()
|
||||
{
|
||||
$sql = "SELECT";
|
||||
$sql.= " f.rowid, f.datec, f.tms, f.fk_user_mod, f.fk_user_author";
|
||||
@ -941,7 +925,7 @@ class Cronjob extends CommonObject
|
||||
}
|
||||
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Run a job.
|
||||
* Once job is finished, status and nb of run is updated.
|
||||
@ -950,7 +934,7 @@ class Cronjob extends CommonObject
|
||||
* @param string $userlogin User login
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function run_jobs($userlogin)
|
||||
public function run_jobs($userlogin)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $langs, $conf;
|
||||
@ -1217,7 +1201,7 @@ class Cronjob extends CommonObject
|
||||
}
|
||||
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Reprogram a job
|
||||
*
|
||||
@ -1225,7 +1209,7 @@ class Cronjob extends CommonObject
|
||||
* @param timestamp $now Date returned by dol_now()
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function reprogram_jobs($userlogin, $now)
|
||||
public function reprogram_jobs($userlogin, $now)
|
||||
{
|
||||
// phpcs:enable
|
||||
dol_syslog(get_class($this)."::reprogram_jobs userlogin:$userlogin", LOG_DEBUG);
|
||||
@ -1301,12 +1285,12 @@ class Cronjob extends CommonObject
|
||||
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
|
||||
* @return string Label of status
|
||||
*/
|
||||
function getLibStatut($mode = 0)
|
||||
public function getLibStatut($mode = 0)
|
||||
{
|
||||
return $this->LibStatut($this->status, $mode, $this->processing);
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Renvoi le libelle d'un statut donne
|
||||
*
|
||||
@ -1315,7 +1299,7 @@ class Cronjob extends CommonObject
|
||||
* @param int $processing 0=Not running, 1=Running
|
||||
* @return string Label of status
|
||||
*/
|
||||
function LibStatut($status, $mode = 0, $processing = 0)
|
||||
public function LibStatut($status, $mode = 0, $processing = 0)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $langs;
|
||||
@ -1350,11 +1334,11 @@ class Cronjob extends CommonObject
|
||||
elseif ($status == 0) return img_picto($langs->trans('Disabled').$moretext, 'statut5', 'class="pictostatus"').' '.$langs->trans('Disabled').$moretext;
|
||||
}
|
||||
elseif ($mode == 5)
|
||||
{
|
||||
if ($status == 1) return $langs->trans('Enabled').$moretext.' '.img_picto($langs->trans('Enabled').$moretext, 'statut'.($processing?'1':'4'), 'class="pictostatus"');
|
||||
elseif ($status == 0) return $langs->trans('Disabled').$moretext.' '.img_picto($langs->trans('Disabled').$moretext, 'statut5', 'class="pictostatus"');
|
||||
}
|
||||
}
|
||||
{
|
||||
if ($status == 1) return $langs->trans('Enabled').$moretext.' '.img_picto($langs->trans('Enabled').$moretext, 'statut'.($processing?'1':'4'), 'class="pictostatus"');
|
||||
elseif ($status == 0) return $langs->trans('Disabled').$moretext.' '.img_picto($langs->trans('Disabled').$moretext, 'statut5', 'class="pictostatus"');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1423,7 +1407,7 @@ class Cronjobline
|
||||
* Constructor
|
||||
*
|
||||
*/
|
||||
function __construct()
|
||||
public function __construct()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -123,13 +123,13 @@ class Fichinter extends CommonObject
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
public function __construct($db)
|
||||
{
|
||||
{
|
||||
$this->db = $db;
|
||||
|
||||
$this->products = array();
|
||||
}
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Load indicators into this->nb for board
|
||||
*
|
||||
@ -1002,16 +1002,16 @@ class Fichinter extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Defines a delivery date of intervention
|
||||
* Defines a delivery date of intervention
|
||||
*
|
||||
* @param User $user Object user who define
|
||||
* @param date $date_delivery date of delivery
|
||||
* @return int <0 if ko, >0 if ok
|
||||
*/
|
||||
* @param User $user Object user who define
|
||||
* @param date $date_delivery date of delivery
|
||||
* @return int <0 if ko, >0 if ok
|
||||
*/
|
||||
public function set_date_delivery($user, $date_delivery)
|
||||
{
|
||||
{
|
||||
// phpcs:enable
|
||||
global $conf;
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user