diff --git a/htdocs/compta/propal.php b/htdocs/compta/propal.php index ddc5b89293cca5d453bc90f4f131b5d0adb1cc98..73a9e6e814897bfbac8ad8d37c33708b6ccc14e5 100644 --- a/htdocs/compta/propal.php +++ b/htdocs/compta/propal.php @@ -125,8 +125,8 @@ if ($_GET["propalid"]) * */ $sql = 'SELECT s.nom, s.idp, p.price, p.fk_projet,p.remise, p.tva, p.total, p.ref,'.$db->pdate('p.datep').' as dp, c.id as statut, c.label as lst, p.note, x.firstname, x.name, x.fax, x.phone, x.email, 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, '.MAIN_DB_PREFIX.'c_propalst as c, '.MAIN_DB_PREFIX.'socpeople as x'; - $sql .= ' WHERE p.fk_soc = s.idp AND p.fk_statut = c.id AND x.idp = p.fk_soc_contact AND p.rowid = '.$propal->id; + $sql.= ' FROM '.MAIN_DB_PREFIX.'societe as s, '.MAIN_DB_PREFIX.'propal as p, '.MAIN_DB_PREFIX.'c_propalst as c, '.MAIN_DB_PREFIX.'socpeople as x'; + $sql.= ' WHERE p.fk_soc = s.idp AND p.fk_statut = c.id AND x.idp = p.fk_soc_contact AND p.rowid = '.$propal->id; if ($socidp) $sql .= ' AND s.idp = '.$socidp; $result = $db->query($sql); @@ -431,7 +431,7 @@ if ($_GET["propalid"]) print '<a class="butAction" href="facture.php?propalid='.$propal->id."&action=create\">".$langs->trans("BuildBill")."</a>"; } - if ($obj->statut == 2 && $num_fac_asso) + if ($obj->statut == 2 && sizeof($propal->facture_liste_array())) { print '<a class="butAction" href="propal.php?propalid='.$propal->id."&action=setstatut&statut=4\">".$langs->trans("ClassifyBilled")."</a>"; } diff --git a/htdocs/langs/en_US/compta.lang b/htdocs/langs/en_US/compta.lang index 2943330c4560d311d57b9b329ff157e48caf2540..cf3e0bab56fa1e0a94f154ea612f9578e6491e41 100644 --- a/htdocs/langs/en_US/compta.lang +++ b/htdocs/langs/en_US/compta.lang @@ -1,5 +1,6 @@ # Dolibarr language file - en_US - compta Accountancy=Accountancy +AccountancyCard=Accountancy card Treasury=Treasury OptionMode=Option for accountancy OptionModeTrue=Option Recettes-D�penses diff --git a/htdocs/langs/en_US/projects.lang b/htdocs/langs/en_US/projects.lang index fea0638649f0b3e8ccdbe10b862695bfae807a3a..8b2eb0f65610725e320d7470fc8758dde5e7cf81 100755 --- a/htdocs/langs/en_US/projects.lang +++ b/htdocs/langs/en_US/projects.lang @@ -9,3 +9,4 @@ ConfirmDeleteAProject=Are you sure you want to delete this project ? LastProjects=Last %s projects AllProjects=All projects ShowProject=Show project +NoProject=No project defined \ No newline at end of file diff --git a/htdocs/langs/en_US/propal.lang b/htdocs/langs/en_US/propal.lang index 02130bc5984360e7b529abe8e6dccbfa09234a0b..5ceda43a8bf033f0eaee5fe0efa37adbc4872277 100644 --- a/htdocs/langs/en_US/propal.lang +++ b/htdocs/langs/en_US/propal.lang @@ -27,6 +27,15 @@ PropalsOpened=Opened PropalStatusDraft=Draft (need to be validated) PropalStatusValidated=Validated (proposal is opened) PropalStatusClosed=Closed +PropalStatusSigned=Signed (need to be billed) +PropalStatusNotSigned=Not signed (closed) +PropalStatusBilled=Billed +PropalStatusDraftShort=Draft +PropalStatusValidatedShort=Validated +PropalStatusClosedShort=Closed +PropalStatusSignedShort=Signed +PropalStatusClosedShort=Not signed +PropalStatusBilledShort=Billed ListOfProposals=List of commercial proposals ActionsOnPropal=Tasks on proposal NoOpenedPropals=No opened commercial proposals @@ -38,5 +47,11 @@ FileNotUploaded=The file was not uploaded FileUploaded=The file was successfully uploaded AssociatedDocuments=Documents associated with the proposal: ErrorCantOpenDir=Can't open directory -DateEndPropal=Date fin validit� -DateEndPropalShort=Date fin +DateEndPropal=Date end validity +DateEndPropalShort=Date end +ValidityDuration=Validity duration +CloseAs=Close with status +ClassifyBilled=Classify billed +BuildBill=Build bill +RelatedBill=Related bill +RelatedBills=Related bills \ No newline at end of file diff --git a/htdocs/langs/fr_FR/compta.lang b/htdocs/langs/fr_FR/compta.lang index 1c0d6ec16d954893d68434d3113599f92a1bcf4e..5c7060ccb6f7733e74421c1d116d5bec6594130f 100644 --- a/htdocs/langs/fr_FR/compta.lang +++ b/htdocs/langs/fr_FR/compta.lang @@ -1,5 +1,6 @@ # Dolibarr language file - fr_FR - compta Accountancy=Compta +AccountancyCard=Fiche Compta Treasury=Tr�so OptionMode=Option de tenue de comptabilit� OptionModeTrue=Option Recettes-D�penses diff --git a/htdocs/langs/fr_FR/projects.lang b/htdocs/langs/fr_FR/projects.lang index 518ccab2944e2ebae41332f68845cfe84e754cab..d016b1b4563dd436772cdea048d6215ac1f45987 100755 --- a/htdocs/langs/fr_FR/projects.lang +++ b/htdocs/langs/fr_FR/projects.lang @@ -9,3 +9,4 @@ ConfirmDeleteAProject= LastProjects=Les %s derniers projets AllProjects=Tous les projets ShowProject=Afficher projet +NoProject=Aucun projet d�fini \ No newline at end of file diff --git a/htdocs/langs/fr_FR/propal.lang b/htdocs/langs/fr_FR/propal.lang index e914747937bb86710102e1202c57dd5ea15b62e9..45e5e2499db6171d2347269f88ed82948b44a686 100644 --- a/htdocs/langs/fr_FR/propal.lang +++ b/htdocs/langs/fr_FR/propal.lang @@ -26,7 +26,16 @@ PropalsDraft=Brouillons PropalsOpened=Ouvertes PropalStatusDraft=Brouillon (� valider) PropalStatusValidated=Valid�e (propale ouverte) -PropalStatusClosed=Ferm� +PropalStatusClosed=Ferm�e +PropalStatusSigned=Sign�e (� facturer) +PropalStatusNotSigned=Non sign�e (ferm�e) +PropalStatusBilled=Factur�e +PropalStatusDraftShort=Brouillon +PropalStatusValidatedShort=Valid�e +PropalStatusClosedShort=Ferm�e +PropalStatusSignedShort=Sign�e +PropalStatusClosedShort=Non sign�e +PropalStatusBilledShort=Factur�e ListOfProposals=Liste des devis/propositions commerciales ActionsOnPropal=Actions sur la proposition NoOpenedPropals=Pas de proposition ouverte @@ -40,3 +49,9 @@ AssociatedDocuments=Documents associ ErrorCantOpenDir=Impossible d'ouvrir le r�pertoire DateEndPropal=Date fin validit� DateEndPropalShort=Date fin +ValidityDuration=Dur�e de validit� +CloseAs=Cl�turer au statut +ClassifyBilled=Classer factur�e +BuildBill=Cr�er facture +RelatedBill=Facture associ�e +RelatedBills=Factures associ�es \ No newline at end of file diff --git a/htdocs/propal.class.php b/htdocs/propal.class.php index e9a8b54f9ef2558444c28e652024af9d6c619004..c7c5d9e13730e1d736425e6f57975a4ec420cf0f 100644 --- a/htdocs/propal.class.php +++ b/htdocs/propal.class.php @@ -79,10 +79,14 @@ class Propal $langs->load("propals"); $this->labelstatut[0]=$langs->trans("PropalStatusDraft"); $this->labelstatut[1]=$langs->trans("PropalStatusValidated"); - $this->labelstatut[2]=$langs->trans("PropalStatusClosed"); - $this->labelstatut_short[0]=$langs->trans("PropalStatusDraft"); + $this->labelstatut[2]=$langs->trans("PropalStatusSigned"); + $this->labelstatut[3]=$langs->trans("PropalStatusNotSigned"); + $this->labelstatut[4]=$langs->trans("PropalStatusBilled"); + $this->labelstatut_short[0]=$langs->trans("PropalStatusDraftShort"); $this->labelstatut_short[1]=$langs->trans("Opened"); - $this->labelstatut_short[2]=$langs->trans("PropalStatusClosed"); + $this->labelstatut_short[2]=$langs->trans("PropalStatusSignedShort"); + $this->labelstatut_short[3]=$langs->trans("PropalStatusNotSignedShort"); + $this->labelstatut_short[4]=$langs->trans("PropalStatusBilledShort"); } @@ -786,45 +790,45 @@ class Propal } } - /** - * \brief Renvoie un tableau contenant les num�ros de commandes associ�es - * - */ - - function commande_liste_array () + /** + * \brief Renvoie un tableau contenant les num�ros de commandes associ�es + * \remarks Fonction plus light que associated_orders + * \seealso associated_orders + */ + function commande_liste_array () { - $ga = array(); - - $sql = "SELECT fk_commande FROM ".MAIN_DB_PREFIX."co_pr"; - $sql .= " WHERE fk_propale = " . $this->id; - if ($this->db->query($sql) ) - { - $nump = $this->db->num_rows(); - - if ($nump) - { - $i = 0; - while ($i < $nump) - { - $obj = $this->db->fetch_object(); - - $ga[$i] = $obj->fk_commande; - $i++; - } - } - return $ga; - } - else - { - dolibarr_print_error($this->db); - } + $ga = array(); + + $sql = "SELECT fk_commande FROM ".MAIN_DB_PREFIX."co_pr"; + $sql .= " WHERE fk_propale = " . $this->id; + if ($this->db->query($sql) ) + { + $nump = $this->db->num_rows(); + + if ($nump) + { + $i = 0; + while ($i < $nump) + { + $obj = $this->db->fetch_object(); + + $ga[$i] = $obj->fk_commande; + $i++; + } + } + return $ga; + } + else + { + dolibarr_print_error($this->db); + } } /** - * \brief Renvoie un tableau contenant les commandes associ�es - * + * \brief Renvoie un tableau contenant les commandes associ�es + * \remarks Fonction plus lourde que commande_liste_array + * \seealso commande_liste_array */ - function associated_orders () { $ga = array(); @@ -855,11 +859,42 @@ class Propal } } - /* - * - * + /** + * \brief Renvoie un tableau contenant les num�ros de factures associ�es + */ + function facture_liste_array () + { + $ga = array(); + + $sql = "SELECT fk_facture FROM ".MAIN_DB_PREFIX."fa_pr as fp"; + $sql .= " WHERE fk_propal = " . $this->id; + if ($this->db->query($sql) ) + { + $nump = $this->db->num_rows(); + + if ($nump) + { + $i = 0; + while ($i < $nump) + { + $obj = $this->db->fetch_object(); + + $ga[$i] = $obj->fk_facture; + $i++; + } + } + return $ga; + } + else + { + dolibarr_print_error($this->db); + } + } + + /** + * \brief Efface propal + * \param user Objet du user qui efface */ - function delete($user) { $sql = "DELETE FROM ".MAIN_DB_PREFIX."propaldet WHERE fk_propal = $this->id ;"; @@ -904,55 +939,57 @@ class Propal } - /* - * \brief Information sur l'objet - * - */ - - function info($id) + /** + * \brief Information sur l'objet propal + * \param id id de la propale + */ + function info($id) { - $sql = "SELECT c.rowid, ".$this->db->pdate("datec")." as datec"; - $sql .= ", fk_user_valid, fk_user_cloture, fk_user_author"; - $sql .= " FROM ".MAIN_DB_PREFIX."propal as c"; - $sql .= " WHERE c.rowid = $id"; - - if ($this->db->query($sql)) - { - if ($this->db->num_rows()) - { - $obj = $this->db->fetch_object(); - - $this->id = $obj->rowid; - - $this->date_creation = $obj->datec; - - $cuser = new User($this->db, $obj->fk_user_author); - $cuser->fetch(); - $this->user_creation = $cuser; - - if ($obj->fk_user_valid) - { - $vuser = new User($this->db, $obj->fk_user_valid); - $vuser->fetch(); - $this->user_validation = $vuser; - } - - if ($obj->fk_user_cloture) - { - $cluser = new User($this->db, $obj->fk_user_cloture); - $cluser->fetch(); - $this->user_cloture = $cluser; - } - - - } - $this->db->free(); + $sql = "SELECT c.rowid, "; + $sql.= $this->db->pdate("datec")." as datec, ".$this->db->pdate("date_valid")." as datev, ".$this->db->pdate("date_cloture")." as dateo"; + $sql.= ", fk_user_author, fk_user_valid, fk_user_cloture"; + $sql.= " FROM ".MAIN_DB_PREFIX."propal as c"; + $sql.= " WHERE c.rowid = $id"; + + if ($this->db->query($sql)) + { + if ($this->db->num_rows()) + { + $obj = $this->db->fetch_object(); + + $this->id = $obj->rowid; + + $this->date_creation = $obj->datec; + $this->date_validation = $obj->datev; + $this->date_cloture = $obj->dateo; - } - else - { - dolibarr_print_error($this->db); - } + $cuser = new User($this->db, $obj->fk_user_author); + $cuser->fetch(); + $this->user_creation = $cuser; + + if ($obj->fk_user_valid) + { + $vuser = new User($this->db, $obj->fk_user_valid); + $vuser->fetch(); + $this->user_validation = $vuser; + } + + if ($obj->fk_user_cloture) + { + $cluser = new User($this->db, $obj->fk_user_cloture); + $cluser->fetch(); + $this->user_cloture = $cluser; + } + + + } + $this->db->free(); + + } + else + { + dolibarr_print_error($this->db); + } }