Qual: Add deprecated tag on functions that seems to not be used.

This commit is contained in:
Laurent Destailleur 2011-12-07 18:57:35 +01:00
parent 1b2c0120da
commit f9e5f25fd2
6 changed files with 51 additions and 119 deletions

View File

@ -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 "<br>\n";
if ($address->error)
@ -258,7 +258,7 @@ if ($_GET["action"] == 'create' || $_POST["action"] == 'create')
print '<table class="border" width="100%">';
print '<tr><td class="fieldrequired">'.$langs->trans('AddressLabel').'</td><td><input type="text" size="30" name="label" id="label" value="'.($address->label?$address->label:$langs->trans('RequiredField')).'"></td></tr>';
print '<tr><td class="fieldrequired">'.$langs->trans('Label').'</td><td><input type="text" size="30" name="label" id="label" value="'.($address->label?$address->label:$langs->trans('RequiredField')).'"></td></tr>';
print '<tr><td class="fieldrequired">'.$langs->trans('Name').'</td><td><input type="text" size="30" name="name" id="name" value="'.($address->name?$address->name:$langs->trans('RequiredField')).'"></td></tr>';
print '<tr><td valign="top">'.$langs->trans('Address').'</td><td colspan="3"><textarea name="address" cols="40" rows="3" wrap="soft">';
@ -287,10 +287,11 @@ if ($_GET["action"] == 'create' || $_POST["action"] == 'create')
print $address->note;
print '</textarea></td></tr>';
print '<tr><td colspan="4" align="center">';
print '<input type="submit" class="button" value="'.$langs->trans('AddAddress').'"></td></tr>'."\n";
print '</table>'."\n";
print '<br><center>';
print '<input type="submit" class="button" value="'.$langs->trans('AddAddress').'"></center>'."\n";
print '</form>'."\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);

View File

@ -1260,7 +1260,7 @@ if ($id > 0 || ! empty($ref))
print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('PaymentConditionsShort');
print '</td>';
if ($action != 'editconditions' && $object->brouillon) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editconditions&amp;id='.$object->id.'">'.img_edit($langs->trans('SetConditions'),1).'</a></td>';
if ($action != 'editconditions' && $object->brouillon) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editconditions&amp;id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetConditions'),1).'</a></td>';
print '</tr></table>';
print '</td><td colspan="3">';
if ($action == 'editconditions')
@ -1280,7 +1280,7 @@ if ($id > 0 || ! empty($ref))
print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('DeliveryDate');
print '</td>';
if ($action != 'editdate_livraison' && $object->brouillon) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editdate_livraison&amp;id='.$object->id.'">'.img_edit($langs->trans('SetDeliveryDate'),1).'</a></td>';
if ($action != 'editdate_livraison' && $object->brouillon) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editdate_livraison&amp;id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetDeliveryDate'),1).'</a></td>';
print '</tr></table>';
print '</td><td colspan="3">';
if ($action == 'editdate_livraison')
@ -1307,7 +1307,7 @@ if ($id > 0 || ! empty($ref))
print $langs->trans('DeliveryAddress');
print '</td>';
if ($action != 'editdelivery_address' && $object->brouillon) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editdelivery_address&amp;socid='.$object->socid.'&amp;id='.$object->id.'">'.img_edit($langs->trans('SetDeliveryAddress'),1).'</a></td>';
if ($action != 'editdelivery_address' && $object->brouillon) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editdelivery_address&amp;socid='.$object->socid.'&amp;id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetDeliveryAddress'),1).'</a></td>';
print '</tr></table>';
print '</td><td colspan="3">';
@ -1328,7 +1328,7 @@ if ($id > 0 || ! empty($ref))
print $langs->trans('AvailabilityPeriod');
if ($conf->commande->enabled) print ' ('.$langs->trans('AfterOrder').')';
print '</td>';
if ($action != 'editavailability' && $object->brouillon) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editavailability&amp;id='.$object->id.'">'.img_edit($langs->trans('SetAvailability'),1).'</a></td>';
if ($action != 'editavailability' && $object->brouillon) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editavailability&amp;id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetAvailability'),1).'</a></td>';
print '</tr></table>';
print '</td><td colspan="3">';
if ($action == 'editavailability')
@ -1348,7 +1348,7 @@ if ($id > 0 || ! empty($ref))
print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('Source');
print '</td>';
if ($action != 'editdemandreason' && $object->brouillon) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editdemandreason&amp;id='.$object->id.'">'.img_edit($langs->trans('SetDemandReason'),1).'</a></td>';
if ($action != 'editdemandreason' && $object->brouillon) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editdemandreason&amp;id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetDemandReason'),1).'</a></td>';
print '</tr></table>';
print '</td><td colspan="3">';
//print $object->demand_reason_id;
@ -1370,7 +1370,7 @@ if ($id > 0 || ! empty($ref))
print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('PaymentMode');
print '</td>';
if ($action != 'editmode' && $object->brouillon) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editmode&amp;id='.$object->id.'">'.img_edit($langs->trans('SetMode'),1).'</a></td>';
if ($action != 'editmode' && $object->brouillon) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editmode&amp;id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetMode'),1).'</a></td>';
print '</tr></table>';
print '</td><td colspan="3">';
if ($action == 'editmode')
@ -1392,7 +1392,7 @@ if ($id > 0 || ! empty($ref))
print $langs->trans('Project').'</td>';
if ($user->rights->propale->creer)
{
if ($action != 'classify') print '<td align="right"><a href="'.$_SERVER['PHP_SELF'].'?action=classify&amp;id='.$object->id.'">'.img_edit($langs->trans('SetProject')).'</a></td>';
if ($action != 'classify') print '<td align="right"><a href="'.$_SERVER['PHP_SELF'].'?action=classify&amp;id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a></td>';
print '</tr></table>';
print '</td><td colspan="3">';
if ($action == 'classify')

View File

@ -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
*/

View File

@ -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='')
{

View File

@ -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)
{

View File

@ -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)
{