diff --git a/htdocs/comm/address.php b/htdocs/comm/address.php index c05429e4536..99a632263b6 100644 --- a/htdocs/comm/address.php +++ b/htdocs/comm/address.php @@ -214,7 +214,7 @@ if ($_GET["action"] == 'create' || $_POST["action"] == 'create') $address->pays = $obj->libelle; } - print_titre($langs->trans("NewAddress")); + print_titre($langs->trans("AddAddress")); print "
\n"; if ($address->error) @@ -258,7 +258,7 @@ if ($_GET["action"] == 'create' || $_POST["action"] == 'create') print ''; - print ''; + print ''; print ''; print ''; - print ''."\n"; - print '
'.$langs->trans('AddressLabel').'
'.$langs->trans('Label').'
'.$langs->trans('Name').'
'.$langs->trans('Address').'
'; - print '
'."\n"; + + print '
'; + print '
'."\n"; + print ''."\n"; } @@ -411,7 +412,7 @@ else * Fiche societe en mode visu */ $address = new Address($db); - $result=$address->fetch($socid); + $result=$address->fetch_lines($socid); if ($result < 0) { dol_print_error($db,$address->error); diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 0d88a1a9840..2f83f113c16 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -1260,7 +1260,7 @@ if ($id > 0 || ! empty($ref)) print ''; - if ($action != 'editconditions' && $object->brouillon) print ''; + if ($action != 'editconditions' && $object->brouillon) print ''; print '
'; print $langs->trans('PaymentConditionsShort'); print 'id.'">'.img_edit($langs->trans('SetConditions'),1).'id.'">'.img_edit($langs->transnoentitiesnoconv('SetConditions'),1).'
'; print ''; if ($action == 'editconditions') @@ -1280,7 +1280,7 @@ if ($id > 0 || ! empty($ref)) print ''; - if ($action != 'editdate_livraison' && $object->brouillon) print ''; + if ($action != 'editdate_livraison' && $object->brouillon) print ''; print '
'; print $langs->trans('DeliveryDate'); print 'id.'">'.img_edit($langs->trans('SetDeliveryDate'),1).'id.'">'.img_edit($langs->transnoentitiesnoconv('SetDeliveryDate'),1).'
'; print ''; if ($action == 'editdate_livraison') @@ -1307,7 +1307,7 @@ if ($id > 0 || ! empty($ref)) print $langs->trans('DeliveryAddress'); print ''; - if ($action != 'editdelivery_address' && $object->brouillon) print 'socid.'&id='.$object->id.'">'.img_edit($langs->trans('SetDeliveryAddress'),1).''; + if ($action != 'editdelivery_address' && $object->brouillon) print 'socid.'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetDeliveryAddress'),1).''; print ''; print ''; @@ -1328,7 +1328,7 @@ if ($id > 0 || ! empty($ref)) print $langs->trans('AvailabilityPeriod'); if ($conf->commande->enabled) print ' ('.$langs->trans('AfterOrder').')'; print ''; - if ($action != 'editavailability' && $object->brouillon) print 'id.'">'.img_edit($langs->trans('SetAvailability'),1).''; + if ($action != 'editavailability' && $object->brouillon) print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetAvailability'),1).''; print ''; print ''; if ($action == 'editavailability') @@ -1348,7 +1348,7 @@ if ($id > 0 || ! empty($ref)) print ''; - if ($action != 'editdemandreason' && $object->brouillon) print ''; + if ($action != 'editdemandreason' && $object->brouillon) print ''; print '
'; print $langs->trans('Source'); print 'id.'">'.img_edit($langs->trans('SetDemandReason'),1).'id.'">'.img_edit($langs->transnoentitiesnoconv('SetDemandReason'),1).'
'; print ''; //print $object->demand_reason_id; @@ -1370,7 +1370,7 @@ if ($id > 0 || ! empty($ref)) print ''; - if ($action != 'editmode' && $object->brouillon) print ''; + if ($action != 'editmode' && $object->brouillon) print ''; print '
'; print $langs->trans('PaymentMode'); print 'id.'">'.img_edit($langs->trans('SetMode'),1).'id.'">'.img_edit($langs->transnoentitiesnoconv('SetMode'),1).'
'; print ''; if ($action == 'editmode') @@ -1392,7 +1392,7 @@ if ($id > 0 || ! empty($ref)) print $langs->trans('Project').''; if ($user->rights->propale->creer) { - if ($action != 'classify') print ''.img_edit($langs->trans('SetProject')).''; + if ($action != 'classify') print ''.img_edit($langs->transnoentitiesnoconv('SetProject')).''; print ''; print ''; if ($action == 'classify') diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index bbb52cb840e..8c199c0a952 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -587,22 +587,6 @@ abstract class CommonObject return $result; } - /** - * Load delivery adresse id into $this->fk_address - * - * @param fk_address Id of address - * @return int <0 if KO, >0 if OK - */ - function fetch_address($fk_address) - { - $object = new Societe($this->db); - $result=$object->fetch_address($fk_address); - $this->deliveryaddress = $object; // TODO obsolete - $this->adresse = $object; // TODO obsolete - $this->address = $object; - return $result; - } - /** * Read linked origin object */ diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index b6edad4462c..7f8b9150fd3 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -2841,14 +2841,15 @@ class Form } /** - * Affiche formulaire de selection de l'adresse + * Show form to select addresse * - * @param page Page - * @param selected Id condition pre-selectionne - * @param htmlname Nom du formulaire select - * @param origin Origine de l'appel pour pouvoir creer un retour - * @param originid Id de l'origine - * @return void + * @param page Page + * @param selected Id condition pre-selectionne + * @param htmlname Nom du formulaire select + * @param origin Origine de l'appel pour pouvoir creer un retour + * @param originid Id de l'origine + * @return void + * @deprecated */ function form_address($page, $selected='', $socid, $htmlname='address_id', $origin='', $originid='') { diff --git a/htdocs/societe/class/address.class.php b/htdocs/societe/class/address.class.php index 21f8d27db13..fade073eca4 100644 --- a/htdocs/societe/class/address.class.php +++ b/htdocs/societe/class/address.class.php @@ -27,6 +27,7 @@ /** * \class Address * \brief Class to manage addresses + * @deprecated */ class Address { @@ -48,18 +49,13 @@ class Address /** - * \brief Constructeur de la classe - * \param DB handler acces base de donnees - * \param id id societe (0 par defaut) + * Constructeur de la classe + * + * @param DoliDB $db handler acces base de donnees */ - function Address($DB, $id=0) + function Address($db) { - global $conf; - - $this->db = $DB; - - $this->id = $id; - + $this->db = $db; return 1; } @@ -242,12 +238,13 @@ class Address } /** - * \brief Charge depuis la base toutes les adresses d'une societe - * \param socid Id de la societe a charger en memoire - * \param user Objet de l'utilisateur - * \return int >0 si ok, <0 si ko + * Charge depuis la base toutes les adresses d'une societe + * + * @param int $socid Id de la societe a charger en memoire + * @param User $user Objet de l'utilisateur + * @return int >0 si ok, <0 si ko */ - function fetch($socid, $user=0) + function fetch_lines($socid, $user=0) { global $langs, $conf; @@ -337,10 +334,11 @@ class Address } /** - * \brief Charge depuis la base l'objet adresse - * \param id Id de l'adresse a charger en memoire - * \param user Objet de l'utilisateur - * \return int >0 si ok, <0 si ko + * Charge depuis la base l'objet adresse + * + * @param int $id Id de l'adresse a charger en memoire + * @param User $user Objet de l'utilisateur + * @return int >0 si ok, <0 si ko */ function fetch_address($id, $user=0) { diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index d612d50a77e..00e4c2c3cc1 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -174,8 +174,8 @@ class Societe extends CommonObject /** * Create third party in database * - * @param user Object of user that ask creation - * @return int >= 0 if OK, < 0 if KO + * @param User $user Object of user that ask creation + * @return int >= 0 if OK, < 0 if KO */ function create($user='') { @@ -371,13 +371,13 @@ class Societe extends CommonObject /** * Update parameters of third party * - * @param id id societe - * @param user Utilisateur qui demande la mise a jour - * @param call_trigger 0=non, 1=oui - * @param allowmodcodeclient Inclut modif code client et code compta - * @param allowmodcodefournisseur Inclut modif code fournisseur et code compta fournisseur - * @param action 'create' or 'update' - * @return int <0 if KO, >=0 if OK + * @param int $id id societe + * @param User $user Utilisateur qui demande la mise a jour + * @param int $call_trigger 0=non, 1=oui + * @param int $allowmodcodeclient Inclut modif code client et code compta + * @param int $allowmodcodefournisseur Inclut modif code fournisseur et code compta fournisseur + * @param string $action 'create' or 'update' + * @return int <0 if KO, >=0 if OK */ function update($id, $user='', $call_trigger=1, $allowmodcodeclient=0, $allowmodcodefournisseur=0, $action='update') { @@ -616,6 +616,7 @@ class Societe extends CommonObject /** * Load a third party from database into memory + * * @param rowid Id of third party to load * @param ref Reference of third party, name (Warning, this can return several records) * @param ref_ext External reference of third party (Warning, this information is a free field not provided by Dolibarr) @@ -809,65 +810,12 @@ class Societe extends CommonObject return $result; } - /** - * Lit une adresse - * TODO: utiliser la classe address - */ - function fetch_address($id) - { - global $conf,$langs; - - $sql = "SELECT l.rowid, l.label, l.fk_soc, l.name, l.address, l.cp"; - $sql .= ", l.tms as dm, l.datec as dc"; - $sql .= ", l.ville, l.fk_pays, l.note, l.tel, l.fax"; - $sql .= ", p.libelle as pays, p.code as pays_code"; - $sql .= " FROM ".MAIN_DB_PREFIX."societe_address as l"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_pays as p ON l.fk_pays = p.rowid"; - $sql .= " WHERE l.rowid = ".$id; - - $result = $this->db->query($sql); - - if ( $result ) - { - $obj = $this->db->fetch_object($result); - - $this->id = $obj->rowid; - $this->datec = $this->db->jdate($obj->dc); - $this->datem = $this->db->jdate($obj->dm); - $this->label = $obj->label; - $this->socid = $obj->fk_soc; - $this->name = $obj->name; - $this->address = $obj->address; - $this->cp = $obj->cp; // TODO deprecated - $this->zip = $obj->cp; - $this->ville = $obj->ville; // TODO deprecated - $this->town = $obj->ville; - $this->pays_id = $obj->fk_pays; - $this->pays_code = $obj->fk_pays?$obj->pays_code:''; - $this->pays = $obj->fk_pays?($langs->trans('Country'.$obj->pays_code)!='Country'.$obj->pays_code?$langs->trans('Country'.$obj->pays_code):$obj->pays):''; // TODO deprecated - $this->country = $obj->fk_pays?($langs->trans('Country'.$obj->pays_code)!='Country'.$obj->pays_code?$langs->trans('Country'.$obj->pays_code):$obj->pays):''; - $this->tel = $obj->tel; // TODO deprecated - $this->phone = $obj->tel; - $this->fax = $obj->fax; - $this->note = $obj->note; - - - $this->db->free($result); - - return 1; - } - else - { - $this->error=$this->db->error(); - return -1; - } - } /** * Delete a third party from database and all its dependencies (contacts, rib...) * - * @param id id of third party to delete - * @return int <0 if KO, 0 if nothing done, >0 if OK + * @param int $id Id of third party to delete + * @return int <0 if KO, 0 if nothing done, >0 if OK */ function delete($id) {