From 333d4873c375def6b7579e362c554830fa071566 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 25 Jun 2020 12:17:47 +0200 Subject: [PATCH] Properties ->contactid has been renamed into ->contact_id --- ChangeLog | 11 ++++++ htdocs/adherents/class/adherent.class.php | 2 +- htdocs/comm/action/card.php | 12 +++---- htdocs/comm/action/class/actioncomm.class.php | 6 ++-- htdocs/comm/action/index.php | 2 +- htdocs/comm/action/pertype.php | 22 ++++++------ htdocs/comm/action/peruser.php | 22 ++++++------ htdocs/comm/propal/card.php | 4 +-- htdocs/commande/card.php | 2 +- htdocs/commande/class/commande.class.php | 2 +- htdocs/compta/facture/class/facture.class.php | 2 +- htdocs/core/class/CSMSFile.class.php | 4 +-- htdocs/core/class/commonobject.class.php | 6 ++-- htdocs/core/class/html.formticket.class.php | 2 +- ...terface_50_modAgenda_ActionsAuto.class.php | 2 +- .../class/emailcollector.class.php | 2 +- .../install/mysql/migration/12.0.0-13.0.0.sql | 15 ++++++++ htdocs/install/mysql/tables/llx_user.sql | 15 +++----- htdocs/societe/notify/card.php | 2 +- htdocs/ticket/class/ticket.class.php | 2 +- htdocs/user/card.php | 20 +++++------ htdocs/user/class/user.class.php | 34 +++++++------------ htdocs/webservices/server_actioncomm.php | 6 ++-- htdocs/webservices/server_user.php | 2 +- 24 files changed, 106 insertions(+), 93 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2527864a862..4e35ff9e6a0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,17 @@ English Dolibarr ChangeLog -------------------------------------------------------------- +***** ChangeLog for 13.0.0 compared to 12.0.0 ***** +For users: + + + +WARNING: + +Following changes may create regressions for some external modules, but were necessary to make Dolibarr better: +* Properties ->contactid has been renamed into ->contact_id + + ***** ChangeLog for 12.0.0 compared to 11.0.0 ***** For users: diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 90dec733bc8..ec112b7d779 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -2747,7 +2747,7 @@ class Adherent extends CommonObject $actioncomm->datef = $now; $actioncomm->percentage = -1; // Not applicable $actioncomm->socid = $adherent->thirdparty->id; - $actioncomm->contactid = 0; + $actioncomm->contact_id = 0; $actioncomm->authorid = $user->id; // User saving action $actioncomm->userownerid = $user->id; // Owner of action // Fields when action is en email (content should be added into note) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 55cca00d7d7..ff368c5a759 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -177,7 +177,7 @@ if (empty($reshook) && $action == 'confirm_clone' && $confirm == 'yes') //$object->fetch($id); if (!empty($object->socpeopleassigned)) { reset($object->socpeopleassigned); - $object->contactid = key($object->socpeopleassigned); + $object->contact_id = key($object->socpeopleassigned); } $result = $object->createFromClone($user, GETPOST('socid', 'int')); if ($result > 0) { @@ -350,7 +350,7 @@ if (empty($reshook) && $action == 'add') if (!empty($object->socpeopleassigned)) { reset($object->socpeopleassigned); - $object->contactid = key($object->socpeopleassigned); + $object->contact_id = key($object->socpeopleassigned); } // Fill array 'array_options' with data from add form @@ -445,10 +445,10 @@ if (empty($reshook) && $action == 'update') $socpeopleassigned = GETPOST("socpeopleassigned", 'array'); $object->socpeopleassigned = array(); foreach ($socpeopleassigned as $cid) $object->socpeopleassigned[$cid] = array('id' => $cid); - $object->contactid = GETPOST("contactid", 'int'); - if (empty($object->contactid) && !empty($object->socpeopleassigned)) { + $object->contact_id = GETPOST("contactid", 'int'); + if (empty($object->contact_id) && !empty($object->socpeopleassigned)) { reset($object->socpeopleassigned); - $object->contactid = key($object->socpeopleassigned); + $object->contact_id = key($object->socpeopleassigned); } $object->fk_project = GETPOST("projectid", 'int'); $object->note_private = GETPOST("note", "none"); @@ -1156,7 +1156,7 @@ if ($id > 0) $object->socid = GETPOST("socid", "int"); $socpeopleassigned = GETPOST("socpeopleassigned", 'array'); foreach ($socpeopleassigned as $tmpid) $object->socpeopleassigned[$id] = array('id' => $tmpid); - $object->contactid = GETPOST("contactid", 'int'); + $object->contact_id = GETPOST("contactid", 'int'); $object->fk_project = GETPOST("projectid", 'int'); $object_private = GETPOST("note", 'none'); diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 2cda34a494b..dd20325c194 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -492,7 +492,7 @@ class ActionComm extends CommonObject $sql .= ((isset($this->socid) && $this->socid > 0) ? $this->socid : "null").", "; $sql .= ((isset($this->fk_project) && $this->fk_project > 0) ? $this->fk_project : "null").", "; $sql .= " '".$this->db->escape($this->note_private)."', "; - $sql .= ((isset($this->contactid) && $this->contactid > 0) ? $this->contactid : "null").", "; + $sql .= ((isset($this->contact_id) && $this->contact_id > 0) ? $this->contact_id : "null").", "; $sql .= (isset($user->id) && $user->id > 0 ? $user->id : "null").", "; $sql .= ($userownerid > 0 ? $userownerid : "null").", "; $sql .= ($userdoneid > 0 ? $userdoneid : "null").", "; @@ -758,7 +758,7 @@ class ActionComm extends CommonObject $this->transparency = $obj->transparency; $this->socid = $obj->fk_soc; // To have fetch_thirdparty method working - $this->contactid = $obj->fk_contact; // To have fetch_contact method working + $this->contact_id = $obj->fk_contact; // To have fetch_contact method working $this->fk_project = $obj->fk_project; // To have fetch_projet method working //$this->societe->id = $obj->fk_soc; // deprecated @@ -999,7 +999,7 @@ class ActionComm extends CommonObject } $socid = (($this->socid > 0) ? $this->socid : 0); - $contactid = (($this->contactid > 0) ? $this->contactid : 0); + $contactid = (($this->contact_id > 0) ? $this->contact_id : 0); $userownerid = ($this->userownerid ? $this->userownerid : 0); $userdoneid = ($this->userdoneid ? $this->userdoneid : 0); diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 17b1307fb89..dd04e5f757c 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -1642,7 +1642,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa if ($event->type_code == 'ICALEVENT') print '
('.dol_trunc($event->icalname, $maxnbofchar).')'; $thirdparty_id = ($event->thirdparty_id > 0 ? $event->thirdparty_id : ((is_object($event->societe) && $event->societe->id > 0) ? $event->societe->id : 0)); - $contact_id = ($event->contact_id > 0 ? $event->contact_id : ((is_object($event->contact) && $event->cotact->id > 0) ? $event->contact->id : 0)); + $contact_id = ($event->contact_id > 0 ? $event->contact_id : ((is_object($event->contact) && $event->contact->id > 0) ? $event->contact->id : 0)); // If action related to company / contact $linerelatedto = ''; diff --git a/htdocs/comm/action/pertype.php b/htdocs/comm/action/pertype.php index a769d709c4d..5b91dcd8c7c 100644 --- a/htdocs/comm/action/pertype.php +++ b/htdocs/comm/action/pertype.php @@ -469,7 +469,7 @@ if ($resql) $event->fk_project = $obj->fk_project; $event->socid = $obj->fk_soc; - $event->contactid = $obj->fk_contact; + $event->contact_id = $obj->fk_contact; $event->fk_element = $obj->fk_element; $event->elementtype = $obj->elementtype; @@ -880,15 +880,15 @@ function show_day_events_pertype($username, $day, $month, $year, $monthshown, $s } $cases1[$h][$event->id]['string'] .= ', '.$cachethirdparties[$event->socid]->name; } - if ($event->contactid > 0) + if ($event->contact_id > 0) { - if (empty($cachecontacts[$event->contactid])) + if (empty($cachecontacts[$event->contact_id])) { $tmpcontact = new Contact($db); - $tmpcontact->fetch($event->contactid); - $cachecontacts[$event->contactid] = $tmpcontact; + $tmpcontact->fetch($event->contact_id); + $cachecontacts[$event->contact_id] = $tmpcontact; } - $cases1[$h][$event->id]['string'] .= ', '.$cachecontacts[$event->contactid]->getFullName($langs); + $cases1[$h][$event->id]['string'] .= ', '.$cachecontacts[$event->contact_id]->getFullName($langs); } } if ($event->date_start_in_calendar < $c && $dateendtouse > $b) @@ -926,15 +926,15 @@ function show_day_events_pertype($username, $day, $month, $year, $monthshown, $s } $cases2[$h][$event->id]['string'] .= ', '.$cachethirdparties[$event->socid]->name; } - if ($event->contactid > 0) + if ($event->contact_id > 0) { - if (empty($cachecontacts[$event->contactid])) + if (empty($cachecontacts[$event->contact_id])) { $tmpcontact = new Contact($db); - $tmpcontact->fetch($event->contactid); - $cachecontacts[$event->contactid] = $tmpcontact; + $tmpcontact->fetch($event->contact_id); + $cachecontacts[$event->contact_id] = $tmpcontact; } - $cases2[$h][$event->id]['string'] .= ', '.$cachecontacts[$event->contactid]->getFullName($langs); + $cases2[$h][$event->id]['string'] .= ', '.$cachecontacts[$event->contact_id]->getFullName($langs); } } } else { diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index ef2c60e5ae6..81028796dc2 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -534,7 +534,7 @@ if ($resql) $event->fk_project = $obj->fk_project; $event->socid = $obj->fk_soc; - $event->contactid = $obj->fk_contact; + $event->contact_id = $obj->fk_contact; $event->fk_element = $obj->fk_element; $event->elementtype = $obj->elementtype; @@ -1071,15 +1071,15 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, & } $cases1[$h][$event->id]['string'] .= ', '.$cachethirdparties[$event->socid]->name; } - if ($event->contactid > 0) + if ($event->contact_id > 0) { - if (empty($cachecontacts[$event->contactid])) + if (empty($cachecontacts[$event->contact_id])) { $tmpcontact = new Contact($db); - $tmpcontact->fetch($event->contactid); - $cachecontacts[$event->contactid] = $tmpcontact; + $tmpcontact->fetch($event->contact_id); + $cachecontacts[$event->contact_id] = $tmpcontact; } - $cases1[$h][$event->id]['string'] .= ', '.$cachecontacts[$event->contactid]->getFullName($langs); + $cases1[$h][$event->id]['string'] .= ', '.$cachecontacts[$event->contact_id]->getFullName($langs); } } if ($event->date_start_in_calendar < $c && $dateendtouse > $b) @@ -1117,15 +1117,15 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, & } $cases2[$h][$event->id]['string'] .= ', '.$cachethirdparties[$event->socid]->name; } - if ($event->contactid > 0) + if ($event->contact_id > 0) { - if (empty($cachecontacts[$event->contactid])) + if (empty($cachecontacts[$event->contact_id])) { $tmpcontact = new Contact($db); - $tmpcontact->fetch($event->contactid); - $cachecontacts[$event->contactid] = $tmpcontact; + $tmpcontact->fetch($event->contact_id); + $cachecontacts[$event->contact_id] = $tmpcontact; } - $cases2[$h][$event->id]['string'] .= ', '.$cachecontacts[$event->contactid]->getFullName($langs); + $cases2[$h][$event->id]['string'] .= ', '.$cachecontacts[$event->contact_id]->getFullName($langs); } } } else { diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index e737aa1d8c3..00c311d7209 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -347,7 +347,7 @@ if (empty($reshook)) $object->remise_percent = GETPOST('remise_percent'); $object->remise_absolue = GETPOST('remise_absolue'); $object->socid = GETPOST('socid', 'int'); - $object->contactid = GETPOST('contactid', 'int'); + $object->contact_id = GETPOST('contactid', 'int'); $object->fk_project = GETPOST('projectid', 'int'); $object->modelpdf = GETPOST('model'); $object->author = $user->id; // deprecated @@ -375,7 +375,7 @@ if (empty($reshook)) $object->cond_reglement_id = GETPOST('cond_reglement_id'); $object->mode_reglement_id = GETPOST('mode_reglement_id'); $object->fk_account = GETPOST('fk_account', 'int'); - $object->contactid = GETPOST('contactid', 'int'); + $object->contact_id = GETPOST('contactid', 'int'); $object->fk_project = GETPOST('projectid', 'int'); $object->modelpdf = GETPOST('model'); $object->author = $user->id; // deprecated diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index d7f7b659492..f9288f49d20 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -278,7 +278,7 @@ if (empty($reshook)) $object->shipping_method_id = GETPOST('shipping_method_id', 'int'); $object->warehouse_id = GETPOST('warehouse_id', 'int'); $object->fk_delivery_address = GETPOST('fk_address'); - $object->contactid = GETPOST('contactid'); + $object->contact_id = GETPOST('contactid'); $object->fk_incoterms = GETPOST('incoterm_id', 'int'); $object->location_incoterms = GETPOST('location_incoterms', 'alpha'); $object->multicurrency_code = GETPOST('multicurrency_code', 'alpha'); diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 1c3c44dce93..28d2170e49a 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1338,7 +1338,7 @@ class Commande extends CommonOrder $this->shipping_method_id = $object->shipping_method_id; $this->warehouse_id = $object->warehouse_id; $this->fk_delivery_address = $object->fk_delivery_address; - $this->contact_id = $object->contactid; + $this->contact_id = $object->contact_id; $this->ref_client = $object->ref_client; if (empty($conf->global->MAIN_DISABLE_PROPAGATE_NOTES_FROM_ORIGIN)) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 369f4f0ee25..784c4e3f39d 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1311,7 +1311,7 @@ class Facture extends CommonInvoice $this->demand_reason_id = $object->demand_reason_id; $this->date_livraison = $object->date_livraison; $this->fk_delivery_address = $object->fk_delivery_address; // deprecated - $this->contact_id = $object->contactid; + $this->contact_id = $object->contact_id; $this->ref_client = $object->ref_client; if (empty($conf->global->MAIN_DISABLE_PROPAGATE_NOTES_FROM_ORIGIN)) diff --git a/htdocs/core/class/CSMSFile.class.php b/htdocs/core/class/CSMSFile.class.php index 4e496408f1d..4f1959d2707 100644 --- a/htdocs/core/class/CSMSFile.class.php +++ b/htdocs/core/class/CSMSFile.class.php @@ -131,7 +131,7 @@ class CSMSFile $sms->nostop = $this->nostop; $sms->socid = $this->socid; - $sms->contactid = $this->contactid; + $sms->contact_id = $this->contact_id; $sms->project = $this->fk_project; $res = $sms->SmsSend(); @@ -162,7 +162,7 @@ class CSMSFile $sms->nostop = $this->nostop; $sms->socid = $this->socid; - $sms->contactid = $this->contactid; + $sms->contact_id = $this->contact_id; $sms->fk_project = $this->fk_project; $res = $sms->SmsSend(); diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 91ffaeffc4c..703460a8053 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -1424,15 +1424,15 @@ abstract class CommonObject // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Load object contact with id=$this->contactid into $this->contact + * Load object contact with id=$this->contact_id into $this->contact * - * @param int $contactid Id du contact. Use this->contactid if empty. + * @param int $contactid Id du contact. Use this->contact_id if empty. * @return int <0 if KO, >0 if OK */ public function fetch_contact($contactid = null) { // phpcs:enable - if (empty($contactid)) $contactid = $this->contactid; + if (empty($contactid)) $contactid = $this->contact_id; if (empty($contactid)) return 0; diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php index 8dcd4965c65..d2e709c69a3 100644 --- a/htdocs/core/class/html.formticket.class.php +++ b/htdocs/core/class/html.formticket.class.php @@ -338,7 +338,7 @@ class FormTicket print ''; } else { print ''; - print ''; + print ''; print ''; } diff --git a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php index 2807a3b5a56..1d70938e87c 100644 --- a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php +++ b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php @@ -838,7 +838,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $actioncomm->durationp = 0; $actioncomm->percentage = -1; // Not applicable $actioncomm->socid = $societeforaction->id; - $actioncomm->contactid = $contactforaction->id; + $actioncomm->contact_id = $contactforaction->id; $actioncomm->authorid = $user->id; // User saving action $actioncomm->userownerid = $user->id; // Owner of action // Fields defined when action is an email (content should be into object->actionmsg to be added into note, subject into object->actionms2 to be added into label) diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index 55bd07d7789..1a546256483 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -1533,7 +1533,7 @@ class EmailCollector extends CommonObject $actioncomm->datef = $date; $actioncomm->percentage = -1; // Not applicable $actioncomm->socid = $thirdpartystatic->id; - $actioncomm->contactid = $contactstatic->id; + $actioncomm->contact_id = $contactstatic->id; $actioncomm->socpeopleassigned = (!empty($contactstatic->id) ? array($contactstatic->id => '') : array()); $actioncomm->authorid = $user->id; // User saving action $actioncomm->userownerid = $user->id; // Owner of action diff --git a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql index fc9e22d6c60..869720d8bbd 100644 --- a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql +++ b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql @@ -54,3 +54,18 @@ ALTER TABLE llx_subscription MODIFY COLUMN datef DATETIME; ALTER TABLE llx_loan_schedule ADD column fk_payment_loan INTEGER; + +ALTER TABLE llx_user DROP COLUMN jabberid; +ALTER TABLE llx_user DROP COLUMN skype; +ALTER TABLE llx_user DROP COLUMN twitter; +ALTER TABLE llx_user DROP COLUMN facebook; +ALTER TABLE llx_user DROP COLUMN linkedin; +ALTER TABLE llx_user DROP COLUMN instagram; +ALTER TABLE llx_user DROP COLUMN snapchat; +ALTER TABLE llx_user DROP COLUMN googleplus; +ALTER TABLE llx_user DROP COLUMN youtube; +ALTER TABLE llx_user DROP COLUMN whatsapp; + +ALTER TABLE llx_user ADD COLUMN datestartvalidity datetime; +ALTER TABLE llx_user ADD COLUMN dateendvalidity datetime; + diff --git a/htdocs/install/mysql/tables/llx_user.sql b/htdocs/install/mysql/tables/llx_user.sql index 16170267bee..e27ac19c15a 100644 --- a/htdocs/install/mysql/tables/llx_user.sql +++ b/htdocs/install/mysql/tables/llx_user.sql @@ -57,32 +57,27 @@ create table llx_user personal_email varchar(255), socialnetworks text DEFAULT NULL, -- json with socialnetworks - jabberid varchar(255), - skype varchar(255), - twitter varchar(255), -- - facebook varchar(255), -- - linkedin varchar(255), -- - instagram varchar(255), -- - snapchat varchar(255), -- - googleplus varchar(255), -- - youtube varchar(255), -- - whatsapp varchar(255), -- signature text DEFAULT NULL, admin smallint DEFAULT 0, + module_comm smallint DEFAULT 1, module_compta smallint DEFAULT 1, + fk_soc integer, fk_socpeople integer, fk_member integer, fk_user integer, -- Hierarchic parent fk_user_expense_validator integer, fk_user_holiday_validator integer, + note_public text, note text DEFAULT NULL, model_pdf varchar(255) DEFAULT NULL, datelastlogin datetime, datepreviouslogin datetime, + datestartvalidity datetime, + dateendvalidity datetime, iplastlogin varchar(250), ippreviouslogin varchar(250), egroupware_id integer, diff --git a/htdocs/societe/notify/card.php b/htdocs/societe/notify/card.php index 2a0d2603e5b..18cc536d6b8 100644 --- a/htdocs/societe/notify/card.php +++ b/htdocs/societe/notify/card.php @@ -316,7 +316,7 @@ if ($result > 0) { $obj = $db->fetch_object($resql); - $contactstatic->id = $obj->contactid; + $contactstatic->id = $obj->contact_id; $contactstatic->lastname = $obj->lastname; $contactstatic->firstname = $obj->firstname; print ''.$contactstatic->getNomUrl(1); diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 4555884c536..2964203a727 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -2618,7 +2618,7 @@ class Ticket extends CommonObject foreach ($external_contacts as $key => $info_sendto) { // altairis: avoid duplicate emails to external contacts - if ($info_sendto['id'] == $user->contactid) { + if ($info_sendto['id'] == $user->contact_id) { continue; } diff --git a/htdocs/user/card.php b/htdocs/user/card.php index bc036cdcd9f..de0005bde56 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -1529,7 +1529,7 @@ if ($action == 'create' || $action == 'adduserldap') print $form->textwithpicto($text, $langs->trans("InternalExternalDesc")); print ''; $type = $langs->trans("Internal"); - if ($object->societe_id > 0) $type = $langs->trans("External"); + if ($object->socid > 0) $type = $langs->trans("External"); print $type; if ($object->ldap_sid) print ' ('.$langs->trans("DomainUser").')'; print ''."\n"; @@ -1766,10 +1766,10 @@ if ($action == 'create' || $action == 'adduserldap') } else { print $langs->trans("ThisUserIsNot"); } - if (!empty($object->contactid)) + if (!empty($object->contact_id)) { $contact = new Contact($db); - $contact->fetch($object->contactid); + $contact->fetch($object->contact_id); if ($object->socid > 0) print ' / '; else print '
'; print $contact->getNomUrl(1, ''); @@ -2214,15 +2214,15 @@ if ($action == 'create' || $action == 'adduserldap') } else { // Select mode $type = 0; - if ($object->contactid) $type = $object->contactid; + if ($object->contact_id) $type = $object->contact_id; - if ($object->socid > 0 && ! ($object->contactid > 0)) { // external user but no link to a contact + if ($object->socid > 0 && ! ($object->contact_id > 0)) { // external user but no link to a contact print img_picto('', 'company').$form->select_company($object->socid, 'socid', '', ' '); print img_picto('', 'contact').$form->selectcontacts(0, 0, 'contactid', 1, '', '', 1, '', false, 1); if ($object->ldap_sid) print ' ('.$langs->trans("DomainUser").')'; - } elseif ($object->socid > 0 && $object->contactid > 0) { // external user with a link to a contact + } elseif ($object->socid > 0 && $object->contact_id > 0) { // external user with a link to a contact print img_picto('', 'company').$form->select_company(0, 'socid', '', ' '); // We keep thirdparty empty, contact is already set - print img_picto('', 'contact').$form->selectcontacts(0, $object->contactid, 'contactid', 1, '', '', 1, '', false, 1); + print img_picto('', 'contact').$form->selectcontacts(0, $object->contact_id, 'contactid', 1, '', '', 1, '', false, 1); if ($object->ldap_sid) print ' ('.$langs->trans("DomainUser").')'; } else { // $object->socid is not > 0 here print img_picto('', 'company').$form->select_company(0, 'socid', '', ' '); // We keep thirdparty empty, contact is already set @@ -2523,11 +2523,11 @@ if ($action == 'create' || $action == 'adduserldap') $societe = new Societe($db); $societe->fetch($object->socid); print $societe->getNomUrl(1, ''); - if ($object->contactid) + if ($object->contact_id) { $contact = new Contact($db); - $contact->fetch($object->contactid); - print ' / '.img_object($langs->trans("ShowContact"), 'contact').' '.dol_trunc($contact->getFullName($langs), 32).''; + $contact->fetch($object->contact_id); + print ' / '.img_object($langs->trans("ShowContact"), 'contact').' '.dol_trunc($contact->getFullName($langs), 32).''; } } else { print $langs->trans("ThisUserIsNot"); diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 03df07f24f6..fdac9cc1051 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -130,18 +130,9 @@ class User extends CommonObject public $datem; //! If this is defined, it is an external user - /** - * @deprecated - * @see $socid - */ - public $societe_id; - /** - * @deprecated - * @see $contactid - */ - public $contact_id; public $socid; - public $contactid; + //! If this is defined, it is a user created from a contact + public $contact_id; /** * @var int ID @@ -162,6 +153,8 @@ class User extends CommonObject public $datelastlogin; public $datepreviouslogin; + public $datestartvalidity; + public $dateedvalidity; public $photo; public $lang; @@ -177,7 +170,7 @@ class User extends CommonObject public $users = array(); // To store all tree of users hierarchy public $parentof; // To store an array of all parents for all ids. - private $cache_childids; + private $cache_childids; // Cache array of already loaded childs public $accountancy_code; // Accountancy code in prevision of the complete accountancy module @@ -270,6 +263,8 @@ class User extends CommonObject $sql .= " u.tms as datem,"; $sql .= " u.datelastlogin as datel,"; $sql .= " u.datepreviouslogin as datep,"; + $sql .= " u.datestartvalidity,"; + $sql .= " u.dateendvalidity,"; $sql .= " u.photo as photo,"; $sql .= " u.openid as openid,"; $sql .= " u.accountancy_code,"; @@ -388,11 +383,11 @@ class User extends CommonObject $this->datem = $this->db->jdate($obj->datem); $this->datelastlogin = $this->db->jdate($obj->datel); $this->datepreviouslogin = $this->db->jdate($obj->datep); + $this->datestartvalidity = $this->db->jdate($obj->datestartvalidity); + $this->dateendvalidity = $this->db->jdate($obj->dateendvalidity); - $this->societe_id = $obj->fk_soc; // deprecated - $this->contact_id = $obj->fk_socpeople; // deprecated $this->socid = $obj->fk_soc; - $this->contactid = $obj->fk_socpeople; + $this->contact_id = $obj->fk_socpeople; $this->fk_member = $obj->fk_member; $this->fk_user = $obj->fk_user; $this->fk_user_expense_validator = $obj->fk_user_expense_validator; @@ -1044,9 +1039,9 @@ class User extends CommonObject } // If contact, remove link - if ($this->contactid > 0 || $this->contact_id > 0) + if ($this->contact_id > 0) { - $sql = "UPDATE ".MAIN_DB_PREFIX."socpeople SET fk_user_creat = null WHERE rowid = ".(($this->contactid > 0) ? $this->contactid : $this->contact_id); + $sql = "UPDATE ".MAIN_DB_PREFIX."socpeople SET fk_user_creat = null WHERE rowid = ".$this->contact_id); if (!$error && !$this->db->query($sql)) { $error++; @@ -1651,8 +1646,7 @@ class User extends CommonObject require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; - // This user is linked with a contact, so we also update contact information - // if this is an update. + // This user is linked with a contact, so we also update contact information if this is an update. $tmpobj = new Contact($this->db); $result = $tmpobj->fetch($this->contact_id); @@ -2643,8 +2637,6 @@ class User extends CommonObject $this->datepreviouslogin = $now; $this->statut = 1; - //$this->societe_id = 1; For external users - //$this->contact_id = 1; For external users $this->entity = 1; } diff --git a/htdocs/webservices/server_actioncomm.php b/htdocs/webservices/server_actioncomm.php index 092624c1501..c9e035edc6b 100644 --- a/htdocs/webservices/server_actioncomm.php +++ b/htdocs/webservices/server_actioncomm.php @@ -300,7 +300,7 @@ function getActionComm($authentication, $id) 'fulldayevent'=> $actioncomm->fulldayevent, 'location'=> $actioncomm->location, 'socid'=> $actioncomm->socid, - 'contactid'=> $actioncomm->contactid, + 'contactid'=> $actioncomm->contact_id, 'projectid'=> $actioncomm->fk_project, 'fk_element'=> $actioncomm->fk_element, 'elementtype'=> $actioncomm->elementtype @@ -438,7 +438,7 @@ function createActionComm($authentication, $actioncomm) $newobject->socid = $actioncomm['socid']; $newobject->fk_project = $actioncomm['projectid']; $newobject->note = $actioncomm['note']; - $newobject->contactid = $actioncomm['contactid']; + $newobject->contact_id = $actioncomm['contactid']; $newobject->userownerid = $actioncomm['userownerid']; $newobject->label = $actioncomm['label']; $newobject->percentage = $actioncomm['percentage']; @@ -533,7 +533,7 @@ function updateActionComm($authentication, $actioncomm) $object->datef = $actioncomm['datef']; $object->type_code = $actioncomm['type_code']; $object->socid = $actioncomm['socid']; - $object->contactid = $actioncomm['contactid']; + $object->contact_id = $actioncomm['contactid']; $object->fk_project = $actioncomm['projectid']; $object->note = $actioncomm['note']; $object->userownerid = $actioncomm['userownerid']; diff --git a/htdocs/webservices/server_user.php b/htdocs/webservices/server_user.php index 3353b433fa5..bc43c4ab6d4 100644 --- a/htdocs/webservices/server_user.php +++ b/htdocs/webservices/server_user.php @@ -360,7 +360,7 @@ function getUser($authentication, $id, $ref = '', $ref_ext = '') 'datec' => dol_print_date($user->datec, 'dayhourrfc'), 'datem' => dol_print_date($user->datem, 'dayhourrfc'), 'fk_thirdparty' => $user->socid, - 'fk_contact' => $user->contactid, + 'fk_contact' => $user->contact_id, 'fk_member' => $user->fk_member, 'datelastlogin' => dol_print_date($user->datelastlogin, 'dayhourrfc'), 'datepreviouslogin' => dol_print_date($user->datepreviouslogin, 'dayhourrfc'),