mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
deprecate set_as_client
This commit is contained in:
parent
4ae9cea409
commit
26dff90658
|
|
@ -2702,7 +2702,7 @@ class Propal extends CommonObject
|
|||
// The connected company is classified as a client
|
||||
$soc=new Societe($this->db);
|
||||
$soc->id = $this->socid;
|
||||
$result = $soc->set_as_client();
|
||||
$result = $soc->setAsCustomer();
|
||||
|
||||
if ($result < 0) {
|
||||
$this->error=$this->db->lasterror();
|
||||
|
|
|
|||
|
|
@ -505,7 +505,7 @@ class Commande extends CommonOrder
|
|||
$soc->fetch($this->socid);
|
||||
|
||||
// Class of company linked to order
|
||||
$result = $soc->set_as_client();
|
||||
$result = $soc->setAsCustomer();
|
||||
|
||||
// Define new ref
|
||||
if (!$error && (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref))) { // empty should not happened, but when it occurs, the test save life
|
||||
|
|
|
|||
|
|
@ -3372,7 +3372,7 @@ class Facture extends CommonInvoice
|
|||
|
||||
if (!$error) {
|
||||
// Define third party as a customer
|
||||
$result = $this->thirdparty->set_as_client();
|
||||
$result = $this->thirdparty->setAsCustomer();
|
||||
|
||||
// If active we decrement the main product and its components at invoice validation
|
||||
if ($this->type != self::TYPE_DEPOSIT && $result >= 0 && isModEnabled('stock') && !empty($conf->global->STOCK_CALCULATE_ON_BILL) && $idwarehouse > 0) {
|
||||
|
|
|
|||
|
|
@ -499,7 +499,7 @@ class Contrat extends CommonObject
|
|||
|
||||
// A contract is validated so we can move thirdparty to status customer
|
||||
if (empty($conf->global->CONTRACT_DISABLE_AUTOSET_AS_CLIENT_ON_CONTRACT_VALIDATION)) {
|
||||
$result = $this->thirdparty->set_as_client();
|
||||
$result = $this->thirdparty->setAsCustomer();
|
||||
}
|
||||
|
||||
// Define new ref
|
||||
|
|
|
|||
|
|
@ -725,7 +725,7 @@ class Expedition extends CommonObject
|
|||
$soc->fetch($this->socid);
|
||||
|
||||
// Class of company linked to order
|
||||
$result = $soc->set_as_client();
|
||||
$result = $soc->setAsCustomer();
|
||||
|
||||
// Define new ref
|
||||
if (!$error && (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref))) { // empty should not happened, but when it occurs, the test save life
|
||||
|
|
|
|||
|
|
@ -2171,16 +2171,30 @@ class Societe extends CommonObject
|
|||
* Define third party as a customer
|
||||
*
|
||||
* @return int <0 if KO, >0 if OK
|
||||
* @deprecated
|
||||
* @see setAsCustomer()
|
||||
*/
|
||||
public function set_as_client()
|
||||
{
|
||||
// phpcs:enable
|
||||
dol_syslog(get_class($this)."::set_as_client is deprecated use setAsCustomer instead", LOG_NOTICE);
|
||||
return $this->setAsCustomer();
|
||||
}
|
||||
|
||||
/**
|
||||
* Define third party as a customer
|
||||
*
|
||||
* @return int <0 if KO, >0 if OK
|
||||
* @since dolibarr v19
|
||||
*/
|
||||
public function setAsCustomer()
|
||||
{
|
||||
if ($this->id) {
|
||||
$newclient = 1;
|
||||
if (($this->client == 2 || $this->client == 3) && empty($conf->global->SOCIETE_DISABLE_PROSPECTSCUSTOMERS)) {
|
||||
if (($this->client == 2 || $this->client == 3) && !getDolGlobalInt('SOCIETE_DISABLE_PROSPECTSCUSTOMERS')) {
|
||||
$newclient = 3; //If prospect, we keep prospect tag
|
||||
}
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."societe";
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;
|
||||
$sql .= " SET client = ".((int) $newclient);
|
||||
$sql .= " WHERE rowid = ".((int) $this->id);
|
||||
|
||||
|
|
|
|||
|
|
@ -337,7 +337,7 @@ class SocieteTest extends PHPUnit\Framework\TestCase
|
|||
$langs=$this->savlangs;
|
||||
$db=$this->savdb;
|
||||
|
||||
$result=$localobject->set_as_client();
|
||||
$result=$localobject->setAsCustomer();
|
||||
print __METHOD__." id=".$localobject->id." result=".$result."\n";
|
||||
$this->assertLessThan($result, 0);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user