diff --git a/dev/generate-commande.php b/dev/generate-commande.php index 168b7ae18b1..e18d4ee1b81 100644 --- a/dev/generate-commande.php +++ b/dev/generate-commande.php @@ -139,7 +139,7 @@ for ($s = 0 ; $s < GEN_NUMBER_COMMANDE ; $s++) $com = new Commande($db); - $com->socidp = 4; + $com->socid = 4; $com->date_commande = $dates[rand(1, sizeof($dates)-1)]; $com->note = $_POST["note"]; $com->source = 1; diff --git a/htdocs/adherents/cotisation.class.php b/htdocs/adherents/cotisation.class.php index 2031acd0b49..343b8a929b9 100644 --- a/htdocs/adherents/cotisation.class.php +++ b/htdocs/adherents/cotisation.class.php @@ -33,411 +33,407 @@ class Cotisation { - var $id; - var $db; - var $date; - var $amount; - var $prenom; - var $nom; - var $societe; - var $adresse; - var $cp; - var $ville; - var $pays; - var $email; - var $public; - var $projetid; - var $modepaiement; - var $modepaiementid; - var $commentaire; - var $statut; + var $id; + var $db; + var $date; + var $amount; + var $prenom; + var $nom; + var $societe; + var $adresse; + var $cp; + var $ville; + var $pays; + var $email; + var $public; + var $projetid; + var $modepaiement; + var $modepaiementid; + var $commentaire; + var $statut; - var $projet; - var $errorstr; + var $projet; + var $errorstr; - /*! - \brief Cotisation - \param DB base de données - \param socidp - */ - - function Cotisation($DB, $socidp="") - { - $this->db = $DB ; - $this->modepaiementid = 0; - } - - - /* - * - * - */ - - function print_error_list() - { - $num = sizeof($this->errorstr); - for ($i = 0 ; $i < $num ; $i++) - { - print "
  • " . $this->errorstr[$i]; - } - } + /** + \brief Cotisation + \param DB Handler base de données + \param socid ID societe + */ + function Cotisation($DB, $socid="") + { + $this->db = $DB ; + $this->modepaiementid = 0; + } + /* - * - * - */ - - function check($minimum=0) - { - $err = 0; - - if (strlen(trim($this->societe)) == 0) + * + * + */ + function print_error_list() { - if ((strlen(trim($this->nom)) + strlen(trim($this->prenom))) == 0) - { - $error_string[$err] = "Vous devez saisir vos nom et prénom ou le nom de votre société."; - $err++; - } - } - - if (strlen(trim($this->adresse)) == 0) - { - $error_string[$err] = "L'adresse saisie est invalide"; - $err++; - } - - if (strlen(trim($this->cp)) == 0) - { - $error_string[$err] = "Le code postal saisi est invalide"; - $err++; - } - - if (strlen(trim($this->ville)) == 0) - { - $error_string[$err] = "La ville saisie est invalide"; - $err++; - } - - if (strlen(trim($this->email)) == 0) - { - $error_string[$err] = "L'email saisi est invalide"; - $err++; - } - - $this->amount = trim($this->amount); - - $map = range(0,9); - for ($i = 0; $i < strlen($this->amount) ; $i++) - { - if (!isset($map[substr($this->amount, $i, 1)] )) - { - $error_string[$err] = "Le montant du don contient un/des caractère(s) invalide(s)"; - $err++; - $amount_invalid = 1; - break; - } - } - - if (! $amount_invalid) - { - if ($this->amount == 0) - { - $error_string[$err] = "Le montant du don est null"; - $err++; - } - else - { - if ($this->amount < $minimum && $minimum > 0) + $num = sizeof($this->errorstr); + for ($i = 0 ; $i < $num ; $i++) { - $error_string[$err] = "Le montant minimum du don est de $minimum"; - $err++; + print "
  • " . $this->errorstr[$i]; } - } } - - /* - * Return errors - * - */ - if ($err) + /* + * + * + */ + function check($minimum=0) { - $this->errorstr = $error_string; - return 0; - } - else - { - return 1; + $err = 0; + + if (strlen(trim($this->societe)) == 0) + { + if ((strlen(trim($this->nom)) + strlen(trim($this->prenom))) == 0) + { + $error_string[$err] = "Vous devez saisir vos nom et prénom ou le nom de votre société."; + $err++; + } + } + + if (strlen(trim($this->adresse)) == 0) + { + $error_string[$err] = "L'adresse saisie est invalide"; + $err++; + } + + if (strlen(trim($this->cp)) == 0) + { + $error_string[$err] = "Le code postal saisi est invalide"; + $err++; + } + + if (strlen(trim($this->ville)) == 0) + { + $error_string[$err] = "La ville saisie est invalide"; + $err++; + } + + if (strlen(trim($this->email)) == 0) + { + $error_string[$err] = "L'email saisi est invalide"; + $err++; + } + + $this->amount = trim($this->amount); + + $map = range(0,9); + for ($i = 0; $i < strlen($this->amount) ; $i++) + { + if (!isset($map[substr($this->amount, $i, 1)] )) + { + $error_string[$err] = "Le montant du don contient un/des caractère(s) invalide(s)"; + $err++; + $amount_invalid = 1; + break; + } + } + + if (! $amount_invalid) + { + if ($this->amount == 0) + { + $error_string[$err] = "Le montant du don est null"; + $err++; + } + else + { + if ($this->amount < $minimum && $minimum > 0) + { + $error_string[$err] = "Le montant minimum du don est de $minimum"; + $err++; + } + } + } + + /* + * Return errors + * + */ + + if ($err) + { + $this->errorstr = $error_string; + return 0; + } + else + { + return 1; + } + } - } - -/*! + /** \brief fonction qui permet de créer le don \param userid userid de l'adhérent -*/ - + */ function create($userid) - { - /* - * Insertion dans la base - */ - - $this->date = $this->db->idate($this->date); - - $sql = "INSERT INTO ".MAIN_DB_PREFIX."don (datec, amount, fk_paiement,prenom, nom, societe,adresse, cp, ville, pays, public, fk_don_projet, note, fk_user_author, datedon, email)"; - $sql .= " VALUES (now(), $this->amount, $this->modepaiementid,'$this->prenom','$this->nom','$this->societe','$this->adresse', '$this->cp','$this->ville','$this->pays',$this->public, $this->projetid, '$this->commentaire', $userid, '$this->date','$this->email')"; - - $result = $this->db->query($sql); - - if ($result) { - return $this->db->last_insert_id(MAIN_DB_PREFIX."don"); + /* + * Insertion dans la base + */ + + $this->date = $this->db->idate($this->date); + + $sql = "INSERT INTO ".MAIN_DB_PREFIX."don (datec, amount, fk_paiement,prenom, nom, societe,adresse, cp, ville, pays, public, fk_don_projet, note, fk_user_author, datedon, email)"; + $sql .= " VALUES (now(), $this->amount, $this->modepaiementid,'$this->prenom','$this->nom','$this->societe','$this->adresse', '$this->cp','$this->ville','$this->pays',$this->public, $this->projetid, '$this->commentaire', $userid, '$this->date','$this->email')"; + + $result = $this->db->query($sql); + + if ($result) + { + return $this->db->last_insert_id(MAIN_DB_PREFIX."don"); + } + else + { + dolibarr_print_error($this->db); + return 0; + } } - else + + /*! + \brief fonction qui permet de mettre à jour le don + \param userid userid de l'adhérent + */ + + function update($userid) { - dolibarr_print_error($this->db); - return 0; - } - } -/*! - \brief fonction qui permet de mettre à jour le don - \param userid userid de l'adhérent -*/ + $this->date = $this->db->idate($this->date); - function update($userid) - { - - $this->date = $this->db->idate($this->date); + $sql = "UPDATE ".MAIN_DB_PREFIX."don SET "; + $sql .= "amount = " . $this->amount; + $sql .= ",fk_paiement = ".$this->modepaiementid; + $sql .= ",prenom = '".$this->prenom ."'"; + $sql .= ",nom='".$this->nom."'"; + $sql .= ",societe='".$this->societe."'"; + $sql .= ",adresse='".$this->adresse."'"; + $sql .= ",cp='".$this->cp."'"; + $sql .= ",ville='".$this->ville."'"; + $sql .= ",pays='".$this->pays."'"; + $sql .= ",public=".$this->public; + $sql .= ",fk_don_projet=".$this->projetid; + $sql .= ",note='".$this->commentaire."'"; + $sql .= ",datedon='".$this->date."'"; + $sql .= ",email='".$this->email."'"; + $sql .= ",fk_statut=".$this->statut; - $sql = "UPDATE ".MAIN_DB_PREFIX."don SET "; - $sql .= "amount = " . $this->amount; - $sql .= ",fk_paiement = ".$this->modepaiementid; - $sql .= ",prenom = '".$this->prenom ."'"; - $sql .= ",nom='".$this->nom."'"; - $sql .= ",societe='".$this->societe."'"; - $sql .= ",adresse='".$this->adresse."'"; - $sql .= ",cp='".$this->cp."'"; - $sql .= ",ville='".$this->ville."'"; - $sql .= ",pays='".$this->pays."'"; - $sql .= ",public=".$this->public; - $sql .= ",fk_don_projet=".$this->projetid; - $sql .= ",note='".$this->commentaire."'"; - $sql .= ",datedon='".$this->date."'"; - $sql .= ",email='".$this->email."'"; - $sql .= ",fk_statut=".$this->statut; + $sql .= " WHERE rowid = $this->id"; - $sql .= " WHERE rowid = $this->id"; - - $result = $this->db->query($sql); - - if ($result) - { - return 1; + $result = $this->db->query($sql); + + if ($result) + { + return 1; + } + else + { + dolibarr_print_error($this->db); + return 0; + } } - else + + /*! + \brief fonction qui permet de supprimer le don + \param rowid + */ + + function delete($rowid) + { - dolibarr_print_error($this->db); - return 0; - } - } - /*! - \brief fonction qui permet de supprimer le don - \param rowid - */ + $sql = "DELETE FROM ".MAIN_DB_PREFIX."don WHERE rowid = $rowid AND fk_statut = 0;"; - function delete($rowid) + if ( $this->db->query( $sql) ) + { + if ( $this->db->affected_rows() ) + { + return 1; + } + else + { + return 0; + } + } + else + { + dolibarr_print_error($this->db); + return 0; + } + } - { + /*! + \brief fonction qui permet de récupèrer le don + \param rowid + */ - $sql = "DELETE FROM ".MAIN_DB_PREFIX."don WHERE rowid = $rowid AND fk_statut = 0;"; + function fetch($rowid) + { + $sql = "SELECT d.rowid, ".$this->db->pdate("d.datedon")." as datedon, d.prenom, d.nom, d.societe, d.amount, p.libelle as projet, d.fk_statut, d.adresse, d.cp, d.ville, d.pays, d.public, d.amount, d.fk_paiement, d.note, cp.libelle, d.email, d.fk_don_projet"; + $sql .= " FROM ".MAIN_DB_PREFIX."don as d, ".MAIN_DB_PREFIX."don_projet as p, ".MAIN_DB_PREFIX."c_paiement as cp"; - if ( $this->db->query( $sql) ) - { - if ( $this->db->affected_rows() ) - { - return 1; - } - else - { - return 0; - } - } - else - { - dolibarr_print_error($this->db); - return 0; - } - } + $sql .= " WHERE p.rowid = d.fk_don_projet AND cp.id = d.fk_paiement AND d.rowid = $rowid"; - /*! - \brief fonction qui permet de récupèrer le don - \param rowid - */ + if ( $this->db->query( $sql) ) + { + if ($this->db->num_rows()) + { - function fetch($rowid) - { - $sql = "SELECT d.rowid, ".$this->db->pdate("d.datedon")." as datedon, d.prenom, d.nom, d.societe, d.amount, p.libelle as projet, d.fk_statut, d.adresse, d.cp, d.ville, d.pays, d.public, d.amount, d.fk_paiement, d.note, cp.libelle, d.email, d.fk_don_projet"; - $sql .= " FROM ".MAIN_DB_PREFIX."don as d, ".MAIN_DB_PREFIX."don_projet as p, ".MAIN_DB_PREFIX."c_paiement as cp"; + $obj = $this->db->fetch_object(); - $sql .= " WHERE p.rowid = d.fk_don_projet AND cp.id = d.fk_paiement AND d.rowid = $rowid"; + $this->id = $obj->rowid; + $this->date = $obj->datedon; + $this->prenom = stripslashes($obj->prenom); + $this->nom = stripslashes($obj->nom); + $this->societe = stripslashes($obj->societe); + $this->statut = $obj->fk_statut; + $this->adresse = stripslashes($obj->adresse); + $this->cp = stripslashes($obj->cp); + $this->ville = stripslashes($obj->ville); + $this->email = stripslashes($obj->email); + $this->pays = stripslashes($obj->pays); + $this->projet = $obj->projet; + $this->projetid = $obj->fk_don_projet; + $this->public = $obj->public; + $this->modepaiementid = $obj->fk_paiement; + $this->modepaiement = $obj->libelle; + $this->amount = $obj->amount; + $this->commentaire = stripslashes($obj->note); + } + } + else + { + print $this->db->error(); + } - if ( $this->db->query( $sql) ) - { - if ($this->db->num_rows()) - { + } - $obj = $this->db->fetch_object(); + /*! + \brief fonction qui permet de valider la promesse de don + \param rowid + \param userid userid de l'adhérent + */ - $this->id = $obj->rowid; - $this->date = $obj->datedon; - $this->prenom = stripslashes($obj->prenom); - $this->nom = stripslashes($obj->nom); - $this->societe = stripslashes($obj->societe); - $this->statut = $obj->fk_statut; - $this->adresse = stripslashes($obj->adresse); - $this->cp = stripslashes($obj->cp); - $this->ville = stripslashes($obj->ville); - $this->email = stripslashes($obj->email); - $this->pays = stripslashes($obj->pays); - $this->projet = $obj->projet; - $this->projetid = $obj->fk_don_projet; - $this->public = $obj->public; - $this->modepaiementid = $obj->fk_paiement; - $this->modepaiement = $obj->libelle; - $this->amount = $obj->amount; - $this->commentaire = stripslashes($obj->note); - } - } - else - { - print $this->db->error(); - } + function valid_promesse($rowid, $userid) + { - } + $sql = "UPDATE ".MAIN_DB_PREFIX."don SET fk_statut = 1, fk_user_valid = $userid WHERE rowid = $rowid AND fk_statut = 0;"; - /*! - \brief fonction qui permet de valider la promesse de don - \param rowid - \param userid userid de l'adhérent - */ + if ( $this->db->query( $sql) ) + { + if ( $this->db->affected_rows() ) + { + return 1; + } + else + { + return 0; + } + } + else + { + dolibarr_print_error($this->db); + return 0; + } + } - function valid_promesse($rowid, $userid) - { - - $sql = "UPDATE ".MAIN_DB_PREFIX."don SET fk_statut = 1, fk_user_valid = $userid WHERE rowid = $rowid AND fk_statut = 0;"; - - if ( $this->db->query( $sql) ) - { - if ( $this->db->affected_rows() ) - { - return 1; - } - else - { - return 0; - } - } - else - { - dolibarr_print_error($this->db); - return 0; - } - } - - /*! - \brief fonction qui permet de définir la cotisation comme payée - \param rowid rowid de la cotisation - \param modepaiement mode de paiement - */ + /*! + \brief fonction qui permet de définir la cotisation comme payée + \param rowid rowid de la cotisation + \param modepaiement mode de paiement + */ function set_paye($rowid, $modepaiement='') - { - $sql = "UPDATE ".MAIN_DB_PREFIX."don SET fk_statut = 2"; + { + $sql = "UPDATE ".MAIN_DB_PREFIX."don SET fk_statut = 2"; - if ($modepaiement) - { - $sql .= ", fk_paiement=$modepaiement"; - } - $sql .= " WHERE rowid = $rowid AND fk_statut = 1;"; + if ($modepaiement) + { + $sql .= ", fk_paiement=$modepaiement"; + } + $sql .= " WHERE rowid = $rowid AND fk_statut = 1;"; - if ( $this->db->query( $sql) ) - { - if ( $this->db->affected_rows() ) - { - return 1; - } - else - { - return 0; - } - } - else - { - dolibarr_print_error($this->db); - return 0; - } - } + if ( $this->db->query( $sql) ) + { + if ( $this->db->affected_rows() ) + { + return 1; + } + else + { + return 0; + } + } + else + { + dolibarr_print_error($this->db); + return 0; + } + } - /*! - \brief fonction qui permet de mettre un commentaire sur le don - \param rowid - \param commentaire - */ + /*! + \brief fonction qui permet de mettre un commentaire sur le don + \param rowid + \param commentaire + */ - function set_commentaire($rowid, $commentaire='') - { - $sql = "UPDATE ".MAIN_DB_PREFIX."don SET note = '$commentaire'"; + function set_commentaire($rowid, $commentaire='') + { + $sql = "UPDATE ".MAIN_DB_PREFIX."don SET note = '$commentaire'"; - $sql .= " WHERE rowid = $rowid ;"; + $sql .= " WHERE rowid = $rowid ;"; - if ( $this->db->query( $sql) ) - { - if ( $this->db->affected_rows() ) - { - return 1; - } - else - { - return 0; - } - } - else - { - dolibarr_print_error($this->db); - return 0; - } - } + if ( $this->db->query( $sql) ) + { + if ( $this->db->affected_rows() ) + { + return 1; + } + else + { + return 0; + } + } + else + { + dolibarr_print_error($this->db); + return 0; + } + } - /*! - \brief fonction qui permet de mettre le don comme encaissé - \param rowid - */ + /*! + \brief fonction qui permet de mettre le don comme encaiss + \param rowid + */ function set_encaisse($rowid) - { + { - $sql = "UPDATE ".MAIN_DB_PREFIX."don SET fk_statut = 3 WHERE rowid = $rowid AND fk_statut = 2;"; + $sql = "UPDATE ".MAIN_DB_PREFIX."don SET fk_statut = 3 WHERE rowid = $rowid AND fk_statut = 2;"; - if ( $this->db->query( $sql) ) - { - if ( $this->db->affected_rows() ) - { - return 1; - } - else - { - return 0; - } - } - else - { - dolibarr_print_error($this->db); - return 0; - } - } + if ( $this->db->query( $sql) ) + { + if ( $this->db->affected_rows() ) + { + return 1; + } + else + { + return 0; + } + } + else + { + dolibarr_print_error($this->db); + return 0; + } + } } diff --git a/htdocs/bon-prelevement.class.php b/htdocs/bon-prelevement.class.php index 338f2f49ea8..b5f27a37cdb 100644 --- a/htdocs/bon-prelevement.class.php +++ b/htdocs/bon-prelevement.class.php @@ -752,7 +752,7 @@ class BonPrelevement if ($fact->fetch($fac[0]) >= 0) { $soc = new Societe($this->db); - if ($soc->fetch($fact->socidp) >= 0) + if ($soc->fetch($fact->socid) >= 0) { if ($soc->verif_rib() == 1) { @@ -763,8 +763,8 @@ class BonPrelevement } else { - dolibarr_syslog("Erreur de RIB societe $fact->socidp $soc->nom"); - $facture_errors[$fac[0]]="Erreur de RIB societe $fact->socidp $soc->nom"; + dolibarr_syslog("Erreur de RIB societe $fact->socid $soc->nom"); + $facture_errors[$fac[0]]="Erreur de RIB societe $fact->socid $soc->nom"; } } else diff --git a/htdocs/comm/action/document.php b/htdocs/comm/action/document.php index 0d0a6f04c95..3b28f6a746b 100755 --- a/htdocs/comm/action/document.php +++ b/htdocs/comm/action/document.php @@ -47,7 +47,7 @@ $upload_dir = $conf->actions->dir_output.'/'.$_GET['id']; if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } diff --git a/htdocs/comm/action/fiche.php b/htdocs/comm/action/fiche.php index a8532d3e581..01bdd400474 100644 --- a/htdocs/comm/action/fiche.php +++ b/htdocs/comm/action/fiche.php @@ -43,7 +43,7 @@ $langs->load("orders"); if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } if (isset($_GET["error"])) $error=$_GET["error"]; diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 87f8aa12438..43004611ebc 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -34,7 +34,7 @@ require_once(DOL_DOCUMENT_ROOT."/actioncomm.class.php"); $langs->load("companies"); -$socidp = isset($_GET["socid"])?$_GET["socid"]:$_POST["socid"]; +$socid = isset($_GET["socid"])?$_GET["socid"]:$_POST["socid"]; $sortfield = isset($_GET["sortfield"])?$_GET["sortfield"]:$_POST["sortfield"]; $sortorder = isset($_GET["sortorder"])?$_GET["sortorder"]:$_POST["sortorder"]; $page = isset($_GET["page"])?$_GET["page"]:$_POST["page"]; @@ -43,7 +43,7 @@ $page = isset($_GET["page"])?$_GET["page"]:$_POST["page"]; if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } if ($page == -1) { $page = 0 ; } @@ -62,12 +62,12 @@ llxHeader(); * */ -$sql = "SELECT s.nom as societe, s.idp as socidp, s.client,"; +$sql = "SELECT s.nom as societe, s.idp as socid, s.client,"; $sql.= " a.id,".$db->pdate("a.datep")." as dp, a.fk_contact, a.note, a.percent as percent,"; $sql.= " c.code as acode, c.libelle, u.code, u.rowid as userid"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", sc.fk_soc, sc.fk_user"; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user"; $sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as a, ".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."user as u"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE a.fk_soc = s.idp AND c.id=a.fk_action AND a.fk_user_author = u.rowid"; if ($_GET["type"]) { @@ -77,11 +77,11 @@ if ($_GET["time"] == "today") { $sql .= " AND date_format(a.datep, '%d%m%Y') = ".strftime("%d%m%Y",time()); } -if ($socidp) +if ($socid) { - $sql .= " AND s.idp = $socidp"; + $sql .= " AND s.idp = $socid"; } -if (!$user->rights->commercial->client->voir && !$socidp) //restriction +if (!$user->rights->commercial->client->voir && !$socid) //restriction { $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; } @@ -101,10 +101,10 @@ if ($resql) if ($status == 'todo') $title="ToDoActions"; $param="&status=$status"; - if ($socidp) + if ($socid) { $societe = new Societe($db); - $societe->fetch($socidp); + $societe->fetch($socid); print_barre_liste($langs->trans($title."For",$societe->nom), $page, "index.php",$param,$sortfield,$sortorder,'',$num); } @@ -178,7 +178,7 @@ if ($resql) if ($obj->client == 1) $url=DOL_URL_ROOT.'/comm/fiche.php?socid='; elseif ($obj->client == 2) $url=DOL_URL_ROOT.'/comm/prospect/fiche.php?id='; else $url=DOL_URL_ROOT.'/soc.php?socid='; - print ' '.img_object($langs->trans("ShowCompany"),"company").' '.dolibarr_trunc($obj->societe,24).''; + print ' '.img_object($langs->trans("ShowCompany"),"company").' '.dolibarr_trunc($obj->societe,24).''; // Contact print ''; diff --git a/htdocs/comm/action/info.php b/htdocs/comm/action/info.php index 0cc2f099b16..ab62bb43565 100644 --- a/htdocs/comm/action/info.php +++ b/htdocs/comm/action/info.php @@ -38,7 +38,7 @@ $langs->load("commercial"); if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } diff --git a/htdocs/comm/action/rapport/rapport.pdf.php b/htdocs/comm/action/rapport/rapport.pdf.php index e77c5e1bb53..de49b01bf4c 100644 --- a/htdocs/comm/action/rapport/rapport.pdf.php +++ b/htdocs/comm/action/rapport/rapport.pdf.php @@ -149,7 +149,7 @@ class CommActionRapport $pdf->SetFont('Arial','',8); $y=$pdf->GetY()+1; - $sql = "SELECT s.nom as societe, s.idp as socidp, s.client, a.id,".$this->db->pdate("a.datea")." as da, a.datea, c.libelle, u.code, a.fk_contact, a.note, a.percent as percent"; + $sql = "SELECT s.nom as societe, s.idp as socid, s.client, a.id,".$this->db->pdate("a.datea")." as da, a.datea, c.libelle, u.code, a.fk_contact, a.note, a.percent as percent"; $sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a, ".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."user as u"; $sql .= " WHERE a.fk_soc = s.idp AND c.id=a.fk_action AND a.fk_user_author = u.rowid"; diff --git a/htdocs/comm/addpropal.php b/htdocs/comm/addpropal.php index 4f3705abd95..4ee52466e92 100644 --- a/htdocs/comm/addpropal.php +++ b/htdocs/comm/addpropal.php @@ -71,7 +71,7 @@ if ($_GET["projetid"]) if ($_GET["action"] == 'create') { $soc = new Societe($db); - $result=$soc->fetch($_GET["socidp"]); + $result=$soc->fetch($_GET["socid"]); if ($result < 0) { dolibarr_print_error($db,$soc->error); @@ -97,7 +97,7 @@ if ($_GET["action"] == 'create') } } - print "
    id."\" method=\"post\">"; + print "id."\" method=\"post\">"; print ""; print ''; @@ -112,7 +112,7 @@ if ($_GET["action"] == 'create') // Societe print ''; print ''; @@ -218,7 +218,7 @@ if ($conf->expedition->enabled) { print ''; print ''; print ''; diff --git a/htdocs/comm/adresse_livraison.php b/htdocs/comm/adresse_livraison.php index 8dad4c631cf..273dcbe01cc 100644 --- a/htdocs/comm/adresse_livraison.php +++ b/htdocs/comm/adresse_livraison.php @@ -108,7 +108,7 @@ if ($_POST["action"] == 'add' || $_POST["action"] == 'update') } elseif ($origin == propal) { - Header("Location: ../comm/propal.php?action=editdelivery_adress&socidp=".$socid."&propalid=".$originid); + Header("Location: ../comm/propal.php?action=editdelivery_adress&socid=".$socid."&propalid=".$originid); exit; } else diff --git a/htdocs/comm/clients.php b/htdocs/comm/clients.php index b334b8374b8..306b5761272 100644 --- a/htdocs/comm/clients.php +++ b/htdocs/comm/clients.php @@ -35,7 +35,7 @@ if (!$user->rights->societe->lire) accessforbidden(); if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } $page=$_GET["page"]; @@ -60,7 +60,7 @@ $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."c_stcomm as st" if (!$user->rights->commercial->client->voir) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql .= " WHERE s.fk_stcomm = st.id AND s.client=1"; -if ($socidp) $sql .= " AND s.idp = $socidp"; +if ($socid) $sql .= " AND s.idp = $socid"; if ($user->societe_id) $sql .= " AND s.idp = " .$user->societe_id; if (!$user->rights->commercial->client->voir) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; diff --git a/htdocs/comm/contact.php b/htdocs/comm/contact.php index 137ef34b37b..b104e76a9b4 100644 --- a/htdocs/comm/contact.php +++ b/htdocs/comm/contact.php @@ -84,13 +84,13 @@ if ($type == "f") $sql = "SELECT s.idp, s.nom, st.libelle as stcomm"; $sql .= ", p.idp as cidp, p.name, p.firstname, p.email, p.phone"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", sc.fk_soc, sc.fk_user"; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user"; $sql .= " FROM ".MAIN_DB_PREFIX."c_stcomm as st,"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= " ".MAIN_DB_PREFIX."societe_commerciaux as sc,"; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= " ".MAIN_DB_PREFIX."societe_commerciaux as sc,"; $sql .= " ".MAIN_DB_PREFIX."socpeople as p"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.idp = p.fk_soc"; $sql .= " WHERE s.fk_stcomm = st.id"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; if ($type == "c") $sql .= " AND s.client = 1"; if ($type == "p") $sql .= " AND s.client = 2"; if ($type == "f") $sql .= " AND s.fournisseur = 1"; diff --git a/htdocs/comm/fiche.php b/htdocs/comm/fiche.php index adc138bb539..39f067f4aa0 100644 --- a/htdocs/comm/fiche.php +++ b/htdocs/comm/fiche.php @@ -46,21 +46,21 @@ if ($conf->fichinter->enabled) $langs->load("interventions"); $user->getrights("commercial"); if (!$user->rights->societe->lire) accessforbidden(); -$socidp = isset($_GET["socid"])?$_GET["socid"]:''; -if ($socidp == '') accessforbidden(); +$socid = isset($_GET["socid"])?$_GET["socid"]:''; +if ($socid == '') accessforbidden(); // Protection quand utilisateur externe if ($user->societe_id > 0) { - $socidp = $user->societe_id; + $socid = $user->societe_id; } // Protection restriction commercial -if (!$user->rights->commercial->client->voir && $socidp && !$user->societe_id > 0) +if (!$user->rights->commercial->client->voir && $socid && !$user->societe_id > 0) { $sql = "SELECT sc.fk_soc, s.client"; $sql .= " FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc, ".MAIN_DB_PREFIX."societe as s"; - $sql .= " WHERE sc.fk_soc = ".$socidp." AND sc.fk_user = ".$user->id." AND s.client = 1"; + $sql .= " WHERE sc.fk_soc = ".$socid." AND sc.fk_user = ".$user->id." AND s.client = 1"; if ( $db->query($sql) ) { @@ -106,7 +106,7 @@ if ($_POST["action"] == 'setassujtva' && $user->rights->societe->creer) { $societe = new Societe($db, $_GET["socid"]); $societe->tva_assuj=$_POST['assujtva_value']; - $sql = "UPDATE ".MAIN_DB_PREFIX."societe SET tva_assuj='".$_POST['assujtva_value']."' WHERE idp='".$socidp."'"; + $sql = "UPDATE ".MAIN_DB_PREFIX."societe SET tva_assuj='".$_POST['assujtva_value']."' WHERE idp='".$socid."'"; $result = $db->query($sql); if (! $result) dolibarr_print_error($result); } @@ -116,12 +116,12 @@ if ($action == 'stcomm') if ($stcommid <> 'null' && $stcommid <> $oldstcomm) { $sql = "INSERT INTO socstatutlog (datel, fk_soc, fk_statut, author) "; - $sql .= " VALUES ('$dateaction',$socidp,$stcommid,'" . $user->login . "')"; + $sql .= " VALUES ('$dateaction',$socid,$stcommid,'" . $user->login . "')"; $result = @$db->query($sql); if ($result) { - $sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm=$stcommid WHERE idp=".$socidp; + $sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm=$stcommid WHERE idp=".$socid; $result = $db->query($sql); } else @@ -132,7 +132,7 @@ if ($action == 'stcomm') if ($actioncommid) { - $sql = "INSERT INTO ".MAIN_DB_PREFIX."actioncomm (datea, fk_action, fk_soc, fk_user_author) VALUES ('$dateaction',$actioncommid,$socidp,'" . $user->id . "')"; + $sql = "INSERT INTO ".MAIN_DB_PREFIX."actioncomm (datea, fk_action, fk_soc, fk_user_author) VALUES ('$dateaction',$actioncommid,$socid,'" . $user->id . "')"; $result = @$db->query($sql); if (!$result) @@ -149,17 +149,17 @@ if ($action == 'stcomm') if ($mode == 'search') { if ($mode-search == 'soc') { $sql = "SELECT s.idp"; - if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", sc.fk_soc, sc.fk_user "; + if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user "; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; - if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql .= " WHERE lower(s.nom) like '%".strtolower($socname)."%'"; - if (!$user->rights->commercial->client->voir && !$socidp) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; + if (!$user->rights->commercial->client->voir && !$socid) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; } if ( $db->query($sql) ) { if ( $db->num_rows() == 1) { $obj = $db->fetch_object(); - $socidp = $obj->idp; + $socid = $obj->idp; } $db->free(); } @@ -175,12 +175,12 @@ llxHeader('',$langs->trans('CustomerCard')); * Mode fiche * *********************************************************************************/ -if ($socidp > 0) +if ($socid > 0) { // On recupere les donnees societes par l'objet $objsoc = new Societe($db); - $objsoc->id=$socidp; - $objsoc->fetch($socidp,$to); + $objsoc->id=$socid; + $objsoc->fetch($socid,$to); $dac = strftime("%Y-%m-%d %H:%M", time()); if ($errmesg) @@ -406,7 +406,7 @@ if ($socidp > 0) if ($num > 0) { print ''; - print ''; + print ''; print ''; $var=!$var; } @@ -459,7 +459,7 @@ if ($socidp > 0) if ($num >0 ) { print ''; - print ''; + print ''; print ''; } $i = 0; @@ -552,7 +552,7 @@ if ($socidp > 0) if ($num >0 ) { print ''; - print ''; + print ''; print ''; $var=!$var; } @@ -628,13 +628,13 @@ if ($socidp > 0) if ($conf->propal->enabled && $user->rights->propale->creer) { $langs->load("propal"); - print ''.$langs->trans("AddProp").''; + print ''.$langs->trans("AddProp").''; } if ($conf->commande->enabled && $user->rights->commande->creer) { $langs->load("orders"); - print ''.$langs->trans("AddOrder").''; + print ''.$langs->trans("AddOrder").''; } if ($user->rights->contrat->creer) @@ -646,7 +646,7 @@ if ($socidp > 0) if ($conf->fichinter->enabled && $user->rights->ficheinter->creer) { $langs->load("fichinter"); - print ''.$langs->trans("AddIntervention").''; + print ''.$langs->trans("AddIntervention").''; } print ''.$langs->trans("AddAction").''; diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php index 60346217c79..0d2a223bd99 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -39,12 +39,12 @@ $langs->load("commercial"); $langs->load("orders"); // Sécurité accés client -$socidp=''; -if ($_GET["socidp"]) { $socidp=$_GET["socidp"]; } +$socid=''; +if ($_GET["socid"]) { $socid=$_GET["socid"]; } if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } $max=5; @@ -60,12 +60,12 @@ if ($conf->propal->enabled) $propalstatic=new Propal($db); if (isset($_GET["action"]) && $_GET["action"] == 'add_bookmark') { - $sql = "DELETE FROM ".MAIN_DB_PREFIX."bookmark WHERE fk_soc = ".$_GET["socidp"]." AND fk_user=".$user->id; + $sql = "DELETE FROM ".MAIN_DB_PREFIX."bookmark WHERE fk_soc = ".$_GET["socid"]." AND fk_user=".$user->id; if (! $db->query($sql) ) { dolibarr_print_error($db); } - $sql = "INSERT INTO ".MAIN_DB_PREFIX."bookmark (fk_soc, dateb, fk_user) VALUES (".$_GET["socidp"].", now(),".$user->id.");"; + $sql = "INSERT INTO ".MAIN_DB_PREFIX."bookmark (fk_soc, dateb, fk_user) VALUES (".$_GET["socid"].", now(),".$user->id.");"; if (! $db->query($sql) ) { dolibarr_print_error($db); @@ -131,15 +131,15 @@ if ($conf->contrat->enabled) if ($conf->propal->enabled && $user->rights->propale->lire) { $sql = "SELECT p.rowid, p.ref, p.price, s.idp, s.nom"; - if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", sc.fk_soc, sc.fk_user"; + if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user"; $sql.= " FROM ".MAIN_DB_PREFIX."propal as p, ".MAIN_DB_PREFIX."societe as s"; - if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE p.fk_statut = 0 and p.fk_soc = s.idp"; - if ($socidp) + if ($socid) { - $sql .= " AND s.idp = $socidp"; + $sql .= " AND s.idp = $socid"; } - if (!$user->rights->commercial->client->voir && !$socidp) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; + if (!$user->rights->commercial->client->voir && !$socid) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; $resql=$db->query($sql); if ($resql) @@ -183,14 +183,14 @@ if ($conf->commande->enabled) { $langs->load("orders"); $sql = "SELECT c.rowid, c.ref, c.total_ttc, s.nom, s.idp"; - if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", sc.fk_soc, sc.fk_user"; + if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user"; $sql.= " FROM ".MAIN_DB_PREFIX."commande as c, ".MAIN_DB_PREFIX."societe as s"; - if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE c.fk_soc = s.idp AND c.fk_statut = 0"; - if (!$user->rights->commercial->client->voir && !$socidp) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; - if ($socidp) + if (!$user->rights->commercial->client->voir && !$socid) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; + if ($socid) { - $sql .= " AND c.fk_soc = $socidp"; + $sql .= " AND c.fk_soc = $socid"; } $resql = $db->query($sql); @@ -233,9 +233,9 @@ if ($conf->commande->enabled) $sql = "SELECT s.idp, s.nom,b.rowid as bid"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."bookmark as b"; $sql .= " WHERE b.fk_soc = s.idp AND b.fk_user = ".$user->id; -if ($socidp) +if ($socid) { - $sql .= " AND s.idp = $socidp"; + $sql .= " AND s.idp = $socid"; } $sql .= " ORDER BY lower(s.nom) ASC"; @@ -279,14 +279,14 @@ print ''; - if ($_GET['action'] != 'editdelivery_adress' && $propal->brouillon) print ''; + if ($_GET['action'] != 'editdelivery_adress' && $propal->brouillon) print ''; print '
    '.$langs->trans('Company').''.$soc->getNomUrl(1); - print ''; + print ''; print '
    '.$langs->trans('DeliveryAddress').''; - $numaddress = $html->select_adresse_livraison($soc->adresse_livraison_id, $_GET['socidp'],'adresse_livraison_id',1); + $numaddress = $html->select_adresse_livraison($soc->adresse_livraison_id, $_GET['socid'],'adresse_livraison_id',1); if ($numaddress==0) { print '   id.'&action=create>'.$langs->trans("AddAddress").''; @@ -245,7 +245,7 @@ if ($conf->expedition->enabled) $numprojet=$html->select_projects($soc->id,$projetid,'projetidp'); if ($numprojet==0) { - print '   '.$langs->trans("AddProject").''; + print '   '.$langs->trans("AddProject").''; } print '
    '.$langs->trans("LastPropals",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllPropals").' ('.$num.')
    '.$langs->trans("LastPropals",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllPropals").' ('.$num.')
    '.$langs->trans("LastOrders",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllOrders").' ('.$num.')
    '.$langs->trans("LastOrders",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllOrders").' ('.$num.')
    '.$langs->trans("LastInterventions",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllInterventions").' ('.$num.')
    '.$langs->trans("LastInterventions",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllInterventions").' ('.$num.')
    '; */ $sql = "SELECT a.id, a.label, ".$db->pdate("a.datep")." as dp, c.code, c.libelle, a.fk_user_author, s.nom as sname, s.idp"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", sc.fk_soc, sc.fk_user"; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user"; $sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a, ".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."societe as s"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql .= " WHERE c.id=a.fk_action AND a.percent < 100 AND s.idp = a.fk_soc"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; -if ($socidp) +if (!$user->rights->commercial->client->voir && !$socid) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; +if ($socid) { - $sql .= " AND s.idp = $socidp"; + $sql .= " AND s.idp = $socid"; } $sql .= " ORDER BY a.datep DESC, a.id DESC"; @@ -350,15 +350,15 @@ else */ $sql = "SELECT a.id, a.percent, ".$db->pdate("a.datea")." as da, c.code, c.libelle, a.fk_user_author, s.nom as sname, s.idp"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", sc.fk_soc, sc.fk_user"; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user"; $sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a, ".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."societe as s"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql .= " WHERE c.id=a.fk_action AND a.percent >= 100 AND s.idp = a.fk_soc"; -if ($socidp) +if ($socid) { - $sql .= " AND s.idp = ".$socidp; + $sql .= " AND s.idp = ".$socid; } -if (!$user->rights->commercial->client->voir && !$socidp) //restriction +if (!$user->rights->commercial->client->voir && !$socid) //restriction { $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; } @@ -419,15 +419,15 @@ else if ($user->rights->societe->lire) { $sql = "SELECT s.idp,s.nom,".$db->pdate("datec")." as datec"; - if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", sc.fk_soc, sc.fk_user"; + if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; - if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE s.client = 1"; - if ($socidp) + if ($socid) { - $sql .= " AND s.idp = $socidp"; + $sql .= " AND s.idp = $socid"; } - if (!$user->rights->commercial->client->voir && !$socidp) //restriction + if (!$user->rights->commercial->client->voir && !$socid) //restriction { $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; } @@ -476,15 +476,15 @@ if ($conf->contrat->enabled && 0) // \todo A REFAIRE DEPUIS NOUVEAU CONTRAT $langs->load("contracts"); $sql = "SELECT s.nom, s.idp, c.statut, c.rowid, p.ref, c.mise_en_service as datemes, c.fin_validite as datefin, c.date_cloture as dateclo"; - if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", sc.fk_soc, sc.fk_user"; + if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as c, ".MAIN_DB_PREFIX."product as p"; - if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql .= " WHERE c.fk_soc = s.idp and c.fk_product = p.rowid"; - if ($socidp) + if ($socid) { - $sql .= " AND s.idp = $socidp"; + $sql .= " AND s.idp = $socid"; } - if (!$user->rights->commercial->client->voir && !$socidp) //restriction + if (!$user->rights->commercial->client->voir && !$socid) //restriction { $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; } @@ -531,12 +531,12 @@ if ($conf->propal->enabled && $user->rights->propale->lire) $langs->load("propal"); $sql = "SELECT s.nom, s.idp, p.rowid as propalid, p.price, p.ref, p.fk_statut, ".$db->pdate("p.datep")." as dp"; - if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", sc.fk_soc, sc.fk_user"; + if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as p"; - if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql .= " WHERE p.fk_soc = s.idp AND p.fk_statut = 1"; - if ($socidp) $sql .= " AND s.idp = $socidp"; - if (!$user->rights->commercial->client->voir && !$socidp) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; + if ($socid) $sql .= " AND s.idp = $socid"; + if (!$user->rights->commercial->client->voir && !$socid) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; $sql .= " ORDER BY p.rowid DESC"; $result=$db->query($sql); @@ -588,15 +588,15 @@ if ($conf->propal->enabled && $user->rights->propale->lire) { $NBMAX=5; $sql = "SELECT s.nom, s.idp, p.rowid as propalid, p.price, p.ref, p.fk_statut, ".$db->pdate("p.datep")." as dp"; - if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", sc.fk_soc, sc.fk_user"; + if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as p"; - if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql .= " WHERE p.fk_soc = s.idp AND p.fk_statut > 1"; - if ($socidp) + if ($socid) { - $sql .= " AND s.idp = $socidp"; + $sql .= " AND s.idp = $socid"; } - if (!$user->rights->commercial->client->voir && !$socidp) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; + if (!$user->rights->commercial->client->voir && !$socid) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; $sql .= " ORDER BY p.rowid DESC"; $sql .= $db->plimit($NBMAX, 0); diff --git a/htdocs/comm/mailing/liste.php b/htdocs/comm/mailing/liste.php index 6175d022354..f3f17d528a8 100644 --- a/htdocs/comm/mailing/liste.php +++ b/htdocs/comm/mailing/liste.php @@ -34,7 +34,7 @@ if (!$user->rights->mailing->lire) accessforbidden(); if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } $page=$_GET["page"]; diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index e54177ec9fe..53348171c1f 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -58,12 +58,12 @@ $year=isset($_GET["year"])?$_GET["year"]:""; $month=isset($_GET["month"])?$_GET["month"]:""; // Sécurité accés client -$socidp=''; -if ($_GET["socidp"]) { $socidp=$_GET["socidp"]; } +$socid=''; +if ($_GET["socid"]) { $socid=$_GET["socid"]; } if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } // Nombre de ligne pour choix de produit/service prédéfinis @@ -165,7 +165,7 @@ if ($_POST['action'] == 'set_ref_client' && $user->rights->propale->creer) if ($_POST['action'] == 'add' && $user->rights->propale->creer) { $propal = new Propal($db); - $propal->socidp=$_POST['socidp']; + $propal->socid=$_POST['socid']; $propal->fetch_client(); $db->begin(); @@ -183,7 +183,7 @@ if ($_POST['action'] == 'add' && $user->rights->propale->creer) $propal->mode_reglement_id = $_POST['mode_reglement_id']; $propal->remise_percent = $_POST['remise_percent']; $propal->remise_absolue = $_POST['remise_absolue']; - $propal->socidp = $_POST['socidp']; + $propal->socid = $_POST['socid']; $propal->contactid = $_POST['contactidp']; $propal->projetidp = $_POST['projetidp']; $propal->modelpdf = $_POST['model']; @@ -304,7 +304,7 @@ if ($_POST['action'] == 'send') $file = $conf->propal->dir_output . '/' . $propalref . '/' . $propalref . '.pdf'; if (is_readable($file)) { - $soc = new Societe($db, $propal->socidp); + $soc = new Societe($db, $propal->socid); if ($_POST['sendto']) { // Le destinataire a été fourni via le champ libre @@ -370,7 +370,7 @@ if ($_POST['action'] == 'send') $actioncomm->date = time(); // L'action est faite maintenant $actioncomm->percent = 100; $actioncomm->contact = new Contact($db,$sendtoid); - $actioncomm->societe = new Societe($db,$propal->socidp); + $actioncomm->societe = new Societe($db,$propal->socid); $actioncomm->user = $user; // User qui a fait l'action $actioncomm->propalrowid = $propal->id; $ret=$actioncomm->add($user); // User qui saisi l'action @@ -455,8 +455,8 @@ if ($_POST['action'] == "addligne" && $user->rights->propale->creer) { $propal = new Propal($db); $ret=$propal->fetch($_POST['propalid']); - $soc = new Societe($db, $propal->socidp); - $soc->fetch($propal->socidp); + $soc = new Societe($db, $propal->socid); + $soc->fetch($propal->socid); // Ecrase $pu par celui du produit // Ecrase $desc par celui du produit @@ -689,7 +689,7 @@ if ($_GET['propalid'] > 0) } $societe = new Societe($db); - $societe->fetch($propal->socidp); + $societe->fetch($propal->socid); $head = propal_prepare_head($propal); dolibarr_fiche_head($head, 'comm', $langs->trans('Proposal')); @@ -869,17 +869,17 @@ if ($conf->expedition->enabled) print $langs->trans('DeliveryAddress'); print 'socidp.'&propalid='.$propal->id.'">'.img_edit($langs->trans('SetDeliveryAddress'),1).'socid.'&propalid='.$propal->id.'">'.img_edit($langs->trans('SetDeliveryAddress'),1).'
    '; print ''; if ($_GET['action'] == 'editdelivery_adress') { - $html->form_adresse_livraison($_SERVER['PHP_SELF'].'?propalid='.$propal->id,$propal->adresse_livraison_id,$_GET['socidp'],'adresse_livraison_id','propal',$propal->id); + $html->form_adresse_livraison($_SERVER['PHP_SELF'].'?propalid='.$propal->id,$propal->adresse_livraison_id,$_GET['socid'],'adresse_livraison_id','propal',$propal->id); } else { - $html->form_adresse_livraison($_SERVER['PHP_SELF'].'?propalid='.$propal->id,$propal->adresse_livraison_id,$_GET['socidp'],'none','propal',$propal->id); + $html->form_adresse_livraison($_SERVER['PHP_SELF'].'?propalid='.$propal->id,$propal->adresse_livraison_id,$_GET['socid'],'none','propal',$propal->id); } print ''; } @@ -936,7 +936,7 @@ if ($conf->expedition->enabled) print ''; print ''; print $langs->trans("NoProject").''; - print 'id.'&action=create>'.$langs->trans('AddProject').''; + print 'id.'&action=create>'.$langs->trans('AddProject').''; print ''; } else @@ -948,11 +948,11 @@ if ($conf->expedition->enabled) print ''; if ($_GET['action'] == 'classer') { - $form->form_project($_SERVER['PHP_SELF'].'?propalid='.$propal->id, $propal->socidp, $propal->projetidp, 'projetidp'); + $form->form_project($_SERVER['PHP_SELF'].'?propalid='.$propal->id, $propal->socid, $propal->projetidp, 'projetidp'); } else { - $form->form_project($_SERVER['PHP_SELF'].'?propalid='.$propal->id, $propal->socidp, $propal->projetidp, 'none'); + $form->form_project($_SERVER['PHP_SELF'].'?propalid='.$propal->id, $propal->socid, $propal->projetidp, 'none'); } print ''; } @@ -1071,7 +1071,7 @@ if ($conf->expedition->enabled) print ''; // ancre pour retourner sur la ligne if (($objp->info_bits & 2) == 2) { - print ''; + print ''; print img_object($langs->trans("ShowReduc"),'reduc').' '.$langs->trans("Discount"); print ''; if ($objp->description) print ' - '.nl2br($objp->description); @@ -1596,7 +1596,7 @@ if ($conf->expedition->enabled) $sql = 'SELECT id, '.$db->pdate('a.datea'). ' as da, label, note, fk_user_author' ; $sql .= ' FROM '.MAIN_DB_PREFIX.'actioncomm as a'; $sql .= ' WHERE a.propalrowid = '.$propal->id ; - if ($socidp) $sql .= ' AND a.fk_soc = '.$socidp; + if ($socid) $sql .= ' AND a.fk_soc = '.$socid; $resql = $db->query($sql); if ($resql) { @@ -1698,13 +1698,13 @@ else $pagenext = $page + 1; $sql = 'SELECT s.nom, s.idp, s.client, p.rowid as propalid, p.price, p.ref, p.fk_statut, '.$db->pdate('p.datep').' as dp,'.$db->pdate('p.fin_validite').' as dfv'; - if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", sc.fk_soc, sc.fk_user"; + if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user"; $sql.= ' FROM '.MAIN_DB_PREFIX.'societe as s, '.MAIN_DB_PREFIX.'propal as p'; - if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; if ($sall) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'propaldet as pd ON p.rowid=pd.fk_propal'; $sql.= ' WHERE p.fk_soc = s.idp'; - if (!$user->rights->commercial->client->voir && !$socidp) //restriction + if (!$user->rights->commercial->client->voir && !$socid) //restriction { $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; } @@ -1721,7 +1721,7 @@ else $sql .= " AND p.price='".addslashes($_GET['search_montant_ht'])."'"; } if ($sall) $sql.= " AND (s.nom like '%".addslashes($sall)."%' OR p.note like '%".addslashes($sall)."%' OR pd.description like '%".addslashes($sall)."%')"; - if ($socidp) $sql .= ' AND s.idp = '.$socidp; + if ($socid) $sql .= ' AND s.idp = '.$socid; if ($_GET['viewstatut'] <> '') { $sql .= ' AND p.fk_statut in ('.$_GET['viewstatut'].')'; @@ -1750,16 +1750,16 @@ else if ($result) { $num = $db->num_rows($result); - print_barre_liste($langs->trans('ListOfProposals'), $page,'propal.php','&socidp='.$socidp,$sortfield,$sortorder,'',$num); + print_barre_liste($langs->trans('ListOfProposals'), $page,'propal.php','&socid='.$socid,$sortfield,$sortorder,'',$num); $i = 0; print ''; print ''; - print_liste_field_titre($langs->trans('Ref'),$_SERVER["PHP_SELF"],'p.ref','','&socidp='.$socidp.'&viewstatut='.$viewstatut,'',$sortfield); - print_liste_field_titre($langs->trans('Company'),$_SERVER["PHP_SELF"],'s.nom','','&socidp='.$socidp.'&viewstatut='.$viewstatut,'',$sortfield); - print_liste_field_titre($langs->trans('Date'),$_SERVER["PHP_SELF"],'p.datep','','&socidp='.$socidp.'&viewstatut='.$viewstatut, 'align="center"',$sortfield); - print_liste_field_titre($langs->trans('DateEndPropalShort'),$_SERVER["PHP_SELF"],'dfv','','&socidp='.$socidp.'&viewstatut='.$viewstatut, 'align="center"',$sortfield); - print_liste_field_titre($langs->trans('Price'),$_SERVER["PHP_SELF"],'p.price','','&socidp='.$socidp.'&viewstatut='.$viewstatut, 'align="right"',$sortfield); - print_liste_field_titre($langs->trans('Status'),$_SERVER["PHP_SELF"],'p.fk_statut','','&socidp='.$socidp.'&viewstatut='.$viewstatut,'align="right"',$sortfield); + print_liste_field_titre($langs->trans('Ref'),$_SERVER["PHP_SELF"],'p.ref','','&socid='.$socid.'&viewstatut='.$viewstatut,'',$sortfield); + print_liste_field_titre($langs->trans('Company'),$_SERVER["PHP_SELF"],'s.nom','','&socid='.$socid.'&viewstatut='.$viewstatut,'',$sortfield); + print_liste_field_titre($langs->trans('Date'),$_SERVER["PHP_SELF"],'p.datep','','&socid='.$socid.'&viewstatut='.$viewstatut, 'align="center"',$sortfield); + print_liste_field_titre($langs->trans('DateEndPropalShort'),$_SERVER["PHP_SELF"],'dfv','','&socid='.$socid.'&viewstatut='.$viewstatut, 'align="center"',$sortfield); + print_liste_field_titre($langs->trans('Price'),$_SERVER["PHP_SELF"],'p.price','','&socid='.$socid.'&viewstatut='.$viewstatut, 'align="right"',$sortfield); + print_liste_field_titre($langs->trans('Status'),$_SERVER["PHP_SELF"],'p.fk_statut','','&socid='.$socid.'&viewstatut='.$viewstatut,'align="right"',$sortfield); print "\n"; // Lignes des champs de filtre print ''; diff --git a/htdocs/comm/propal/aideremise.php b/htdocs/comm/propal/aideremise.php index f352cb8997e..67e960d861e 100644 --- a/htdocs/comm/propal/aideremise.php +++ b/htdocs/comm/propal/aideremise.php @@ -39,7 +39,7 @@ include_once(DOL_DOCUMENT_ROOT."/propal.class.php"); if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } @@ -68,7 +68,7 @@ if ($_GET["propalid"]) $propal->fetch($_GET["propalid"]); $societe = new Societe($db); - $societe->fetch($propal->socidp); + $societe->fetch($propal->socid); $head[0][0] = DOL_URL_ROOT.'/comm/propal.php?propalid='.$propal->id; $head[0][1] = "Proposition commerciale : $propal->ref"; diff --git a/htdocs/comm/propal/apercu.php b/htdocs/comm/propal/apercu.php index 074494f3a3a..5471d5d3c33 100644 --- a/htdocs/comm/propal/apercu.php +++ b/htdocs/comm/propal/apercu.php @@ -50,7 +50,7 @@ $langs->load('compta'); if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } @@ -71,8 +71,8 @@ if ($_GET["propalid"] > 0) if ( $propal->fetch($_GET["propalid"], $user->societe_id) > 0) { - $soc = new Societe($db, $propal->socidp); - $soc->fetch($propal->socidp); + $soc = new Societe($db, $propal->socid); + $soc->fetch($propal->socid); $head = propal_prepare_head($propal); dolibarr_fiche_head($head, 'preview', $langs->trans('Proposal')); @@ -85,7 +85,7 @@ if ($_GET["propalid"] > 0) $sql.= ' p.fk_user_author, p.fk_user_valid, p.fk_user_cloture, p.datec, p.date_valid, p.date_cloture'; $sql.= ' FROM '.MAIN_DB_PREFIX.'societe as s, '.MAIN_DB_PREFIX.'propal as p'; $sql.= ' WHERE p.fk_soc = s.idp AND p.rowid = '.$propal->id; - if ($socidp) $sql .= ' AND s.idp = '.$socidp; + if ($socid) $sql .= ' AND s.idp = '.$socid; $result = $db->query($sql); diff --git a/htdocs/comm/propal/contact.php b/htdocs/comm/propal/contact.php index d58c4078870..28254ea69e6 100644 --- a/htdocs/comm/propal/contact.php +++ b/htdocs/comm/propal/contact.php @@ -106,7 +106,7 @@ function select_type_contact($propal, $defValue, $htmlname = 'type', $source) if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } /* @@ -220,8 +220,8 @@ if ($id > 0) $propal = New Propal($db); if ( $propal->fetch($_GET['propalid'], $user->societe_id) > 0) { - $soc = new Societe($db, $propal->socidp); - $soc->fetch($propal->socidp); + $soc = new Societe($db, $propal->socid); + $soc->fetch($propal->socid); $head = propal_prepare_head($propal); diff --git a/htdocs/comm/propal/document.php b/htdocs/comm/propal/document.php index 7635571c69a..fa5c92c8130 100644 --- a/htdocs/comm/propal/document.php +++ b/htdocs/comm/propal/document.php @@ -109,7 +109,7 @@ if ($propalid > 0) $upload_dir = $conf->propal->dir_output.'/'.$propref; $societe = new Societe($db); - $societe->fetch($propal->socidp); + $societe->fetch($propal->socid); $head = propal_prepare_head($propal); dolibarr_fiche_head($head, 'document', $langs->trans('Proposal')); diff --git a/htdocs/comm/propal/info.php b/htdocs/comm/propal/info.php index dff75e7c22c..6277da81405 100644 --- a/htdocs/comm/propal/info.php +++ b/htdocs/comm/propal/info.php @@ -56,7 +56,7 @@ $propal = new Propal($db); $propal->fetch($_GET['propalid']); $societe = new Societe($db); -$societe->fetch($propal->socidp); +$societe->fetch($propal->socid); $head = propal_prepare_head($propal); dolibarr_fiche_head($head, 'info', $langs->trans('Proposal')); diff --git a/htdocs/comm/propal/note.php b/htdocs/comm/propal/note.php index b73eec10361..55aaf998c7b 100644 --- a/htdocs/comm/propal/note.php +++ b/htdocs/comm/propal/note.php @@ -46,7 +46,7 @@ if (!$user->rights->propale->lire) if ($user->societe_id > 0) { unset($_GET['action']); - $socidp = $user->societe_id; + $socid = $user->societe_id; } /******************************************************************************/ @@ -109,7 +109,7 @@ if ($_GET['propalid']) if ( $propal->fetch($_GET['propalid']) ) { $societe = new Societe($db); - if ( $societe->fetch($propal->socidp) ) + if ( $societe->fetch($propal->socid) ) { $head = propal_prepare_head($propal); dolibarr_fiche_head($head, 'note', $langs->trans('Proposal')); diff --git a/htdocs/comm/prospect/fiche.php b/htdocs/comm/prospect/fiche.php index 8154da85173..bb79cec63c3 100644 --- a/htdocs/comm/prospect/fiche.php +++ b/htdocs/comm/prospect/fiche.php @@ -177,7 +177,7 @@ if ($socid > 0) { $tableaushown=1; print ''; - print ''; + print ''; print ''; } @@ -222,12 +222,12 @@ if ($socid > 0) if ($conf->propal->enabled && defined("MAIN_MODULE_PROPALE") && MAIN_MODULE_PROPALE && $user->rights->propale->creer) { - print ''.$langs->trans("AddProp").''; + print ''.$langs->trans("AddProp").''; } if ($conf->projet->enabled && $user->rights->projet->creer) { - print ''.$langs->trans("AddProject").''; + print ''.$langs->trans("AddProject").''; } print ''; diff --git a/htdocs/comm/prospect/index.php b/htdocs/comm/prospect/index.php index 198c32fc5a1..3a6ee0acc4f 100644 --- a/htdocs/comm/prospect/index.php +++ b/htdocs/comm/prospect/index.php @@ -37,7 +37,7 @@ $user->getrights('propale'); if ($user->societe_id > 0) { - $socidp = $user->societe_id; + $socid = $user->societe_id; } @@ -73,11 +73,11 @@ if ($conf->propal->enabled) */ $sql = "SELECT count(*) as cc, st.libelle, st.id"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", sc.fk_soc, sc.fk_user "; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user "; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."c_stcomm as st "; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql .= " WHERE s.fk_stcomm = st.id AND s.client=2"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; $sql .= " GROUP BY st.id"; $sql .= " ORDER BY st.id"; @@ -114,11 +114,11 @@ if ($resql) if ($conf->propal->enabled && $user->rights->propale->lire) { $sql = "SELECT p.rowid, p.ref, p.price, s.nom"; - if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", sc.fk_soc, sc.fk_user "; + if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user "; $sql .= " FROM ".MAIN_DB_PREFIX."propal as p, ".MAIN_DB_PREFIX."societe as s"; - if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql .= " WHERE p.fk_statut = 0 and p.fk_soc = s.idp"; - if (!$user->rights->commercial->client->voir && !$socidp) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; + if (!$user->rights->commercial->client->voir && !$socid) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; $resql=$db->query($sql); if ($resql) @@ -165,11 +165,11 @@ print ''; } @@ -955,7 +955,7 @@ else if ( $commande->fetch($_GET['id']) > 0) { $soc = new Societe($db); - $soc->fetch($commande->socidp); + $soc->fetch($commande->socid); $author = new User($db); $author->id = $commande->user_author_id; @@ -1124,7 +1124,7 @@ else print $langs->trans('DeliveryAddress'); print ''; - if ($_GET['action'] != 'editdelivery_adress' && $commande->brouillon) print ''; + if ($_GET['action'] != 'editdelivery_adress' && $commande->brouillon) print ''; print '
    '.$langs->trans("LastPropals",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllPropals").' ('.$num.')
    '.$langs->trans("LastPropals",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllPropals").' ('.$num.')
    '; $sql = "SELECT a.id, ".$db->pdate("a.datea")." as da, a.fk_user_author, a.percent,"; $sql.= " c.code, c.libelle,"; $sql.= " s.nom as sname, s.idp"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", sc.fk_soc, sc.fk_user "; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user "; $sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a, ".MAIN_DB_PREFIX."c_actioncomm as c, ".MAIN_DB_PREFIX."societe as s"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql .= " WHERE c.id=a.fk_action AND a.percent < 100 AND s.idp = a.fk_soc AND a.fk_user_action = $user->id"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; $sql .= " ORDER BY a.datea DESC"; $resql=$db->query($sql); @@ -218,12 +218,12 @@ else if ($conf->propal->enabled && $user->rights->propale->lire) { $sql = "SELECT s.nom, s.idp, p.rowid as propalid, p.price, p.ref,".$db->pdate("p.datep")." as dp, c.label as statut, c.id as statutid"; - if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", sc.fk_soc, sc.fk_user "; + if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user "; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as p, ".MAIN_DB_PREFIX."c_propalst as c"; - if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql .= " WHERE p.fk_soc = s.idp AND p.fk_statut = c.id AND p.fk_statut = 1"; - if (!$user->rights->commercial->client->voir && !$socidp) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; - if ($socidp) $sql .= " AND s.idp = $socidp"; + if (!$user->rights->commercial->client->voir && !$socid) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; + if ($socid) $sql .= " AND s.idp = $socid"; $sql .= " ORDER BY p.rowid DESC"; $sql .= $db->plimit(5, 0); @@ -267,11 +267,11 @@ if ($conf->propal->enabled && $user->rights->propale->lire) * */ $sql = "SELECT s.nom, s.idp"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", sc.fk_soc, sc.fk_user "; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user "; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql .= " WHERE s.fk_stcomm = 1"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; $sql .= " ORDER BY s.tms ASC"; $sql .= $db->plimit(15, 0); diff --git a/htdocs/comm/prospect/prospects.php b/htdocs/comm/prospect/prospects.php index e559a89023b..395f9c52c24 100644 --- a/htdocs/comm/prospect/prospects.php +++ b/htdocs/comm/prospect/prospects.php @@ -38,11 +38,11 @@ $user->getrights('commande'); $user->getrights('projet'); // Sécurité accés client -$socidp=0; +$socid=0; if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } $socname=isset($_GET["socname"])?$_GET["socname"]:$_POST["socname"]; @@ -77,12 +77,12 @@ if ($_GET["action"] == 'cstc') $sql = "SELECT s.idp, s.nom, s.ville, ".$db->pdate("s.datec")." as datec, ".$db->pdate("s.datea")." as datea, st.libelle as stcomm, s.prefix_comm, s.fk_stcomm "; $sql .= ", d.nom as departement"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", sc.fk_soc, sc.fk_user"; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user"; $sql .= " FROM (".MAIN_DB_PREFIX."c_stcomm as st, ".MAIN_DB_PREFIX."societe as s"; // Avec MySQL 5.0 la procédure de requêtes jointes (JOIN) a changé pour suivre les standards plus correctement. // référence: http://dev.mysql.com/doc/refman/5.0/fr/join.html -if (!$user->rights->commercial->client->voir && !$socidp) +if (!$user->rights->commercial->client->voir && !$socid) { $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc)"; } @@ -93,7 +93,7 @@ else $sql .= " LEFT join ".MAIN_DB_PREFIX."c_departements as d on (d.rowid = s.fk_departement)"; $sql .= " WHERE s.fk_stcomm = st.id AND s.client=2"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; if (isset($stcomm)) { diff --git a/htdocs/commande/apercu.php b/htdocs/commande/apercu.php index 466d235fb83..5d518dc7b80 100644 --- a/htdocs/commande/apercu.php +++ b/htdocs/commande/apercu.php @@ -60,7 +60,7 @@ if ($conf->projet->enabled) if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } llxHeader(); @@ -78,8 +78,8 @@ if ($_GET["id"] > 0) { if ( $commande->fetch($_GET["id"], $user->societe_id) > 0) { - $soc = new Societe($db, $commande->socidp); - $soc->fetch($commande->socidp); + $soc = new Societe($db, $commande->socid); + $soc->fetch($commande->socid); $head = commande_prepare_head($commande); @@ -94,7 +94,7 @@ if ($_GET["id"] > 0) { $sql.= ' FROM '.MAIN_DB_PREFIX.'societe as s, '.MAIN_DB_PREFIX.'commande as c'; $sql.= ' WHERE c.fk_soc = s.idp'; $sql.= ' AND c.rowid = '.$commande->id; - if ($socidp) $sql .= ' AND s.idp = '.$socidp; + if ($socid) $sql .= ' AND s.idp = '.$socid; $result = $db->query($sql); diff --git a/htdocs/commande/commande.class.php b/htdocs/commande/commande.class.php index ab1a04191c6..04c553daef8 100644 --- a/htdocs/commande/commande.class.php +++ b/htdocs/commande/commande.class.php @@ -45,7 +45,7 @@ class Commande extends CommonObject var $id ; - var $socidp; // Id client + var $socid; // Id client var $client; // Objet societe client (à charger par fetch_client) var $ref; @@ -77,12 +77,12 @@ class Commande extends CommonObject * \brief Constructeur * \param DB Handler d'accès base */ - function Commande($DB, $socidp="", $commandeid=0) + function Commande($DB, $socid="", $commandeid=0) { global $langs; $langs->load('orders'); $this->db = $DB; - $this->socidp = $socidp; + $this->socid = $socid; $this->id = $commandeid; $this->sources[0] = $langs->trans('OrderSource0'); @@ -126,7 +126,7 @@ class Commande extends CommonObject $this->lines[$i] = $CommLigne; } - $this->socidp = $propal->socidp; + $this->socid = $propal->socid; $this->projetid = $propal->projetidp; $this->cond_reglement_id = $propal->cond_reglement_id; $this->mode_reglement_id = $propal->mode_reglement_id; @@ -137,7 +137,7 @@ class Commande extends CommonObject /* Définit la société comme un client */ $soc = new Societe($this->db); - $soc->id = $this->socidp; + $soc->id = $this->socid; $soc->set_as_client(); $this->propale_id = $propal->id; @@ -174,7 +174,7 @@ class Commande extends CommonObject // Recuperation de la nouvelle reference $objMod = new $modName($this->db); $soc = new Societe($this->db); - $soc->fetch($this->socidp); + $soc->fetch($this->socid); // Classe la société rattachée comme client $result=$soc->set_as_client(); @@ -373,7 +373,7 @@ class Commande extends CommonObject if (! $this->projetid) $this->projetid = 0; $soc = new Societe($this->db); - $result=$soc->fetch($this->socidp); + $result=$soc->fetch($this->socid); if ($result < 0) { $this->error="Failed to fetch company"; @@ -387,7 +387,7 @@ class Commande extends CommonObject $sql.= 'fk_soc, date_creation, fk_user_author, fk_projet, date_commande, source, note_public, ref_client,'; $sql.= ' model_pdf, fk_cond_reglement, fk_mode_reglement, date_livraison, fk_adresse_livraison,'; $sql.= ' remise_absolue, remise_percent)'; - $sql.= ' VALUES ('.$this->socidp.', now(), '.$user->id.', '.$this->projetid.','; + $sql.= ' VALUES ('.$this->socid.', now(), '.$user->id.', '.$this->projetid.','; $sql.= ' '.$this->db->idate($this->date_commande).','; $sql.= ' '.$this->source.', '; $sql.= " '".addslashes($this->note)."', "; @@ -440,7 +440,7 @@ class Commande extends CommonObject $this->db->query($sql); // On récupère les différents contact interne et externe - $prop = New Propal($this->db, $this->socidp, $this->propale_id); + $prop = New Propal($this->db, $this->socid, $this->propale_id); // On récupère le commercial suivi propale $this->userid = $prop->getIdcontact('internal', 'SALESREPFOLL'); @@ -795,7 +795,7 @@ class Commande extends CommonObject $this->id = $obj->rowid; $this->ref = $obj->ref; $this->ref_client = $obj->ref_client; - $this->socidp = $obj->fk_soc; + $this->socid = $obj->fk_soc; $this->statut = $obj->fk_statut; $this->user_author_id = $obj->fk_user_author; $this->total_ht = $obj->total_ht; @@ -2012,7 +2012,7 @@ class Commande extends CommonObject $this->ref = 'SPECIMEN'; $this->specimen=1; $socid = rand(1, $num_socs); - $this->socidp = $socids[$socid]; + $this->socid = $socids[$socid]; $this->date = time(); $this->date_lim_reglement=$this->date+3600*24*30; $this->cond_reglement_code = 'RECEP'; diff --git a/htdocs/commande/contact.php b/htdocs/commande/contact.php index 027abe74013..035f353ede0 100644 --- a/htdocs/commande/contact.php +++ b/htdocs/commande/contact.php @@ -106,7 +106,7 @@ function select_type_contact($commande, $defValue, $htmlname = 'type', $source) if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } /* @@ -220,8 +220,8 @@ if ($id > 0) $commande = New Commande($db); if ( $commande->fetch($_GET['id'], $user->societe_id) > 0) { - $soc = new Societe($db, $commande->socidp); - $soc->fetch($commande->socidp); + $soc = new Societe($db, $commande->socid); + $soc->fetch($commande->socid); $head = commande_prepare_head($commande); diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index d5005c74a06..70483a020b9 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -54,11 +54,11 @@ if (!$user->rights->commande->lire) accessforbidden(); // Sécurité accés client -$socidp=0; +$socid=0; if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } // Récupération de l'id de projet @@ -88,7 +88,7 @@ if ($_POST['action'] == 'add' && $user->rights->commande->creer) $datelivraison = @mktime(12, 0, 0, $_POST['liv_month'],$_POST['liv_day'],$_POST['liv_year']); $commande = new Commande($db); - $commande->socidp=$_POST['socidp']; + $commande->socid=$_POST['socid']; $commande->fetch_client(); $db->begin(); @@ -149,7 +149,7 @@ if ($_POST['action'] == 'add' && $user->rights->commande->creer) { $db->rollback(); $_GET["action"]='create'; - $_GET['socidp']=$_POST['socidp']; + $_GET['socid']=$_POST['socid']; if (! $mesg) $mesg='
    '.$commande->error.'
    '; } @@ -248,8 +248,8 @@ if ($_POST['action'] == 'addligne' && $user->rights->commande->creer) { $commande = new Commande($db); $ret=$commande->fetch($_POST['id']); - $soc = new Societe($db, $commande->socidp); - $soc->fetch($commande->socidp); + $soc = new Societe($db, $commande->socid); + $soc->fetch($commande->socid); if ($ret < 0) { @@ -375,7 +375,7 @@ if ($_POST['action'] == 'confirm_valid' && $_POST['confirm'] == 'yes' && $user-> $commande = new Commande($db); $commande->fetch($_GET['id']); $soc = new Societe($db); - $soc->fetch($commande->socidp); + $soc->fetch($commande->socid); $result = $commande->valid($user); } @@ -524,7 +524,7 @@ if ($_POST['action'] == 'send') $file = $conf->commande->dir_output . '/' . $orderref . '/' . $orderref . '.pdf'; if (is_readable($file)) { - $soc = new Societe($db, $commande->socidp); + $soc = new Societe($db, $commande->socid); if ($_POST['sendto']) { // Le destinataire a été fourni via le champ libre @@ -590,7 +590,7 @@ if ($_POST['action'] == 'send') $actioncomm->date = time(); // L'action est faite maintenant $actioncomm->percent = 100; $actioncomm->contact = new Contact($db,$sendtoid); - $actioncomm->societe = new Societe($db,$commande->socidp); + $actioncomm->societe = new Societe($db,$commande->socid); $actioncomm->user = $user; // User qui a fait l'action $actioncomm->orderrowid = $commande->id; $ret=$actioncomm->add($user); // User qui saisi l'action @@ -657,7 +657,7 @@ if ($_GET['action'] == 'create' && $user->rights->commande->creer) { $sql = 'SELECT s.nom, s.prefix_comm, s.idp, s.mode_reglement, s.cond_reglement '; $sql .= 'FROM '.MAIN_DB_PREFIX.'societe as s '; - $sql .= 'WHERE s.idp = '.$_GET['socidp']; + $sql .= 'WHERE s.idp = '.$_GET['socid']; } $resql = $db->query($sql); if ( $resql ) @@ -674,7 +674,7 @@ if ($_GET['action'] == 'create' && $user->rights->commande->creer) print ''; print ''; - print '' ."\n"; + print '' ."\n"; print ''; print ''; @@ -734,7 +734,7 @@ if ($_GET['action'] == 'create' && $user->rights->commande->creer) // Adresse de livraison print '
    '.$langs->trans('DeliveryAddress').''; - $numaddress = $html->select_adresse_livraison($soc->adresse_livraison_id, $_GET['socidp'],'adresse_livraison_id',1); + $numaddress = $html->select_adresse_livraison($soc->adresse_livraison_id, $_GET['socid'],'adresse_livraison_id',1); if ($numaddress==0) { @@ -798,7 +798,7 @@ if ($_GET['action'] == 'create' && $user->rights->commande->creer) $numprojet=$html->select_projects($soc->id,$projetid,'projetid'); if ($numprojet==0) { - print '   id.'&action=create>'.$langs->trans("AddProject").''; + print '   id.'&action=create>'.$langs->trans("AddProject").''; } print '
    socidp.'&id='.$commande->id.'">'.img_edit($langs->trans('SetDeliveryAddress'),1).'socid.'&id='.$commande->id.'">'.img_edit($langs->trans('SetDeliveryAddress'),1).'
    '; print ''; @@ -1187,11 +1187,11 @@ else print ''; if ($_GET['action'] == 'classer') { - $html->form_project($_SERVER['PHP_SELF'].'?id='.$commande->id, $commande->socidp, $commande->projet_id, 'projetid'); + $html->form_project($_SERVER['PHP_SELF'].'?id='.$commande->id, $commande->socid, $commande->projet_id, 'projetid'); } else { - $html->form_project($_SERVER['PHP_SELF'].'?id='.$commande->id, $commande->socidp, $commande->projet_id, 'none'); + $html->form_project($_SERVER['PHP_SELF'].'?id='.$commande->id, $commande->socid, $commande->projet_id, 'none'); } print ''; } @@ -1283,7 +1283,7 @@ else print ''; // ancre pour retourner sur la ligne if (($objp->info_bits & 2) == 2) { - print ''; + print ''; print img_object($langs->trans("ShowReduc"),'reduc').' '.$langs->trans("Discount"); print ''; if ($objp->description) print ' - '.nl2br($objp->description); @@ -1758,7 +1758,7 @@ else $sql = 'SELECT id, '.$db->pdate('a.datea'). ' as da, label, note, fk_user_author' ; $sql .= ' FROM '.MAIN_DB_PREFIX.'actioncomm as a'; $sql .= ' WHERE a.fk_commande = '.$commande->id ; - if ($socidp) $sql .= ' AND a.fk_soc = '.$socidp; + if ($socid) $sql .= ' AND a.fk_soc = '.$socid; $resql = $db->query($sql); if ($resql) { @@ -1828,7 +1828,7 @@ else print_titre($langs->trans('SendOrderByMail')); $soc = new Societe($db); - $soc->fetch($commande->socidp); + $soc->fetch($commande->socid); $liste[0]=" "; foreach ($soc->contact_email_array() as $key=>$value) diff --git a/htdocs/commande/index.php b/htdocs/commande/index.php index 4ca503e08ea..85d72f156ac 100644 --- a/htdocs/commande/index.php +++ b/htdocs/commande/index.php @@ -35,12 +35,12 @@ if (!$user->rights->commande->lire) accessforbidden(); $langs->load("orders"); // Sécurité accés client -$socidp=''; -if ($_GET["socidp"]) { $socidp=$_GET["socidp"]; } +$socid=''; +if ($_GET["socid"]) { $socid=$_GET["socid"]; } if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } $commandestatic=new Commande($db); @@ -73,12 +73,12 @@ print "

    \n"; * Commandes brouillons */ $sql = "SELECT c.rowid, c.ref, s.nom, s.idp"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", sc.fk_soc, sc.fk_user"; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user"; $sql .= " FROM ".MAIN_DB_PREFIX."commande as c, ".MAIN_DB_PREFIX."societe as s"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql .= " WHERE c.fk_soc = s.idp AND c.fk_statut = 0"; -if ($socidp) $sql .= " AND c.fk_soc = ".$socidp; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; +if ($socid) $sql .= " AND c.fk_soc = ".$socid; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; if ( $db->query($sql) ) { @@ -107,12 +107,12 @@ if ( $db->query($sql) ) * Commandes à traiter */ $sql = "SELECT c.rowid, c.ref, s.nom, s.idp"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", sc.fk_soc, sc.fk_user"; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user"; $sql .=" FROM ".MAIN_DB_PREFIX."commande as c, ".MAIN_DB_PREFIX."societe as s"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql .= " WHERE c.fk_soc = s.idp AND c.fk_statut = 1"; -if ($socidp) $sql .= " AND c.fk_soc = ".$socidp; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; +if ($socid) $sql .= " AND c.fk_soc = ".$socid; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; $sql .= " ORDER BY c.rowid DESC"; if ( $db->query($sql) ) @@ -147,12 +147,12 @@ print ''; * Commandes en cours */ $sql = "SELECT c.rowid, c.ref, c.fk_statut, c.facture, s.nom, s.idp"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", sc.fk_soc, sc.fk_user"; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user"; $sql .= " FROM ".MAIN_DB_PREFIX."commande as c, ".MAIN_DB_PREFIX."societe as s"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql .= " WHERE c.fk_soc = s.idp AND c.fk_statut = 2 "; -if ($socidp) $sql .= " AND c.fk_soc = ".$socidp; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; +if ($socid) $sql .= " AND c.fk_soc = ".$socid; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; $sql .= " ORDER BY c.rowid DESC"; if ( $db->query($sql) ) @@ -188,12 +188,12 @@ $max=5; $sql = "SELECT c.rowid, c.ref, c.fk_statut, c.facture, s.nom, s.idp,"; $sql.= " ".$db->pdate("date_cloture")." as datec"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", sc.fk_soc, sc.fk_user"; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user"; $sql.= " FROM ".MAIN_DB_PREFIX."commande as c, ".MAIN_DB_PREFIX."societe as s"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE c.fk_soc = s.idp and c.fk_statut > 2"; -if ($socidp) $sql .= " AND c.fk_soc = ".$socidp; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; +if ($socid) $sql .= " AND c.fk_soc = ".$socid; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; $sql.= " ORDER BY c.tms DESC"; $sql.= $db->plimit($max, 0); diff --git a/htdocs/commande/info.php b/htdocs/commande/info.php index 37f9d4824f8..f32ab86665e 100644 --- a/htdocs/commande/info.php +++ b/htdocs/commande/info.php @@ -49,8 +49,8 @@ llxHeader(); $commande = new Commande($db); $commande->fetch($_GET["id"]); $commande->info($_GET["id"]); -$soc = new Societe($db, $commande->socidp); -$soc->fetch($commande->socidp); +$soc = new Societe($db, $commande->socid); +$soc->fetch($commande->socid); $head = commande_prepare_head($commande); dolibarr_fiche_head($head, 'info', $langs->trans("CustomerOrder")); diff --git a/htdocs/commande/liste.php b/htdocs/commande/liste.php index 0740837f783..b4b64f4fe67 100644 --- a/htdocs/commande/liste.php +++ b/htdocs/commande/liste.php @@ -45,11 +45,11 @@ $snom=isset($_GET['snom'])?$_GET['snom']:$_POST['snom']; $sall=isset($_GET['sall'])?$_GET['sall']:$_POST['sall']; // Sécurité accés client -$socidp = $_GET['socidp']; +$socid = $_GET['socid']; if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } @@ -71,11 +71,11 @@ $offset = $limit * $_GET['page'] ; $sql = 'SELECT s.nom, s.idp, c.rowid, c.ref, c.total_ht, c.ref_client,'; $sql.= ' '.$db->pdate('c.date_commande').' as date_commande, c.fk_statut, c.facture as facturee'; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", sc.fk_soc, sc.fk_user"; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user"; $sql.= ' FROM '.MAIN_DB_PREFIX.'societe as s, '.MAIN_DB_PREFIX.'commande as c'; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= ' WHERE c.fk_soc = s.idp'; -if (!$user->rights->commercial->client->voir && !$socidp) //restriction +if (!$user->rights->commercial->client->voir && !$socid) //restriction { $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; } @@ -87,9 +87,9 @@ if ($sall) { $sql .= " AND (c.ref like '%".addslashes($sall)."%' OR c.note like '%".addslashes($sall)."%')"; } -if ($socidp) +if ($socid) { - $sql .= ' AND s.idp = '.$socidp; + $sql .= ' AND s.idp = '.$socid; } if ($_GET['month'] > 0) { @@ -132,10 +132,10 @@ $resql = $db->query($sql); if ($resql) { - if ($socidp) + if ($socid) { $soc = new Societe($db); - $soc->fetch($socidp); + $soc->fetch($socid); $title = $langs->trans('ListOfOrders') . ' - '.$soc->nom; } else @@ -145,15 +145,15 @@ if ($resql) if ($_GET['status'] == 3) $title.=' - '.$langs->trans('StatusOrderToBill'); $num = $db->num_rows($resql); - print_barre_liste($title, $_GET['page'], 'liste.php','&socidp='.$socidp,$sortfield,$sortorder,'',$num); + print_barre_liste($title, $_GET['page'], 'liste.php','&socid='.$socid,$sortfield,$sortorder,'',$num); $i = 0; print ''; print ''; - print_liste_field_titre($langs->trans('Ref'),'liste.php','c.ref','','&socidp='.$socidp,'width="25%"',$sortfield); - print_liste_field_titre($langs->trans('Company'),'liste.php','s.nom','','&socidp='.$socidp,'width="30%"',$sortfield); - print_liste_field_titre($langs->trans('RefCustomerOrder'),'liste.php','c.ref_client','','&socidp='.$socidp,'width="15%"',$sortfield); - print_liste_field_titre($langs->trans('Date'),'liste.php','c.date_commande','','&socidp='.$socidp, 'width="20%" align="right" colspan="2"',$sortfield); - print_liste_field_titre($langs->trans('Status'),'liste.php','c.fk_statut','','&socidp='.$socidp,'width="10%" align="center"',$sortfield); + print_liste_field_titre($langs->trans('Ref'),'liste.php','c.ref','','&socid='.$socid,'width="25%"',$sortfield); + print_liste_field_titre($langs->trans('Company'),'liste.php','s.nom','','&socid='.$socid,'width="30%"',$sortfield); + print_liste_field_titre($langs->trans('RefCustomerOrder'),'liste.php','c.ref_client','','&socid='.$socid,'width="15%"',$sortfield); + print_liste_field_titre($langs->trans('Date'),'liste.php','c.date_commande','','&socid='.$socid, 'width="20%" align="right" colspan="2"',$sortfield); + print_liste_field_titre($langs->trans('Status'),'liste.php','c.fk_statut','','&socid='.$socid,'width="10%" align="center"',$sortfield); print ''; // Lignes des champs de filtre print ''; diff --git a/htdocs/commande/note.php b/htdocs/commande/note.php index a05c198295d..7951e94e13d 100644 --- a/htdocs/commande/note.php +++ b/htdocs/commande/note.php @@ -30,7 +30,7 @@ require("./pre.inc.php"); require_once(DOL_DOCUMENT_ROOT.'/lib/order.lib.php'); -$socidp=isset($_GET["socidp"])?$_GET["socidp"]:isset($_POST["socidp"])?$_POST["socidp"]:""; +$socid=isset($_GET["socid"])?$_GET["socid"]:isset($_POST["socid"])?$_POST["socid"]:""; $user->getrights('commande'); if (!$user->rights->commande->lire) @@ -44,7 +44,7 @@ $langs->load("orders"); if ($user->societe_id > 0) { unset($_GET["action"]); - $socidp = $user->societe_id; + $socid = $user->societe_id; } @@ -100,8 +100,8 @@ $html = new Form($db); if ($_GET["id"]) { - $soc = new Societe($db, $commande->socidp); - $soc->fetch($commande->socidp); + $soc = new Societe($db, $commande->socid); + $soc->fetch($commande->socid); $head = commande_prepare_head($commande); diff --git a/htdocs/commande/stats/commandestats.class.php b/htdocs/commande/stats/commandestats.class.php index 5c4a208eed1..f54c00e1421 100644 --- a/htdocs/commande/stats/commandestats.class.php +++ b/htdocs/commande/stats/commandestats.class.php @@ -39,10 +39,10 @@ class CommandeStats extends Stats { var $db ; - function CommandeStats($DB, $socidp) + function CommandeStats($DB, $socid) { $this->db = $DB; - $this->socidp = $socidp; + $this->socid = $socid; } /** @@ -56,12 +56,12 @@ class CommandeStats extends Stats $sql = "SELECT date_format(c.date_commande,'%m') as dm, count(*) nb"; $sql .= " FROM ".MAIN_DB_PREFIX."commande as c"; - if (!$user->rights->commercial->client->voir && !$this->socidp) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + if (!$user->rights->commercial->client->voir && !$this->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql .= " WHERE date_format(c.date_commande,'%Y') = $year AND c.fk_statut > 0"; - if (!$user->rights->commercial->client->voir && !$this->socidp) $sql .= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id; - if ($this->socidp) + if (!$user->rights->commercial->client->voir && !$this->socid) $sql .= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id; + if ($this->socid) { - $sql .= " AND c.fk_soc = ".$this->socidp; + $sql .= " AND c.fk_soc = ".$this->socid; } $sql .= " GROUP BY dm"; $sql .= " ORDER BY dm DESC"; @@ -80,12 +80,12 @@ class CommandeStats extends Stats $sql = "SELECT date_format(c.date_commande,'%Y') as dm, count(*), sum(c.total_ht)"; $sql .= " FROM ".MAIN_DB_PREFIX."commande as c"; - if (!$user->rights->commercial->client->voir && !$this->socidp) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + if (!$user->rights->commercial->client->voir && !$this->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql .= " WHERE c.fk_statut > 0"; - if (!$user->rights->commercial->client->voir && !$this->socidp) $sql .= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id; - if ($this->socidp) + if (!$user->rights->commercial->client->voir && !$this->socid) $sql .= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id; + if ($this->socid) { - $sql .= " AND c.fk_soc = ".$this->socidp; + $sql .= " AND c.fk_soc = ".$this->socid; } $sql .= " GROUP BY dm DESC"; @@ -103,12 +103,12 @@ class CommandeStats extends Stats $sql = "SELECT date_format(c.date_commande,'%m') as dm, sum(c.total_ht)"; $sql .= " FROM ".MAIN_DB_PREFIX."commande as c"; - if (!$user->rights->commercial->client->voir && !$this->socidp) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + if (!$user->rights->commercial->client->voir && !$this->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql .= " WHERE date_format(c.date_commande,'%Y') = $year AND c.fk_statut > 0"; - if (!$user->rights->commercial->client->voir && !$this->socidp) $sql .= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id; - if ($this->socidp) + if (!$user->rights->commercial->client->voir && !$this->socid) $sql .= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id; + if ($this->socid) { - $sql .= " AND c.fk_soc = ".$this->socidp; + $sql .= " AND c.fk_soc = ".$this->socid; } $sql .= " GROUP BY dm DESC"; @@ -126,12 +126,12 @@ class CommandeStats extends Stats $sql = "SELECT date_format(c.date_commande,'%m') as dm, avg(c.total_ht)"; $sql .= " FROM ".MAIN_DB_PREFIX."commande as c"; - if (!$user->rights->commercial->client->voir && !$this->socidp) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + if (!$user->rights->commercial->client->voir && !$this->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql .= " WHERE date_format(c.date_commande,'%Y') = $year AND c.fk_statut > 0"; - if (!$user->rights->commercial->client->voir && !$this->socidp) $sql .= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id; - if ($this->socidp) + if (!$user->rights->commercial->client->voir && !$this->socid) $sql .= " AND c.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id; + if ($this->socid) { - $sql .= " AND c.fk_soc = ".$this->socidp; + $sql .= " AND c.fk_soc = ".$this->socid; } $sql .= " GROUP BY dm DESC"; diff --git a/htdocs/commande/stats/index.php b/htdocs/commande/stats/index.php index 247dff10180..8daa1ca656e 100644 --- a/htdocs/commande/stats/index.php +++ b/htdocs/commande/stats/index.php @@ -41,7 +41,7 @@ if (!$user->rights->commande->lire) accessforbidden(); if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } @@ -49,7 +49,7 @@ llxHeader(); print_fiche_titre($langs->trans("OrdersStatistics"), $mesg); -$stats = new CommandeStats($db, $socidp); +$stats = new CommandeStats($db, $socid); $year = strftime("%Y", time()); $data = $stats->getNbByMonthWithPrevYear($year); diff --git a/htdocs/commande/stats/month.php b/htdocs/commande/stats/month.php index 66d935e63d5..b2b6ca57183 100644 --- a/htdocs/commande/stats/month.php +++ b/htdocs/commande/stats/month.php @@ -36,7 +36,7 @@ require_once(DOL_DOCUMENT_ROOT."/dolgraph.class.php"); if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } llxHeader(); @@ -57,7 +57,7 @@ $HEIGHT=200; print_fiche_titre($langs->trans("OrdersStatistics"), $mesg); -$stats = new CommandeStats($db, $socidp); +$stats = new CommandeStats($db, $socid); $data = $stats->getNbByMonth($year); create_exdir($conf->commande->dir_temp); diff --git a/htdocs/commonobject.class.php b/htdocs/commonobject.class.php index ec45b8c702f..134594e2705 100644 --- a/htdocs/commonobject.class.php +++ b/htdocs/commonobject.class.php @@ -339,7 +339,7 @@ class CommonObject function fetch_client() { $client = new Societe($this->db); - $client->fetch($this->socidp); + $client->fetch($this->socid); $this->client = $client; } diff --git a/htdocs/companybankaccount.class.php b/htdocs/companybankaccount.class.php index 1a48cd8e85a..aaf4d3b685f 100644 --- a/htdocs/companybankaccount.class.php +++ b/htdocs/companybankaccount.class.php @@ -22,7 +22,7 @@ class CompanyBankAccount { var $rowid; - var $socidp; + var $socid; var $bank; var $courant; @@ -41,7 +41,7 @@ class CompanyBankAccount global $config; $this->db = $DB; - $this->socidp = $socid; + $this->socid = $socid; $this->clos = 0; $this->solde = 0; @@ -56,7 +56,7 @@ class CompanyBankAccount */ function create() { - $sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_rib (fk_soc, datec) values ($this->socidp, now());"; + $sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_rib (fk_soc, datec) values ($this->socid, now());"; if ($this->db->query($sql)) { if ($this->db->affected_rows()) @@ -79,7 +79,7 @@ class CompanyBankAccount { $sql = "SELECT fk_soc FROM ".MAIN_DB_PREFIX."societe_rib "; - $sql .= " WHERE fk_soc = ".$this->socidp; + $sql .= " WHERE fk_soc = ".$this->socid; $result = $this->db->query($sql); @@ -116,7 +116,7 @@ class CompanyBankAccount $sql .= ",proprio = '".addslashes($this->proprio)."'"; $sql .= ",adresse_proprio = '".addslashes($this->adresse_proprio)."'"; - $sql .= " WHERE fk_soc = ".$this->socidp; + $sql .= " WHERE fk_soc = ".$this->socid; $result = $this->db->query($sql); @@ -139,7 +139,7 @@ class CompanyBankAccount { $sql = "SELECT rowid, bank, number, code_banque, code_guichet, cle_rib, bic, iban_prefix, domiciliation, proprio, adresse_proprio FROM ".MAIN_DB_PREFIX."societe_rib"; - $sql .= " WHERE fk_soc = ".$this->socidp; + $sql .= " WHERE fk_soc = ".$this->socid; $result = $this->db->query($sql); diff --git a/htdocs/compta/bank/annuel.php b/htdocs/compta/bank/annuel.php index c6847ca02dd..f67c167b393 100644 --- a/htdocs/compta/bank/annuel.php +++ b/htdocs/compta/bank/annuel.php @@ -47,7 +47,7 @@ else // Sécurité accés client if ($user->societe_id > 0) { - $socidp = $user->societe_id; + $socid = $user->societe_id; } diff --git a/htdocs/compta/charges.php b/htdocs/compta/charges.php index e67b8297ea7..a49b2cf7a18 100644 --- a/htdocs/compta/charges.php +++ b/htdocs/compta/charges.php @@ -37,7 +37,7 @@ $langs->load("tax"); * Action ajout en bookmark */ if ($action == 'add_bookmark') { - $sql = "INSERT INTO ".MAIN_DB_PREFIX."bookmark (fk_soc, dateb, fk_user) VALUES ($socidp, now(),".$user->id.");"; + $sql = "INSERT INTO ".MAIN_DB_PREFIX."bookmark (fk_soc, dateb, fk_user) VALUES ($socid, now(),".$user->id.");"; if (! $db->query($sql) ) { print $db->error(); } diff --git a/htdocs/compta/clients.php b/htdocs/compta/clients.php index 36d65e713a9..d381fb30f05 100644 --- a/htdocs/compta/clients.php +++ b/htdocs/compta/clients.php @@ -57,7 +57,7 @@ llxHeader(); if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } if ($action == 'attribute_prefix') @@ -131,11 +131,11 @@ if ($mode == 'search') { $sql = "SELECT s.idp, s.nom, s.ville, ".$db->pdate("s.datec")." as datec, ".$db->pdate("s.datea")." as datea"; $sql .= ", st.libelle as stcomm, s.prefix_comm, s.code_client, s.code_compta "; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", sc.fk_soc, sc.fk_user "; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user "; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."c_stcomm as st"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql .= " WHERE s.fk_stcomm = st.id AND s.client=1"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; if (strlen($stcomm)) { @@ -169,9 +169,9 @@ if (strlen($begin)) $sql .= " AND s.nom like '".addslashes($begin)."'"; } -if ($socidp) +if ($socid) { - $sql .= " AND s.idp = $socidp"; + $sql .= " AND s.idp = $socid"; } $sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset); diff --git a/htdocs/compta/commande/fiche.php b/htdocs/compta/commande/fiche.php index 7e147156bd3..d2710a76cf9 100644 --- a/htdocs/compta/commande/fiche.php +++ b/htdocs/compta/commande/fiche.php @@ -46,7 +46,7 @@ if (! $user->rights->commande->lire) accessforbidden(); if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } @@ -80,7 +80,7 @@ if ($_GET["id"] > 0) if ( $commande->fetch($_GET["id"]) > 0) { $soc = new Societe($db); - $soc->fetch($commande->socidp); + $soc->fetch($commande->socid); $author = new User($db); $author->id = $commande->user_author_id; @@ -200,7 +200,7 @@ if ($_GET["id"] > 0) print $langs->trans('DeliveryAddress'); print ''; - if (1 == 2 && $_GET['action'] != 'editdelivery_adress' && $commande->brouillon) print ''; + if (1 == 2 && $_GET['action'] != 'editdelivery_adress' && $commande->brouillon) print ''; print '
    socidp.'&id='.$commande->id.'">'.img_edit($langs->trans('SetDeliveryAddress'),1).'socid.'&id='.$commande->id.'">'.img_edit($langs->trans('SetDeliveryAddress'),1).'
    '; print ''; @@ -262,11 +262,11 @@ if ($_GET["id"] > 0) print ''; if ($_GET['action'] == 'classer') { - $html->form_project($_SERVER['PHP_SELF'].'?id='.$commande->id, $commande->socidp, $commande->projet_id, 'projetid'); + $html->form_project($_SERVER['PHP_SELF'].'?id='.$commande->id, $commande->socid, $commande->projet_id, 'projetid'); } else { - $html->form_project($_SERVER['PHP_SELF'].'?id='.$commande->id, $commande->socidp, $commande->projet_id, 'none'); + $html->form_project($_SERVER['PHP_SELF'].'?id='.$commande->id, $commande->socid, $commande->projet_id, 'none'); } print ''; } @@ -348,7 +348,7 @@ if ($_GET["id"] > 0) print ''; if (($objp->info_bits & 2) == 2) { - print ''; + print ''; print img_object($langs->trans("ShowReduc"),'reduc').' '.$langs->trans("Discount"); print ''; if ($objp->description) print ' - '.nl2br($objp->description); @@ -528,7 +528,7 @@ if ($_GET["id"] > 0) if ($commande->statut > 0 && $user->rights->facture->creer) { - print ''.$langs->trans("CreateBill").''; + print ''.$langs->trans("CreateBill").''; } if ($commande->statut > 0 && $user->rights->commande->creer) diff --git a/htdocs/compta/commande/liste.php b/htdocs/compta/commande/liste.php index cc2444568c1..411ae7c8f4e 100644 --- a/htdocs/compta/commande/liste.php +++ b/htdocs/compta/commande/liste.php @@ -42,11 +42,11 @@ $limit = $conf->liste_limit; $offset = $limit * $_GET["page"] ; // Sécurité accés client -$socidp = $_GET["socidp"]; +$socid = $_GET["socid"]; if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } $langs->load('companies'); @@ -58,14 +58,14 @@ llxHeader(); $sql = "SELECT s.nom, s.idp,"; $sql.= " c.rowid, c.ref, c.total_ht,".$db->pdate("c.date_commande")." as date_commande,"; $sql.= " c.fk_statut, c.facture"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", sc.fk_soc, sc.fk_user"; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as c"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql .= " WHERE c.fk_soc = s.idp"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; -if ($socidp) +if (!$user->rights->commercial->client->voir && !$socid) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; +if ($socid) { - $sql .= " AND s.idp = $socidp"; + $sql .= " AND s.idp = $socid"; } if ($_GET["month"] > 0) { @@ -93,10 +93,10 @@ $resql = $db->query($sql); if ($resql) { - if ($socidp) + if ($socid) { $soc = new Societe($db); - $soc->fetch($socidp); + $soc->fetch($socid); $title = $langs->trans("ListOfOrders") . " - ".$soc->nom; } else @@ -106,7 +106,7 @@ if ($resql) // Si page des commandes à facturer $link=DOL_URL_ROOT."/compta/commande/fiche.php"; $title.=" - ".$langs->trans("StatusOrderToBill"); - $param="&socidp=".$socidp."&year=".$_GET["year"]."&month=".$_GET["month"]; + $param="&socid=".$socid."&year=".$_GET["year"]."&month=".$_GET["month"]; $num = $db->num_rows($resql); print_barre_liste($title, $_GET["page"], "liste.php",$param,$sortfield,$sortorder,'',$num); diff --git a/htdocs/compta/deplacement/fiche.php b/htdocs/compta/deplacement/fiche.php index f41ffd054c3..86a43b69b9a 100644 --- a/htdocs/compta/deplacement/fiche.php +++ b/htdocs/compta/deplacement/fiche.php @@ -55,7 +55,7 @@ if ($_POST["action"] == 'add' && $_POST["cancel"] <> $langs->trans("Cancel")) $_POST["reyear"]); $deplacement->km = $_POST["km"]; - $deplacement->socidp = $_POST["socidp"]; + $deplacement->socid = $_POST["socid"]; $deplacement->userid = $user->id; //$_POST["km"]; $id = $deplacement->create($user); diff --git a/htdocs/compta/deplacement/index.php b/htdocs/compta/deplacement/index.php index a4962e87e73..88db305ef36 100644 --- a/htdocs/compta/deplacement/index.php +++ b/htdocs/compta/deplacement/index.php @@ -53,25 +53,25 @@ $pageprev = $page - 1; $pagenext = $page + 1; // Sécurité accés client -$socidp = $_GET["socidp"]; +$socid = $_GET["socid"]; if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } $sql = "SELECT s.nom, s.idp,"; // Ou $sql.= " d.rowid, ".$db->pdate("d.dated")." as dd, d.km, "; // Comment $sql.= " u.name, u.firstname"; // Qui -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", sc.fk_soc, sc.fk_user"; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."deplacement as d, ".MAIN_DB_PREFIX."user as u"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE d.fk_soc = s.idp AND d.fk_user = u.rowid"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; -if ($socidp) +if ($socid) { - $sql .= " AND s.idp = $socidp"; + $sql .= " AND s.idp = $socid"; } $sql .= " ORDER BY $sortfield $sortorder " . $db->plimit( $limit + 1 ,$offset); @@ -81,16 +81,16 @@ if ($resql) { $num = $db->num_rows($resql); - print_barre_liste($langs->trans("ListOfTrips"), $page, "index.php","&socidp=$socidp",$sortfield,$sortorder,'',$num); + print_barre_liste($langs->trans("ListOfTrips"), $page, "index.php","&socid=$socid",$sortfield,$sortorder,'',$num); $i = 0; print ''; print ""; - print_liste_field_titre($langs->trans("Ref"),"index.php","d.rowid","","&socidp=$socidp",'',$sortfield); - print_liste_field_titre($langs->trans("Date"),"index.php","d.dated","","&socidp=$socidp",'',$sortfield); - print_liste_field_titre($langs->trans("Company"),"index.php","s.nom","","&socidp=$socidp",'',$sortfield); - print_liste_field_titre($langs->trans("Person"),"index.php","u.name","","&socidp=$socidp",'',$sortfield); - print_liste_field_titre($langs->trans("Distance"),"index.php","d.km","","&socidp=$socidp",'align="right"',$sortfield); + print_liste_field_titre($langs->trans("Ref"),"index.php","d.rowid","","&socid=$socid",'',$sortfield); + print_liste_field_titre($langs->trans("Date"),"index.php","d.dated","","&socid=$socid",'',$sortfield); + print_liste_field_titre($langs->trans("Company"),"index.php","s.nom","","&socid=$socid",'',$sortfield); + print_liste_field_titre($langs->trans("Person"),"index.php","u.name","","&socid=$socid",'',$sortfield); + print_liste_field_titre($langs->trans("Distance"),"index.php","d.km","","&socid=$socid",'align="right"',$sortfield); print "\n"; $var=true; diff --git a/htdocs/compta/export/liste.php b/htdocs/compta/export/liste.php index a925a9c195b..7791c02b7fc 100644 --- a/htdocs/compta/export/liste.php +++ b/htdocs/compta/export/liste.php @@ -28,7 +28,7 @@ llxHeader('','Compta - Export'); if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index f936c78cb7f..8cc69731cb1 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -55,13 +55,13 @@ $langs->load('main'); $sall=isset($_GET['sall'])?trim($_GET['sall']):trim($_POST['sall']); $mesg=isset($_GET['mesg'])?urldecode($_GET['mesg']):''; -$socidp=isset($_GET['socidp'])?$_GET['socidp']:$_POST['socidp']; +$socid=isset($_GET['socid'])?$_GET['socid']:$_POST['socid']; // Sécurité accés client if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } // Récupération de l'id de projet @@ -152,7 +152,7 @@ if ($_POST['action'] == 'confirm_valid' && $_POST['confirm'] == 'yes' && $user-> $fac = new Facture($db); $fac->fetch($_GET['facid']); $soc = new Societe($db); - $soc->fetch($fac->socidp); + $soc->fetch($fac->socid); $result = $fac->set_valid($fac->id, $user, $soc); if ($result >= 0) { @@ -270,7 +270,7 @@ if ($_POST['action'] == 'confirm_payed_partially' && $_POST['confirm'] == 'yes' if ($_POST['action'] == 'add' && $user->rights->facture->creer) { $facture = new Facture($db); - $facture->socidp=$_POST['socid']; + $facture->socid=$_POST['socid']; $facture->fetch_client(); $db->begin(); @@ -313,7 +313,7 @@ if ($_POST['action'] == 'add' && $user->rights->facture->creer) // Si facture récurrente $datefacture = mktime(12, 0 , 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); - $facture->socidp = $_POST['socid']; + $facture->socid = $_POST['socid']; $facture->type = $_POST['type']; $facture->number = $_POST['facnumber']; $facture->date = $datefacture; @@ -331,7 +331,7 @@ if ($_POST['action'] == 'add' && $user->rights->facture->creer) // Si facture standard $datefacture = mktime(12, 0 , 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); - $facture->socidp = $_POST['socid']; + $facture->socid = $_POST['socid']; $facture->type = $_POST['type']; $facture->number = $_POST['facnumber']; $facture->date = $datefacture; @@ -534,7 +534,7 @@ if (($_POST['action'] == 'addligne' || $_POST['action'] == 'addligne_predef') && $fac = new Facture($db); $ret=$fac->fetch($_POST['facid']); $soc = new Societe($db); - $ret=$soc->fetch($fac->socidp); + $ret=$soc->fetch($fac->socid); $date_start=''; $date_end=''; @@ -752,7 +752,7 @@ if (($_POST['action'] == 'send' || $_POST['action'] == 'relance') && ! $_POST['c if (is_readable($file)) { - $soc = new Societe($db, $fac->socidp); + $soc = new Societe($db, $fac->socid); if ($_POST['sendto']) { // Le destinataire a été fourni via le champ libre @@ -836,7 +836,7 @@ if (($_POST['action'] == 'send' || $_POST['action'] == 'relance') && ! $_POST['c $actioncomm->date = time(); $actioncomm->percent = 100; $actioncomm->contact = new Contact($db,$sendtoid); - $actioncomm->societe = new Societe($db,$fac->socidp); + $actioncomm->societe = new Societe($db,$fac->socid); $actioncomm->user = $user; // User qui a fait l'action $actioncomm->facid = $fac->id; @@ -966,7 +966,7 @@ if ($_GET['action'] == 'create') { $propal = New Propal($db); $propal->fetch($_GET['propalid']); - $societe_id = $propal->socidp; + $societe_id = $propal->socid; $projetid=$propal->projetidp; $ref_client=$propal->ref_client; @@ -980,7 +980,7 @@ if ($_GET['action'] == 'create') { $commande = New Commande($db); $commande->fetch($_GET['commandeid']); - $societe_id = $commande->socidp; + $societe_id = $commande->socid; $projetid=$commande-> projet_id; $ref_client=$commande->ref_client; @@ -1005,7 +1005,7 @@ if ($_GET['action'] == 'create') } else { - $societe_id=$socidp; + $societe_id=$socid; $soc->fetch($societe_id); $cond_reglement_id = $soc->cond_reglement; @@ -1043,7 +1043,7 @@ if ($_GET['action'] == 'create') // Societe print ''; print ''; @@ -1419,7 +1419,7 @@ if ($_GET['action'] == 'create') print ''; print ''; @@ -1926,7 +1926,7 @@ else print ''; // ancre pour retourner sur la ligne if (($objp->info_bits & 2) == 2) { - print ''; + print ''; print img_object($langs->trans("ShowReduc"),'reduc').' '.$langs->trans("Discount"); print ''; if ($objp->description) print ' - '.nl2br($objp->description); @@ -2516,7 +2516,7 @@ else $sql .= ' FROM '.MAIN_DB_PREFIX.'actioncomm as a, '.MAIN_DB_PREFIX.'user as u '; $sql .= ' WHERE a.fk_user_author = u.rowid '; $sql .= ' AND a.fk_action in (9,10) '; - $sql .= ' AND a.fk_soc = '.$fac->socidp ; + $sql .= ' AND a.fk_soc = '.$fac->socid ; $sql .= ' AND a.fk_facture = '.$fac->id; $resql = $db->query($sql); @@ -2709,7 +2709,7 @@ else if (! $sall) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiement_facture as pf ON f.rowid=pf.fk_facture '; if ($sall) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'facturedet as fd ON f.rowid=fd.fk_facture '; $sql.= ' WHERE f.fk_soc = s.idp'; - if ($socidp) $sql .= ' AND s.idp = '.$socidp; + if ($socid) $sql .= ' AND s.idp = '.$socid; if ($month > 0) $sql .= ' AND date_format(f.datef, \'%m\') = '.$month; if ($_GET['filtre']) { @@ -2764,24 +2764,24 @@ else { $num = $db->num_rows($resql); - if ($socidp) + if ($socid) { $soc = new Societe($db); - $soc->fetch($socidp); + $soc->fetch($socid); } - print_barre_liste($langs->trans('BillsCustomers').' '.($socidp?' '.$soc->nom:''),$page,'facture.php','&socidp='.$socidp,$sortfield,$sortorder,'',$num); + print_barre_liste($langs->trans('BillsCustomers').' '.($socid?' '.$soc->nom:''),$page,'facture.php','&socid='.$socid,$sortfield,$sortorder,'',$num); $i = 0; print '
    '.$langs->trans('Company').''; print $soc->getNomUrl(1); - print ''; + print ''; print '
    '; if (($objp->info_bits & 2) == 2) { - print ''; + print ''; print img_object($langs->trans("ShowReduc"),'reduc').' '.$langs->trans("Discount"); print ''; } @@ -1482,8 +1482,8 @@ else $fac = New Facture($db); if ( $fac->fetch($_GET['facid'], $user->societe_id) > 0) { - $soc = new Societe($db, $fac->socidp); - $soc->fetch($fac->socidp); + $soc = new Societe($db, $fac->socid); + $soc->fetch($fac->socid); $absolute_discount=$soc->getCurrentDiscount(); $totalpaye = $fac->getSommePaiement(); @@ -1533,7 +1533,7 @@ else require_once(DOL_DOCUMENT_ROOT ."/notify.class.php"); $notify=new Notify($db); $text.='
    '; - $text.=$notify->confirmMessage(2,$fac->socidp); + $text.=$notify->confirmMessage(2,$fac->socid); } $html->form_confirm($_SERVER["PHP_SELF"].'?facid='.$fac->id,$langs->trans('ValidateBill'),$text,'confirm_valid'); @@ -1839,11 +1839,11 @@ else print '
    '; if ($_GET['action'] == 'classer') { - $html->form_project($_SERVER['PHP_SELF'].'?facid='.$fac->id,$fac->socidp,$fac->projetid,'projetid'); + $html->form_project($_SERVER['PHP_SELF'].'?facid='.$fac->id,$fac->socid,$fac->projetid,'projetid'); } else { - $html->form_project($_SERVER['PHP_SELF'].'?facid='.$fac->id,$fac->socidp,$fac->projetid,'none'); + $html->form_project($_SERVER['PHP_SELF'].'?facid='.$fac->id,$fac->socid,$fac->projetid,'none'); } print '
    '; print ''; - print_liste_field_titre($langs->trans('Ref'),$_SERVER['PHP_SELF'],'f.facnumber','','&socidp='.$socidp,'',$sortfield); - print_liste_field_titre($langs->trans('Date'),$_SERVER['PHP_SELF'],'f.datef','','&socidp='.$socidp,'align="center"',$sortfield); - print_liste_field_titre($langs->trans('Company'),$_SERVER['PHP_SELF'],'s.nom','','&socidp='.$socidp,'',$sortfield); - print_liste_field_titre($langs->trans('AmountHT'),$_SERVER['PHP_SELF'],'f.total','','&socidp='.$socidp,'align="right"',$sortfield); - print_liste_field_titre($langs->trans('AmountTTC'),$_SERVER['PHP_SELF'],'f.total_ttc','','&socidp='.$socidp,'align="right"',$sortfield); - print_liste_field_titre($langs->trans('Received'),$_SERVER['PHP_SELF'],'am','','&socidp='.$socidp,'align="right"',$sortfield); - print_liste_field_titre($langs->trans('Status'),$_SERVER['PHP_SELF'],'fk_statut,paye,am','','&socidp='.$socidp,'align="right"',$sortfield); + print_liste_field_titre($langs->trans('Ref'),$_SERVER['PHP_SELF'],'f.facnumber','','&socid='.$socid,'',$sortfield); + print_liste_field_titre($langs->trans('Date'),$_SERVER['PHP_SELF'],'f.datef','','&socid='.$socid,'align="center"',$sortfield); + print_liste_field_titre($langs->trans('Company'),$_SERVER['PHP_SELF'],'s.nom','','&socid='.$socid,'',$sortfield); + print_liste_field_titre($langs->trans('AmountHT'),$_SERVER['PHP_SELF'],'f.total','','&socid='.$socid,'align="right"',$sortfield); + print_liste_field_titre($langs->trans('AmountTTC'),$_SERVER['PHP_SELF'],'f.total_ttc','','&socid='.$socid,'align="right"',$sortfield); + print_liste_field_titre($langs->trans('Received'),$_SERVER['PHP_SELF'],'am','','&socid='.$socid,'align="right"',$sortfield); + print_liste_field_titre($langs->trans('Status'),$_SERVER['PHP_SELF'],'fk_statut,paye,am','','&socid='.$socid,'align="right"',$sortfield); print ''; // Lignes des champs de filtre diff --git a/htdocs/compta/facture/apercu.php b/htdocs/compta/facture/apercu.php index 083e39ba1e3..cf479140598 100644 --- a/htdocs/compta/facture/apercu.php +++ b/htdocs/compta/facture/apercu.php @@ -45,7 +45,7 @@ $langs->load("bills"); if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } @@ -64,8 +64,8 @@ if ($_GET["facid"] > 0) $fac = New Facture($db); if ( $fac->fetch($_GET["facid"], $user->societe_id) > 0) { - $soc = new Societe($db, $fac->socidp); - $soc->fetch($fac->socidp); + $soc = new Societe($db, $fac->socid); + $soc->fetch($fac->socid); $author = new User($db); if ($fac->user_author) { diff --git a/htdocs/compta/facture/contact.php b/htdocs/compta/facture/contact.php index c2ce66b19b9..d9fc67ab01f 100644 --- a/htdocs/compta/facture/contact.php +++ b/htdocs/compta/facture/contact.php @@ -107,7 +107,7 @@ function select_type_contact($facture, $defValue, $htmlname = 'type', $source) if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } /* diff --git a/htdocs/compta/facture/document.php b/htdocs/compta/facture/document.php index c806f326a2a..93b2ca25897 100644 --- a/htdocs/compta/facture/document.php +++ b/htdocs/compta/facture/document.php @@ -111,7 +111,7 @@ if ($facid > 0) $upload_dir = $conf->facture->dir_output.'/'.$facref; $societe = new Societe($db); - $societe->fetch($facture->socidp); + $societe->fetch($facture->socid); $head = facture_prepare_head($facture); dolibarr_fiche_head($head, 'documents', $langs->trans('InvoiceCustomer')); diff --git a/htdocs/compta/facture/facture-rec.class.php b/htdocs/compta/facture/facture-rec.class.php index ceb0cec5d78..a587a08be7b 100644 --- a/htdocs/compta/facture/facture-rec.class.php +++ b/htdocs/compta/facture/facture-rec.class.php @@ -43,7 +43,7 @@ class FactureRec extends Facture var $id ; - var $socidp; // Id client + var $socid; // Id client var $client; // Objet societe client (à charger par fetch_client) var $number; @@ -97,7 +97,7 @@ class FactureRec extends Facture $this->brouillon = 1; $sql = "INSERT INTO ".MAIN_DB_PREFIX."facture_rec (titre, fk_soc, datec, amount, remise, remise_percent, note, fk_user_author,fk_projet, fk_cond_reglement) "; - $sql.= " VALUES ('$this->titre', '$facsrc->socidp', now(), '$facsrc->amount', '$facsrc->remise', '$facsrc->remise_percent', '".addslashes($this->note)."','$user->id',"; + $sql.= " VALUES ('$this->titre', '$facsrc->socid', now(), '$facsrc->amount', '$facsrc->remise', '$facsrc->remise_percent', '".addslashes($this->note)."','$user->id',"; $sql.= " ".($facsrc->projetid?"'".$facsrc->projetid."'":"null").", "; $sql.= " '".$facsrc->cond_reglement_id."')"; if ( $this->db->query($sql) ) @@ -175,7 +175,7 @@ class FactureRec extends Facture $this->total_ttc = $obj->total_ttc; $this->paye = $obj->paye; $this->remise_percent = $obj->remise_percent; - $this->socidp = $obj->fk_soc; + $this->socid = $obj->fk_soc; $this->statut = $obj->fk_statut; $this->date_lim_reglement = $obj->dlr; $this->cond_reglement_id = $obj->crid; diff --git a/htdocs/compta/facture/fiche-rec.php b/htdocs/compta/facture/fiche-rec.php index cc97576c480..dd324180ae1 100644 --- a/htdocs/compta/facture/fiche-rec.php +++ b/htdocs/compta/facture/fiche-rec.php @@ -58,7 +58,7 @@ $sortfield="f.datef"; if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } @@ -283,8 +283,8 @@ else if ( $fac->fetch($facid, $user->societe_id) > 0) { - $soc = new Societe($db, $fac->socidp); - $soc->fetch($fac->socidp); + $soc = new Societe($db, $fac->socid); + $soc->fetch($fac->socid); $author = new User($db); $author->id = $fac->user_author; $author->fetch(); @@ -402,8 +402,8 @@ else $sql = "SELECT s.nom,s.idp,f.titre,f.total,f.rowid as facid"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture_rec as f WHERE f.fk_soc = s.idp"; - if ($socidp) - $sql .= " AND s.idp = $socidp"; + if ($socid) + $sql .= " AND s.idp = $socid"; //$sql .= " ORDER BY $sortfield $sortorder, rowid DESC "; // $sql .= $db->plimit($limit + 1,$offset); @@ -413,13 +413,13 @@ else if ($result) { $num = $db->num_rows($result); - print_barre_liste($langs->trans("RepeatableInvoice"),$page,"fiche-rec.php","&socidp=$socidp",$sortfield,$sortorder,'',$num); + print_barre_liste($langs->trans("RepeatableInvoice"),$page,"fiche-rec.php","&socid=$socid",$sortfield,$sortorder,'',$num); $i = 0; print "
    "; print ''; print ''; - print_liste_field_titre($langs->trans("Company"),"fiche-rec.php","s.nom","","&socidp=$socidp"); + print_liste_field_titre($langs->trans("Company"),"fiche-rec.php","s.nom","","&socid=$socid"); print ''; print ''; print "\n"; diff --git a/htdocs/compta/facture/impayees.php b/htdocs/compta/facture/impayees.php index bfd20d8a9d4..a495253a19c 100644 --- a/htdocs/compta/facture/impayees.php +++ b/htdocs/compta/facture/impayees.php @@ -43,13 +43,13 @@ $langs->load("bills"); -if ($_GET["socidp"]) { $socidp=$_GET["socidp"]; } +if ($_GET["socid"]) { $socid=$_GET["socid"]; } // Sécurité accés client if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } @@ -76,15 +76,15 @@ if ($user->rights->facture->lire) $sql.= $db->pdate("f.datef")." as df, ".$db->pdate("f.date_lim_reglement")." as datelimite, "; $sql.= " f.paye as paye, f.rowid as facid, f.fk_statut"; $sql.= " ,sum(pf.amount) as am"; - if (! $user->rights->commercial->client->voir && ! $socidp) $sql .= ", sc.fk_soc, sc.fk_user "; + if (! $user->rights->commercial->client->voir && ! $socid) $sql .= ", sc.fk_soc, sc.fk_user "; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; - if (! $user->rights->commercial->client->voir && ! $socidp) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + if (! $user->rights->commercial->client->voir && ! $socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= ",".MAIN_DB_PREFIX."facture as f"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON f.rowid=pf.fk_facture "; $sql.= " WHERE f.fk_soc = s.idp"; $sql.= " AND f.paye = 0 AND f.fk_statut = 1"; - if (! $user->rights->commercial->client->voir && ! $socidp) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; - if ($socidp) $sql .= " AND s.idp = $socidp"; + if (! $user->rights->commercial->client->voir && ! $socid) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; + if ($socid) $sql .= " AND s.idp = $socid"; if ($_GET["filtre"]) { @@ -135,26 +135,26 @@ if ($user->rights->facture->lire) { $num = $db->num_rows($result); - if ($socidp) + if ($socid) { $soc = new Societe($db); - $soc->fetch($socidp); + $soc->fetch($socid); } - $titre=($socidp?$langs->trans("BillsCustomersUnpayedForCompany",$soc->nom):$langs->trans("BillsCustomersUnpayed")); - print_barre_liste($titre,$page,"impayees.php","&socidp=$socidp",$sortfield,$sortorder,'',$num); + $titre=($socid?$langs->trans("BillsCustomersUnpayedForCompany",$soc->nom):$langs->trans("BillsCustomersUnpayed")); + print_barre_liste($titre,$page,"impayees.php","&socid=$socid",$sortfield,$sortorder,'',$num); $i = 0; print '
    '.$langs->trans("Ref").''.$langs->trans("Amount").' 
    '; print ''; - print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"f.facnumber","","&socidp=$socidp","",$sortfield); - print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"f.datef","","&socidp=$socidp",'align="center"',$sortfield); - print_liste_field_titre($langs->trans("DateDue"),$_SERVER["PHP_SELF"],"f.date_lim_reglement","","&socidp=$socidp",'align="center"',$sortfield); - print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","","&socidp=$socidp","",$sortfield); - print_liste_field_titre($langs->trans("AmountHT"),$_SERVER["PHP_SELF"],"f.total","","&socidp=$socidp",'align="right"',$sortfield); - print_liste_field_titre($langs->trans("AmountTTC"),$_SERVER["PHP_SELF"],"f.total_ttc","","&socidp=$socidp",'align="right"',$sortfield); - print_liste_field_titre($langs->trans("Received"),$_SERVER["PHP_SELF"],"am","","&socidp=$socidp",'align="right"',$sortfield); - print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"fk_statut,paye,am","","&socidp=$socidp",'align="right"',$sortfield); + print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"f.facnumber","","&socid=$socid","",$sortfield); + print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"f.datef","","&socid=$socid",'align="center"',$sortfield); + print_liste_field_titre($langs->trans("DateDue"),$_SERVER["PHP_SELF"],"f.date_lim_reglement","","&socid=$socid",'align="center"',$sortfield); + print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","","&socid=$socid","",$sortfield); + print_liste_field_titre($langs->trans("AmountHT"),$_SERVER["PHP_SELF"],"f.total","","&socid=$socid",'align="right"',$sortfield); + print_liste_field_titre($langs->trans("AmountTTC"),$_SERVER["PHP_SELF"],"f.total_ttc","","&socid=$socid",'align="right"',$sortfield); + print_liste_field_titre($langs->trans("Received"),$_SERVER["PHP_SELF"],"am","","&socid=$socid",'align="right"',$sortfield); + print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"fk_statut,paye,am","","&socid=$socid",'align="right"',$sortfield); print "\n"; // Lignes des champs de filtre diff --git a/htdocs/compta/facture/info.php b/htdocs/compta/facture/info.php index 2e0d0b004c1..09cf65e75b2 100644 --- a/htdocs/compta/facture/info.php +++ b/htdocs/compta/facture/info.php @@ -44,8 +44,8 @@ $fac = new Facture($db); $fac->fetch($_GET["facid"]); $fac->info($_GET["facid"]); -$soc = new Societe($db, $fac->socidp); -$soc->fetch($fac->socidp); +$soc = new Societe($db, $fac->socid); +$soc->fetch($fac->socid); $head = facture_prepare_head($fac); dolibarr_fiche_head($head, 'info', $langs->trans("InvoiceCustomer")); diff --git a/htdocs/compta/facture/note.php b/htdocs/compta/facture/note.php index 29f5fc705c0..0c348b80a43 100644 --- a/htdocs/compta/facture/note.php +++ b/htdocs/compta/facture/note.php @@ -30,7 +30,7 @@ require("./pre.inc.php"); require_once(DOL_DOCUMENT_ROOT.'/lib/invoice.lib.php'); -$socidp=isset($_GET["socidp"])?$_GET["socidp"]:isset($_POST["socidp"])?$_POST["socidp"]:""; +$socid=isset($_GET["socid"])?$_GET["socid"]:isset($_POST["socid"])?$_POST["socid"]:""; $user->getrights('facture'); if (!$user->rights->facture->lire) @@ -43,7 +43,7 @@ $langs->load("bills"); if ($user->societe_id > 0) { unset($_GET["action"]); - $socidp = $user->societe_id; + $socid = $user->societe_id; } @@ -99,8 +99,8 @@ $html = new Form($db); if ($_GET["facid"]) { - $soc = new Societe($db, $fac->socidp); - $soc->fetch($fac->socidp); + $soc = new Societe($db, $fac->socid); + $soc->fetch($fac->socid); $head = facture_prepare_head($fac); $hselected = 2; diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php index 2d512ce9bde..4a98690467d 100644 --- a/htdocs/compta/facture/prelevement.php +++ b/htdocs/compta/facture/prelevement.php @@ -44,7 +44,7 @@ $langs->load("withdrawals"); if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } @@ -102,8 +102,8 @@ if ($_GET["facid"] > 0) { if ($mesg) print $mesg.'
    '; - $soc = new Societe($db, $fac->socidp); - $soc->fetch($fac->socidp); + $soc = new Societe($db, $fac->socid); + $soc->fetch($fac->socid); $author = new User($db); if ($fac->user_author) diff --git a/htdocs/compta/facture/stats/facturestats.class.php b/htdocs/compta/facture/stats/facturestats.class.php index 5d182093a3d..25f3b43b521 100644 --- a/htdocs/compta/facture/stats/facturestats.class.php +++ b/htdocs/compta/facture/stats/facturestats.class.php @@ -40,10 +40,10 @@ class FactureStats extends Stats { var $db ; - function FactureStats($DB, $socidp=0) + function FactureStats($DB, $socid=0) { $this->db = $DB; - $this->socidp = $socidp; + $this->socid = $socid; } @@ -55,9 +55,9 @@ class FactureStats extends Stats { $sql = "SELECT date_format(datef,'%m') as dm, count(*) FROM ".MAIN_DB_PREFIX."facture"; $sql .= " WHERE date_format(datef,'%Y') = $year AND fk_statut > 0"; - if ($this->socidp) + if ($this->socid) { - $sql .= " AND fk_soc = ".$this->socidp; + $sql .= " AND fk_soc = ".$this->socid; } $sql .= " GROUP BY dm DESC"; @@ -84,9 +84,9 @@ class FactureStats extends Stats { $sql = "SELECT date_format(datef,'%m') as dm, sum(total) FROM ".MAIN_DB_PREFIX."facture"; $sql .= " WHERE date_format(datef,'%Y') = $year AND fk_statut > 0"; - if ($this->socidp) + if ($this->socid) { - $sql .= " AND fk_soc = ".$this->socidp; + $sql .= " AND fk_soc = ".$this->socid; } $sql .= " GROUP BY dm DESC"; @@ -100,9 +100,9 @@ class FactureStats extends Stats { $sql = "SELECT date_format(datef,'%m') as dm, avg(total) FROM ".MAIN_DB_PREFIX."facture"; $sql .= " WHERE date_format(datef,'%Y') = $year AND fk_statut > 0"; - if ($this->socidp) + if ($this->socid) { - $sql .= " AND fk_soc = ".$this->socidp; + $sql .= " AND fk_soc = ".$this->socid; } $sql .= " GROUP BY dm DESC"; diff --git a/htdocs/compta/facture/stats/index.php b/htdocs/compta/facture/stats/index.php index c4e2a10122d..3a63ab8e643 100644 --- a/htdocs/compta/facture/stats/index.php +++ b/htdocs/compta/facture/stats/index.php @@ -37,14 +37,14 @@ $HEIGHT=200; if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } llxHeader(); print_fiche_titre($langs->trans("BillsStatistics"), $mesg); -$stats = new FactureStats($db, $socidp); +$stats = new FactureStats($db, $socid); $year = strftime("%Y", time()); $data = $stats->getNbByMonthWithPrevYear($year); @@ -70,9 +70,9 @@ if (! $mesg) } $sql = "SELECT count(*) as nb, date_format(datef,'%Y') as dm, sum(total) as total FROM ".MAIN_DB_PREFIX."facture WHERE fk_statut > 0 "; -if ($socidp) +if ($socid) { - $sql .= " AND fk_soc = $socidp"; + $sql .= " AND fk_soc = $socid"; } $sql .= " GROUP BY dm DESC "; $resql=$db->query($sql); diff --git a/htdocs/compta/facture/stats/month.php b/htdocs/compta/facture/stats/month.php index 878605e9316..28fb971bb10 100644 --- a/htdocs/compta/facture/stats/month.php +++ b/htdocs/compta/facture/stats/month.php @@ -37,7 +37,7 @@ $GRAPHHEIGHT=200; if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } @@ -51,7 +51,7 @@ $mesg.= ' '.img_next().''; print_fiche_titre($langs->trans("BillsStatistics"), $mesg); -$stats = new FactureStats($db, $socidp); +$stats = new FactureStats($db, $socid); $data = $stats->getNbByMonth($year); create_exdir($conf->facture->dir_temp); diff --git a/htdocs/compta/fiche.php b/htdocs/compta/fiche.php index b393152bbf3..50f3be131e7 100644 --- a/htdocs/compta/fiche.php +++ b/htdocs/compta/fiche.php @@ -255,7 +255,7 @@ if ($socid > 0) { $tableaushown=1; print ''; - print ''; + print ''; print ''; } @@ -309,7 +309,7 @@ if ($socid > 0) { $tableaushown=1; print ''; - print ''; + print ''; print ''; } while ($i < $num && $i < $MAXLIST) @@ -346,7 +346,7 @@ if ($socid > 0) // Si société cliente ou prospect, on affiche bouton "Créer facture client" if ($societe->client != 0 && $conf->facture->enabled && $user->rights->facture->creer) { $langs->load("bills"); - print "id\">".$langs->trans("AddBill").""; + print "id\">".$langs->trans("AddBill").""; } if ($conf->deplacement->enabled) { diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index 6fcfd51d951..c11843cd976 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -47,11 +47,11 @@ $langs->load("bills"); if ($conf->commande->enabled) $langs->load("orders"); // Sécurité accés client -$socidp=''; +$socid=''; if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } @@ -61,12 +61,12 @@ if ($user->societe_id > 0) if (isset($_GET["action"]) && $_GET["action"] == 'add_bookmark') { - $sql = "DELETE FROM ".MAIN_DB_PREFIX."bookmark WHERE fk_soc = ".$socidp." AND fk_user=".$user->id; + $sql = "DELETE FROM ".MAIN_DB_PREFIX."bookmark WHERE fk_soc = ".$socid." AND fk_user=".$user->id; if (! $db->query($sql) ) { dolibarr_print_error($db); } - $sql = "INSERT INTO ".MAIN_DB_PREFIX."bookmark (fk_soc, dateb, fk_user) VALUES ($socidp, now(),".$user->id.");"; + $sql = "INSERT INTO ".MAIN_DB_PREFIX."bookmark (fk_soc, dateb, fk_user) VALUES ($socid, now(),".$user->id.");"; if (! $db->query($sql) ) { dolibarr_print_error($db); @@ -119,15 +119,15 @@ if ($conf->facture->enabled) if ($conf->facture->enabled && $user->rights->facture->lire) { $sql = "SELECT f.facnumber, f.rowid, f.total_ttc, s.nom, s.idp"; - if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", sc.fk_soc, sc.fk_user "; + if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user "; $sql .= " FROM ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."societe as s"; - if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql .= " WHERE s.idp = f.fk_soc AND f.fk_statut = 0"; - if (!$user->rights->commercial->client->voir && !$socidp) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; + if (!$user->rights->commercial->client->voir && !$socid) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; - if ($socidp) + if ($socid) { - $sql .= " AND f.fk_soc = $socidp"; + $sql .= " AND f.fk_soc = $socid"; } $resql = $db->query($sql); @@ -275,16 +275,16 @@ if ($conf->facture->enabled && $conf->commande->enabled && $user->rights->comman $sql = "SELECT sum(f.total) as tot_fht, sum(f.total_ttc) as tot_fttc,"; $sql.= " s.nom, s.idp,"; $sql.= " p.rowid, p.ref, p.facture, p.fk_statut, p.total_ht, p.total_ttc"; - if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", sc.fk_soc, sc.fk_user "; + if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user "; $sql.= " FROM ".MAIN_DB_PREFIX."societe AS s, ".MAIN_DB_PREFIX."commande AS p"; - if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."co_fa AS co_fa ON co_fa.fk_commande = p.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture AS f ON co_fa.fk_facture = f.rowid"; $sql.= " WHERE p.fk_soc = s.idp"; - if (!$user->rights->commercial->client->voir && !$socidp) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; - if ($socidp) + if (!$user->rights->commercial->client->voir && !$socid) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; + if ($socid) { - $sql.= " AND p.fk_soc = $socidp"; + $sql.= " AND p.fk_soc = $socid"; } $sql.= " AND p.fk_statut = 3 AND p.facture=0"; $sql.= " GROUP BY p.rowid"; @@ -356,13 +356,13 @@ if ($conf->facture->enabled && $user->rights->facture->lire) $sql = "SELECT f.rowid, f.facnumber, f.fk_statut, f.total, f.total_ttc, ".$db->pdate("f.date_lim_reglement")." as datelimite,"; $sql.= " sum(pf.amount) as am,"; $sql.= " s.nom, s.idp"; - if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", sc.fk_soc, sc.fk_user "; + if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user "; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf on f.rowid=pf.fk_facture"; - if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE s.idp = f.fk_soc AND f.paye = 0 AND f.fk_statut = 1"; - if (!$user->rights->commercial->client->voir && !$socidp) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; - if ($socidp) $sql .= " AND f.fk_soc = ".$socidp; + if (!$user->rights->commercial->client->voir && !$socid) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; + if ($socid) $sql .= " AND f.fk_soc = ".$socid; $sql.= " GROUP BY f.rowid, f.facnumber, f.fk_statut, f.total, f.total_ttc, s.nom, s.idp"; $sql.= " ORDER BY f.datef ASC, f.facnumber ASC"; @@ -436,13 +436,13 @@ if ($conf->facture->enabled && $user->rights->facture->lire) $sql = "SELECT ff.rowid, ff.facnumber, ff.fk_statut, ff.fk_statut, ff.libelle, ff.total_ht, ff.total_ttc,"; $sql.= " sum(pf.amount) as am,"; $sql.= " s.nom, s.idp"; - if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", sc.fk_soc, sc.fk_user "; + if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user "; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_fourn as ff"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiementfourn_facturefourn as pf on ff.rowid=pf.fk_facturefourn"; - if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE s.idp = ff.fk_soc"; $sql.= " AND ff.paye=0 AND ff.fk_statut = 1"; - if (!$user->rights->commercial->client->voir && !$socidp) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; + if (!$user->rights->commercial->client->voir && !$socid) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; $sql.= " GROUP BY ff.rowid, ff.facnumber, ff.fk_statut, ff.total, ff.total_ttc, s.nom, s.idp"; $resql=$db->query($sql); diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php index b5e3df103b5..f5d17d686f3 100644 --- a/htdocs/compta/paiement.php +++ b/htdocs/compta/paiement.php @@ -185,7 +185,7 @@ if ($_POST['action'] == 'add_paiement') if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } @@ -269,7 +269,7 @@ if ($_GET['action'] == 'create' || $_POST['action'] == 'add_paiement') $sql .= ', sum(pf.amount) as am'; $sql .= ' FROM '.MAIN_DB_PREFIX.'facture as f'; $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiement_facture as pf ON pf.fk_facture = f.rowid'; - $sql .= ' WHERE f.fk_soc = '.$facture->socidp; + $sql .= ' WHERE f.fk_soc = '.$facture->socid; $sql .= ' AND f.paye = 0'; $sql .= ' AND f.fk_statut = 1'; // Statut=0 => non validée, Statut=2 => annulée $sql .= ' GROUP BY f.facnumber'; @@ -376,9 +376,9 @@ if (! $_GET['action'] && ! $_POST['action']) $sql .= ' FROM '.MAIN_DB_PREFIX.'paiement as p, '.MAIN_DB_PREFIX.'facture as f, '.MAIN_DB_PREFIX.'c_paiement as c'; $sql .= ' WHERE p.fk_facture = f.rowid AND p.fk_paiement = c.id'; - if ($socidp) + if ($socid) { - $sql .= ' AND f.fk_soc = '.$socidp; + $sql .= ' AND f.fk_soc = '.$socid; } $sql .= ' ORDER BY '.$sortfield.' '.$sortorder; diff --git a/htdocs/compta/paiement/avalider.php b/htdocs/compta/paiement/avalider.php index 3a819909c8b..15c650ef973 100644 --- a/htdocs/compta/paiement/avalider.php +++ b/htdocs/compta/paiement/avalider.php @@ -37,11 +37,11 @@ $langs->load("bills"); if (! $user->rights->facture->lire) accessforbidden(); -$socidp=0; +$socid=0; if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } @@ -63,15 +63,15 @@ $offset = $limit * $page ; $sql = "SELECT p.rowid,".$db->pdate("p.datep")." as dp, p.amount, p.statut"; $sql .=", c.libelle as paiement_type, p.num_paiement"; $sql .= " FROM ".MAIN_DB_PREFIX."paiement as p, ".MAIN_DB_PREFIX."c_paiement as c"; -if ($socidp) +if ($socid) { $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON p.rowid = pf.fk_paiement"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture as f ON pf.fk_facture = f.rowid"; } $sql .= " WHERE p.fk_paiement = c.id"; -if ($socidp) +if ($socid) { - $sql.= " AND f.fk_soc = ".$socidp; + $sql.= " AND f.fk_soc = ".$socid; } $sql .= " AND p.statut = 0"; $sql .= " ORDER BY $sortfield $sortorder"; diff --git a/htdocs/compta/paiement/liste.php b/htdocs/compta/paiement/liste.php index 9f1ffea7a24..27fcf545422 100644 --- a/htdocs/compta/paiement/liste.php +++ b/htdocs/compta/paiement/liste.php @@ -37,11 +37,11 @@ $user->getrights("facture"); if (! $user->rights->facture->lire) accessforbidden(); -$socidp=0; +$socid=0; if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } @@ -68,15 +68,15 @@ $sql.= " FROM ".MAIN_DB_PREFIX."c_paiement as c,"; $sql.= " ".MAIN_DB_PREFIX."paiement as p"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON p.fk_bank = b.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.rowid"; -if ($socidp) +if ($socid) { $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON p.rowid = pf.fk_paiement"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture as f ON pf.fk_facture = f.rowid"; } $sql.= " WHERE p.fk_paiement = c.id"; -if ($socidp) +if ($socid) { - $sql.= " AND f.fk_soc = ".$socidp; + $sql.= " AND f.fk_soc = ".$socid; } if ($_GET["search_montant"]) { diff --git a/htdocs/compta/paiement/rapport.php b/htdocs/compta/paiement/rapport.php index 9ba095e97e4..61154b790fb 100644 --- a/htdocs/compta/paiement/rapport.php +++ b/htdocs/compta/paiement/rapport.php @@ -37,11 +37,11 @@ if (! $user->rights->facture->lire) $dir = $conf->compta->dir_output; -$socidp=0; +$socid=0; if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; $dir = DOL_DATA_ROOT.'/private/'.$user->id.'/compta'; } diff --git a/htdocs/compta/paiement_charge.php b/htdocs/compta/paiement_charge.php index da9531c5157..64f2a410bd6 100755 --- a/htdocs/compta/paiement_charge.php +++ b/htdocs/compta/paiement_charge.php @@ -132,7 +132,7 @@ if ($_POST["action"] == 'add_paiement') if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } /* @@ -223,7 +223,7 @@ if ($_GET["action"] == 'create') // $sql .= ", sum(pf.amount) as am"; // $sql .= " FROM ".MAIN_DB_PREFIX."facture as f"; // $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON pf.fk_facture = f.rowid"; -// $sql .= " WHERE f.fk_soc = ".$facture->socidp; +// $sql .= " WHERE f.fk_soc = ".$facture->socid; // $sql .= " AND f.paye = 0"; // $sql .= " AND f.fk_statut = 1"; // Statut=0 => non validée, Statut=2 => annulée // $sql .= " GROUP BY f.facnumber"; diff --git a/htdocs/compta/param/comptes/index.php b/htdocs/compta/param/comptes/index.php index 0eb3d12a3a8..d259fa62320 100644 --- a/htdocs/compta/param/comptes/index.php +++ b/htdocs/compta/param/comptes/index.php @@ -40,7 +40,7 @@ $langs->load("bills"); if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } llxHeader("","Accueil Compta"); diff --git a/htdocs/compta/param/index.php b/htdocs/compta/param/index.php index 16e69da982c..715078816c9 100644 --- a/htdocs/compta/param/index.php +++ b/htdocs/compta/param/index.php @@ -41,7 +41,7 @@ $langs->load("bills"); if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } llxHeader("",$langs->trans("AccountancySetup")); diff --git a/htdocs/compta/prelevement/bons.php b/htdocs/compta/prelevement/bons.php index 5436a6bb0f3..1d7d7447faa 100644 --- a/htdocs/compta/prelevement/bons.php +++ b/htdocs/compta/prelevement/bons.php @@ -45,7 +45,7 @@ llxHeader('','Pr if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } diff --git a/htdocs/compta/prelevement/create.php b/htdocs/compta/prelevement/create.php index 3009c06aece..d055cb172dd 100644 --- a/htdocs/compta/prelevement/create.php +++ b/htdocs/compta/prelevement/create.php @@ -169,9 +169,9 @@ $sql .= " , ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd"; $sql .= " WHERE s.idp = f.fk_soc"; $sql .= " AND pfd.traite = 0 AND pfd.fk_facture = f.rowid"; -if ($socidp) +if ($socid) { - $sql .= " AND f.fk_soc = $socidp"; + $sql .= " AND f.fk_soc = $socid"; } if ( $db->query($sql) ) diff --git a/htdocs/compta/prelevement/demandes.php b/htdocs/compta/prelevement/demandes.php index b31211099b2..34089535409 100644 --- a/htdocs/compta/prelevement/demandes.php +++ b/htdocs/compta/prelevement/demandes.php @@ -37,7 +37,7 @@ $langs->load("widthdrawals"); if ($user->societe_id > 0) { - $socidp = $user->societe_id; + $socid = $user->societe_id; } llxHeader(); @@ -66,12 +66,12 @@ if (! $sortfield) $sortfield="f.facnumber"; $sql= "SELECT f.facnumber, f.rowid, s.nom, s.idp"; $sql.= " , ".$db->pdate("pfd.date_demande")." as date_demande"; $sql.= " , pfd.fk_user_demande"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", sc.fk_soc, sc.fk_user"; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user"; $sql.= " FROM ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."societe as s"; $sql.= " , ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE s.idp = f.fk_soc"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; if (! $statut) $sql.= " AND pfd.traite = 0"; if ($statut) $sql.= " AND pfd.traite = ".$statut; $sql.= " AND pfd.fk_facture = f.rowid"; @@ -79,9 +79,9 @@ if (strlen(trim($_GET["search_societe"]))) { $sql .= " AND s.nom LIKE '%".$_GET["search_societe"]."%'"; } -if ($socidp) +if ($socid) { - $sql .= " AND f.fk_soc = $socidp"; + $sql .= " AND f.fk_soc = $socid"; } $sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset); diff --git a/htdocs/compta/prelevement/index.php b/htdocs/compta/prelevement/index.php index 19c82d8f12d..3a58fadef1e 100644 --- a/htdocs/compta/prelevement/index.php +++ b/htdocs/compta/prelevement/index.php @@ -37,7 +37,7 @@ if (!$user->rights->prelevement->bons->lire) if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } @@ -128,18 +128,18 @@ print ''; } else @@ -357,7 +357,7 @@ if ($_GET["propalid"] > 0) print ''; // ancre pour retourner sur la ligne if (($objp->info_bits & 2) == 2) { - print ''; + print ''; print img_object($langs->trans("ShowReduc"),'reduc').' '.$langs->trans("Discount"); print ''; if ($objp->description) print ' - '.nl2br($objp->description); @@ -735,12 +735,12 @@ et non globalement $sql = "SELECT s.nom, s.idp, p.rowid as propalid, p.price, p.ref, p.fk_statut, "; $sql.= $db->pdate("p.datep")." as dp, "; $sql.= $db->pdate("p.fin_validite")." as dfin"; - if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", sc.fk_soc, sc.fk_user"; + if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as p"; - if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE p.fk_soc = s.idp"; - if (!$user->rights->commercial->client->voir && !$socidp) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; - if ($socidp) $sql .= " AND s.idp = $socidp"; + if (!$user->rights->commercial->client->voir && !$socid) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; + if ($socid) $sql .= " AND s.idp = $socid"; if ($viewstatut <> '') $sql .= " AND p.fk_statut in ($viewstatut)"; // viewstatut peut etre combinaisons séparé par virgules if ($month > 0) $sql .= " AND date_format(p.datep, '%Y-%m') = '$year-$month'"; if ($year > 0) $sql .= " AND date_format(p.datep, '%Y') = $year"; @@ -753,7 +753,7 @@ et non globalement $propalstatic=new Propal($db); - print_barre_liste($langs->trans("Proposals"), $page, "propal.php","&socidp=$socidp",$sortfield,$sortorder,'',$num); + print_barre_liste($langs->trans("Proposals"), $page, "propal.php","&socid=$socid",$sortfield,$sortorder,'',$num); $i = 0; $var=true; diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php index 85ebbcb1e4f..3f4fd206468 100644 --- a/htdocs/compta/resultat/clientfourn.php +++ b/htdocs/compta/resultat/clientfourn.php @@ -113,7 +113,7 @@ if ($result) { $var=!$var; print ""; - print "\n"; + print "\n"; if ($modecompta == 'CREANCES-DETTES') print "\n"; print "\n"; diff --git a/htdocs/compta/resultat/index.php b/htdocs/compta/resultat/index.php index 0566a6c0905..ec0e923dd2e 100644 --- a/htdocs/compta/resultat/index.php +++ b/htdocs/compta/resultat/index.php @@ -45,7 +45,7 @@ else { */ if ($user->societe_id > 0) { - $socidp = $user->societe_id; + $socid = $user->societe_id; } $modecompta = $conf->compta->mode; @@ -95,7 +95,7 @@ if ($modecompta == 'CREANCES-DETTES') { $sql .= " FROM ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."paiement_facture as pf, ".MAIN_DB_PREFIX."paiement as p"; $sql .= " WHERE p.rowid = pf.fk_paiement AND pf.fk_facture = f.rowid"; } -if ($socidp) $sql .= " AND f.fk_soc = $socidp"; +if ($socid) $sql .= " AND f.fk_soc = $socid"; $sql .= " GROUP BY dm"; $sql .= " ORDER BY dm"; @@ -160,9 +160,9 @@ if ($modecompta == 'CREANCES-DETTES') { $sql .= " ON f.rowid = p.fk_facture_fourn"; $sql .= " WHERE 1=1"; } -if ($socidp) +if ($socid) { - $sql .= " AND f.fk_soc = $socidp"; + $sql .= " AND f.fk_soc = $socid"; } $sql .= " GROUP BY dm"; diff --git a/htdocs/compta/stats/cabyuser.php b/htdocs/compta/stats/cabyuser.php index c8c5382815b..422ea69da92 100644 --- a/htdocs/compta/stats/cabyuser.php +++ b/htdocs/compta/stats/cabyuser.php @@ -40,7 +40,7 @@ if (! $sortorder) $sortorder="asc"; if (! $sortfield) $sortfield="name"; // Sécurité accés client -if ($user->societe_id > 0) $socidp = $user->societe_id; +if ($user->societe_id > 0) $socid = $user->societe_id; llxHeader(); @@ -91,7 +91,7 @@ else $sql .= " WHERE p.rowid = pf.fk_paiement AND pf.fk_facture = f.rowid AND f.fk_user_author = u.rowid"; if ($year) $sql .= " AND p.datep between '".$year."-01-01 00:00:00' and '".$year."-12-31 23:59:59'"; } -if ($socidp) $sql .= " AND f.fk_soc = $socidp"; +if ($socid) $sql .= " AND f.fk_soc = $socid"; $sql .= " GROUP BY rowid"; $sql .= " ORDER BY rowid"; diff --git a/htdocs/compta/stats/casoc.php b/htdocs/compta/stats/casoc.php index 3cceba21a39..58bd40ad26d 100644 --- a/htdocs/compta/stats/casoc.php +++ b/htdocs/compta/stats/casoc.php @@ -40,7 +40,7 @@ if (! $sortorder) $sortorder="asc"; if (! $sortfield) $sortfield="nom"; // Sécurité accés client -if ($user->societe_id > 0) $socidp = $user->societe_id; +if ($user->societe_id > 0) $socid = $user->societe_id; llxHeader(); @@ -90,7 +90,7 @@ else $sql .= " WHERE p.rowid = pf.fk_paiement AND pf.fk_facture = f.rowid AND f.fk_soc = s.idp"; if ($year) $sql .= " AND p.datep between '".$year."-01-01 00:00:00' and '".$year."-12-31 23:59:59'"; } -if ($socidp) $sql .= " AND f.fk_soc = $socidp"; +if ($socid) $sql .= " AND f.fk_soc = $socid"; $sql .= " GROUP BY rowid"; $sql .= " ORDER BY rowid"; diff --git a/htdocs/compta/stats/comp.php b/htdocs/compta/stats/comp.php index d3f56d7b419..ae30244b48c 100644 --- a/htdocs/compta/stats/comp.php +++ b/htdocs/compta/stats/comp.php @@ -68,7 +68,7 @@ function propals ($db, $year, $month) { $var=!$var; print ""; - print "\n"; + print "\n"; print "\n"; @@ -130,7 +130,7 @@ function factures ($db, $year, $month, $paye) { $objp = $db->fetch_object($result); $var=!$var; print ""; - print "\n"; + print "\n"; print "\n"; if ($objp->df > 0 ) { @@ -236,7 +236,7 @@ function pt ($db, $sql, $year) { } } -function ppt ($db, $year, $socidp) +function ppt ($db, $year, $socid) { global $bc,$conf,$langs; print "
    '.$langs->trans("LastCustomersBills",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllBills").' ('.$num.')
    '.$langs->trans("LastCustomersBills",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllBills").' ('.$num.')
    '.$langs->trans("LastProjects",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllProjects").' ('.$num.')
    '.$langs->trans("LastProjects",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllProjects").' ('.$num.')
    '; * */ $sql = "SELECT f.facnumber, f.rowid, s.nom, s.idp"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", sc.fk_soc, sc.fk_user"; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user"; $sql .= " FROM ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."societe as s"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql .= " , ".MAIN_DB_PREFIX."prelevement_facture_demande as pfd"; $sql .= " WHERE s.idp = f.fk_soc"; $sql .= " AND pfd.traite = 0 AND pfd.fk_facture = f.rowid"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; -if ($socidp) +if ($socid) { - $sql .= " AND f.fk_soc = $socidp"; + $sql .= " AND f.fk_soc = $socid"; } if ( $db->query($sql) ) diff --git a/htdocs/compta/prelevement/liste.php b/htdocs/compta/prelevement/liste.php index 5ff7fd83590..febf1e606df 100644 --- a/htdocs/compta/prelevement/liste.php +++ b/htdocs/compta/prelevement/liste.php @@ -38,7 +38,7 @@ $langs->load("withdrawals"); if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } diff --git a/htdocs/compta/prelevement/rejet-prelevement.class.php b/htdocs/compta/prelevement/rejet-prelevement.class.php index 1957d45e374..f778ba21d17 100644 --- a/htdocs/compta/prelevement/rejet-prelevement.class.php +++ b/htdocs/compta/prelevement/rejet-prelevement.class.php @@ -192,7 +192,7 @@ class RejetPrelevement $emuser->fetch(); $soc = new Societe($this->db); - $soc->fetch($fac->socidp); + $soc->fetch($fac->socid); require_once(DOL_DOCUMENT_ROOT."/lib/CMailFile.class.php"); diff --git a/htdocs/compta/propal.php b/htdocs/compta/propal.php index ad09811159a..986a67e2af4 100644 --- a/htdocs/compta/propal.php +++ b/htdocs/compta/propal.php @@ -57,12 +57,12 @@ $pagenext = $page + 1; // Sécurité accés client -$socidp=''; -if ($_GET["socidp"]) { $socidp=$_GET["socidp"]; } +$socid=''; +if ($_GET["socid"]) { $socid=$_GET["socid"]; } if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } @@ -124,7 +124,7 @@ if ($_GET["propalid"] > 0) $propal->fetch($_GET['propalid']); $societe = new Societe($db); - $societe->fetch($propal->socidp); + $societe->fetch($propal->socid); $head = propal_prepare_head($propal); dolibarr_fiche_head($head, 'compta', $langs->trans('Proposal')); @@ -240,7 +240,7 @@ if ($_GET["propalid"] > 0) { print ''; print $langs->trans("NoProject").''; - print 'id.'&action=create>'.$langs->trans('AddProject').''; + print 'id.'&action=create>'.$langs->trans('AddProject').''; print '
     ".$langs->trans("Bills")." idp\">$objp->nom".$langs->trans("Bills")." idp\">$objp->nom".price($objp->amount_ht)."".price($objp->amount_ttc)."
    idp\">$objp->nomidp\">$objp->nompropalid\">$objp->ref
    idp\">$objp->nomidp\">$objp->nomfacid\">$objp->facnumber
    "; @@ -252,9 +252,9 @@ function ppt ($db, $year, $socidp) $sql = "SELECT sum(f.price) as sum, round(date_format(f.datep,'%m')) as dm"; $sql .= " FROM ".MAIN_DB_PREFIX."propal as f WHERE fk_statut in (1,2,4) AND date_format(f.datep,'%Y') = $year "; - if ($socidp) + if ($socid) { - $sql .= " AND f.fk_soc = $socidp"; + $sql .= " AND f.fk_soc = $socid"; } $sql .= " GROUP BY dm"; @@ -270,9 +270,9 @@ function ppt ($db, $year, $socidp) $sql .= " AND f.paye = 1"; } $sql .= " AND date_format(f.datef,'%Y') = $year "; - if ($socidp) + if ($socid) { - $sql .= " AND f.fk_soc = $socidp"; + $sql .= " AND f.fk_soc = $socid"; } $sql .= " GROUP BY dm"; @@ -300,7 +300,7 @@ function ppt ($db, $year, $socidp) } $ayear = $year - 1; - $acat = get_ca($db, $ayear, $socidp) - get_ca_propal($db, $ayear, $socidp); + $acat = get_ca($db, $ayear, $socid) - get_ca_propal($db, $ayear, $socid); print ""; @@ -324,7 +324,7 @@ llxHeader(); */ if ($user->societe_id > 0) { - $socidp = $user->societe_id; + $socid = $user->societe_id; } $cyear = isset($_GET["year"])?$_GET["year"]:0; @@ -332,7 +332,7 @@ if (! $cyear) { $cyear = strftime ("%Y", time()); } print_fiche_titre("Chiffre d'Affaire transformé (prévu-réalisé)",($cyear?"".img_previous()." Année $cyear ".img_next()."":"")); -ppt($db, $cyear, $socidp); +ppt($db, $cyear, $socid); if ($details == 1) { diff --git a/htdocs/compta/stats/cumul.php b/htdocs/compta/stats/cumul.php index 218593ceba9..20d4c560657 100644 --- a/htdocs/compta/stats/cumul.php +++ b/htdocs/compta/stats/cumul.php @@ -37,7 +37,7 @@ llxHeader(); */ if ($user->societe_id > 0) { - $socidp = $user->societe_id; + $socid = $user->societe_id; } $mode='recettes'; @@ -54,9 +54,9 @@ if ($conf->compta->mode != 'CREANCES-DETTES') { $sql .= " AND f.paye = 1"; } -if ($socidp) +if ($socid) { - $sql .= " AND f.fk_soc = $socidp"; + $sql .= " AND f.fk_soc = $socid"; } $sql .= " GROUP BY dm"; @@ -70,9 +70,9 @@ $sql .= " WHERE f.fk_statut = 1"; if ($conf->compta->mode != 'CREANCES-DETTES') { $sql .= " AND f.paye = 1"; } -if ($socidp) +if ($socid) { - $sql .= " AND f.fk_soc = $socidp"; + $sql .= " AND f.fk_soc = $socid"; } $sql .= " GROUP BY dm"; diff --git a/htdocs/compta/stats/exercices.php b/htdocs/compta/stats/exercices.php index f3567e66e37..544359df820 100644 --- a/htdocs/compta/stats/exercices.php +++ b/htdocs/compta/stats/exercices.php @@ -34,7 +34,7 @@ llxHeader(); */ if ($user->societe_id > 0) { - $socidp = $user->societe_id; + $socid = $user->societe_id; } $mode='recettes'; @@ -74,7 +74,7 @@ function factures ($db, $year, $month, $paye) $objp = $db->fetch_object($result); $var=!$var; print ""; - print "\n"; + print "\n"; print "\n"; if ($objp->df > 0 ) { print "\n"; @@ -173,7 +173,7 @@ function pt ($db, $sql, $year) { } } -function ppt ($db, $year, $socidp) +function ppt ($db, $year, $socid) { global $bc,$conf,$langs; print "
    Total :".price($deltat)."
    idp\">$objp->nomidp\">$objp->nomfacid\">$objp->facnumber".dolibarr_print_date($objp->df)."
    "; @@ -193,9 +193,9 @@ function ppt ($db, $year, $socidp) if ($conf->compta->mode != 'CREANCES-DETTES') { $sql .= " AND f.paye = 1"; } - if ($socidp) + if ($socid) { - $sql .= " AND f.fk_soc = $socidp"; + $sql .= " AND f.fk_soc = $socid"; } $sql .= " GROUP BY dm"; @@ -210,9 +210,9 @@ function ppt ($db, $year, $socidp) if ($conf->compta->mode != 'CREANCES-DETTES') { $sql .= " AND f.paye = 1"; } - if ($socidp) + if ($socid) { - $sql .= " AND f.fk_soc = $socidp"; + $sql .= " AND f.fk_soc = $socid"; } $sql .= " GROUP BY dm"; @@ -251,7 +251,7 @@ function ppt ($db, $year, $socidp) $cyear = strftime ("%Y", time()); -ppt($db, $cyear, $socidp); +ppt($db, $cyear, $socid); $db->close(); diff --git a/htdocs/compta/stats/index.php b/htdocs/compta/stats/index.php index 8d7d9aa4563..050c781ae32 100644 --- a/htdocs/compta/stats/index.php +++ b/htdocs/compta/stats/index.php @@ -44,7 +44,7 @@ else { */ if ($user->societe_id > 0) { - $socidp = $user->societe_id; + $socid = $user->societe_id; } $modecompta = $conf->compta->mode; @@ -93,7 +93,7 @@ if ($modecompta == 'CREANCES-DETTES') { $sql .= " FROM ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."paiement_facture as pf, ".MAIN_DB_PREFIX."paiement as p"; $sql .= " WHERE p.rowid = pf.fk_paiement AND pf.fk_facture = f.rowid"; } -if ($socidp) $sql .= " AND f.fk_soc = $socidp"; +if ($socid) $sql .= " AND f.fk_soc = $socid"; $sql .= " GROUP BY dm DESC"; $result = $db->query($sql); @@ -315,9 +315,9 @@ if ($modecompta != 'CREANCES-DETTES') $sql = "SELECT f.facnumber, f.rowid, s.nom, s.idp, f.total_ttc, sum(pf.amount) as am"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f left join ".MAIN_DB_PREFIX."paiement_facture as pf on f.rowid=pf.fk_facture"; $sql .= " WHERE s.idp = f.fk_soc AND f.paye = 0 AND f.fk_statut = 1"; - if ($socidp) + if ($socid) { - $sql .= " AND f.fk_soc = $socidp"; + $sql .= " AND f.fk_soc = $socid"; } $sql .= " GROUP BY f.facnumber,f.rowid,s.nom, s.idp, f.total_ttc"; @@ -366,9 +366,9 @@ En attendant correction. WHERE p.fk_soc = s.idp AND p.fk_statut >=1 AND p.facture =0"; - if ($socidp) + if ($socid) { - $sql .= " AND f.fk_soc = $socidp"; + $sql .= " AND f.fk_soc = $socid"; } $sql .= " GROUP BY p.rowid"; diff --git a/htdocs/compta/stats/lib.inc.php b/htdocs/compta/stats/lib.inc.php index 6b8adf9a9d4..1f2830bfec0 100644 --- a/htdocs/compta/stats/lib.inc.php +++ b/htdocs/compta/stats/lib.inc.php @@ -21,13 +21,13 @@ * */ -function get_ca_propal ($db, $year, $socidp) +function get_ca_propal ($db, $year, $socid) { $sql = "SELECT sum(f.price - f.remise) as sum FROM ".MAIN_DB_PREFIX."propal as f WHERE fk_statut in (1,2,4) AND date_format(f.datep, '%Y') = $year "; - if ($socidp) + if ($socid) { - $sql .= " AND f.fk_soc = $socidp"; + $sql .= " AND f.fk_soc = $socid"; } $result = $db->query($sql); @@ -43,7 +43,7 @@ function get_ca_propal ($db, $year, $socidp) } -function get_ca ($db, $year, $socidp) +function get_ca ($db, $year, $socid) { $sql = "SELECT sum(f.amount) as sum FROM ".MAIN_DB_PREFIX."facture as f"; @@ -52,9 +52,9 @@ function get_ca ($db, $year, $socidp) $sql .= " AND f.paye = 1"; } $sql .= " AND date_format(f.datef , '%Y') = $year "; - if ($socidp) + if ($socid) { - $sql .= " AND f.fk_soc = $socidp"; + $sql .= " AND f.fk_soc = $socid"; } $result = $db->query($sql); diff --git a/htdocs/compta/stats/prev.php b/htdocs/compta/stats/prev.php index 7a55e5423e5..03b26d83f2c 100644 --- a/htdocs/compta/stats/prev.php +++ b/htdocs/compta/stats/prev.php @@ -27,7 +27,7 @@ require("./pre.inc.php"); */ if ($user->societe_id > 0) { - $socidp = $user->societe_id; + $socid = $user->societe_id; } @@ -98,9 +98,9 @@ print ''; } diff --git a/htdocs/expedition/expedition.class.php b/htdocs/expedition/expedition.class.php index 8156e12adb6..3c91eb9bb51 100644 --- a/htdocs/expedition/expedition.class.php +++ b/htdocs/expedition/expedition.class.php @@ -710,7 +710,7 @@ class Expedition extends CommonObject $this->date = time(); $this->entrepot_id = 0; $this->adresse_livraison_id = 0; - $this->socidp = $socids[$socid]; + $this->socid = $socids[$socid]; $nbp = 5; $xnbp = 0; diff --git a/htdocs/expedition/fiche.php b/htdocs/expedition/fiche.php index 6a70f884313..e7c596ac973 100644 --- a/htdocs/expedition/fiche.php +++ b/htdocs/expedition/fiche.php @@ -51,7 +51,7 @@ if (!$user->rights->expedition->lire) if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } @@ -191,7 +191,7 @@ if ($_GET["action"] == 'create') if ( $commande->fetch($_GET["commande_id"])) { $soc = new Societe($db); - $soc->fetch($commande->socidp); + $soc->fetch($commande->socid); $author = new User($db); $author->id = $commande->user_author_id; @@ -440,7 +440,7 @@ else $commande->fetch($expedition->commande_id); $soc = new Societe($db); - $soc->fetch($commande->socidp); + $soc->fetch($commande->socid); $h=0; $head[$h][0] = DOL_URL_ROOT."/expedition/fiche.php?id=".$expedition->id; diff --git a/htdocs/expedition/index.php b/htdocs/expedition/index.php index c3a663a95c0..451eb0f115e 100644 --- a/htdocs/expedition/index.php +++ b/htdocs/expedition/index.php @@ -51,15 +51,15 @@ print "
    '; $sql = "SELECT sum(f.price) as amount, date_format(f.datep,'%Y-%m') as dm"; $sql .= " FROM ".MAIN_DB_PREFIX."propal as f WHERE fk_statut in $in"; -if ($socidp) +if ($socid) { - $sql .= " AND f.fk_soc = $socidp"; + $sql .= " AND f.fk_soc = $socid"; } $sql .= " GROUP BY dm DESC"; @@ -110,9 +110,9 @@ print ''; $sql = "SELECT sum(f.price) as amount, year(f.datep) as dm"; $sql .= " FROM ".MAIN_DB_PREFIX."propal as f WHERE fk_statut in $in"; -if ($socidp) +if ($socid) { - $sql .= " AND f.fk_soc = $socidp"; + $sql .= " AND f.fk_soc = $socid"; } $sql .= " GROUP BY dm DESC"; @@ -122,9 +122,9 @@ print "
    "; $sql = "SELECT sum(f.price) as amount, month(f.datep) as dm"; $sql .= " FROM ".MAIN_DB_PREFIX."propal as f WHERE fk_statut in $in"; -if ($socidp) +if ($socid) { - $sql .= " AND f.fk_soc = $socidp"; + $sql .= " AND f.fk_soc = $socid"; } $sql .= " GROUP BY dm"; diff --git a/htdocs/contact/index.php b/htdocs/contact/index.php index e822c065b4f..34b0af02d29 100644 --- a/htdocs/contact/index.php +++ b/htdocs/contact/index.php @@ -38,7 +38,7 @@ $langs->load("suppliers"); if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } @@ -91,9 +91,9 @@ if ($_POST["button_removefilter"]) llxHeader(); $sql = "SELECT s.idp, s.nom, p.idp as cidp, p.name, p.firstname, p.email, p.phone, p.phone_mobile, p.fax"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", sc.fk_soc, sc.fk_user"; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user"; $sql.= " FROM ".MAIN_DB_PREFIX."socpeople as p"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.idp = p.fk_soc"; $sql.= " WHERE 1=1 "; @@ -101,7 +101,7 @@ if ($_GET["userid"]) // statut commercial { $sql .= " AND p.fk_user=".$_GET["userid"]; } -if (!$user->rights->commercial->client->voir && !$socidp) //restriction +if (!$user->rights->commercial->client->voir && !$socid) //restriction { $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; } @@ -133,9 +133,9 @@ if ($sall) { $sql .= " AND (p.name like '%".addslashes($sall)."%' OR p.firstname like '%".addslashes($sall)."%' OR p.email like '%".addslashes($sall)."%') "; } -if ($socidp) +if ($socid) { - $sql .= " AND s.idp = $socidp"; + $sql .= " AND s.idp = $socid"; } if($_GET["view"] == "recent") diff --git a/htdocs/contrat/contact.php b/htdocs/contrat/contact.php index ec54372be97..a794a2798fe 100644 --- a/htdocs/contrat/contact.php +++ b/htdocs/contrat/contact.php @@ -48,7 +48,7 @@ $contratid = isset($_GET["id"])?$_GET["id"]:''; if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } // Protection restriction commercial @@ -61,7 +61,7 @@ if ($contratid && (!$user->rights->commercial->client->voir || $user->societe_id { $sql .= " AND sc.fk_soc = c.fk_soc AND sc.fk_user = ".$user->id; } - if ($user->societe_id > 0) $sql .= " AND c.fk_soc = ".$socidp; + if ($user->societe_id > 0) $sql .= " AND c.fk_soc = ".$socid; if ( $db->query($sql) ) { @@ -240,7 +240,7 @@ if ($id > 0) if ($mesg) print $mesg; $soc = new Societe($db); - $soc->fetch($contrat->socidp); + $soc->fetch($contrat->socid); $head = contract_prepare_head($contrat); diff --git a/htdocs/contrat/contrat.class.php b/htdocs/contrat/contrat.class.php index bc452e5c505..714f33edb5e 100644 --- a/htdocs/contrat/contrat.class.php +++ b/htdocs/contrat/contrat.class.php @@ -43,7 +43,7 @@ class Contrat extends CommonObject var $id; var $ref; - var $socidp; + var $socid; var $societe; // Objet societe var $product; @@ -302,7 +302,7 @@ class Contrat extends CommonObject $this->fk_projet = $result["fk_projet"]; - $this->socidp = $result["fk_soc"]; + $this->socid = $result["fk_soc"]; $this->societe->fetch($result["fk_soc"]); $this->db->free($resql); @@ -470,7 +470,7 @@ class Contrat extends CommonObject $sql = "INSERT INTO ".MAIN_DB_PREFIX."contrat (datec, fk_soc, fk_user_author, date_contrat"; // $sql.= ", fk_commercial_signature, fk_commercial_suivi"; $sql.= " , ref)"; - $sql.= " VALUES (now(),".$this->socidp.",".$user->id; + $sql.= " VALUES (now(),".$this->socid.",".$user->id; $sql.= ",".$this->db->idate($this->date_contrat); // $sql.= ",".($this->commercial_signature_id>=0?$this->commercial_signature_id:"null"); // $sql.= ",".($this->commercial_suivi_id>=0?$this->commercial_suivi_id:"null"); diff --git a/htdocs/contrat/fiche.php b/htdocs/contrat/fiche.php index 42d7a31fb27..28247995a7c 100644 --- a/htdocs/contrat/fiche.php +++ b/htdocs/contrat/fiche.php @@ -50,7 +50,7 @@ $contratid = isset($_GET["id"])?$_GET["id"]:''; if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } // Protection restriction commercial @@ -63,7 +63,7 @@ if ($contratid && !$user->rights->commercial->client->voir) { $sql .= " AND sc.fk_soc = c.fk_soc AND sc.fk_user = ".$user->id; } - if ($user->societe_id > 0) $sql .= " AND c.fk_soc = ".$socidp; + if ($user->societe_id > 0) $sql .= " AND c.fk_soc = ".$socid; if ( $db->query($sql) ) { @@ -134,7 +134,7 @@ if ($_POST["action"] == 'add') $contrat = new Contrat($db); - $contrat->socidp = $_POST["socidp"]; + $contrat->socid = $_POST["socid"]; $contrat->date_contrat = $datecontrat; $contrat->commercial_suivi_id = $_POST["commercial_suivi_id"]; @@ -154,7 +154,7 @@ if ($_POST["action"] == 'add') else { $mesg='
    '.$contrat->error.'
    '; } - $_GET["socid"]=$_POST["socidp"]; + $_GET["socid"]=$_POST["socid"]; $_GET["action"]='create'; $action = ''; } @@ -330,7 +330,7 @@ if ($_GET["action"] == 'create') print ''; print ''; - print ''."\n"; + print ''."\n"; print ''; print ''; @@ -631,11 +631,11 @@ else print '"; } @@ -971,7 +971,7 @@ else if ($contrat->statut > 0 && $user->rights->facture->creer) { $langs->load("bills"); - print ''.$langs->trans("CreateBill").''; + print ''.$langs->trans("CreateBill").''; } $numclos=$contrat->array_detail(5); // Tableau des lignes au statut clos diff --git a/htdocs/contrat/index.php b/htdocs/contrat/index.php index db7c3f7ede2..1a981407f05 100644 --- a/htdocs/contrat/index.php +++ b/htdocs/contrat/index.php @@ -40,12 +40,12 @@ $page = isset($_GET["page"])?$_GET["page"]:$_POST["page"]; $statut=isset($_GET["statut"])?$_GET["statut"]:1; // Sécurité accés client -$socidp=''; -if ($_GET["socidp"]) { $socidp=$_GET["socidp"]; } +$socid=''; +if ($_GET["socid"]) { $socid=$_GET["socid"]; } if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } $staticcontrat=new Contrat($db); @@ -106,13 +106,13 @@ $sql.= ' sum('.$db->ifsql("cd.statut=4 AND cd.date_fin_validite > sysdate()",1,0 $sql.= ' sum('.$db->ifsql("cd.statut=4 AND (cd.date_fin_validite IS NULL OR cd.date_fin_validite <= sysdate())",1,0).') as nb_late,'; $sql.= ' sum('.$db->ifsql("cd.statut=5",1,0).') as nb_closed,'; $sql.= " c.rowid as cid, c.ref, c.datec, c.statut, s.nom, s.idp as sidp"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", sc.fk_soc, sc.fk_user"; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as c"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."contratdet as cd ON c.rowid = cd.fk_contrat"; $sql.= " WHERE c.fk_soc = s.idp "; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; -if ($socidp > 0) $sql .= " AND s.idp = ".$socidp; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; +if ($socid > 0) $sql .= " AND s.idp = ".$socid; $sql.= " GROUP BY c.rowid, c.datec, c.statut, s.nom, s.idp"; $sql.= " ORDER BY c.datec DESC"; $sql.= " LIMIT $max"; @@ -169,13 +169,13 @@ print '
    '; // Not activated services $sql = "SELECT cd.rowid as cid, c.ref, cd.statut, cd.label, cd.description as note, cd.fk_contrat, c.fk_soc, s.nom"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", sc.fk_soc, sc.fk_user"; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user"; $sql.= " FROM ".MAIN_DB_PREFIX."contratdet as cd, ".MAIN_DB_PREFIX."contrat as c, ".MAIN_DB_PREFIX."societe as s"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE c.statut=1 AND cd.statut = 0"; $sql.= " AND cd.fk_contrat = c.rowid AND c.fk_soc = s.idp"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; -if ($socidp > 0) $sql.= " AND s.idp = ".$socidp; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; +if ($socid > 0) $sql.= " AND s.idp = ".$socid; $sql.= " ORDER BY cd.tms DESC"; if ( $db->query($sql) ) @@ -223,12 +223,12 @@ print '
    '; $max=5; $sql = "SELECT cd.rowid as cid, c.ref, cd.statut, cd.label, cd.description as note, cd.fk_contrat, c.fk_soc, s.nom"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", sc.fk_soc, sc.fk_user"; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user"; $sql.= " FROM ".MAIN_DB_PREFIX."contratdet as cd, ".MAIN_DB_PREFIX."contrat as c, ".MAIN_DB_PREFIX."societe as s"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE cd.fk_contrat = c.rowid AND c.fk_soc = s.idp"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; -if ($socidp > 0) $sql.= " AND s.idp = ".$socidp; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; +if ($socid > 0) $sql.= " AND s.idp = ".$socid; $sql.= " ORDER BY cd.tms DESC"; if ( $db->query($sql) ) diff --git a/htdocs/contrat/info.php b/htdocs/contrat/info.php index 8ebeae42c14..774eefbd92e 100644 --- a/htdocs/contrat/info.php +++ b/htdocs/contrat/info.php @@ -41,7 +41,7 @@ $contratid = isset($_GET["id"])?$_GET["id"]:''; if ($user->societe_id > 0) { - $socidp = $user->societe_id; + $socid = $user->societe_id; } // Protection restriction commercial @@ -54,7 +54,7 @@ if ($contratid && (!$user->rights->commercial->client->voir || $user->societe_id { $sql .= " AND sc.fk_soc = c.fk_soc AND sc.fk_user = ".$user->id; } - if ($user->societe_id > 0) $sql .= " AND c.fk_soc = ".$socidp; + if ($user->societe_id > 0) $sql .= " AND c.fk_soc = ".$socid; if ( $db->query($sql) ) { diff --git a/htdocs/contrat/ligne.php b/htdocs/contrat/ligne.php index 123ddc537b1..f7993c1fdfe 100644 --- a/htdocs/contrat/ligne.php +++ b/htdocs/contrat/ligne.php @@ -51,7 +51,7 @@ accessforbidden(); if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } @@ -112,7 +112,7 @@ if ($id > 0) if ( $contrat->fetch($id) > 0) { $soc = new Societe($db); - $soc->fetch($contrat->socidp); + $soc->fetch($contrat->socid); $author = new User($db); $author->id = $contrat->user_author_id; diff --git a/htdocs/contrat/note.php b/htdocs/contrat/note.php index 1a8e1b88c46..21f607e046e 100644 --- a/htdocs/contrat/note.php +++ b/htdocs/contrat/note.php @@ -31,7 +31,7 @@ require("./pre.inc.php"); require_once(DOL_DOCUMENT_ROOT.'/lib/contract.lib.php'); if ($conf->contrat->enabled) require_once(DOL_DOCUMENT_ROOT."/contrat/contrat.class.php"); -$socidp=isset($_GET["socidp"])?$_GET["socidp"]:isset($_POST["socidp"])?$_POST["socidp"]:""; +$socid=isset($_GET["socid"])?$_GET["socid"]:isset($_POST["socid"])?$_POST["socid"]:""; $user->getrights('contrat'); if (!$user->rights->contrat->lire) @@ -46,7 +46,7 @@ $contratid = isset($_GET["id"])?$_GET["id"]:''; if ($user->societe_id > 0) { unset($_GET["action"]); - $socidp = $user->societe_id; + $socid = $user->societe_id; } // Protection restriction commercial @@ -59,7 +59,7 @@ if ($contratid && (!$user->rights->commercial->client->voir || $user->societe_id { $sql .= " AND sc.fk_soc = c.fk_soc AND sc.fk_user = ".$user->id; } - if ($user->societe_id > 0) $sql .= " AND c.fk_soc = ".$socidp; + if ($user->societe_id > 0) $sql .= " AND c.fk_soc = ".$socid; if ( $db->query($sql) ) { diff --git a/htdocs/don.class.php b/htdocs/don.class.php index 05a900e52c9..4dc0617fec0 100644 --- a/htdocs/don.class.php +++ b/htdocs/don.class.php @@ -166,7 +166,7 @@ class Don $this->specimen=1; $this->nom = 'Doe'; $this->prenom = 'John'; - $this->socidp = $socids[$socid]; + $this->socid = $socids[$socid]; $this->date = time(); $this->amount = 100; $this->public = 1; diff --git a/htdocs/dossier/client/fiche.php b/htdocs/dossier/client/fiche.php index a9a33441459..15c03a87d06 100644 --- a/htdocs/dossier/client/fiche.php +++ b/htdocs/dossier/client/fiche.php @@ -51,7 +51,7 @@ llxHeader("",'Dossier', $client); if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } if ($_GET["facid"]) diff --git a/htdocs/expedition/commande.php b/htdocs/expedition/commande.php index e4cd3046619..dd5db01a680 100644 --- a/htdocs/expedition/commande.php +++ b/htdocs/expedition/commande.php @@ -53,7 +53,7 @@ if (!$user->rights->commande->lire) if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } @@ -88,7 +88,7 @@ if ($_GET["id"] > 0) $commande->loadExpeditions(1); $soc = new Societe($db); - $soc->fetch($commande->socidp); + $soc->fetch($commande->socid); $author = new User($db); $author->id = $commande->user_author_id; @@ -206,7 +206,7 @@ if ($_GET["id"] > 0) print $langs->trans('DeliveryAddress'); print ''; - if ($_GET['action'] != 'editdelivery_adress' && $commande->brouillon) print ''; + if ($_GET['action'] != 'editdelivery_adress' && $commande->brouillon) print ''; print '
    '; if ($_GET["action"] == "classer") { - $html->form_project("fiche.php?id=$id",$contrat->socidp,$contrat->fk_projet,"projetid"); + $html->form_project("fiche.php?id=$id",$contrat->socid,$contrat->fk_projet,"projetid"); } else { - $html->form_project("fiche.php?id=$id",$contrat->socidp,$contrat->fk_projet,"none"); + $html->form_project("fiche.php?id=$id",$contrat->socid,$contrat->fk_projet,"none"); } print "
    socidp.'&id='.$commande->id.'">'.img_edit($langs->trans('SetDeliveryAddress'),1).'socid.'&id='.$commande->id.'">'.img_edit($langs->trans('SetDeliveryAddress'),1).'
    '; print '
    '; @@ -268,11 +268,11 @@ if ($_GET["id"] > 0) print ''; if ($_GET['action'] == 'classer') { - $html->form_project($_SERVER['PHP_SELF'].'?id='.$commande->id, $commande->socidp, $commande->projet_id, 'projetid'); + $html->form_project($_SERVER['PHP_SELF'].'?id='.$commande->id, $commande->socid, $commande->projet_id, 'projetid'); } else { - $html->form_project($_SERVER['PHP_SELF'].'?id='.$commande->id, $commande->socidp, $commande->projet_id, 'none'); + $html->form_project($_SERVER['PHP_SELF'].'?id='.$commande->id, $commande->socid, $commande->projet_id, 'none'); } print '

    \n"; * Expeditions à valider */ $sql = "SELECT e.rowid, e.ref, s.nom, s.idp, c.ref as commande_ref, c.rowid as commande_id"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", sc.fk_soc, sc.fk_user"; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user"; $sql.= " FROM ".MAIN_DB_PREFIX."expedition as e, ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as c"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE e.fk_commande = c.rowid AND c.fk_soc = s.idp AND e.fk_statut = 0"; -if ($socidp) +if ($socid) { - $sql .= " AND c.fk_soc = $socidp"; + $sql .= " AND c.fk_soc = $socid"; } -if (!$user->rights->commercial->client->voir && !$socidp) //restriction +if (!$user->rights->commercial->client->voir && !$socid) //restriction { $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; } @@ -92,12 +92,12 @@ if ($resql) * Commandes à traiter */ $sql = "SELECT c.rowid, c.ref, s.nom, s.idp"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", sc.fk_soc, sc.fk_user"; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user"; $sql.= " FROM ".MAIN_DB_PREFIX."commande as c, ".MAIN_DB_PREFIX."societe as s"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE c.fk_soc = s.idp AND c.fk_statut = 1"; -if ($socidp) $sql .= " AND c.fk_soc = $socidp"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; +if ($socid) $sql .= " AND c.fk_soc = $socid"; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; $sql.= " ORDER BY c.rowid ASC"; if ( $db->query($sql) ) @@ -137,12 +137,12 @@ print ''; * Commandes en traitement */ $sql = "SELECT c.rowid, c.ref, s.nom, s.idp"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", sc.fk_soc, sc.fk_user"; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user"; $sql .= " FROM ".MAIN_DB_PREFIX."commande as c, ".MAIN_DB_PREFIX."societe as s"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql .= " WHERE c.fk_soc = s.idp AND c.fk_statut = 2"; -if ($socidp) $sql .= " AND c.fk_soc = $socidp"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; +if ($socid) $sql .= " AND c.fk_soc = $socid"; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; $resql = $db->query($sql); if ( $resql ) { @@ -174,12 +174,12 @@ if ( $resql ) * Expeditions à valider */ $sql = "SELECT e.rowid, e.ref, s.nom, s.idp, c.ref as commande_ref, c.rowid as commande_id"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", sc.fk_soc, sc.fk_user"; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user"; $sql .= " FROM ".MAIN_DB_PREFIX."expedition as e, ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as c"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql .= " WHERE e.fk_commande = c.rowid AND c.fk_soc = s.idp AND e.fk_statut = 1"; -if ($socidp) $sql .= " AND c.fk_soc = $socidp"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; +if ($socid) $sql .= " AND c.fk_soc = $socid"; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; $sql .= " ORDER BY e.date_expedition DESC"; $sql .= $db->plimit(5, 0); diff --git a/htdocs/expedition/liste.php b/htdocs/expedition/liste.php index a1a46567e09..0b1e4122395 100644 --- a/htdocs/expedition/liste.php +++ b/htdocs/expedition/liste.php @@ -35,7 +35,7 @@ if (!$user->rights->expedition->lire) accessforbidden(); if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } $sortfield=isset($_GET["sortfield"])?$_GET["sortfield"]:""; @@ -58,17 +58,17 @@ $offset = $limit * $_GET["page"] ; llxHeader('',$langs->trans('ListOfSendings'),'ch-expedition.html'); $sql = "SELECT e.rowid, e.ref,".$db->pdate("e.date_expedition")." as date_expedition, e.fk_statut, s.nom as socname, s.idp, c.ref as comref, c.rowid as comid"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", sc.fk_soc, sc.fk_user"; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user"; $sql .= " FROM ".MAIN_DB_PREFIX."expedition as e"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc, ".MAIN_DB_PREFIX."commande as c"; -if ($socidp) $sql.=", ".MAIN_DB_PREFIX."commande as c"; -if ($user->rights->commercial->client->voir && !$socidp) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."commande as c ON c.rowid = e.fk_commande"; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc, ".MAIN_DB_PREFIX."commande as c"; +if ($socid) $sql.=", ".MAIN_DB_PREFIX."commande as c"; +if ($user->rights->commercial->client->voir && !$socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."commande as c ON c.rowid = e.fk_commande"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.idp = c.fk_soc"; $sql_add = " WHERE "; -if ($socidp) +if ($socid) { - $sql.= $sql_add . " e.fk_commande = c.rowid AND c.fk_soc = ".$socidp; + $sql.= $sql_add . " e.fk_commande = c.rowid AND c.fk_soc = ".$socid; $sql_add = " AND "; } if ($_POST["sf_ref"]) @@ -76,7 +76,7 @@ if ($_POST["sf_ref"]) $sql.= $sql_add . " e.ref like '%".addslashes($_POST["sf_ref"])."%'"; $sql_add = " AND "; } -if (!$user->rights->commercial->client->voir && !$socidp) //restriction +if (!$user->rights->commercial->client->voir && !$socid) //restriction { $sql .= $sql_add . " e.fk_commande = c.rowid AND c.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id; } @@ -91,17 +91,17 @@ if ($resql) { $num = $db->num_rows($resql); - print_barre_liste($langs->trans('ListOfSendings'), $_GET["page"], "liste.php","&socidp=$socidp",$sortfield,$sortorder,'',$num); + print_barre_liste($langs->trans('ListOfSendings'), $_GET["page"], "liste.php","&socid=$socid",$sortfield,$sortorder,'',$num); $i = 0; print ''; print ''; - print_liste_field_titre($langs->trans("Ref"),"liste.php","e.ref","","&socidp=$socidp",'width="15%"',$sortfield); - print_liste_field_titre($langs->trans("Company"),"liste.php","s.nom", "", "&socidp=$socidp",'width="25%" align="left"',$sortfield); - print_liste_field_titre($langs->trans("Order"),"liste.php","c.ref", "", "&socidp=$socidp",'width="25%" align="left"',$sortfield); - print_liste_field_titre($langs->trans("Date"),"liste.php","e.date_expedition","","&socidp=$socidp", 'width="25%" align="right" colspan="2"',$sortfield); - print_liste_field_titre($langs->trans("Status"),"liste.php","e.fk_statut","","&socidp=$socidp",'width="10%" align="center"',$sortfield); + print_liste_field_titre($langs->trans("Ref"),"liste.php","e.ref","","&socid=$socid",'width="15%"',$sortfield); + print_liste_field_titre($langs->trans("Company"),"liste.php","s.nom", "", "&socid=$socid",'width="25%" align="left"',$sortfield); + print_liste_field_titre($langs->trans("Order"),"liste.php","c.ref", "", "&socid=$socid",'width="25%" align="left"',$sortfield); + print_liste_field_titre($langs->trans("Date"),"liste.php","e.date_expedition","","&socid=$socid", 'width="25%" align="right" colspan="2"',$sortfield); + print_liste_field_titre($langs->trans("Status"),"liste.php","e.fk_statut","","&socid=$socid",'width="10%" align="center"',$sortfield); print "\n"; $var=True; diff --git a/htdocs/expedition/mods/pdf/pdf_expedition_merou.modules.php b/htdocs/expedition/mods/pdf/pdf_expedition_merou.modules.php index 7f57f152037..efda5ce637a 100644 --- a/htdocs/expedition/mods/pdf/pdf_expedition_merou.modules.php +++ b/htdocs/expedition/mods/pdf/pdf_expedition_merou.modules.php @@ -100,7 +100,7 @@ Class pdf_expedition_merou extends ModelePdfExpedition { //Creation du Client $soc = new Societe($this->db); - $soc->fetch($this->expe->commande->socidp); + $soc->fetch($this->expe->commande->socid); //Creation de l expediteur $this->expediteur = $soc; diff --git a/htdocs/facture.class.php b/htdocs/facture.class.php index 8f695f1f3f8..d0217fb0339 100644 --- a/htdocs/facture.class.php +++ b/htdocs/facture.class.php @@ -49,7 +49,7 @@ class Facture extends CommonObject var $id; - var $socidp; // Id client + var $socid; // Id client var $client; // Objet societe client (à charger par fetch_client) var $number; @@ -91,17 +91,17 @@ class Facture extends CommonObject /** * \brief Constructeur de la classe * \param DB handler accès base de données - * \param socidp id societe ('' par defaut) + * \param socid id societe ('' par defaut) * \param facid id facture ('' par defaut) */ - function Facture($DB, $socidp='', $facid='') + function Facture($DB, $socid='', $facid='') { $this->db = $DB; $this->table = 'facture'; $this->tabledetail = 'facturedet'; $this->id = $facid; - $this->socidp = $socidp; + $this->socid = $socid; $this->amount = 0; $this->remise = 0; @@ -134,7 +134,7 @@ class Facture extends CommonObject dolibarr_syslog("Facture::create"); $soc = new Societe($this->db); - $soc->fetch($this->socidp); + $soc->fetch($this->socid); $this->db->begin(); @@ -160,7 +160,7 @@ class Facture extends CommonObject $datelim=$this->calculate_date_lim_reglement(); // Insertion dans la base - $socid = $this->socidp; + $socid = $this->socid; $amount = $this->amount; $remise = $this->remise; @@ -310,7 +310,7 @@ class Facture extends CommonObject $facture->fk_facture_source = $this->fk_facture_source; $facture->type = $this->type; - $facture->socidp = $this->socidp; + $facture->socid = $this->socid; $facture->date = $this->date; $facture->note_public = $this->note_public; $facture->note = $this->note; @@ -337,7 +337,7 @@ class Facture extends CommonObject } } - dolibarr_syslog("Facture::create_clone invertdetail=$invertdetail socidp=".$this->socidp." nboflines=".sizeof($facture->lignes)); + dolibarr_syslog("Facture::create_clone invertdetail=$invertdetail socid=".$this->socid." nboflines=".sizeof($facture->lignes)); $facid = $facture->create($user); @@ -418,7 +418,7 @@ class Facture extends CommonObject $this->paye = $obj->paye; $this->close_code = $obj->close_code; $this->close_note = $obj->close_note; - $this->socidp = $obj->fk_soc; + $this->socid = $obj->fk_soc; $this->statut = $obj->fk_statut; $this->date_lim_reglement = $obj->dlr; $this->mode_reglement_id = $obj->fk_mode_reglement; @@ -1181,7 +1181,7 @@ class Facture extends CommonObject { // Classe la société rattachée comme client $soc=new Societe($this->db); - $soc->id = $this->socidp; + $soc->id = $this->socid; $result=$soc->set_as_client(); $this->ref = $numfa; @@ -2238,7 +2238,7 @@ class Facture extends CommonObject dolibarr_syslog("Facture::demande_prelevement $this->statut $this->paye $this->mode_reglement_id"); $soc = new Societe($this->db); - $soc->id = $this->socidp; + $soc->id = $this->socid; $soc->rib(); if ($this->statut > 0 && $this->paye == 0 && $this->mode_reglement_id == 3) { @@ -2539,7 +2539,7 @@ class Facture extends CommonObject $this->ref = 'SPECIMEN'; $this->specimen=1; $socid = rand(1, $num_socs); - $this->socidp = $socids[$socid]; + $this->socid = $socids[$socid]; $this->date = time(); $this->date_lim_reglement=$this->date+3600*24*30; $this->cond_reglement_code = 'RECEP'; diff --git a/htdocs/fichinter/fiche.php b/htdocs/fichinter/fiche.php index 7da16542ddb..59194a4ce61 100644 --- a/htdocs/fichinter/fiche.php +++ b/htdocs/fichinter/fiche.php @@ -43,17 +43,17 @@ $user->getrights("ficheinter"); if (!$user->rights->ficheinter->lire) accessforbidden(); -if ($_GET["socidp"]) +if ($_GET["socid"]) { $societe=new Societe($db); - $societe->fetch($_GET["socidp"]); + $societe->fetch($_GET["socid"]); } // Sécurité accés client if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } @@ -73,7 +73,7 @@ if ($_POST["action"] == 'add') $fichinter = new Fichinter($db); $fichinter->date = $db->idate(mktime(12, 1 , 1, $_POST["pmonth"], $_POST["pday"], $_POST["pyear"])); - $fichinter->socidp = $_POST["socidp"]; + $fichinter->socid = $_POST["socid"]; $fichinter->duree = $_POST["duree"]; $fichinter->projet_id = $_POST["projetidp"]; $fichinter->author = $user->id; @@ -89,7 +89,7 @@ if ($_POST["action"] == 'update') $fichinter = new Fichinter($db); $fichinter->date = $db->idate(mktime(12, 1 , 1, $_POST["remonth"], $_POST["reday"], $_POST["reyear"])); - $fichinter->socidp = $_POST["socidp"]; + $fichinter->socid = $_POST["socid"]; $fichinter->duree = $_POST["duree"]; $fichinter->projet_id = $_POST["projetidp"]; $fichinter->author = $user->id; @@ -159,7 +159,7 @@ if ($_GET["action"] == 'create') $syear = date("Y", time()); print '
    '; - print ''; + print ''; print ""; print ""; print '
    ".$langs->trans("Company")."".$societe->getNomUrl(1)."
    ".$langs->trans("Date").""; @@ -180,7 +180,7 @@ if ($_GET["action"] == 'create') print '
    '.$langs->trans("Project").'
    '.$langs->trans("Project").''; $proj = new Project($db); - $html->select_array("projetid",$proj->liste_array($commande->socidp)); + $html->select_array("projetid",$proj->liste_array($commande->socid)); print "
    '; diff --git a/htdocs/fourn/commande/history.php b/htdocs/fourn/commande/history.php index 4bae969edbe..b715a6c9754 100644 --- a/htdocs/fourn/commande/history.php +++ b/htdocs/fourn/commande/history.php @@ -51,7 +51,7 @@ if ($_GET["id"] > 0) if ( $commande->fetch($_GET["id"]) == 0) { - $soc->fetch($commande->socidp); + $soc->fetch($commande->socid); $author = new User($db); $author->id = $commande->user_author_id; diff --git a/htdocs/fourn/commande/index.php b/htdocs/fourn/commande/index.php index 1b01bb725ac..9d2267f9eeb 100644 --- a/htdocs/fourn/commande/index.php +++ b/htdocs/fourn/commande/index.php @@ -37,7 +37,7 @@ llxHeader('',"Commandes Fournisseurs"); if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } $commande = new CommandeFournisseur($db); diff --git a/htdocs/fourn/commande/liste.php b/htdocs/fourn/commande/liste.php index 44b7af167f9..42a7ee08272 100644 --- a/htdocs/fourn/commande/liste.php +++ b/htdocs/fourn/commande/liste.php @@ -78,7 +78,7 @@ $sql .= " WHERE cf.fk_soc = s.idp "; if ($socid) { - $sql .= " AND s.idp=$socid"; + $sql .= " AND s.idp=".$socid; } if (strlen($_GET["statut"])) diff --git a/htdocs/fourn/commande/modules/modules_commandefournisseur.php b/htdocs/fourn/commande/modules/modules_commandefournisseur.php index 08b76eaae15..984350a7de1 100644 --- a/htdocs/fourn/commande/modules/modules_commandefournisseur.php +++ b/htdocs/fourn/commande/modules/modules_commandefournisseur.php @@ -190,7 +190,7 @@ function commande_supplier_delete_preview($db, $propalid) $comfourn = new CommandeFournisseur($db,"",$propalid); $comfourn->fetch($propalid); $client = new Societe($db); - $client->fetch($comfourn->socidp); + $client->fetch($comfourn->socid); if ($conf->fournisseur->commande->dir_output) { diff --git a/htdocs/fourn/commande/modules/pdf/pdf_muscadet.modules.php b/htdocs/fourn/commande/modules/pdf/pdf_muscadet.modules.php index 3f7cbb17c92..20bce753819 100644 --- a/htdocs/fourn/commande/modules/pdf/pdf_muscadet.modules.php +++ b/htdocs/fourn/commande/modules/pdf/pdf_muscadet.modules.php @@ -728,7 +728,7 @@ class pdf_muscadet extends ModelePDFCommandesSuppliers $pdf->MultiCell(80,5, $langs->trans("BillTo").":"); // $client = new Societe($this->db); - $client->fetch($com->socidp); + $client->fetch($com->socid); $com->client = $client; // diff --git a/htdocs/fourn/commande/note.php b/htdocs/fourn/commande/note.php index 21adf98b646..bc0d732d807 100644 --- a/htdocs/fourn/commande/note.php +++ b/htdocs/fourn/commande/note.php @@ -73,7 +73,7 @@ if ($_GET["id"] > 0) if ( $commande->fetch($_GET["id"]) == 0) { $soc = new Societe($db); - $soc->fetch($commande->socidp); + $soc->fetch($commande->socid); $author = new User($db); $author->id = $commande->user_author_id; diff --git a/htdocs/fourn/contact.php b/htdocs/fourn/contact.php index bcff3a4795b..3c8ce3772d3 100644 --- a/htdocs/fourn/contact.php +++ b/htdocs/fourn/contact.php @@ -41,7 +41,7 @@ llxHeader(); if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } $page=$_GET["page"]; @@ -61,11 +61,11 @@ $offset = $limit * $page ; */ $sql = "SELECT s.idp, s.nom, st.libelle as stcomm, p.idp as cidp, p.name, p.firstname, p.email, p.phone"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", sc.fk_soc, sc.fk_user "; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user "; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."socpeople as p, ".MAIN_DB_PREFIX."c_stcomm as st"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql .= " WHERE s.fk_stcomm = st.id AND s.fournisseur = 1 AND s.idp = p.fk_soc"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; if (strlen($stcomm)) { $sql .= " AND s.fk_stcomm=$stcomm"; @@ -81,8 +81,8 @@ if ($contactname) { $sortorder = "ASC"; } -if ($socidp) { - $sql .= " AND s.idp = $socidp"; +if ($socid) { + $sql .= " AND s.idp = $socid"; } $sql .= " ORDER BY $sortfield $sortorder " . $db->plimit( $limit, $offset); @@ -113,7 +113,7 @@ if ($result) { print ''.img_object($langs->trans("ShowContact"),"contact").' '.$obj->name.''; print ''.$obj->firstname.''; - print ''.img_object($langs->trans("ShowCompany"),"company").' '.$obj->nom.''; + print ''.img_object($langs->trans("ShowCompany"),"company").' '.$obj->nom.''; print ''.$obj->email.''; print ''.$obj->phone.''; diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php index 52d9798f615..419b39458b6 100644 --- a/htdocs/fourn/facture/fiche.php +++ b/htdocs/fourn/facture/fiche.php @@ -45,7 +45,7 @@ $langs->load('companies'); if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } @@ -149,7 +149,7 @@ if ($_POST['action'] == 'add' && $user->rights->fournisseur->facture->creer) $facfou = new FactureFournisseur($db); $facfou->ref = $_POST['facnumber']; - $facfou->socidp = $_POST['socidp']; + $facfou->socid = $_POST['socid']; $facfou->libelle = $_POST['libelle']; $facfou->date = $datefacture; $facfou->date_echeance = mktime(12,0,0,$_POST['echmonth'],$_POST['echday'],$_POST['echyear']); @@ -316,11 +316,11 @@ if ($_GET['action'] == 'create' or $_GET['action'] == 'copy') if ($_GET['socid']) { print $societe->getNomUrl(1); - print ''; + print ''; } else { - $html->select_societes(empty($_GET['socid'])?'':$_GET['socid'],'socidp','s.fournisseur = 1'); + $html->select_societes(empty($_GET['socid'])?'':$_GET['socid'],'socid','s.fournisseur = 1'); } print ''; print ''.$langs->trans('NotePublic').''; @@ -402,9 +402,9 @@ else $fac->fetch($_GET['facid']); $societe = new Fournisseur($db); - if ($societe->fetch($fac->socidp)) + if ($societe->fetch($fac->socid)) { - $addons[0][0] = DOL_URL_ROOT.'/fourn/fiche.php?socid='.$fac->socidp; + $addons[0][0] = DOL_URL_ROOT.'/fourn/fiche.php?socid='.$fac->socid; $addons[0][1] = $societe->nom; } @@ -557,11 +557,11 @@ else if ($conf->produit->enabled) { print '
    '; - print ''; + print ''; $var=! $var; print ''; print ''; - $html->select_produits_fournisseurs($fac->socidp,'','idprod',$filtre); + $html->select_produits_fournisseurs($fac->socid,'','idprod',$filtre); print ''; print ''; print ' '; @@ -618,7 +618,7 @@ else // Societe print ''.$langs->trans('Company').''.$societe->getNomUrl(1).''; - print ''.$langs->trans('OtherBills').''; + print ''.$langs->trans('OtherBills').''; print ''; print ''.$langs->trans('Label').''; @@ -801,7 +801,7 @@ else else if ($user->rights->fournisseur->facture->creer) { - print ''.$langs->trans('Copy').''; + print ''.$langs->trans('Copy').''; } if ($_GET['action'] != 'edit' && $fac->statut == 0 && $user->rights->fournisseur->facture->supprimer) diff --git a/htdocs/fourn/facture/index.php b/htdocs/fourn/facture/index.php index a210f2a4c8b..bec11d4703d 100644 --- a/htdocs/fourn/facture/index.php +++ b/htdocs/fourn/facture/index.php @@ -34,14 +34,13 @@ if (!$user->rights->fournisseur->facture->lire) $langs->load("companies"); -//on devrait uniformiser soit sur socid, soit sur socidp -$socidp = $_GET["socidp"]; +$socid = $_GET["socid"]; // Sécurité accés client if ($user->societe_id > 0) { $_GET["action"] = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } $page=$_GET["page"]; @@ -74,7 +73,7 @@ if ($_POST["mode"] == 'search') if ( $db->num_rows() == 1) { $obj = $db->fetch_object(); - $socidp = $obj->idp; + $socid = $obj->idp; } $db->free(); } @@ -92,14 +91,14 @@ llxHeader(); $sql = "SELECT s.idp as socid, s.nom, ".$db->pdate("fac.date_lim_reglement")." as date_echeance, fac.total_ht"; $sql .= ", fac.total_ttc, fac.paye as paye, fac.fk_statut as fk_statut, fac.libelle, fac.rowid as facid, fac.facnumber"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", sc.fk_soc, sc.fk_user "; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user "; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_fourn as fac"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql .= " WHERE fac.fk_soc = s.idp"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; -if ($socidp) +if (!$user->rights->commercial->client->voir && !$socid) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; +if ($socid) { - $sql .= " AND s.idp = $socidp"; + $sql .= " AND s.idp = ".$socid; } if ($_GET["filtre"]) { @@ -145,22 +144,22 @@ if ($resql) $num = $db->num_rows($resql); $i = 0; - if ($socidp) { + if ($socid) { $soc = new Societe($db); - $soc->fetch($socidp); + $soc->fetch($socid); } - print_barre_liste($langs->trans("BillsSuppliers").($socidp?" $soc->nom":""),$page,"index.php","&socidp=$socidp",$sortfield,$sortorder,'',$num); + print_barre_liste($langs->trans("BillsSuppliers").($socid?" $soc->nom":""),$page,"index.php","&socid=$socid",$sortfield,$sortorder,'',$num); print ''; print ''; - print_liste_field_titre($langs->trans("Ref"),"index.php","facnumber","&socidp=$socidp","","",$sortfield); - print_liste_field_titre($langs->trans("DateEcheance"),"index.php","fac.datef","&socidp=$socidp","","",$sortfield); - print_liste_field_titre($langs->trans("Label"),"index.php","fac.libelle","&socidp=$socidp","","",$sortfield); - print_liste_field_titre($langs->trans("Company"),"index.php","s.nom","&socidp=$socidp","","",$sortfield); - print_liste_field_titre($langs->trans("AmountHT"),"index.php","fac.total_ht","&socidp=$socidp","",'align="right"',$sortfield); - print_liste_field_titre($langs->trans("AmountTTC"),"index.php","fac.total_ttc","&socidp=$socidp","",'align="right"',$sortfield); - print_liste_field_titre($langs->trans("Status"),"index.php","fk_statut,paye","&socidp=$socidp","",'align="center"',$sortfield); + print_liste_field_titre($langs->trans("Ref"),"index.php","facnumber","&socid=$socid","","",$sortfield); + print_liste_field_titre($langs->trans("DateEcheance"),"index.php","fac.datef","&socid=$socid","","",$sortfield); + print_liste_field_titre($langs->trans("Label"),"index.php","fac.libelle","&socid=$socid","","",$sortfield); + print_liste_field_titre($langs->trans("Company"),"index.php","s.nom","&socid=$socid","","",$sortfield); + print_liste_field_titre($langs->trans("AmountHT"),"index.php","fac.total_ht","&socid=$socid","",'align="right"',$sortfield); + print_liste_field_titre($langs->trans("AmountTTC"),"index.php","fac.total_ttc","&socid=$socid","",'align="right"',$sortfield); + print_liste_field_titre($langs->trans("Status"),"index.php","fk_statut,paye","&socid=$socid","",'align="center"',$sortfield); print "\n"; // Lignes des champs de filtre diff --git a/htdocs/fourn/facture/info.php b/htdocs/fourn/facture/info.php index 6e4a9d56ca4..c9d91a25585 100644 --- a/htdocs/fourn/facture/info.php +++ b/htdocs/fourn/facture/info.php @@ -43,8 +43,8 @@ llxHeader(); $fac = new FactureFournisseur($db); $fac->fetch($_GET["facid"]); $fac->info($_GET["facid"]); -$soc = new Societe($db, $fac->socidp); -$soc->fetch($fac->socidp); +$soc = new Societe($db, $fac->socid); +$soc->fetch($fac->socid); $head = facturefourn_prepare_head($fac); $titre=$langs->trans('SupplierInvoice'); diff --git a/htdocs/fourn/facture/note.php b/htdocs/fourn/facture/note.php index 548d0c12e75..5af9235353b 100644 --- a/htdocs/fourn/facture/note.php +++ b/htdocs/fourn/facture/note.php @@ -30,7 +30,7 @@ require("./pre.inc.php"); require_once(DOL_DOCUMENT_ROOT.'/lib/fourn.lib.php'); -$socidp=isset($_GET["socidp"])?$_GET["socidp"]:isset($_POST["socidp"])?$_POST["socidp"]:""; +$socid=isset($_GET["socid"])?$_GET["socid"]:isset($_POST["socid"])?$_POST["socid"]:""; $user->getrights('facture'); if (!$user->rights->facture->lire) @@ -43,7 +43,7 @@ $langs->load("bills"); if ($user->societe_id > 0) { unset($_GET["action"]); - $socidp = $user->societe_id; + $socid = $user->societe_id; } diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php index 86f1466ddf4..b62db09d2a7 100644 --- a/htdocs/fourn/facture/paiement.php +++ b/htdocs/fourn/facture/paiement.php @@ -46,11 +46,11 @@ $sortorder = isset($_GET['sortorder'])?$_GET['sortorder']:$_POST['sortorder']; $page=isset($_GET['page'])?$_GET['page']:$_POST['page']; // Sécurité accés client -$socidp=0; +$socid=0; if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } @@ -201,12 +201,12 @@ if ($action == 'create' || $action == 'add_paiement') $facture->fetch($facid); $sql = 'SELECT s.nom,s.idp, f.amount, f.total_ttc as total, f.facnumber'; - if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", sc.fk_soc, sc.fk_user "; + if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user "; $sql .= ' FROM '.MAIN_DB_PREFIX.'societe as s, '.MAIN_DB_PREFIX.'facture_fourn as f'; - if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql .= ' WHERE f.fk_soc = s.idp'; $sql .= ' AND f.rowid = '.$facid; - if (!$user->rights->commercial->client->voir && !$socidp) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; + if (!$user->rights->commercial->client->voir && !$socid) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; $resql = $db->query($sql); if ($resql) { @@ -259,7 +259,7 @@ if ($action == 'create' || $action == 'add_paiement') $sql .= ', sum(pf.amount) as am'; $sql .= ' FROM '.MAIN_DB_PREFIX.'facture_fourn as f'; $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiementfourn_facturefourn as pf ON pf.fk_facturefourn = f.rowid'; - $sql .= ' WHERE f.fk_soc = '.$facture->socidp; + $sql .= ' WHERE f.fk_soc = '.$facture->socid; $sql .= ' AND f.paye = 0'; $sql .= ' AND f.fk_statut = 1'; // Statut=0 => non validée, Statut=2 => annulée $sql .= ' GROUP BY f.facnumber'; @@ -368,9 +368,9 @@ if (! $_GET['action'] && ! $_POST['action']) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON p.fk_bank = b.rowid'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank_account as ba ON b.fk_account = ba.rowid'; if (!$user->rights->commercial->client->voir) $sql .= " WHERE s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; - if ($socidp) + if ($socid) { - $sql .= ' WHERE f.fk_soc = '.$socidp; + $sql .= ' WHERE f.fk_soc = '.$socid; } $sql .= ' ORDER BY '.$sortfield.' '.$sortorder; $sql .= $db->plimit($limit + 1 ,$offset); diff --git a/htdocs/fourn/fiche.php b/htdocs/fourn/fiche.php index d1769b94bd2..eac1c5eaa61 100644 --- a/htdocs/fourn/fiche.php +++ b/htdocs/fourn/fiche.php @@ -46,7 +46,7 @@ if ($user->societe_id > 0) $action = ''; $socid = $user->societe_id; } -if ($socid == '') accessforbidden(); +if (! $socid) accessforbidden(); diff --git a/htdocs/fourn/fournisseur.class.php b/htdocs/fourn/fournisseur.class.php index 45180a72066..b1823ed9da8 100644 --- a/htdocs/fourn/fournisseur.class.php +++ b/htdocs/fourn/fournisseur.class.php @@ -114,7 +114,7 @@ class Fournisseur extends Societe { dolibarr_syslog("Fournisseur::Create_Commande"); $comm = new CommandeFournisseur($this->db); - $comm->socidp = $this->id; + $comm->socid = $this->id; if ($comm->create($user) > 0) { diff --git a/htdocs/fourn/fournisseur.commande.class.php b/htdocs/fourn/fournisseur.commande.class.php index 877a00f2a0e..b104a71c406 100644 --- a/htdocs/fourn/fournisseur.commande.class.php +++ b/htdocs/fourn/fournisseur.commande.class.php @@ -82,7 +82,7 @@ class CommandeFournisseur extends Commande $this->id = $obj->rowid; $this->ref = $obj->ref; - $this->socidp = $obj->fk_soc; + $this->socid = $obj->fk_soc; $this->fourn_id = $obj->fk_soc; $this->statut = $obj->fk_statut; $this->user_author_id = $obj->fk_user_author; @@ -538,7 +538,7 @@ class CommandeFournisseur extends Commande */ function create($user) { - dolibarr_syslog("CommandeFournisseur::Create soc id=".$this->socidp); + dolibarr_syslog("CommandeFournisseur::Create soc id=".$this->socid); $this->db->begin(); @@ -546,7 +546,7 @@ class CommandeFournisseur extends Commande $this->brouillon = 1; $sql = "INSERT INTO ".MAIN_DB_PREFIX."commande_fournisseur (fk_soc, date_creation, fk_user_author, fk_statut) "; - $sql .= " VALUES (".$this->socidp.", now(), ".$user->id.",0)"; + $sql .= " VALUES (".$this->socid.", now(), ".$user->id.",0)"; if ( $this->db->query($sql) ) { diff --git a/htdocs/fourn/fournisseur.facture.class.php b/htdocs/fourn/fournisseur.facture.class.php index 9ed2751aa0d..d9f36cb6b36 100644 --- a/htdocs/fourn/fournisseur.facture.class.php +++ b/htdocs/fourn/fournisseur.facture.class.php @@ -41,7 +41,7 @@ class FactureFournisseur extends Facture { var $id; var $db; - var $socidp; + var $socid; var $statut; var $paye; var $author; @@ -63,17 +63,17 @@ class FactureFournisseur extends Facture /** * \brief Constructeur de la classe * \param DB Handler accès base de données - * \param socidp Id societe ('' par defaut) + * \param socid Id societe ('' par defaut) * \param facid Id facture ('' par defaut) */ - function FactureFournisseur($DB, $socidp='', $facid='') + function FactureFournisseur($DB, $socid='', $facid='') { $this->db = $DB ; $this->table = 'facture_fourn'; $this->tabledetail = 'facture_fourn_det'; $this->id = $facid; - $this->socidp = $socidp; + $this->socid = $socid; $this->amount = 0; $this->remise = 0; @@ -96,7 +96,7 @@ class FactureFournisseur extends Facture { global $langs; - $socidp = $this->socidp; + $socid = $this->socid; $number = $this->ref; $amount = $this->amount; $remise = $this->remise; @@ -108,7 +108,7 @@ class FactureFournisseur extends Facture $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'facture_fourn (facnumber, libelle, fk_soc, datec, datef, note, fk_user_author, date_lim_reglement) '; $sql .= " VALUES ('".addslashes($number)."','".addslashes($this->libelle)."',"; - $sql .= $this->socidp.", now(),'".$this->db->idate($this->date)."','".addslashes($this->note)."', ".$user->id.",'".$this->db->idate($this->date_echeance)."');"; + $sql .= $this->socid.", now(),'".$this->db->idate($this->date)."','".addslashes($this->note)."', ".$user->id.",'".$this->db->idate($this->date_echeance)."');"; $resql=$this->db->query($sql); if ($resql) { @@ -168,7 +168,7 @@ class FactureFournisseur extends Facture $sql.= ' total_ht, total_tva, total_ttc, fk_user_author,'; $sql.= ' fk_statut, paye, f.note, f.note_public,'; $sql.= ' '.$this->db->pdate('date_lim_reglement').'as de,'; - $sql.= ' s.nom as socnom, s.idp as socidp'; + $sql.= ' s.nom as socnom, s.idp as socid'; $sql.= ' FROM '.MAIN_DB_PREFIX.'facture_fourn as f,'.MAIN_DB_PREFIX.'societe as s'; $sql.= ' WHERE f.rowid='.$rowid.' AND f.fk_soc = s.idp'; $resql = $this->db->query($sql); @@ -186,7 +186,7 @@ class FactureFournisseur extends Facture $this->libelle = $obj->libelle; $this->remise = $obj->remise; - $this->socidp = $obj->socidp; + $this->socid = $obj->socid; $this->total_ht = $obj->total_ht; $this->total_tva = $obj->total_tva; @@ -266,7 +266,7 @@ class FactureFournisseur extends Facture function fetch_fournisseur() { $fournisseur = new Fournisseur($this->db); - $fournisseur->fetch($this->socidp); + $fournisseur->fetch($this->socid); $this->fournisseur = $fournisseur; } diff --git a/htdocs/fourn/index.php b/htdocs/fourn/index.php index e965647300c..ed422495bcf 100644 --- a/htdocs/fourn/index.php +++ b/htdocs/fourn/index.php @@ -48,11 +48,11 @@ $langs->load("companies"); llxHeader(); // Sécurité accés client -$socidp=''; +$socid=''; if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } if ($page == -1) { $page = 0 ; } @@ -69,12 +69,12 @@ if (! $sortfield) $sortfield="nom"; $sql = "SELECT s.idp, s.nom, s.ville,".$db->pdate("s.datec")." as datec, ".$db->pdate("s.datea")." as datea, st.libelle as stcomm, s.prefix_comm"; $sql.= " , code_fournisseur, code_compta_fournisseur"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", sc.fk_soc, sc.fk_user "; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user "; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."c_stcomm as st"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE s.fk_stcomm = st.id AND s.fournisseur=1"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; -if ($socidp) $sql .= " AND s.idp=$socidp"; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; +if ($socid) $sql .= " AND s.idp=".$socid; if ($socname) { $sql .= " AND lower(s.nom) like '%".strtolower($socname)."%'"; $sortfield = "lower(s.nom)"; diff --git a/htdocs/includes/modules/commande/pdf_edison.modules.php b/htdocs/includes/modules/commande/pdf_edison.modules.php index 56782696c0a..1017ec80c0b 100644 --- a/htdocs/includes/modules/commande/pdf_edison.modules.php +++ b/htdocs/includes/modules/commande/pdf_edison.modules.php @@ -339,7 +339,7 @@ class pdf_edison extends ModelePDFCommandes $pdf->SetTextColor(0,0,0); $pdf->SetFont('Arial','B',12); $client = new Societe($this->db); - $client->fetch($com->socidp); + $client->fetch($com->socid); $com->client = $client; $pdf->SetXY(102,42); $pdf->MultiCell(96,5, $com->client->nom); diff --git a/htdocs/includes/modules/modFacture.class.php b/htdocs/includes/modules/modFacture.class.php index 53312e35ae7..9d6e507eaab 100644 --- a/htdocs/includes/modules/modFacture.class.php +++ b/htdocs/includes/modules/modFacture.class.php @@ -186,7 +186,7 @@ class modFacture extends DolibarrModules $this->export_label[$r]='Factures clients et lignes de facture'; $this->export_fields_array[$r]=array('s.idp'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.cp'=>'Zip','s.ville'=>'Town','s.fk_pays'=>'Country','s.tel'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','f.rowid'=>"Id",'f.facnumber'=>"Ref",'f.fk_soc'=>"IdCompany",'f.datec'=>"DateCreation",'f.datef'=>"DateInvoice",'f.amount'=>"Amount",'f.remise_percent'=>"GlobalDiscount",'f.total'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.paye'=>"BillShortStatusPayed",'f.fk_statut'=>'Status','f.note'=>"Note",'fd.rowid'=>'LineId','fd.description'=>"LineDescription",'fd.tva_taux'=>"LineVATRate",'fd.qty'=>"LineQty",'fd.date_start'=>"DateStart",'fd.date_end'=>"DateEnd"); $this->export_entities_array[$r]=array('s.idp'=>"company",'s.nom'=>'company','s.address'=>'company','s.cp'=>'company','s.ville'=>'company','s.fk_pays'=>'company','s.tel'=>'company','s.siren'=>'company','s.siret'=>'company','f.rowid'=>"invoice",'f.facnumber'=>"invoice",'f.fk_soc'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.amount'=>"invoice",'f.remise_percent'=>"invoice",'f.total'=>"invoice",'f.total_ttc'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note'=>"invoice",'fd.rowid'=>'invoice_line','fd.description'=>"invoice_line",'fd.tva_taux'=>"invoice_line",'fd.qty'=>"invoice_line",'fd.date_start'=>"invoice_line",'fd.date_end'=>"invoice_line"); - $this->export_alias_array[$r]=array('s.idp'=>"socidp",'s.nom'=>'soc_name','s.address'=>'soc_adres','s.cp'=>'soc_zip','s.ville'=>'soc_ville','s.fk_pays'=>'soc_pays','s.tel'=>'soc_tel','s.siren'=>'soc_siren','s.siret'=>'soc_siret','f.rowid'=>"invoiceid",'f.facnumber'=>"ref",'f.fk_soc'=>"fk_soc",'f.datec'=>"datecreation",'f.datef'=>"dateinvoice",'f.amount'=>"amount",'f.remise_percent'=>"globaldiscount",'f.total'=>"totalht",'f.total_ttc'=>"totalttc",'f.paye'=>"paid",'f.fk_statut'=>'status','f.note'=>"note",'fd.rowid'=>'lineid','fd.description'=>"linedescription",'fd.tva_taux'=>"linevatrate",'fd.qty'=>"lineqty",'fd.date_start'=>"linedatestart",'fd.date_end'=>"linedateend"); + $this->export_alias_array[$r]=array('s.idp'=>"socid",'s.nom'=>'soc_name','s.address'=>'soc_adres','s.cp'=>'soc_zip','s.ville'=>'soc_ville','s.fk_pays'=>'soc_pays','s.tel'=>'soc_tel','s.siren'=>'soc_siren','s.siret'=>'soc_siret','f.rowid'=>"invoiceid",'f.facnumber'=>"ref",'f.fk_soc'=>"fk_soc",'f.datec'=>"datecreation",'f.datef'=>"dateinvoice",'f.amount'=>"amount",'f.remise_percent'=>"globaldiscount",'f.total'=>"totalht",'f.total_ttc'=>"totalttc",'f.paye'=>"paid",'f.fk_statut'=>'status','f.note'=>"note",'fd.rowid'=>'lineid','fd.description'=>"linedescription",'fd.tva_taux'=>"linevatrate",'fd.qty'=>"lineqty",'fd.date_start'=>"linedatestart",'fd.date_end'=>"linedateend"); $this->export_sql[$r]="select distinct "; $i=0; foreach ($this->export_alias_array[$r] as $key => $value) diff --git a/htdocs/includes/modules/modFournisseur.class.php b/htdocs/includes/modules/modFournisseur.class.php index 1d1eb33f465..11970dab115 100644 --- a/htdocs/includes/modules/modFournisseur.class.php +++ b/htdocs/includes/modules/modFournisseur.class.php @@ -226,7 +226,7 @@ class modFournisseur extends DolibarrModules $this->export_label[$r]='Factures fournisseurs et lignes de facture'; $this->export_fields_array[$r]=array('s.idp'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.cp'=>'Zip','s.ville'=>'Town','s.fk_pays'=>'Country','s.tel'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','f.rowid'=>"Id",'f.facnumber'=>"Ref",'f.datec'=>"DateCreation",'f.datef'=>"DateInvoice",'f.total_ht'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.paye'=>"BillShortStatusPayed",'f.fk_statut'=>'Status','f.note'=>"Note",'fd.rowid'=>'LineId','fd.description'=>"LineDescription",'fd.tva_taux'=>"LineVATRate",'fd.qty'=>"LineQty"); $this->export_entities_array[$r]=array('s.idp'=>"company",'s.nom'=>'company','s.address'=>'company','s.cp'=>'company','s.ville'=>'company','s.fk_pays'=>'company','s.tel'=>'company','s.siren'=>'company','s.siret'=>'company','f.rowid'=>"invoice",'f.facnumber'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.total_ht'=>"invoice",'f.total_ttc'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note'=>"invoice",'fd.rowid'=>'invoice_line','fd.description'=>"invoice_line",'fd.tva_taux'=>"invoice_line",'fd.qty'=>"invoice_line"); - $this->export_alias_array[$r]=array('s.idp'=>"socidp",'s.nom'=>'soc_name','s.address'=>'soc_adres','s.cp'=>'soc_zip','s.ville'=>'soc_ville','s.fk_pays'=>'soc_pays','s.tel'=>'soc_tel','s.siren'=>'soc_siren','s.siret'=>'soc_siret','f.rowid'=>"invoiceid",'f.facnumber'=>"ref",'f.datec'=>"datecreation",'f.datef'=>"dateinvoice",'f.total_ht'=>"totalht",'f.total_ttc'=>"totalttc",'f.paye'=>"paid",'f.fk_statut'=>'status','f.note'=>"note",'fd.rowid'=>'lineid','fd.description'=>"linedescription",'fd.tva_taux'=>"linevatrate",'fd.qty'=>"lineqty"); + $this->export_alias_array[$r]=array('s.idp'=>"socid",'s.nom'=>'soc_name','s.address'=>'soc_adres','s.cp'=>'soc_zip','s.ville'=>'soc_ville','s.fk_pays'=>'soc_pays','s.tel'=>'soc_tel','s.siren'=>'soc_siren','s.siret'=>'soc_siret','f.rowid'=>"invoiceid",'f.facnumber'=>"ref",'f.datec'=>"datecreation",'f.datef'=>"dateinvoice",'f.total_ht'=>"totalht",'f.total_ttc'=>"totalttc",'f.paye'=>"paid",'f.fk_statut'=>'status','f.note'=>"note",'fd.rowid'=>'lineid','fd.description'=>"linedescription",'fd.tva_taux'=>"linevatrate",'fd.qty'=>"lineqty"); $this->export_sql[$r]="select distinct "; $i=0; foreach ($this->export_alias_array[$r] as $key => $value) diff --git a/htdocs/includes/triggers/interface_notification.class.php b/htdocs/includes/triggers/interface_notification.class.php index 95ba73d0ed4..e7fd1d7098c 100644 --- a/htdocs/includes/triggers/interface_notification.class.php +++ b/htdocs/includes/triggers/interface_notification.class.php @@ -109,7 +109,7 @@ class InterfaceNotification $mesg = 'La facture '.$object->ref." a été validée.\n"; $notify = new Notify($this->db); - $notify->send($action_notify, $object->socidp, $mesg, 'facture', $object->id, $filepdf); + $notify->send($action_notify, $object->socid, $mesg, 'facture', $object->id, $filepdf); } if ($action == 'FICHEINTER_VALIDATE') @@ -122,7 +122,7 @@ class InterfaceNotification $mesg = 'La fiche intervention '.$object->ref." a été validée.\n"; $notify = new Notify($this->db); - $notify->send($action_notify, $object->socidp, $mesg, 'ficheinter', $object->id, $filepdf); + $notify->send($action_notify, $object->socid, $mesg, 'ficheinter', $object->id, $filepdf); } if ($action == 'ORDER_SUPPLIER_VALIDATE') @@ -135,7 +135,7 @@ class InterfaceNotification $mesg = 'La commande fournisseur '.$object->ref." a été validée.\n"; $notify = new Notify($this->db); - $notify->send($action_notify, $object->socidp, $mesg, 'order_supplier', $object->id, $filepdf); + $notify->send($action_notify, $object->socid, $mesg, 'order_supplier', $object->id, $filepdf); } return 0; diff --git a/htdocs/lib/product.lib.php b/htdocs/lib/product.lib.php index e594c5511db..b095f9281e8 100644 --- a/htdocs/lib/product.lib.php +++ b/htdocs/lib/product.lib.php @@ -130,7 +130,7 @@ function product_prepare_head($product) } -function show_stats_for_company($product,$socidp) +function show_stats_for_company($product,$socid) { global $conf,$langs,$user,$db; @@ -144,7 +144,7 @@ function show_stats_for_company($product,$socidp) // Propals if ($conf->propal->enabled && $user->rights->propale->lire) { - $ret=$product->load_stats_propale($socidp); + $ret=$product->load_stats_propale($socid); if ($ret < 0) dolibarr_print_error($db); $langs->load("propal"); print ''; - show_stats_for_company($product,$socidp); + show_stats_for_company($product,$socid); print "
    '; @@ -161,7 +161,7 @@ function show_stats_for_company($product,$socidp) // Commandes clients if ($conf->commande->enabled && $user->rights->commande->lire) { - $ret=$product->load_stats_commande($socidp); + $ret=$product->load_stats_commande($socid); if ($ret < 0) dolibarr_print_error($db); $langs->load("orders"); print '
    '; @@ -178,7 +178,7 @@ function show_stats_for_company($product,$socidp) // Commandes fournisseurs if ($conf->fournisseur->enabled && $user->rights->fournisseur->commande->lire) { - $ret=$product->load_stats_commande_fournisseur($socidp); + $ret=$product->load_stats_commande_fournisseur($socid); if ($ret < 0) dolibarr_print_error($db); $langs->load("orders"); print '
    '; @@ -195,7 +195,7 @@ function show_stats_for_company($product,$socidp) // Contrats if ($conf->contrat->enabled && $user->rights->contrat->lire) { - $ret=$product->load_stats_contrat($socidp); + $ret=$product->load_stats_contrat($socid); if ($ret < 0) dolibarr_print_error($db); $langs->load("contracts"); print '
    '; @@ -212,7 +212,7 @@ function show_stats_for_company($product,$socidp) // Factures clients if ($conf->facture->enabled && $user->rights->facture->lire) { - $ret=$product->load_stats_facture($socidp); + $ret=$product->load_stats_facture($socid); if ($ret < 0) dolibarr_print_error($db); $langs->load("bills"); print '
    '; @@ -229,7 +229,7 @@ function show_stats_for_company($product,$socidp) // Factures fournisseurs if ($conf->fournisseur->enabled && $user->rights->fournisseur->facture->lire) { - $ret=$product->load_stats_facture_fournisseur($socidp); + $ret=$product->load_stats_facture_fournisseur($socid); if ($ret < 0) dolibarr_print_error($db); $langs->load("bills"); print '
    '; diff --git a/htdocs/livraison/fiche.php b/htdocs/livraison/fiche.php index 97730fa9f42..7e7b70aeb0c 100644 --- a/htdocs/livraison/fiche.php +++ b/htdocs/livraison/fiche.php @@ -47,7 +47,7 @@ if (!$user->rights->expedition->livraison->lire) if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } @@ -176,7 +176,7 @@ if ($_GET["action"] == 'create') if ( $commande->fetch($_GET["commande_id"])) { $soc = new Societe($db); - $soc->fetch($commande->socidp); + $soc->fetch($commande->socid); $author = new User($db); $author->id = $commande->user_author_id; $author->fetch(); @@ -362,7 +362,7 @@ else $commande->fetch($livraison->commande_id); $soc = new Societe($db); - $soc->fetch($commande->socidp); + $soc->fetch($commande->socid); $h=0; if ($conf->expedition->enabled) diff --git a/htdocs/livraison/livraison.class.php b/htdocs/livraison/livraison.class.php index b9c31030720..0ace564b184 100644 --- a/htdocs/livraison/livraison.class.php +++ b/htdocs/livraison/livraison.class.php @@ -225,7 +225,7 @@ class Livraison extends CommonObject $this->date_creation = $obj->date_creation; $this->date_valid = $obj->date_valid; $this->ref = $obj->ref; - $this->socidp = $obj->fk_soc; + $this->socid = $obj->fk_soc; $this->statut = $obj->fk_statut; $this->commande_id = $obj->fk_commande; $this->expedition_id = $obj->fk_expedition; @@ -283,7 +283,7 @@ class Livraison extends CommonObject // Recuperation de la nouvelle reference $objMod = new $modName($this->db); $soc = new Societe($this->db); - $soc->fetch($this->socidp); + $soc->fetch($this->socid); // on vérifie si le bon de livraison est en numérotation provisoire $livref = substr($this->ref, 1, 4); diff --git a/htdocs/livraison/mods/modules_livraison.php b/htdocs/livraison/mods/modules_livraison.php index 838008ef008..57bb4a2e9d8 100644 --- a/htdocs/livraison/mods/modules_livraison.php +++ b/htdocs/livraison/mods/modules_livraison.php @@ -190,7 +190,7 @@ function delivery_order_delete_preview($db, $deliveryid) $delivery = new Livraison($db,"",$deliveryid); $delivery->fetch($deliveryid); $client = new Societe($db); - $client->fetch($delivery->socidp); + $client->fetch($delivery->socid); if ($conf->livraison->dir_output) { diff --git a/htdocs/livraison/mods/pdf/pdf_sirocco.modules.php b/htdocs/livraison/mods/pdf/pdf_sirocco.modules.php index 764b380e05d..6dea28b6d84 100644 --- a/htdocs/livraison/mods/pdf/pdf_sirocco.modules.php +++ b/htdocs/livraison/mods/pdf/pdf_sirocco.modules.php @@ -308,7 +308,7 @@ class pdf_sirocco extends ModelePDFDeliveryOrder $pdf->SetTextColor(0,0,0); $pdf->SetFont('Arial','B',12); $client = new Societe($this->db); - $client->fetch($delivery->socidp); + $client->fetch($delivery->socid); $delivery->client = $client; $pdf->SetXY(102,42); $pdf->MultiCell(96,5, $delivery->client->nom); diff --git a/htdocs/livraison/mods/pdf/pdf_typhon.modules.php b/htdocs/livraison/mods/pdf/pdf_typhon.modules.php index 63a6663c5a9..32ff2cee390 100644 --- a/htdocs/livraison/mods/pdf/pdf_typhon.modules.php +++ b/htdocs/livraison/mods/pdf/pdf_typhon.modules.php @@ -732,7 +732,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder $pdf->MultiCell(80,5, $langs->trans("BillTo").":"); // $client = new Societe($this->db); - $client->fetch($delivery->socidp); + $client->fetch($delivery->socid); $delivery->client = $client; // diff --git a/htdocs/lolix/cv/liste.php b/htdocs/lolix/cv/liste.php index f612c0def9d..01e59ccef38 100644 --- a/htdocs/lolix/cv/liste.php +++ b/htdocs/lolix/cv/liste.php @@ -38,7 +38,7 @@ if ($_GET["action"] == 'deac') if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } if ($page == -1) { $page = 0 ; } diff --git a/htdocs/lolix/index.php b/htdocs/lolix/index.php index 27d621d130f..63e5aa6d5d4 100644 --- a/htdocs/lolix/index.php +++ b/htdocs/lolix/index.php @@ -25,7 +25,7 @@ $user->getrights('propale'); if ($user->societe_id > 0) { - $socidp = $user->societe_id; + $socid = $user->societe_id; } diff --git a/htdocs/lolix/societe/activation.php b/htdocs/lolix/societe/activation.php index 7c113a93f5c..1cba3972e5b 100644 --- a/htdocs/lolix/societe/activation.php +++ b/htdocs/lolix/societe/activation.php @@ -32,7 +32,7 @@ llxHeader("","","Lolix - Soci if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } if ($page == -1) { $page = 0 ; } diff --git a/htdocs/lolix/societe/index.php b/htdocs/lolix/societe/index.php index 27d621d130f..63e5aa6d5d4 100644 --- a/htdocs/lolix/societe/index.php +++ b/htdocs/lolix/societe/index.php @@ -25,7 +25,7 @@ $user->getrights('propale'); if ($user->societe_id > 0) { - $socidp = $user->societe_id; + $socid = $user->societe_id; } diff --git a/htdocs/lolix/societe/liste.php b/htdocs/lolix/societe/liste.php index ffa4bf000bc..7d030faf8f9 100644 --- a/htdocs/lolix/societe/liste.php +++ b/htdocs/lolix/societe/liste.php @@ -29,7 +29,7 @@ llxHeader("","","Lolix, liste des offres"); if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } if ($page == -1) { $page = 0 ; } diff --git a/htdocs/oscommerce_ws/clients/osc_customer.class.php b/htdocs/oscommerce_ws/clients/osc_customer.class.php index 8d93560a4be..642c8460ed5 100644 --- a/htdocs/oscommerce_ws/clients/osc_customer.class.php +++ b/htdocs/oscommerce_ws/clients/osc_customer.class.php @@ -134,10 +134,10 @@ class Osc_customer /** * \brief Mise à jour de la table de transition * \param oscid Id du client dans OsC -* \param socidp champ société.idp +* \param socid champ société.idp * \return int <0 si ko, >0 si ok */ - function transcode($oscid, $socidp ) + function transcode($oscid, $socid) { print "entree transcode
    "; @@ -156,7 +156,7 @@ class Osc_customer // $this->db->rollback(); // return -1; } - $sql = "INSERT INTO ".MAIN_DB_PREFIX."osc_customer VALUES (".$oscid." , now() , ".$socidp.") ;"; + $sql = "INSERT INTO ".MAIN_DB_PREFIX."osc_customer VALUES (".$oscid." , now() , ".$socid.") ;"; $result=$this->db->query($sql); if ($result) @@ -176,7 +176,9 @@ class Osc_customer function get_clientid($osc_client) { - $sql = "SELECT doli_socidp FROM ".MAIN_DB_PREFIX."osc_customer WHERE osc_custid = ".$osc_client.";"; + $sql = "SELECT doli_socidp"; + $sql.= " FROM ".MAIN_DB_PREFIX."osc_customer"; + $sql.= " WHERE osc_custid = ".$osc_client; $result=$this->db->query($sql); $row = $this->db->fetch_row($resql); // test d'erreurs diff --git a/htdocs/oscommerce_ws/commandes/osc_order.class.php b/htdocs/oscommerce_ws/commandes/osc_order.class.php index 66f127b19d1..8b0eff504a5 100644 --- a/htdocs/oscommerce_ws/commandes/osc_order.class.php +++ b/htdocs/oscommerce_ws/commandes/osc_order.class.php @@ -146,7 +146,7 @@ class Osc_order $oscclient = new Osc_Customer($this->db); $clientid = $oscclient->get_clientid($this->osc_custid); - $commande->socidp = $clientid; + $commande->socid = $clientid; $commande->ref = $this->osc_orderid; $commande->date = $this->orderdate; /* on force */ diff --git a/htdocs/product/fiche.php b/htdocs/product/fiche.php index b73e1f5769f..1eae832593d 100644 --- a/htdocs/product/fiche.php +++ b/htdocs/product/fiche.php @@ -237,7 +237,7 @@ if ($_POST["action"] == 'addinpropal') } $soc = new Societe($db); - $soc->fetch($propal->socidp,$user); + $soc->fetch($propal->socid,$user); $prod = new Product($db, $_GET['id']); $result=$prod->fetch($_GET['id']); @@ -288,7 +288,7 @@ if ($_POST["action"] == 'addincommande') $commande->fetch($_POST["commandeid"]); $soc = new Societe($db); - $soc->fetch($commande->socidp,$user); + $soc->fetch($commande->socid,$user); // multiprix if ($conf->global->PRODUIT_MULTIPRICES == 1) @@ -327,7 +327,7 @@ if ($_POST["action"] == 'addinfacture' && $user->rights->facture->creer) $facture->fetch($_POST["factureid"]); $soc = new Societe($db); - $soc->fetch($facture->socidp,$user); + $soc->fetch($facture->socid,$user); // multiprix if ($conf->global->PRODUIT_MULTIPRICES == 1) diff --git a/htdocs/product/stats/commande.php b/htdocs/product/stats/commande.php index d7f3af0b4aa..d7029842118 100644 --- a/htdocs/product/stats/commande.php +++ b/htdocs/product/stats/commande.php @@ -52,15 +52,15 @@ if (! $sortfield) $sortfield="c.date_creation"; // Securite -$socidp = 0; +$socid = 0; if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } else { - $socidp = 0; + $socid = 0; } @@ -114,7 +114,7 @@ if ($_GET["id"] || $_GET["ref"]) print $product->getLibStatut(2); print '
    "; @@ -123,15 +123,15 @@ if ($_GET["id"] || $_GET["ref"]) $sql = "SELECT distinct(s.nom), s.idp, s.code_client, c.rowid, c.total_ht as amount, c.ref,"; $sql.= " ".$db->pdate("c.date_creation")." as date, c.fk_statut as statut, c.facture, c.rowid as commandeid"; - if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", sc.fk_soc, sc.fk_user "; + if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user "; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."commande as c, ".MAIN_DB_PREFIX."commandedet as d"; - if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE c.fk_soc = s.idp"; $sql.= " AND d.fk_commande = c.rowid AND d.fk_product =".$product->id; - if (!$user->rights->commercial->client->voir && !$socidp) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; - if ($socidp) + if (!$user->rights->commercial->client->voir && !$socid) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; + if ($socid) { - $sql .= " AND c.fk_soc = $socidp"; + $sql .= " AND c.fk_soc = $socid"; } $sql.= " ORDER BY $sortfield $sortorder "; $sql.= $db->plimit($conf->liste_limit +1, $offset); diff --git a/htdocs/product/stats/commande_fournisseur.php b/htdocs/product/stats/commande_fournisseur.php index 1234db06cb2..9568a313ea8 100644 --- a/htdocs/product/stats/commande_fournisseur.php +++ b/htdocs/product/stats/commande_fournisseur.php @@ -52,15 +52,15 @@ if (! $sortfield) $sortfield="c.date_creation"; // Securite -$socidp = 0; +$socid = 0; if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } else { - $socidp = 0; + $socid = 0; } @@ -114,7 +114,7 @@ if ($_GET["id"] || $_GET["ref"]) print $product->getLibStatut(2); print ''; - show_stats_for_company($product,$socidp); + show_stats_for_company($product,$socid); print ""; @@ -123,15 +123,15 @@ if ($_GET["id"] || $_GET["ref"]) $sql = "SELECT distinct(s.nom), s.idp, s.code_client, c.rowid, c.total_ht as amount, c.ref,"; $sql.= " ".$db->pdate("c.date_creation")." as date, c.fk_statut as statut, c.rowid as commandeid"; - if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", sc.fk_soc, sc.fk_user "; + if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user "; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."commande_fournisseur as c, ".MAIN_DB_PREFIX."commande_fournisseurdet as d"; - if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE c.fk_soc = s.idp"; $sql.= " AND d.fk_commande = c.rowid AND d.fk_product =".$product->id; - if (!$user->rights->commercial->client->voir && !$socidp) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; - if ($socidp) + if (!$user->rights->commercial->client->voir && !$socid) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; + if ($socid) { - $sql .= " AND c.fk_soc = ".$socidp; + $sql .= " AND c.fk_soc = ".$socid; } $sql.= " ORDER BY $sortfield $sortorder "; $sql.= $db->plimit($conf->liste_limit +1, $offset); diff --git a/htdocs/product/stats/contrat.php b/htdocs/product/stats/contrat.php index fea1b8d7f42..caa740041ad 100644 --- a/htdocs/product/stats/contrat.php +++ b/htdocs/product/stats/contrat.php @@ -50,7 +50,7 @@ if (! $sortorder) $sortorder="DESC"; if (! $sortfield) $sortfield="c.datec"; // Securite -$socidp = 0; +$socid = 0; if ($user->societe_id > 0) { $action = ''; @@ -112,7 +112,7 @@ if ($_GET["id"] || $_GET["ref"]) print $product->getLibStatut(2); print ''; - show_stats_for_company($product,$socidp); + show_stats_for_company($product,$socid); print ""; diff --git a/htdocs/product/stats/facture.php b/htdocs/product/stats/facture.php index bdf098d48d7..ad2c79c29ec 100644 --- a/htdocs/product/stats/facture.php +++ b/htdocs/product/stats/facture.php @@ -51,10 +51,10 @@ if (! $sortorder) $sortorder="DESC"; if (! $sortfield) $sortfield="f.datef"; // Securite -$socidp = 0; +$socid = 0; if ($user->societe_id > 0) { - $socidp = $user->societe_id; + $socid = $user->societe_id; } @@ -108,7 +108,7 @@ if ($_GET["id"] || $_GET["ref"]) print $product->getLibStatut(2); print ''; - show_stats_for_company($product,$socidp); + show_stats_for_company($product,$socid); print ""; @@ -117,15 +117,15 @@ if ($_GET["id"] || $_GET["ref"]) $sql = "SELECT distinct(s.nom), s.idp, s.code_client, f.facnumber, f.amount as amount,"; $sql.= " ".$db->pdate("f.datef")." as date, f.paye, f.fk_statut as statut, f.rowid as facid"; - if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", sc.fk_soc, sc.fk_user "; + if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user "; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."facturedet as d"; - if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE f.fk_soc = s.idp"; $sql.= " AND d.fk_facture = f.rowid AND d.fk_product =".$product->id; - if (!$user->rights->commercial->client->voir && !$socidp) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; - if ($socidp) + if (!$user->rights->commercial->client->voir && !$socid) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; + if ($socid) { - $sql .= " AND f.fk_soc = $socidp"; + $sql .= " AND f.fk_soc = $socid"; } $sql.= " ORDER BY $sortfield $sortorder "; $sql.= $db->plimit($conf->liste_limit +1, $offset); @@ -161,7 +161,7 @@ if ($_GET["id"] || $_GET["ref"]) print ''.img_object($langs->trans("ShowBill"),"bill").' '; print $objp->facnumber; print "\n"; - print ''.img_object($langs->trans("ShowCompany"),"company").' '.dolibarr_trunc($objp->nom,44).''; + print ''.img_object($langs->trans("ShowCompany"),"company").' '.dolibarr_trunc($objp->nom,44).''; print "".$objp->code_client."\n"; print ""; print dolibarr_print_date($objp->date).""; diff --git a/htdocs/product/stats/facture_fournisseur.php b/htdocs/product/stats/facture_fournisseur.php index 1bceaa6b39b..e587af64f8e 100644 --- a/htdocs/product/stats/facture_fournisseur.php +++ b/htdocs/product/stats/facture_fournisseur.php @@ -52,10 +52,10 @@ if (! $sortorder) $sortorder="DESC"; if (! $sortfield) $sortfield="f.datef"; // Securite -$socidp = 0; +$socid = 0; if ($user->societe_id > 0) { - $socidp = $user->societe_id; + $socid = $user->societe_id; } @@ -109,7 +109,7 @@ if ($_GET["id"] || $_GET["ref"]) print $product->getLibStatut(2); print ''; - show_stats_for_company($product,$socidp); + show_stats_for_company($product,$socid); print ""; @@ -118,15 +118,15 @@ if ($_GET["id"] || $_GET["ref"]) $sql = "SELECT distinct(s.nom), s.idp, s.code_client, f.facnumber, f.amount as amount,"; $sql.= " ".$db->pdate("f.datef")." as date, f.paye, f.fk_statut as statut, f.rowid as facid"; - if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", sc.fk_soc, sc.fk_user "; + if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user "; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture_fourn as f, ".MAIN_DB_PREFIX."facture_fourn_det as d"; - if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE f.fk_soc = s.idp"; $sql.= " AND d.fk_facture_fourn = f.rowid AND d.fk_product =".$product->id; - if (!$user->rights->commercial->client->voir && !$socidp) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; - if ($socidp) + if (!$user->rights->commercial->client->voir && !$socid) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; + if ($socid) { - $sql .= " AND f.fk_soc = $socidp"; + $sql .= " AND f.fk_soc = $socid"; } $sql.= " ORDER BY $sortfield $sortorder "; $sql.= $db->plimit($conf->liste_limit +1, $offset); @@ -162,7 +162,7 @@ if ($_GET["id"] || $_GET["ref"]) print ''.img_object($langs->trans("ShowBill"),"bill").' '; print $objp->facnumber; print "\n"; - print ''.img_object($langs->trans("ShowCompany"),"company").' '.dolibarr_trunc($objp->nom,44).''; + print ''.img_object($langs->trans("ShowCompany"),"company").' '.dolibarr_trunc($objp->nom,44).''; print "".$objp->code_client."\n"; print ""; print dolibarr_print_date($objp->date).""; diff --git a/htdocs/product/stats/fiche.php b/htdocs/product/stats/fiche.php index fe9520a0f60..34801bb8a65 100644 --- a/htdocs/product/stats/fiche.php +++ b/htdocs/product/stats/fiche.php @@ -103,7 +103,7 @@ if ($_GET["id"] || $_GET["ref"]) print $product->getLibStatut(2); print ''; - show_stats_for_company($product,$socidp); + show_stats_for_company($product,$socid); print ''; print ''; diff --git a/htdocs/product/stats/propal.php b/htdocs/product/stats/propal.php index 370b0fdc7d6..a43be3f1393 100644 --- a/htdocs/product/stats/propal.php +++ b/htdocs/product/stats/propal.php @@ -49,15 +49,15 @@ if (! $sortfield) $sortfield="p.datec"; // Securite -$socidp = 0; +$socid = 0; if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } else { - $socidp = 0; + $socid = 0; } @@ -111,7 +111,7 @@ if ($_GET["id"] || $_GET["ref"]) print $product->getLibStatut(2); print ''; - show_stats_for_company($product,$socidp); + show_stats_for_company($product,$socid); print ""; @@ -120,15 +120,15 @@ if ($_GET["id"] || $_GET["ref"]) $sql = "SELECT distinct(s.nom), s.idp, p.rowid as propalid, p.ref, p.total as amount,"; $sql.= $db->pdate("p.datec")." as date, p.fk_statut as statut"; - if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", sc.fk_soc, sc.fk_user "; + if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user "; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."propal as p, ".MAIN_DB_PREFIX."propaldet as d"; - if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE p.fk_soc = s.idp"; $sql.= " AND d.fk_propal = p.rowid AND d.fk_product =".$product->id; - if (!$user->rights->commercial->client->voir && !$socidp) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; - if ($socidp) + if (!$user->rights->commercial->client->voir && !$socid) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; + if ($socid) { - $sql .= " AND p.fk_soc = $socidp"; + $sql .= " AND p.fk_soc = $socid"; } $sql .= " ORDER BY $sortfield $sortorder "; $sql.= $db->plimit($conf->liste_limit +1, $offset); diff --git a/htdocs/project.class.php b/htdocs/project.class.php index 716ad039d47..e1348a35fbe 100644 --- a/htdocs/project.class.php +++ b/htdocs/project.class.php @@ -37,7 +37,7 @@ class Project var $db; var $ref; var $title; - var $socidp; + var $socid; /** * \brief Constructeur de la classe @@ -59,7 +59,7 @@ class Project if (trim($this->ref)) { $sql = "INSERT INTO ".MAIN_DB_PREFIX."projet (ref, title, fk_soc, fk_user_creat, dateo) "; - $sql .= " VALUES ('".addslashes($this->ref)."', '".addslashes($this->title)."', $this->socidp, ".$user->id.",now()) ;"; + $sql .= " VALUES ('".addslashes($this->ref)."', '".addslashes($this->title)."', $this->socid, ".$user->id.",now()) ;"; if ($this->db->query($sql) ) { diff --git a/htdocs/projet/activity/index.php b/htdocs/projet/activity/index.php index 8d329c527cb..f9732044fc7 100644 --- a/htdocs/projet/activity/index.php +++ b/htdocs/projet/activity/index.php @@ -38,7 +38,7 @@ if (!$user->rights->projet->lire) accessforbidden(); if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } llxHeader("",$langs->trans("Activity")); @@ -63,12 +63,12 @@ print ''.$langs->trans("NbOpenTasks").''; print "\n"; $sql = "SELECT p.title, p.rowid, count(t.rowid)"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", sc.fk_soc, sc.fk_user"; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user"; $sql .= " FROM ".MAIN_DB_PREFIX."projet as p"; $sql .= " , ".MAIN_DB_PREFIX."projet_task as t"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql .= " WHERE t.fk_projet = p.rowid"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= " AND p.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= " AND p.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id; $sql .= " GROUP BY p.rowid"; @@ -109,13 +109,13 @@ print 'Temps'; print "\n"; $sql = "SELECT p.title, p.rowid, sum(tt.task_duration)"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", sc.fk_soc, sc.fk_user"; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user"; $sql .= " FROM ".MAIN_DB_PREFIX."projet as p"; $sql .= " , ".MAIN_DB_PREFIX."projet_task as t"; $sql .= " , ".MAIN_DB_PREFIX."projet_task_time as tt"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql .= " WHERE t.fk_projet = p.rowid"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= " AND p.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= " AND p.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id; $sql .= " AND tt.fk_task = t.rowid"; $sql .= " AND week(task_date) = ".strftime("%W",time()); $sql .= " GROUP BY p.rowid"; @@ -154,13 +154,13 @@ print 'Nb heures'; print "\n"; $sql = "SELECT p.title, p.rowid, sum(tt.task_duration)"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", sc.fk_soc, sc.fk_user"; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user"; $sql .= " FROM ".MAIN_DB_PREFIX."projet as p"; $sql .= " , ".MAIN_DB_PREFIX."projet_task as t"; $sql .= " , ".MAIN_DB_PREFIX."projet_task_time as tt"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql .= " WHERE t.fk_projet = p.rowid"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= " AND p.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= " AND p.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id; $sql .= " AND tt.fk_task = t.rowid"; $sql .= " AND month(task_date) = ".strftime("%m",$now); $sql .= " GROUP BY p.rowid"; @@ -199,13 +199,13 @@ print 'Nb heures'; print "\n"; $sql = "SELECT p.title, p.rowid, sum(tt.task_duration)"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", sc.fk_soc, sc.fk_user"; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user"; $sql .= " FROM ".MAIN_DB_PREFIX."projet as p"; $sql .= " , ".MAIN_DB_PREFIX."projet_task as t"; $sql .= " , ".MAIN_DB_PREFIX."projet_task_time as tt"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql .= " WHERE t.fk_projet = p.rowid"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= " AND p.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= " AND p.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id; $sql .= " AND tt.fk_task = t.rowid"; $sql .= " AND YEAR(task_date) = ".strftime("%Y",$now); $sql .= " GROUP BY p.rowid"; diff --git a/htdocs/projet/activity/myactivity.php b/htdocs/projet/activity/myactivity.php index 62b1e085024..7112363c835 100644 --- a/htdocs/projet/activity/myactivity.php +++ b/htdocs/projet/activity/myactivity.php @@ -38,7 +38,7 @@ if (!$user->rights->projet->lire) accessforbidden(); */ if ($user->societe_id > 0) { - $socidp = $user->societe_id; + $socid = $user->societe_id; } $langs->load("projects"); @@ -64,15 +64,15 @@ print ''.$langs->trans("NbOpenTasks").''; print "\n"; $sql = "SELECT p.title, p.rowid, count(t.rowid)"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", sc.fk_soc, sc.fk_user"; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user"; $sql .= " FROM ".MAIN_DB_PREFIX."projet as p"; $sql .= " , ".MAIN_DB_PREFIX."projet_task as t"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql .= " WHERE t.fk_projet = p.rowid"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= " AND p.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id; -if ($socidp) +if (!$user->rights->commercial->client->voir && !$socid) $sql .= " AND p.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id; +if ($socid) { - $sql .= " AND p.fk_soc = ".$socidp; + $sql .= " AND p.fk_soc = ".$socid; } $sql .= " GROUP BY p.rowid"; diff --git a/htdocs/projet/commandes.php b/htdocs/projet/commandes.php index e69c04f522c..a3fd01c8060 100644 --- a/htdocs/projet/commandes.php +++ b/htdocs/projet/commandes.php @@ -48,7 +48,7 @@ if ($projetid == '') accessforbidden(); if ($user->societe_id > 0) { - $socidp = $user->societe_id; + $socid = $user->societe_id; } // Protection restriction commercial @@ -59,7 +59,7 @@ if ($projetid) if (!$user->rights->commercial->client->voir) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc "; $sql.= " WHERE p.rowid = ".$projetid; if (!$user->rights->commercial->client->voir) $sql .= " AND p.fk_soc = sc.fk_soc AND sc.fk_user = ".$user->id; - if ($socidp) $sql .= " AND p.fk_soc = ".$socidp; + if ($socid) $sql .= " AND p.fk_soc = ".$socid; if ( $db->query($sql) ) { @@ -129,7 +129,7 @@ print ''; if ($conf->commande->enabled && $user->rights->commande->creer) { $langs->load("orders"); - print ''.$langs->trans("AddOrder").''; + print ''.$langs->trans("AddOrder").''; } print ''; diff --git a/htdocs/projet/facture.php b/htdocs/projet/facture.php index 199344136e5..31efd1d76e9 100644 --- a/htdocs/projet/facture.php +++ b/htdocs/projet/facture.php @@ -49,7 +49,7 @@ if ($projetid == '') accessforbidden(); if ($user->societe_id > 0) { - $socidp = $user->societe_id; + $socid = $user->societe_id; } // Protection restriction commercial @@ -60,7 +60,7 @@ if ($projetid) if (!$user->rights->commercial->client->voir) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc "; $sql.= " WHERE p.rowid = ".$projetid; if (!$user->rights->commercial->client->voir) $sql .= " AND p.fk_soc = sc.fk_soc AND sc.fk_user = ".$user->id; - if ($socidp) $sql .= " AND p.fk_soc = ".$socidp; + if ($socid) $sql .= " AND p.fk_soc = ".$socid; if ( $db->query($sql) ) { @@ -129,7 +129,7 @@ print ''; if ($conf->facture->enabled && $user->rights->facture->creer) { - print ''.$langs->trans("AddBill").''; + print ''.$langs->trans("AddBill").''; } print ''; diff --git a/htdocs/projet/fiche.php b/htdocs/projet/fiche.php index 9a977cf95d9..bda8b7cf499 100644 --- a/htdocs/projet/fiche.php +++ b/htdocs/projet/fiche.php @@ -44,7 +44,7 @@ if ($projetid == '' && ($_GET['action'] != "create" && $_POST['action'] != "add" if ($user->societe_id > 0) { - $socidp = $user->societe_id; + $socid = $user->societe_id; } // Protection restriction commercial @@ -55,7 +55,7 @@ if ($projetid && !$user->rights->commercial->client->voir) if (!$user->rights->commercial->client->voir) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc "; $sql.= " WHERE p.rowid = ".$projetid; if (!$user->rights->commercial->client->voir) $sql .= " AND p.fk_soc = sc.fk_soc AND sc.fk_user = ".$user->id; - if ($socidp) $sql .= " AND p.fk_soc = ".$socidp; + if ($socid) $sql .= " AND p.fk_soc = ".$socid; if ( $db->query($sql) ) { @@ -67,7 +67,7 @@ if ($projetid && !$user->rights->commercial->client->voir) if ($_POST["action"] == 'add' && $user->rights->projet->creer) { $pro = new Project($db); - $pro->socidp = $_GET["socidp"]; + $pro->socid = $_GET["socid"]; $pro->ref = $_POST["ref"]; $pro->title = $_POST["title"]; $result = $pro->create($user); @@ -133,7 +133,7 @@ if ($_GET["action"] == 'create' && $user->rights->projet->creer) if ($mesg) print $mesg; - print ''; + print ''; print ''; print ''; @@ -143,7 +143,7 @@ if ($_GET["action"] == 'create' && $user->rights->projet->creer) print ''; diff --git a/htdocs/projet/index.php b/htdocs/projet/index.php index a2f12939c9d..9ae0bb01a2f 100644 --- a/htdocs/projet/index.php +++ b/htdocs/projet/index.php @@ -36,7 +36,7 @@ if (!$user->rights->projet->lire) accessforbidden(); // Sécurité accés client if ($user->societe_id > 0) { - $socidp = $user->societe_id; + $socid = $user->societe_id; } llxHeader("",$langs->trans("Projects"),"Projet"); @@ -58,16 +58,16 @@ print ''; print "\n"; $sql = "SELECT p.title, p.rowid, count(t.rowid)"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", sc.fk_soc, sc.fk_user"; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user"; $sql.= " FROM ".MAIN_DB_PREFIX."projet as p"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; //$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task as t ON p.rowid = t.fk_projet"; $sql.= " , ".MAIN_DB_PREFIX."projet_task as t"; // pourquoi est-ce que c'était en commentaire ? $sql.= " WHERE t.fk_projet = p.rowid"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= " AND p.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id; -if ($socidp) +if (!$user->rights->commercial->client->voir && !$socid) $sql .= " AND p.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id; +if ($socid) { - $sql .= " AND p.fk_soc = ".$socidp; + $sql .= " AND p.fk_soc = ".$socid; } $sql.= " GROUP BY p.rowid"; @@ -112,14 +112,14 @@ print ''; print "\n"; $sql = "SELECT s.nom, s.idp, count(p.rowid)"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", sc.fk_soc, sc.fk_user"; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."projet as p"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql .= " WHERE p.fk_soc = s.idp"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; -if ($socidp) +if (!$user->rights->commercial->client->voir && !$socid) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; +if ($socid) { - $sql .= " AND s.idp = $socidp"; + $sql .= " AND s.idp = $socid"; } $sql .= " GROUP BY s.nom"; //$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit, $offset); diff --git a/htdocs/projet/liste.php b/htdocs/projet/liste.php index bc3a65eea27..d2cb2145337 100644 --- a/htdocs/projet/liste.php +++ b/htdocs/projet/liste.php @@ -33,17 +33,17 @@ require("./pre.inc.php"); if (!$user->rights->projet->lire) accessforbidden(); -$socidp = ( is_numeric($_GET["socid"]) ? $_GET["socid"] : 0 ); +$socid = ( is_numeric($_GET["socid"]) ? $_GET["socid"] : 0 ); $title = $langs->trans("Projects"); // Sécurité accés client -if ($user->societe_id > 0) $socidp = $user->societe_id; +if ($user->societe_id > 0) $socid = $user->societe_id; -if ($socidp > 0) +if ($socid > 0) { $soc = new Societe($db); - $soc->fetch($socidp); + $soc->fetch($socid); $title .= ' ('.$soc->nom.')'; } @@ -71,14 +71,14 @@ llxHeader(); $sql = "SELECT p.rowid as projectid, p.ref, p.title, ".$db->pdate("p.dateo")." as do"; $sql .= " , s.nom, s.idp, s.client"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", sc.fk_soc, sc.fk_user"; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."projet as p"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql .= " WHERE p.fk_soc = s.idp"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; -if ($socidp) +if (!$user->rights->commercial->client->voir && !$socid) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; +if ($socid) { - $sql .= " AND s.idp = ".$socidp; + $sql .= " AND s.idp = ".$socid; } if ($_GET["search_ref"]) { diff --git a/htdocs/projet/propal.php b/htdocs/projet/propal.php index fc721c717e0..98fb28b83d4 100644 --- a/htdocs/projet/propal.php +++ b/htdocs/projet/propal.php @@ -48,7 +48,7 @@ if ($projetid == '') accessforbidden(); if ($user->societe_id > 0) { - $socidp = $user->societe_id; + $socid = $user->societe_id; } // Protection restriction commercial @@ -59,7 +59,7 @@ if ($projetid) if (!$user->rights->commercial->client->voir) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc "; $sql.= " WHERE p.rowid = ".$projetid; if (!$user->rights->commercial->client->voir) $sql .= " AND p.fk_soc = sc.fk_soc AND sc.fk_user = ".$user->id; - if ($socidp) $sql .= " AND p.fk_soc = ".$socidp; + if ($socid) $sql .= " AND p.fk_soc = ".$socid; if ( $db->query($sql) ) { @@ -128,7 +128,7 @@ print ''; if ($conf->propal->enabled && $user->rights->propale->creer) { $langs->load("propal"); - print ''.$langs->trans("AddProp").''; + print ''.$langs->trans("AddProp").''; } print ''; diff --git a/htdocs/projet/tasks/fiche.php b/htdocs/projet/tasks/fiche.php index 28571f78def..a7b95901021 100644 --- a/htdocs/projet/tasks/fiche.php +++ b/htdocs/projet/tasks/fiche.php @@ -43,7 +43,7 @@ if ($projetid == '') accessforbidden(); if ($user->societe_id > 0) { - $socidp = $user->societe_id; + $socid = $user->societe_id; } // Protection restriction commercial @@ -53,7 +53,7 @@ if ($projetid && !$user->rights->commercial->client->voir) $sql .= " FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc, ".MAIN_DB_PREFIX."projet as p"; $sql .= " WHERE p.rowid = ".$projetid; if (!$user->rights->commercial->client->voir) $sql .= " AND sc.fk_soc = p.fk_soc AND fk_user = ".$user->id; - if ($socidp) $sql .= " AND p.fk_soc = ".$socidp; + if ($socid) $sql .= " AND p.fk_soc = ".$socid; if ( $db->query($sql) ) { @@ -195,7 +195,7 @@ if ($_GET["action"] == 'create' && $user->rights->projet->creer) if ($mesg) print $mesg; - print ''; + print ''; print '
    '.$langs->trans("Company").''; $societe = new Societe($db); - $societe->fetch($_GET["socidp"]); + $societe->fetch($_GET["socid"]); print $societe->getNomUrl(1); print '
    '.$langs->trans("NbOpenTasks").'
    '.$langs->trans("Nb").'
    '; print ''; @@ -205,7 +205,7 @@ if ($_GET["action"] == 'create' && $user->rights->projet->creer) print ''; diff --git a/htdocs/projet/tasks/index.php b/htdocs/projet/tasks/index.php index 06967181d36..ffc49c2b49f 100644 --- a/htdocs/projet/tasks/index.php +++ b/htdocs/projet/tasks/index.php @@ -36,7 +36,7 @@ if (!$user->rights->projet->lire) accessforbidden(); if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } llxHeader("",$langs->trans("Projects"),"Projet"); @@ -59,16 +59,16 @@ print ''; print "\n"; $sql = "SELECT p.title, p.rowid, count(t.rowid)"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", sc.fk_soc, sc.fk_user"; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user"; $sql .= " FROM ".MAIN_DB_PREFIX."projet as p"; $sql .= " , ".MAIN_DB_PREFIX."projet_task as t"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql .= " WHERE t.fk_projet = p.rowid"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= " AND p.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= " AND p.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id; -if ($socidp) +if ($socid) { - $sql .= " AND s.idp = $socidp"; + $sql .= " AND s.idp = $socid"; } $sql .= " GROUP BY p.rowid"; @@ -113,18 +113,18 @@ print ''; print "\n"; $sql = "SELECT p.title, p.rowid, sum(tt.task_duration)"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", sc.fk_soc, sc.fk_user"; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user"; $sql .= " FROM ".MAIN_DB_PREFIX."projet as p"; $sql .= " , ".MAIN_DB_PREFIX."projet_task as t"; $sql .= " , ".MAIN_DB_PREFIX."projet_task_time as tt"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql .= " WHERE t.fk_projet = p.rowid"; $sql .= " AND tt.fk_task = t.rowid"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= " AND p.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= " AND p.fk_soc = sc.fk_soc AND sc.fk_user = " .$user->id; -if ($socidp) +if ($socid) { - $sql .= " AND s.idp = $socidp"; + $sql .= " AND s.idp = $socid"; } $sql .= " GROUP BY p.rowid"; diff --git a/htdocs/projetdon.class.php b/htdocs/projetdon.class.php index 8cfd825c4d9..1223910fbf7 100644 --- a/htdocs/projetdon.class.php +++ b/htdocs/projetdon.class.php @@ -26,7 +26,7 @@ class ProjetDon { var $db; var $ref; var $title; - var $socidp; + var $socid; function ProjetDon($DB) { $this->db = $DB; diff --git a/htdocs/propal.class.php b/htdocs/propal.class.php index 392850190b5..cb091655250 100644 --- a/htdocs/propal.class.php +++ b/htdocs/propal.class.php @@ -50,7 +50,7 @@ class Propal extends CommonObject var $id; - var $socidp; // Id client + var $socid; // Id client var $client; // Objet societe client (à charger par fetch_client) var $contactid; @@ -94,15 +94,15 @@ class Propal extends CommonObject /** * \brief Constructeur * \param DB Handler d'accès base - * \param socidp Id de la société + * \param socid Id de la société * \param propalid Id de la propal */ - function Propal($DB, $socidp="", $propalid=0) + function Propal($DB, $socid="", $propalid=0) { global $langs; $this->db = $DB ; - $this->socidp = $socidp; + $this->socid = $socid; $this->id = $propalid; $this->products = array(); $this->remise = 0; @@ -486,7 +486,7 @@ class Propal extends CommonObject $sql = "INSERT INTO ".MAIN_DB_PREFIX."propal (fk_soc, price, remise, remise_percent, remise_absolue,"; $sql.= " tva, total, datep, datec, ref, fk_user_author, note, note_public, model_pdf, fin_validite,"; $sql.= " fk_cond_reglement, fk_mode_reglement, date_livraison, ref_client) "; - $sql.= " VALUES ($this->socidp, 0, $this->remise, $this->remise_percent, $this->remise_absolue,"; + $sql.= " VALUES ($this->socid, 0, $this->remise, $this->remise_percent, $this->remise_absolue,"; $sql.= " 0,0,".$this->db->idate($this->datep).", now(), '".$this->ref."', ".$this->author.","; $sql.= "'".addslashes($this->note)."',"; $sql.= "'".addslashes($this->note_public)."',"; @@ -806,7 +806,7 @@ class Propal extends CommonObject $this->total_ht = $obj->price; $this->total_tva = $obj->tva; $this->total_ttc = $obj->total; - $this->socidp = $obj->fk_soc; + $this->socid = $obj->fk_soc; $this->projetidp = $obj->fk_projet; $this->modelpdf = $obj->model_pdf; $this->note = $obj->note; @@ -1144,7 +1144,7 @@ class Propal extends CommonObject if ($user->rights->propale->creer) { //verif que le projet et la société concordent - $sql = 'SELECT p.rowid, p.title FROM '.MAIN_DB_PREFIX.'projet as p WHERE p.fk_soc ='.$this->socidp.' AND p.rowid='.$project_id; + $sql = 'SELECT p.rowid, p.title FROM '.MAIN_DB_PREFIX.'projet as p WHERE p.fk_soc ='.$this->socid.' AND p.rowid='.$project_id; $sqlres = $this->db->query($sql); if ($sqlres) { @@ -1223,7 +1223,7 @@ class Propal extends CommonObject { // Classe la société rattachée comme client $soc=new Societe($this->db); - $soc->id = $this->socidp; + $soc->id = $this->socid; $result=$soc->set_as_client(); } @@ -1858,7 +1858,7 @@ class Propal extends CommonObject // Insertion dans la base $sql = "INSERT INTO ".MAIN_DB_PREFIX."propal (fk_soc, price, remise, remise_percent, remise_absolue,"; $sql.= " tva, total, datep, datec, ref, fk_user_author, note, note_public, model_pdf, fin_validite, fk_cond_reglement, fk_mode_reglement, date_livraison, fk_adresse_livraison) "; - $sql.= " VALUES ('$this->socidp', '0', '$this->remise', '$this->remise_percent', '$this->remise_absolue',"; + $sql.= " VALUES ('$this->socid', '0', '$this->remise', '$this->remise_percent', '$this->remise_absolue',"; $sql.= " '0','0','".$this->db->idate($this->datep)."', now(), '$this->ref', '$this->author',"; $sql.= "'".addslashes($this->note)."',"; $sql.= "'".addslashes($this->note_public)."',"; @@ -1981,7 +1981,7 @@ class Propal extends CommonObject $this->ref = 'SPECIMEN'; $this->specimen=1; $socid = rand(1, $num_socs); - $this->socidp = $socids[$socid]; + $this->socid = $socids[$socid]; $this->date = time(); $this->fin_validite = $this->date+3600*24*30; $this->cond_reglement_code = 'RECEP'; diff --git a/htdocs/soc.php b/htdocs/soc.php index 4740284700a..43d3ee6f451 100644 --- a/htdocs/soc.php +++ b/htdocs/soc.php @@ -907,7 +907,7 @@ else if ($conf->projet->enabled && $user->rights->projet->creer) { $langs->load("projects"); - print ''.$langs->trans("AddProject").''; + print ''.$langs->trans("AddProject").''; } if ($user->rights->societe->contact->creer) diff --git a/htdocs/societe.php b/htdocs/societe.php index 412a74f4610..6ea31436666 100644 --- a/htdocs/societe.php +++ b/htdocs/societe.php @@ -41,11 +41,11 @@ $langs->load("suppliers"); // Sécurité accés client -$socidp=0; +$socid=0; if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } @@ -81,11 +81,11 @@ if ($mode == 'search') $_POST["search_nom"]="$socname"; $sql = "SELECT s.idp"; - if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", sc.fk_soc, sc.fk_user"; + if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; - if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql .= " WHERE s.nom like '%".$socname."%'"; - if (!$user->rights->commercial->client->voir && !$socidp) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; + if (!$user->rights->commercial->client->voir && !$socid) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; $result=$db->query($sql); if ($result) @@ -93,8 +93,8 @@ if ($mode == 'search') if ($db->num_rows($result) == 1) { $obj = $db->fetch_object($result); - $socidp = $obj->idp; - header("location: soc.php?socid=$socidp"); + $socid = $obj->idp; + header("location: soc.php?socid=$socid"); exit; } $db->free($result); @@ -103,7 +103,7 @@ if ($mode == 'search') if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } } @@ -128,14 +128,14 @@ $title=$langs->trans("ListOfCompanies"); $sql = "SELECT s.idp, s.nom, s.ville, ".$db->pdate("s.datec")." as datec, ".$db->pdate("s.datea")." as datea"; $sql.= ", st.libelle as stcomm, s.prefix_comm, s.client, s.fournisseur, s.siren"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", sc.fk_soc, sc.fk_user"; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql.= ", ".MAIN_DB_PREFIX."c_stcomm as st"; -if (!$user->rights->commercial->client->voir && !$socidp) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; +if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE s.fk_stcomm = st.id"; -if ($socidp) +if ($socid) { - $sql .= " AND s.idp = $socidp"; + $sql .= " AND s.idp = $socid"; } if ($socname) @@ -147,7 +147,7 @@ if (strlen($stcomm)) { $sql .= " AND s.fk_stcomm=$stcomm"; } -if (!$user->rights->commercial->client->voir && !$socidp) //restriction +if (!$user->rights->commercial->client->voir && !$socid) //restriction { $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; } diff --git a/htdocs/socnote.php b/htdocs/socnote.php index 8e890507437..1666b2a7ee4 100644 --- a/htdocs/socnote.php +++ b/htdocs/socnote.php @@ -38,18 +38,18 @@ $langs->load("companies"); $user->getrights('commercial'); // Protection quand utilisateur externe -$socidp = isset($_GET["socid"])?$_GET["socid"]:$_POST["socid"]; +$socid = isset($_GET["socid"])?$_GET["socid"]:$_POST["socid"]; if ($user->societe_id > 0) { - $socidp = $user->societe_id; + $socid = $user->societe_id; } // Protection restriction commercial -if (!$user->rights->commercial->client->voir && $socidp && !$user->societe_id > 0) +if (!$user->rights->commercial->client->voir && $socid && !$user->societe_id > 0) { $sql = "SELECT sc.fk_soc, s.client"; $sql .= " FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc, ".MAIN_DB_PREFIX."societe as s"; - $sql .= " WHERE sc.fk_soc = ".$socidp." AND sc.fk_user = ".$user->id." AND s.client = 1"; + $sql .= " WHERE sc.fk_soc = ".$socid." AND sc.fk_user = ".$user->id." AND s.client = 1"; if ( $db->query($sql) ) { @@ -64,7 +64,7 @@ if ($_POST["action"] == 'add') $result = $db->query($sql); $_GET["socid"]=$_POST["socid"]; // Pour retour sur fiche - $socidp = $_GET["socid"]; + $socid = $_GET["socid"]; } @@ -74,10 +74,10 @@ if ($_POST["action"] == 'add') llxHeader(); -if ($socidp > 0) +if ($socid > 0) { - $societe = new Societe($db, $socidp); - $societe->fetch($socidp); + $societe = new Societe($db, $socid); + $societe->fetch($socid); /* * Affichage onglets diff --git a/htdocs/telephonie/adsl/index.php b/htdocs/telephonie/adsl/index.php index 3b5463566fb..f9e33ea9963 100644 --- a/htdocs/telephonie/adsl/index.php +++ b/htdocs/telephonie/adsl/index.php @@ -34,7 +34,7 @@ llxHeader('','Telephonie'); if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } /* diff --git a/htdocs/telephonie/adsl/liste.php b/htdocs/telephonie/adsl/liste.php index 44e6eb22987..389165298ff 100644 --- a/htdocs/telephonie/adsl/liste.php +++ b/htdocs/telephonie/adsl/liste.php @@ -34,7 +34,7 @@ llxHeader('','Telephonie - Ligne - Liste'); if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } /* diff --git a/htdocs/telephonie/ca/index.php b/htdocs/telephonie/ca/index.php index 5f4f7dcbac5..b115f2150f9 100644 --- a/htdocs/telephonie/ca/index.php +++ b/htdocs/telephonie/ca/index.php @@ -35,7 +35,7 @@ llxHeader('','Telephonie'); if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } /* diff --git a/htdocs/telephonie/client/contacts.php b/htdocs/telephonie/client/contacts.php index 3bec20f97d5..0babd321126 100644 --- a/htdocs/telephonie/client/contacts.php +++ b/htdocs/telephonie/client/contacts.php @@ -33,7 +33,7 @@ llxHeader('','Telephonie - Clients - Contacts'); if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } if ($sortorder == "") { @@ -58,7 +58,7 @@ $pagenext = $page + 1; * Mode Liste * */ -$sql = "SELECT distinct cont.email, cont.idp, cont.name, cont.firstname, s.nom, s.idp as socidp"; +$sql = "SELECT distinct cont.email, cont.idp, cont.name, cont.firstname, s.nom, s.idp as socid"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= ",".MAIN_DB_PREFIX."societe_perms as sp"; @@ -126,10 +126,10 @@ if ($result) print "'; + print ''.$obj->nom.''; print '\n"; print ''; + print ''.stripslashes($nom).''; print "\n"; $var=!$var; @@ -138,7 +138,7 @@ print ''; + print ''.stripslashes($obj->nom).''; print '\n"; print "\n"; @@ -191,7 +191,7 @@ else print "
    "; /* Commentaires */ -$sql = "SELECT s.idp as socidp, s.nom, c.commentaire"; +$sql = "SELECT s.idp as socid, s.nom, c.commentaire"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."telephonie_societe_commentaire as c"; $sql .= ",".MAIN_DB_PREFIX."societe_perms as sp"; @@ -210,13 +210,13 @@ if ($resql) { $var=!$var; print "'; + print ''.stripslashes($nom).''; print '\n"; print "\n"; } diff --git a/htdocs/telephonie/client/lignes.php b/htdocs/telephonie/client/lignes.php index 4d027e131f6..fbb60b06c5a 100644 --- a/htdocs/telephonie/client/lignes.php +++ b/htdocs/telephonie/client/lignes.php @@ -113,7 +113,7 @@ if ($_GET["id"]) /* Lignes */ - $sql = "SELECT s.idp as socidp, f.nom as fournisseur, s.nom"; + $sql = "SELECT s.idp as socid, f.nom as fournisseur, s.nom"; $sql .= ", ss.nom as agence, ss.ville, ss.code_client"; $sql .= " , l.ligne, l.statut, l.rowid, l.remise"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; diff --git a/htdocs/telephonie/client/liste.php b/htdocs/telephonie/client/liste.php index 8b04716aecf..f57c5f676fe 100644 --- a/htdocs/telephonie/client/liste.php +++ b/htdocs/telephonie/client/liste.php @@ -33,7 +33,7 @@ llxHeader('','Telephonie - Ligne - Liste'); if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } if ($sortorder == "") { @@ -64,7 +64,7 @@ $pagenext = $page + 1; -$sql = "SELECT s.idp as socidp, s.nom, count(l.ligne) as ligne, cs.ca"; +$sql = "SELECT s.idp as socid, s.nom, count(l.ligne) as ligne, cs.ca"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= ",".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; $sql .= ",".MAIN_DB_PREFIX."societe_perms as sp"; @@ -123,11 +123,11 @@ if ($result) print "'; + print ''.$obj->nom.''; print '\n"; print '\n"; diff --git a/htdocs/telephonie/client/my.php b/htdocs/telephonie/client/my.php index 423839ce2d4..9a67979d2b9 100644 --- a/htdocs/telephonie/client/my.php +++ b/htdocs/telephonie/client/my.php @@ -33,7 +33,7 @@ llxHeader('','Telephonie - Mes clients'); if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } if ($sortorder == "") { @@ -62,7 +62,7 @@ $pagenext = $page + 1; * */ -$sql = "SELECT s.idp as socidp, s.nom, count(l.ligne) as ligne, cs.ca"; +$sql = "SELECT s.idp as socid, s.nom, count(l.ligne) as ligne, cs.ca"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= " ,".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; @@ -121,11 +121,11 @@ if ($result) print "'; + print ''.$obj->nom.''; print '\n"; print '\n"; diff --git a/htdocs/telephonie/client/new.php b/htdocs/telephonie/client/new.php index 603990cf199..fd66d7cd00e 100644 --- a/htdocs/telephonie/client/new.php +++ b/htdocs/telephonie/client/new.php @@ -330,7 +330,7 @@ if ($_POST["action"] == 'add') if ((strlen(trim($_POST["rib_banque"])) + strlen(trim($_POST["rib_guichet"])) + strlen(trim($_POST["rib_compte"])) + strlen(trim($_POST["rib_cle"])))<> 0 && $verif == 'ok' && !$error) { - $rib->socidp = $soc->id; + $rib->socid = $soc->id; if ( $rib->update($user) > 0) { diff --git a/htdocs/telephonie/client/remises.php b/htdocs/telephonie/client/remises.php index 8da3593ba12..2559a0d537d 100644 --- a/htdocs/telephonie/client/remises.php +++ b/htdocs/telephonie/client/remises.php @@ -32,7 +32,7 @@ llxHeader('','Telephonie - Clients - Remises if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } if ($sortorder == "") { @@ -55,7 +55,7 @@ $pagenext = $page + 1; * */ -$sql = "SELECT s.idp as socidp, s.nom, r.amount"; +$sql = "SELECT s.idp as socid, s.nom, r.amount"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= ",".MAIN_DB_PREFIX."telephonie_client_remise as r"; $sql .= ",".MAIN_DB_PREFIX."societe_perms as sp"; @@ -108,11 +108,11 @@ if ($result) print "'; + print ''.$obj->nom.''; print '\n"; diff --git a/htdocs/telephonie/client/remisesdone.php b/htdocs/telephonie/client/remisesdone.php index b3c02e3f158..f9edcaae782 100644 --- a/htdocs/telephonie/client/remisesdone.php +++ b/htdocs/telephonie/client/remisesdone.php @@ -32,7 +32,7 @@ llxHeader('','Telephonie - Clients - Remises'); if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } if ($sortorder == "") { @@ -55,7 +55,7 @@ $pagenext = $page + 1; * */ -$sql = "SELECT s.idp as socidp, s.nom, r.amount, f.facnumber, r.fk_facture"; +$sql = "SELECT s.idp as socid, s.nom, r.amount, f.facnumber, r.fk_facture"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= ",".MAIN_DB_PREFIX."telephonie_client_remise as r"; $sql .= ",".MAIN_DB_PREFIX."societe_perms as sp"; @@ -110,11 +110,11 @@ if ($result) print "'; + print ''.$obj->nom.''; print '\n"; print '\n"; diff --git a/htdocs/telephonie/config/concurrents/liste.php b/htdocs/telephonie/config/concurrents/liste.php index b59d1f2cc9b..dacb79dce11 100644 --- a/htdocs/telephonie/config/concurrents/liste.php +++ b/htdocs/telephonie/config/concurrents/liste.php @@ -33,7 +33,7 @@ llxHeader('','Telephonie - Ligne - Liste'); if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } if ($sortorder == "") { diff --git a/htdocs/telephonie/contrat/fiche.php b/htdocs/telephonie/contrat/fiche.php index fc812a785af..a5dbf607cd8 100644 --- a/htdocs/telephonie/contrat/fiche.php +++ b/htdocs/telephonie/contrat/fiche.php @@ -337,7 +337,7 @@ elseif ($_GET["action"] == 'create_line' && $_GET["client_comm"] > 0 && $user->r /* * Contrats existants */ - $sql = "SELECT c.rowid, c.ref, s.idp as socidp, s.nom "; + $sql = "SELECT c.rowid, c.ref, s.idp as socid, s.nom "; $sql .= ", sf.idp as sfidp, sf.nom as sfnom"; $sql .= ", sa.idp as saidp, sa.nom as sanom"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; @@ -377,9 +377,9 @@ elseif ($_GET["action"] == 'create_line' && $_GET["client_comm"] > 0 && $user->r print ' '; print ''.$obj->ref."\n"; - print ''; + print ''; - print ''; + print ''; print ''; print "\n"; diff --git a/htdocs/telephonie/contrat/index.php b/htdocs/telephonie/contrat/index.php index dfbd73f4ace..135a7a1b04b 100644 --- a/htdocs/telephonie/contrat/index.php +++ b/htdocs/telephonie/contrat/index.php @@ -35,7 +35,7 @@ llxHeader('','Telephonie - Contrats'); if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } /* @@ -61,7 +61,7 @@ print '
    '; /* Consultations */ -$sql = "SELECT s.idp as socidp, s.nom, max(sc.datec) as dam, c.ref, c.rowid"; +$sql = "SELECT s.idp as socid, s.nom, max(sc.datec) as dam, c.ref, c.rowid"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= ",".MAIN_DB_PREFIX."telephonie_contrat as c"; $sql .= ",".MAIN_DB_PREFIX."telephonie_contrat_consult as sc"; @@ -82,14 +82,14 @@ if ($resql) while ($obj = $db->fetch_object($resql)) { print "'; + print ''.stripslashes($nom).''; print ''; @@ -152,7 +152,7 @@ else print '\n"; - print ''; + print ''; print ''; print "\n"; diff --git a/htdocs/telephonie/contrat/liste.php b/htdocs/telephonie/contrat/liste.php index 2a558d94aa5..f4d01e4f797 100644 --- a/htdocs/telephonie/contrat/liste.php +++ b/htdocs/telephonie/contrat/liste.php @@ -46,7 +46,7 @@ $pagenext = $page + 1; * * */ -$sql = "SELECT c.rowid, c.ref, s.idp as socidp, c.statut, s.nom "; +$sql = "SELECT c.rowid, c.ref, s.idp as socid, c.statut, s.nom "; $sql .= ", sf.idp as sfidp, sf.nom as sfnom"; $sql .= ", sa.idp as saidp, sa.nom as sanom"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; @@ -135,9 +135,9 @@ if ($result) print ''.$obj->ref."\n"; - print ''; + print ''; - print ''; + print ''; print ''; print ''; diff --git a/htdocs/telephonie/facture/index.php b/htdocs/telephonie/facture/index.php index afcbc5e2110..9476f5a6750 100644 --- a/htdocs/telephonie/facture/index.php +++ b/htdocs/telephonie/facture/index.php @@ -34,7 +34,7 @@ llxHeader('','Telephonie - Factures'); if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } /* diff --git a/htdocs/telephonie/facture/liste.php b/htdocs/telephonie/facture/liste.php index 913fbbc7dc0..84c23e11122 100644 --- a/htdocs/telephonie/facture/liste.php +++ b/htdocs/telephonie/facture/liste.php @@ -35,7 +35,7 @@ llxHeader(); if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } if ($sortorder == "") { diff --git a/htdocs/telephonie/fournisseur/index.php b/htdocs/telephonie/fournisseur/index.php index 9b4b13842dc..6a15e1faae4 100644 --- a/htdocs/telephonie/fournisseur/index.php +++ b/htdocs/telephonie/fournisseur/index.php @@ -37,7 +37,7 @@ llxHeader(); if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } if ($sortorder == "") { diff --git a/htdocs/telephonie/ligne/commande/fiche.php b/htdocs/telephonie/ligne/commande/fiche.php index 914755a74fc..2da429d96c2 100644 --- a/htdocs/telephonie/ligne/commande/fiche.php +++ b/htdocs/telephonie/ligne/commande/fiche.php @@ -53,7 +53,7 @@ print $mesg_erreur; if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } /* @@ -128,7 +128,7 @@ else * */ -$sql = "SELECT sf.idp as sfidp, sf.nom as sfnom, s.idp as socidp, s.nom, l.ligne, f.nom as fournisseur, l.statut, l.rowid"; +$sql = "SELECT sf.idp as sfidp, sf.nom as sfnom, s.idp as socid, s.nom, l.ligne, f.nom as fournisseur, l.statut, l.rowid"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= " , ".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; $sql .= " , ".MAIN_DB_PREFIX."telephonie_fournisseur as f"; @@ -164,7 +164,7 @@ if ($db->query($sql)) print ""; print '\n"; print '\n"; - print ''; + print ''; print ''; print ''; print "\n"; diff --git a/htdocs/telephonie/ligne/commande/historique.php b/htdocs/telephonie/ligne/commande/historique.php index 595e0ff1dd9..364a2de38b8 100644 --- a/htdocs/telephonie/ligne/commande/historique.php +++ b/htdocs/telephonie/ligne/commande/historique.php @@ -32,7 +32,7 @@ llxHeader('','Telephonie - Ligne - Liste'); if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } if ($sortorder == "") { @@ -61,7 +61,7 @@ $pagenext = $page + 1; * */ -$sql = "SELECT s.idp as socidp, s.nom, l.ligne, f.nom as fournisseur, l.statut, l.rowid, l.remise"; +$sql = "SELECT s.idp as socid, s.nom, l.ligne, f.nom as fournisseur, l.statut, l.rowid, l.remise"; $sql .= " , ".$db->pdate("ls.tms")." as dc"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= " ,".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; @@ -144,7 +144,7 @@ if ($result) print ''.dolibarr_print_phone($obj->ligne)."\n"; - print ''; + print ''; print '\n"; diff --git a/htdocs/telephonie/ligne/commande/index.php b/htdocs/telephonie/ligne/commande/index.php index f2abd4b88f0..6a834ee6500 100644 --- a/htdocs/telephonie/ligne/commande/index.php +++ b/htdocs/telephonie/ligne/commande/index.php @@ -37,7 +37,7 @@ llxHeader('','Telephonie - Ligne - Commande'); if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } /* diff --git a/htdocs/telephonie/ligne/commande/liste.php b/htdocs/telephonie/ligne/commande/liste.php index 7c4f4ffe6f8..315cb59d49e 100644 --- a/htdocs/telephonie/ligne/commande/liste.php +++ b/htdocs/telephonie/ligne/commande/liste.php @@ -55,7 +55,7 @@ llxHeader("","Telephonie - Ligne - Commande"); if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } if ($sortorder == "") { @@ -78,7 +78,7 @@ $pagenext = $page + 1; * */ -$sql = "SELECT sf.idp as sfidp, sf.nom as sfnom, s.idp as socidp, s.nom, l.ligne, f.nom as fournisseur, l.statut, l.rowid, f.rowid as fournid, l.mode_paiement"; +$sql = "SELECT sf.idp as sfidp, sf.nom as sfnom, s.idp as socid, s.nom, l.ligne, f.nom as fournisseur, l.statut, l.rowid, f.rowid as fournid, l.mode_paiement"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= ",".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; $sql .= ",".MAIN_DB_PREFIX."telephonie_fournisseur as f"; @@ -161,7 +161,7 @@ if ($result) print '\n"; } - print ''; + print ''; print ''; print ''; diff --git a/htdocs/telephonie/ligne/commande/retour/fichiers.php b/htdocs/telephonie/ligne/commande/retour/fichiers.php index 366d2085368..35fd6bc0d89 100644 --- a/htdocs/telephonie/ligne/commande/retour/fichiers.php +++ b/htdocs/telephonie/ligne/commande/retour/fichiers.php @@ -38,7 +38,7 @@ llxHeader('','Telephonie - Ligne - Commande - Retour - Fichiers'); if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } /* diff --git a/htdocs/telephonie/ligne/communications.php b/htdocs/telephonie/ligne/communications.php index a0004e4ce7b..c6070e558ae 100644 --- a/htdocs/telephonie/ligne/communications.php +++ b/htdocs/telephonie/ligne/communications.php @@ -33,7 +33,7 @@ llxHeader(); if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } if ($sortorder == "") { diff --git a/htdocs/telephonie/ligne/groupe.php b/htdocs/telephonie/ligne/groupe.php index 102e1d76abb..9a04beb8aeb 100644 --- a/htdocs/telephonie/ligne/groupe.php +++ b/htdocs/telephonie/ligne/groupe.php @@ -32,7 +32,7 @@ llxHeader('','Telephonie - Ligne - Liste'); if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } if ($sortorder == "") { @@ -61,7 +61,7 @@ $pagenext = $page + 1; * */ -$sql = "SELECT g.nom as gnom, s.idp as socidp, sf.idp as sfidp, sf.nom as nom_facture,s.nom, l.ligne, l.statut, l.rowid, l.remise"; +$sql = "SELECT g.nom as gnom, s.idp as socid, sf.idp as sfidp, sf.nom as nom_facture,s.nom, l.ligne, l.statut, l.rowid, l.remise"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; $sql .= " , ".MAIN_DB_PREFIX."societe as sf"; diff --git a/htdocs/telephonie/ligne/index.php b/htdocs/telephonie/ligne/index.php index 71c93588fd3..8438e96a36a 100644 --- a/htdocs/telephonie/ligne/index.php +++ b/htdocs/telephonie/ligne/index.php @@ -35,7 +35,7 @@ llxHeader('','Telephonie - Lignes'); if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } /* @@ -152,7 +152,7 @@ if ($user->rights->telephonie->fournisseur->lire) print ''; + print ''; print '\n"; diff --git a/htdocs/telephonie/ligne/liste.php b/htdocs/telephonie/ligne/liste.php index a099af3f60d..f9d3831468b 100644 --- a/htdocs/telephonie/ligne/liste.php +++ b/htdocs/telephonie/ligne/liste.php @@ -34,7 +34,7 @@ llxHeader('','Telephonie - Ligne - Liste'); if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } if ($sortorder == "") { @@ -63,7 +63,7 @@ $pagenext = $page + 1; * */ -$sql = "SELECT s.idp as socidp, sf.idp as sfidp, sf.nom as nom_facture,s.nom, l.ligne, f.nom as fournisseur, l.statut, l.rowid, l.remise"; +$sql = "SELECT s.idp as socid, sf.idp as sfidp, sf.nom as nom_facture,s.nom, l.ligne, f.nom as fournisseur, l.statut, l.rowid, l.remise"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= ",".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; $sql .= ",".MAIN_DB_PREFIX."societe as sf"; @@ -195,7 +195,7 @@ if ($result) print ''.dolibarr_print_phone($obj->ligne)."\n"; - print ''; + print ''; //print ''; print '\n"; diff --git a/htdocs/telephonie/ligne/listecommande.php b/htdocs/telephonie/ligne/listecommande.php index d13d8da37d4..d1b8653b68e 100644 --- a/htdocs/telephonie/ligne/listecommande.php +++ b/htdocs/telephonie/ligne/listecommande.php @@ -40,7 +40,7 @@ llxHeader('','Telephonie - Ligne - Liste'); if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } if ($sortorder == "") { @@ -69,7 +69,7 @@ $pagenext = $page + 1; * */ -$sql = "SELECT s.idp as socidp, l.date_commande_last, s.nom, l.ligne, f.nom as fournisseur, l.statut, l.rowid, l.remise"; +$sql = "SELECT s.idp as socid, l.date_commande_last, s.nom, l.ligne, f.nom as fournisseur, l.statut, l.rowid, l.remise"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= " ,".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; $sql .= " , ".MAIN_DB_PREFIX."telephonie_fournisseur as f"; @@ -135,7 +135,7 @@ if ($resql) print ' '; print ''.dolibarr_print_phone($obj->ligne)."\n"; - print ''; + print ''; print '\n"; print "\n"; diff --git a/htdocs/telephonie/ligne/numdata.php b/htdocs/telephonie/ligne/numdata.php index e5ea1582275..787e09f6145 100644 --- a/htdocs/telephonie/ligne/numdata.php +++ b/htdocs/telephonie/ligne/numdata.php @@ -80,7 +80,7 @@ llxHeader('','Telephonie - Ligne - Liste'); if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } @@ -186,7 +186,7 @@ if ($result) print "\n"; - print ''; + print ''; print '\n"; - print ''; + print ''; print ''; print '\n"; diff --git a/htdocs/telephonie/stats/ProcessGraphClients.class.php b/htdocs/telephonie/stats/ProcessGraphClients.class.php index 306acd31f58..e826a026708 100644 --- a/htdocs/telephonie/stats/ProcessGraphClients.class.php +++ b/htdocs/telephonie/stats/ProcessGraphClients.class.php @@ -71,7 +71,7 @@ class ProcessGraphClients * Lecture des clients * */ - $sql = "SELECT s.idp as socidp, s.nom, count(l.ligne) as ligne"; + $sql = "SELECT s.idp as socid, s.nom, count(l.ligne) as ligne"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= ",".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; $sql .= " WHERE l.fk_client_comm = s.idp "; @@ -100,7 +100,7 @@ class ProcessGraphClients while ($i < $num) { $obj = $this->db->fetch_object($resql); - $clients[$i] = $obj->socidp; + $clients[$i] = $obj->socid; $i++; } $this->db->free($resql); diff --git a/htdocs/telephonie/stats/communications/analyse.php b/htdocs/telephonie/stats/communications/analyse.php index e8550c819ab..1d7e579281b 100644 --- a/htdocs/telephonie/stats/communications/analyse.php +++ b/htdocs/telephonie/stats/communications/analyse.php @@ -35,7 +35,7 @@ llxHeader('','Telephonie - Statistiques'); if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } diff --git a/htdocs/telephonie/stats/communications/destmonth.php b/htdocs/telephonie/stats/communications/destmonth.php index 3df09ff1ef1..a34e01f4337 100644 --- a/htdocs/telephonie/stats/communications/destmonth.php +++ b/htdocs/telephonie/stats/communications/destmonth.php @@ -35,7 +35,7 @@ llxHeader('','Telephonie - Statistiques'); if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } $h = 0; diff --git a/htdocs/telephonie/stats/communications/index.php b/htdocs/telephonie/stats/communications/index.php index 3749cef2d54..8176eef43f4 100644 --- a/htdocs/telephonie/stats/communications/index.php +++ b/htdocs/telephonie/stats/communications/index.php @@ -31,7 +31,7 @@ llxHeader('','Telephonie - Statistiques'); if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } diff --git a/htdocs/telephonie/stats/communications/lastmonth.php b/htdocs/telephonie/stats/communications/lastmonth.php index d0c341caabd..5be894b5537 100644 --- a/htdocs/telephonie/stats/communications/lastmonth.php +++ b/htdocs/telephonie/stats/communications/lastmonth.php @@ -35,7 +35,7 @@ llxHeader('','Telephonie - Statistiques'); if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } $h = 0; diff --git a/htdocs/telephonie/stats/communications/rentabilite.php b/htdocs/telephonie/stats/communications/rentabilite.php index 94e7f876fe5..a47329ec99c 100644 --- a/htdocs/telephonie/stats/communications/rentabilite.php +++ b/htdocs/telephonie/stats/communications/rentabilite.php @@ -35,7 +35,7 @@ llxHeader('','Telephonie - Statistiques'); if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } $h = 0; diff --git a/htdocs/telephonie/stats/destinations/index.php b/htdocs/telephonie/stats/destinations/index.php index 91dc22493b1..be5c94e192a 100644 --- a/htdocs/telephonie/stats/destinations/index.php +++ b/htdocs/telephonie/stats/destinations/index.php @@ -35,7 +35,7 @@ llxHeader('','Telephonie - Statistiques'); if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } $h = 0; diff --git a/htdocs/telephonie/stats/factures/gain.php b/htdocs/telephonie/stats/factures/gain.php index fd147c24353..1c3a578dc35 100644 --- a/htdocs/telephonie/stats/factures/gain.php +++ b/htdocs/telephonie/stats/factures/gain.php @@ -35,7 +35,7 @@ llxHeader('','Telephonie - Ligne'); if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } $h = 0; diff --git a/htdocs/telephonie/stats/factures/index.php b/htdocs/telephonie/stats/factures/index.php index 412ea4a3080..b0484b39fe5 100644 --- a/htdocs/telephonie/stats/factures/index.php +++ b/htdocs/telephonie/stats/factures/index.php @@ -32,7 +32,7 @@ llxHeader('','Telephonie - Ligne'); if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } $year = strftime("%Y",time()); diff --git a/htdocs/telephonie/stats/factures/lastmonth.php b/htdocs/telephonie/stats/factures/lastmonth.php index 48ebb8e293e..8ad76a14898 100644 --- a/htdocs/telephonie/stats/factures/lastmonth.php +++ b/htdocs/telephonie/stats/factures/lastmonth.php @@ -35,7 +35,7 @@ llxHeader('','Telephonie - Ligne'); if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } $h = 0; diff --git a/htdocs/telephonie/stats/factures/marge.php b/htdocs/telephonie/stats/factures/marge.php index fe1faea8a71..3a45cd136af 100644 --- a/htdocs/telephonie/stats/factures/marge.php +++ b/htdocs/telephonie/stats/factures/marge.php @@ -35,7 +35,7 @@ llxHeader('','Telephonie - Ligne'); if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } $year = ($_GET["year"]>0)?$_GET["year"]:strftime("%Y", time()); diff --git a/htdocs/telephonie/stats/factures/type.php b/htdocs/telephonie/stats/factures/type.php index 8101258b15c..a02e1f6617c 100644 --- a/htdocs/telephonie/stats/factures/type.php +++ b/htdocs/telephonie/stats/factures/type.php @@ -35,7 +35,7 @@ llxHeader('','Telephonie - Ligne'); if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } $h = 0; diff --git a/htdocs/telephonie/stats/fournisseurs/index.php b/htdocs/telephonie/stats/fournisseurs/index.php index 1c8801b6a32..0773633e6f1 100644 --- a/htdocs/telephonie/stats/fournisseurs/index.php +++ b/htdocs/telephonie/stats/fournisseurs/index.php @@ -31,7 +31,7 @@ llxHeader('','Telephonie - Statistiques - Fournisseurs'); if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } diff --git a/htdocs/telephonie/tarifs/fiche.php b/htdocs/telephonie/tarifs/fiche.php index abf141d5ce9..7ff56333277 100644 --- a/htdocs/telephonie/tarifs/fiche.php +++ b/htdocs/telephonie/tarifs/fiche.php @@ -77,7 +77,7 @@ if ($_GET["id"]) /* Lignes */ - $sql = "SELECT s.idp as socidp, s.nom, l.ligne, f.nom as fournisseur, l.statut, l.rowid, l.remise"; + $sql = "SELECT s.idp as socid, s.nom, l.ligne, f.nom as fournisseur, l.statut, l.rowid, l.remise"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; $sql .= " , ".MAIN_DB_PREFIX."telephonie_fournisseur as f"; $sql .= " WHERE l.fk_soc = s.idp AND l.fk_fournisseur = f.rowid"; diff --git a/htdocs/telephonie/tarifs/grille-export-achat.php b/htdocs/telephonie/tarifs/grille-export-achat.php index 0c1f65c7430..ebaccbb2415 100644 --- a/htdocs/telephonie/tarifs/grille-export-achat.php +++ b/htdocs/telephonie/tarifs/grille-export-achat.php @@ -29,7 +29,7 @@ require_once DOL_DOCUMENT_ROOT."/includes/php_writeexcel/class.writeexcel_worksh if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } $date = time(); diff --git a/htdocs/telephonie/tarifs/grille-export.php b/htdocs/telephonie/tarifs/grille-export.php index 711b2f37353..0e1bdd2fe02 100644 --- a/htdocs/telephonie/tarifs/grille-export.php +++ b/htdocs/telephonie/tarifs/grille-export.php @@ -29,7 +29,7 @@ require_once DOL_DOCUMENT_ROOT."/includes/php_writeexcel/class.writeexcel_worksh if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } $date = time(); diff --git a/htdocs/telephonie/tarifs/grille.php b/htdocs/telephonie/tarifs/grille.php index 873570e7a58..b02a42b42bc 100644 --- a/htdocs/telephonie/tarifs/grille.php +++ b/htdocs/telephonie/tarifs/grille.php @@ -81,7 +81,7 @@ llxHeader(); if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } diff --git a/htdocs/telephonie/tarifs/grilles.php b/htdocs/telephonie/tarifs/grilles.php index 289dc9d005e..d8d83b2ed0f 100644 --- a/htdocs/telephonie/tarifs/grilles.php +++ b/htdocs/telephonie/tarifs/grilles.php @@ -29,7 +29,7 @@ llxHeader(); if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } /* diff --git a/htdocs/telephonie/tarifs/index.php b/htdocs/telephonie/tarifs/index.php index 0032f806fb1..f74d56bdebc 100644 --- a/htdocs/telephonie/tarifs/index.php +++ b/htdocs/telephonie/tarifs/index.php @@ -29,7 +29,7 @@ llxHeader(); if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } diff --git a/htdocs/telephonie/tarifs/permissions.php b/htdocs/telephonie/tarifs/permissions.php index eee83030dce..32549c1f595 100644 --- a/htdocs/telephonie/tarifs/permissions.php +++ b/htdocs/telephonie/tarifs/permissions.php @@ -93,7 +93,7 @@ llxHeader(); if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } diff --git a/htdocs/telephonie/tarifs/prefix.php b/htdocs/telephonie/tarifs/prefix.php index b2bb060e99a..4ff75e95a3b 100644 --- a/htdocs/telephonie/tarifs/prefix.php +++ b/htdocs/telephonie/tarifs/prefix.php @@ -39,7 +39,7 @@ if ($_GET["type"] == '') if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } if ($sortorder == "") { diff --git a/scripts/prelevement/prelevement-verif.php b/scripts/prelevement/prelevement-verif.php index f4cf01af5cf..06f10e02a5b 100644 --- a/scripts/prelevement/prelevement-verif.php +++ b/scripts/prelevement/prelevement-verif.php @@ -122,7 +122,7 @@ if (!$error) if ($fact->fetch($fac[0]) == 1) { $soc = new Societe($db); - if ($soc->fetch($fact->socidp) == 1) + if ($soc->fetch($fact->socid) == 1) { if ($soc->verif_rib() == 1) @@ -134,7 +134,7 @@ if (!$error) } else { - dolibarr_syslog("Erreur de RIB societe $fact->socidp $soc->nom"); + dolibarr_syslog("Erreur de RIB societe $fact->socid $soc->nom"); } } else diff --git a/scripts/prelevement/prelevement.php b/scripts/prelevement/prelevement.php index 5f1483241cb..9d6fce6e86f 100644 --- a/scripts/prelevement/prelevement.php +++ b/scripts/prelevement/prelevement.php @@ -124,7 +124,7 @@ if (!$error) if ($fact->fetch($fac[0]) == 1) { $soc = new Societe($db); - if ($soc->fetch($fact->socidp) == 1) + if ($soc->fetch($fact->socid) == 1) { if ($soc->verif_rib() == 1) { @@ -135,7 +135,7 @@ if (!$error) } else { - dolibarr_syslog("Erreur de RIB societe $fact->socidp $soc->nom"); + dolibarr_syslog("Erreur de RIB societe $fact->socid $soc->nom"); } } else
    '.$langs->trans("Company").''; $societe = new Societe($db); - $societe->fetch($_GET["socidp"]); + $societe->fetch($_GET["socid"]); print $societe->getNomUrl(1); print '
    '.$langs->trans("NbOpenTasks").'
    Nb heures
    "; - print ''; + print ''; print img_file(); print ' '; - print ''.$obj->nom.''.$obj->firstname.' '.$obj->name."'; diff --git a/htdocs/telephonie/client/facture.php b/htdocs/telephonie/client/facture.php index acaf15de6d2..1a96ca348a8 100644 --- a/htdocs/telephonie/client/facture.php +++ b/htdocs/telephonie/client/facture.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2005 Laurent Destailleur + * Copyright (C) 2004-2006 Laurent Destailleur * Copyright (C) 2004 Éric Seigne * * This program is free software; you can redistribute it and/or modify @@ -42,14 +42,14 @@ require_once DOL_DOCUMENT_ROOT."/lib/CMailFile.class.php"; include_once DOL_DOCUMENT_ROOT."/contact.class.php"; include_once DOL_DOCUMENT_ROOT."/actioncomm.class.php"; -if ($_GET["socidp"]) { $socidp=$_GET["socidp"]; } +if ($_GET["socid"]) { $socid=$_GET["socid"]; } if (isset($_GET["msg"])) { $msg=urldecode($_GET["msg"]); } // Sécurité accés client if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } /* @@ -67,7 +67,7 @@ if ($_POST["action"] == 'send' || $_POST["action"] == 'relance') if (is_readable($file)) { - $soc = new Societe($db, $fac->socidp); + $soc = new Societe($db, $fac->socid); if ($_POST["sendto"]) { // Le destinataire a été fourni via le champ libre @@ -144,7 +144,7 @@ if ($_POST["action"] == 'send' || $_POST["action"] == 'relance') $actioncomm->date = time(); $actioncomm->percent = 100; $actioncomm->contact = new Contact($db,$sendtoid); - $actioncomm->societe = new Societe($db,$fac->socidp); + $actioncomm->societe = new Societe($db,$fac->socid); $actioncomm->user = $user; // User qui a fait l'action $actioncomm->facid = $fac->id; @@ -195,8 +195,8 @@ if ($_GET["facid"] > 0) $fac = New Facture($db); if ( $fac->fetch($_GET["facid"], $user->societe_id) > 0) { - $soc = new Societe($db, $fac->socidp); - $soc->fetch($fac->socidp, $user); + $soc = new Societe($db, $fac->socid); + $soc->fetch($fac->socid, $user); if (!$soc->perm_read) { @@ -613,7 +613,7 @@ if ($_GET["facid"] > 0) $sql .= " FROM ".MAIN_DB_PREFIX."actioncomm as a, ".MAIN_DB_PREFIX."user as u "; $sql .= " WHERE a.fk_user_author = u.rowid "; $sql .= " AND a.fk_action in (9,10) "; - $sql .= " AND a.fk_soc = ".$fac->socidp ; + $sql .= " AND a.fk_soc = ".$fac->socid ; $sql .= " AND a.fk_facture = ".$fac->id; $resql = $db->query($sql); diff --git a/htdocs/telephonie/client/index.php b/htdocs/telephonie/client/index.php index eb2f3dad9f9..2692cd80154 100644 --- a/htdocs/telephonie/client/index.php +++ b/htdocs/telephonie/client/index.php @@ -32,7 +32,7 @@ llxHeader('','Telephonie - Clients'); if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } /* @@ -92,7 +92,7 @@ print '
    '; * Liste * */ -$sql = "SELECT s.idp as socidp, s.nom, max(sc.datec) as dam"; +$sql = "SELECT s.idp as socid, s.nom, max(sc.datec) as dam"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= ",".MAIN_DB_PREFIX."societe_consult as sc"; $sql .= " WHERE s.idp = sc.fk_soc"; @@ -111,14 +111,14 @@ if ($resql) while ($obj = $db->fetch_object($resql)) { print "
    "; - print ''; + print ''; print img_file(); print ' '; $nom = $obj->nom; if (strlen($obj->nom) > 33) $nom = substr($obj->nom,0,30)."..."; - print ''.stripslashes($nom).'
    '; * Liste * */ -$sql = "SELECT s.idp as socidp, s.nom, count(l.ligne) as ligne"; +$sql = "SELECT s.idp as socid, s.nom, count(l.ligne) as ligne"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; $sql .= ",".MAIN_DB_PREFIX."societe_perms as sp"; @@ -170,11 +170,11 @@ if ($resql) print "
    "; - print ''; + print ''; print img_file(); print ' '; - print ''.stripslashes($obj->nom).''.$obj->ligne."
    "; - print ''; + print ''; print img_file(); print ' '; $nom = $obj->nom; if (strlen($obj->nom) > 33) $nom = substr($obj->nom,0,30)."..."; - print ''.stripslashes($nom).''.stripslashes($obj->commentaire)."
    "; - print ''; + print ''; print img_file(); print ' '; - print ''.$obj->nom.''.$obj->ligne."'.price($obj->ca)." euros HT
    "; - print ''; + print ''; print img_file(); print ' '; - print ''.$obj->nom.''.$obj->ligne."'.price($obj->ca)." euros HT
    "; - print ''; + print ''; print img_file(); print ' '; - print ''.$obj->nom.''.price($obj->amount)." euros HT
    "; - print ''; + print ''; print img_file(); print ' '; - print ''.$obj->nom.''.price($obj->amount)." euros HT'.$obj->facnumber."'.stripslashes($obj->nom).''.stripslashes($obj->nom).''.stripslashes($obj->sanom).''.stripslashes($obj->sanom).''.stripslashes($obj->sfnom).'
    "; - print ''; + print ''; print img_file(); print ' '; $nom = $obj->nom; if (strlen($obj->nom) > 33) $nom = substr($obj->nom,0,30)."..."; - print ''.stripslashes($nom).''.$obj->ref.''; $sql = "SELECT c.ref, c.rowid, c.statut"; -$sql .= " ,s.idp as socidp, sf.idp as sfidp, sf.nom as nom_facture,s.nom"; +$sql .= " ,s.idp as socid, sf.idp as sfidp, sf.nom as nom_facture,s.nom"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= " , ".MAIN_DB_PREFIX."societe as sf"; $sql .= " , ".MAIN_DB_PREFIX."telephonie_contrat as c"; @@ -197,7 +197,7 @@ if ($result) print ''.$obj->ref."'.stripslashes($obj->nom).''.stripslashes($obj->nom).''.stripslashes($obj->nom_facture).'
    '.stripslashes($obj->nom).''.stripslashes($obj->nom).''.stripslashes($obj->sanom).''.stripslashes($obj->sanom).''.stripslashes($obj->sfnom).'-
    '.dolibarr_print_phone($obj->ligne)."'.$ligne->statuts[$obj->statut]."'.$obj->nom.''.$obj->nom.''.$obj->sfnom.''.$socf->verif_rib().'".$obj->fournisseur."'.stripslashes($obj->nom).''.stripslashes($obj->nom).''.$ligne->statuts[$obj->statut]."'.$ligne->statuts[$obj->statut]."'.stripslashes($obj->nom).''.stripslashes($obj->nom).''.stripslashes($obj->sfnom).''.$yesno[$socf->verif_rib()].''; -$sql = "SELECT s.idp as socidp, sf.idp as sfidp, sf.nom as nom_facture,s.nom, l.ligne, f.nom as fournisseur, l.statut, l.rowid, l.remise"; +$sql = "SELECT s.idp as socid, sf.idp as sfidp, sf.nom as nom_facture,s.nom, l.ligne, f.nom as fournisseur, l.statut, l.rowid, l.remise"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= ",".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; $sql .= " , ".MAIN_DB_PREFIX."societe as sf"; @@ -212,7 +212,7 @@ if ($resql) $nom = substr(stripslashes($obj->nom),0,20)."..."; } - print ''.$nom.''.$nom.''.$ligne->statuts[$obj->statut]."'.stripslashes($obj->nom).''.stripslashes($obj->nom).''.stripslashes($obj->nom_facture).''.$ligne->statuts[$obj->statut]."'.$obj->nom.''.$obj->nom.''.$obj->date_commande_last."".$obj->fournisseur."
    "; print dolibarr_print_phone($obj->numero)."'.$obj->nom.''.$obj->nom.''; print img_delete(); diff --git a/htdocs/telephonie/script/envoi-emails-speciaux.php b/htdocs/telephonie/script/envoi-emails-speciaux.php index bab0115fc6b..0d7fff92aae 100644 --- a/htdocs/telephonie/script/envoi-emails-speciaux.php +++ b/htdocs/telephonie/script/envoi-emails-speciaux.php @@ -255,7 +255,7 @@ if (sizeof($factures_a_mailer) > 0) $actionmsg="Envoyée à $sendtox"; $actionmsg2="Envoi Facture par mail"; - $sql = "INSERT INTO ".MAIN_DB_PREFIX."actioncomm (datea,fk_action,fk_soc,note,fk_facture, fk_contact,fk_user_author, label, percent) VALUES (now(), '$actioncode' ,'$fact->socidp' ,'$actionmsg','$fact->id','$sendtoid','$user->id', '$actionmsg2',100);"; + $sql = "INSERT INTO ".MAIN_DB_PREFIX."actioncomm (datea,fk_action,fk_soc,note,fk_facture, fk_contact,fk_user_author, label, percent) VALUES (now(), '$actioncode' ,'$fact->socid' ,'$actionmsg','$fact->id','$sendtoid','$user->id', '$actionmsg2',100);"; if (! $db->query($sql) ) { diff --git a/htdocs/telephonie/script/facturation-emission.php b/htdocs/telephonie/script/facturation-emission.php index 1293202d911..5eefab070ca 100644 --- a/htdocs/telephonie/script/facturation-emission.php +++ b/htdocs/telephonie/script/facturation-emission.php @@ -981,7 +981,7 @@ function _emails($db, $user, $contrat_id, $factures_a_mailer) $actionmsg="Envoyée à $sendtox"; $actionmsg2="Envoi Facture par mail"; - $sql = "INSERT INTO ".MAIN_DB_PREFIX."actioncomm (datea,fk_action,fk_soc,note,fk_facture, fk_contact,fk_user_author, label, percent) VALUES (now(), '$actioncode' ,'$fact->socidp' ,'$actionmsg','$fact->id','$sendtoid','$user->id', '$actionmsg2',100);"; + $sql = "INSERT INTO ".MAIN_DB_PREFIX."actioncomm (datea,fk_action,fk_soc,note,fk_facture, fk_contact,fk_user_author, label, percent) VALUES (now(), '$actioncode' ,'$fact->socid' ,'$actionmsg','$fact->id','$sendtoid','$user->id', '$actionmsg2',100);"; if (! $db->query($sql) ) { diff --git a/htdocs/telephonie/service/contrats.php b/htdocs/telephonie/service/contrats.php index 9eee87a473c..76e14daabad 100644 --- a/htdocs/telephonie/service/contrats.php +++ b/htdocs/telephonie/service/contrats.php @@ -35,7 +35,7 @@ llxHeader('','Telephonie - Services - Liste'); if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } if ($sortorder == "") { @@ -86,7 +86,7 @@ if ($_GET["id"]) dolibarr_fiche_head($head, $hselected, 'Service : '.$service->id); - $sql = "SELECT s.idp as socidp, s.nom as nom_facture"; + $sql = "SELECT s.idp as socid, s.nom as nom_facture"; $sql .= " , c.ref, cs.montant, c.rowid as crowid"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= " , ".MAIN_DB_PREFIX."telephonie_contrat as c"; diff --git a/htdocs/telephonie/service/liste.php b/htdocs/telephonie/service/liste.php index 31c6e065884..cfe6cedda83 100644 --- a/htdocs/telephonie/service/liste.php +++ b/htdocs/telephonie/service/liste.php @@ -35,7 +35,7 @@ llxHeader('','Telephonie - Services - Liste'); if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } if ($sortorder == "") { diff --git a/htdocs/telephonie/service/vendus.php b/htdocs/telephonie/service/vendus.php index 7ad8832f4d4..8043532f666 100644 --- a/htdocs/telephonie/service/vendus.php +++ b/htdocs/telephonie/service/vendus.php @@ -35,7 +35,7 @@ llxHeader('','Telephonie - Services - Liste'); if ($user->societe_id > 0) { $action = ''; - $socidp = $user->societe_id; + $socid = $user->societe_id; } if ($sortorder == "") { @@ -64,7 +64,7 @@ $pagenext = $page + 1; * */ -$sql = "SELECT s.rowid, idp as socidp, sf.idp as sfidp, sf.nom as nom_facture,s.nom, l.ligne, f.nom as fournisseur, l.statut, l.rowid, l.remise"; +$sql = "SELECT s.rowid, idp as socid, sf.idp as sfidp, sf.nom as nom_facture,s.nom, l.ligne, f.nom as fournisseur, l.statut, l.rowid, l.remise"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."telephonie_societe_ligne as l"; $sql .= " , ".MAIN_DB_PREFIX."societe as sf"; $sql .= " , ".MAIN_DB_PREFIX."telephonie_fournisseur as f"; @@ -158,7 +158,7 @@ if ($result) print ''.dolibarr_print_phone($obj->ligne)."'.stripslashes($obj->nom).''.stripslashes($obj->nom).''.stripslashes($obj->nom_facture).''.$ligne->statuts[$obj->statut]."