Fix: Statut facturée d'une propale non géré
This commit is contained in:
parent
0732193013
commit
004290a232
@ -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 = '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.= ' 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.= ' 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;
|
if ($socidp) $sql .= ' AND s.idp = '.$socidp;
|
||||||
|
|
||||||
$result = $db->query($sql);
|
$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>";
|
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>";
|
print '<a class="butAction" href="propal.php?propalid='.$propal->id."&action=setstatut&statut=4\">".$langs->trans("ClassifyBilled")."</a>";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
# Dolibarr language file - en_US - compta
|
# Dolibarr language file - en_US - compta
|
||||||
Accountancy=Accountancy
|
Accountancy=Accountancy
|
||||||
|
AccountancyCard=Accountancy card
|
||||||
Treasury=Treasury
|
Treasury=Treasury
|
||||||
OptionMode=Option for accountancy
|
OptionMode=Option for accountancy
|
||||||
OptionModeTrue=Option Recettes-Dépenses
|
OptionModeTrue=Option Recettes-Dépenses
|
||||||
|
|||||||
@ -9,3 +9,4 @@ ConfirmDeleteAProject=Are you sure you want to delete this project ?
|
|||||||
LastProjects=Last %s projects
|
LastProjects=Last %s projects
|
||||||
AllProjects=All projects
|
AllProjects=All projects
|
||||||
ShowProject=Show project
|
ShowProject=Show project
|
||||||
|
NoProject=No project defined
|
||||||
@ -27,6 +27,15 @@ PropalsOpened=Opened
|
|||||||
PropalStatusDraft=Draft (need to be validated)
|
PropalStatusDraft=Draft (need to be validated)
|
||||||
PropalStatusValidated=Validated (proposal is opened)
|
PropalStatusValidated=Validated (proposal is opened)
|
||||||
PropalStatusClosed=Closed
|
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
|
ListOfProposals=List of commercial proposals
|
||||||
ActionsOnPropal=Tasks on proposal
|
ActionsOnPropal=Tasks on proposal
|
||||||
NoOpenedPropals=No opened commercial proposals
|
NoOpenedPropals=No opened commercial proposals
|
||||||
@ -38,5 +47,11 @@ FileNotUploaded=The file was not uploaded
|
|||||||
FileUploaded=The file was successfully uploaded
|
FileUploaded=The file was successfully uploaded
|
||||||
AssociatedDocuments=Documents associated with the proposal:
|
AssociatedDocuments=Documents associated with the proposal:
|
||||||
ErrorCantOpenDir=Can't open directory
|
ErrorCantOpenDir=Can't open directory
|
||||||
DateEndPropal=Date fin validité
|
DateEndPropal=Date end validity
|
||||||
DateEndPropalShort=Date fin
|
DateEndPropalShort=Date end
|
||||||
|
ValidityDuration=Validity duration
|
||||||
|
CloseAs=Close with status
|
||||||
|
ClassifyBilled=Classify billed
|
||||||
|
BuildBill=Build bill
|
||||||
|
RelatedBill=Related bill
|
||||||
|
RelatedBills=Related bills
|
||||||
@ -1,5 +1,6 @@
|
|||||||
# Dolibarr language file - fr_FR - compta
|
# Dolibarr language file - fr_FR - compta
|
||||||
Accountancy=Compta
|
Accountancy=Compta
|
||||||
|
AccountancyCard=Fiche Compta
|
||||||
Treasury=Tréso
|
Treasury=Tréso
|
||||||
OptionMode=Option de tenue de comptabilité
|
OptionMode=Option de tenue de comptabilité
|
||||||
OptionModeTrue=Option Recettes-Dépenses
|
OptionModeTrue=Option Recettes-Dépenses
|
||||||
|
|||||||
@ -9,3 +9,4 @@ ConfirmDeleteAProject=
|
|||||||
LastProjects=Les %s derniers projets
|
LastProjects=Les %s derniers projets
|
||||||
AllProjects=Tous les projets
|
AllProjects=Tous les projets
|
||||||
ShowProject=Afficher projet
|
ShowProject=Afficher projet
|
||||||
|
NoProject=Aucun projet défini
|
||||||
@ -26,7 +26,16 @@ PropalsDraft=Brouillons
|
|||||||
PropalsOpened=Ouvertes
|
PropalsOpened=Ouvertes
|
||||||
PropalStatusDraft=Brouillon (à valider)
|
PropalStatusDraft=Brouillon (à valider)
|
||||||
PropalStatusValidated=Validée (propale ouverte)
|
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
|
ListOfProposals=Liste des devis/propositions commerciales
|
||||||
ActionsOnPropal=Actions sur la proposition
|
ActionsOnPropal=Actions sur la proposition
|
||||||
NoOpenedPropals=Pas de proposition ouverte
|
NoOpenedPropals=Pas de proposition ouverte
|
||||||
@ -40,3 +49,9 @@ AssociatedDocuments=Documents associ
|
|||||||
ErrorCantOpenDir=Impossible d'ouvrir le répertoire
|
ErrorCantOpenDir=Impossible d'ouvrir le répertoire
|
||||||
DateEndPropal=Date fin validité
|
DateEndPropal=Date fin validité
|
||||||
DateEndPropalShort=Date fin
|
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
|
||||||
@ -79,10 +79,14 @@ class Propal
|
|||||||
$langs->load("propals");
|
$langs->load("propals");
|
||||||
$this->labelstatut[0]=$langs->trans("PropalStatusDraft");
|
$this->labelstatut[0]=$langs->trans("PropalStatusDraft");
|
||||||
$this->labelstatut[1]=$langs->trans("PropalStatusValidated");
|
$this->labelstatut[1]=$langs->trans("PropalStatusValidated");
|
||||||
$this->labelstatut[2]=$langs->trans("PropalStatusClosed");
|
$this->labelstatut[2]=$langs->trans("PropalStatusSigned");
|
||||||
$this->labelstatut_short[0]=$langs->trans("PropalStatusDraft");
|
$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[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
|
* \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 ()
|
function commande_liste_array ()
|
||||||
{
|
{
|
||||||
$ga = array();
|
$ga = array();
|
||||||
|
|
||||||
$sql = "SELECT fk_commande FROM ".MAIN_DB_PREFIX."co_pr";
|
$sql = "SELECT fk_commande FROM ".MAIN_DB_PREFIX."co_pr";
|
||||||
$sql .= " WHERE fk_propale = " . $this->id;
|
$sql .= " WHERE fk_propale = " . $this->id;
|
||||||
if ($this->db->query($sql) )
|
if ($this->db->query($sql) )
|
||||||
{
|
{
|
||||||
$nump = $this->db->num_rows();
|
$nump = $this->db->num_rows();
|
||||||
|
|
||||||
if ($nump)
|
if ($nump)
|
||||||
{
|
{
|
||||||
$i = 0;
|
$i = 0;
|
||||||
while ($i < $nump)
|
while ($i < $nump)
|
||||||
{
|
{
|
||||||
$obj = $this->db->fetch_object();
|
$obj = $this->db->fetch_object();
|
||||||
|
|
||||||
$ga[$i] = $obj->fk_commande;
|
$ga[$i] = $obj->fk_commande;
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $ga;
|
return $ga;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dolibarr_print_error($this->db);
|
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 ()
|
function associated_orders ()
|
||||||
{
|
{
|
||||||
$ga = array();
|
$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)
|
function delete($user)
|
||||||
{
|
{
|
||||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."propaldet WHERE fk_propal = $this->id ;";
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."propaldet WHERE fk_propal = $this->id ;";
|
||||||
@ -904,55 +939,57 @@ class Propal
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* \brief Information sur l'objet
|
* \brief Information sur l'objet propal
|
||||||
*
|
* \param id id de la propale
|
||||||
*/
|
*/
|
||||||
|
function info($id)
|
||||||
function info($id)
|
|
||||||
{
|
{
|
||||||
$sql = "SELECT c.rowid, ".$this->db->pdate("datec")." as datec";
|
$sql = "SELECT c.rowid, ";
|
||||||
$sql .= ", fk_user_valid, fk_user_cloture, fk_user_author";
|
$sql.= $this->db->pdate("datec")." as datec, ".$this->db->pdate("date_valid")." as datev, ".$this->db->pdate("date_cloture")." as dateo";
|
||||||
$sql .= " FROM ".MAIN_DB_PREFIX."propal as c";
|
$sql.= ", fk_user_author, fk_user_valid, fk_user_cloture";
|
||||||
$sql .= " WHERE c.rowid = $id";
|
$sql.= " FROM ".MAIN_DB_PREFIX."propal as c";
|
||||||
|
$sql.= " WHERE c.rowid = $id";
|
||||||
if ($this->db->query($sql))
|
|
||||||
{
|
if ($this->db->query($sql))
|
||||||
if ($this->db->num_rows())
|
{
|
||||||
{
|
if ($this->db->num_rows())
|
||||||
$obj = $this->db->fetch_object();
|
{
|
||||||
|
$obj = $this->db->fetch_object();
|
||||||
|
|
||||||
|
$this->id = $obj->rowid;
|
||||||
|
|
||||||
|
$this->date_creation = $obj->datec;
|
||||||
|
$this->date_validation = $obj->datev;
|
||||||
|
$this->date_cloture = $obj->dateo;
|
||||||
|
|
||||||
$this->id = $obj->rowid;
|
$cuser = new User($this->db, $obj->fk_user_author);
|
||||||
|
$cuser->fetch();
|
||||||
$this->date_creation = $obj->datec;
|
$this->user_creation = $cuser;
|
||||||
|
|
||||||
$cuser = new User($this->db, $obj->fk_user_author);
|
if ($obj->fk_user_valid)
|
||||||
$cuser->fetch();
|
{
|
||||||
$this->user_creation = $cuser;
|
$vuser = new User($this->db, $obj->fk_user_valid);
|
||||||
|
$vuser->fetch();
|
||||||
if ($obj->fk_user_valid)
|
$this->user_validation = $vuser;
|
||||||
{
|
}
|
||||||
$vuser = new User($this->db, $obj->fk_user_valid);
|
|
||||||
$vuser->fetch();
|
if ($obj->fk_user_cloture)
|
||||||
$this->user_validation = $vuser;
|
{
|
||||||
}
|
$cluser = new User($this->db, $obj->fk_user_cloture);
|
||||||
|
$cluser->fetch();
|
||||||
if ($obj->fk_user_cloture)
|
$this->user_cloture = $cluser;
|
||||||
{
|
}
|
||||||
$cluser = new User($this->db, $obj->fk_user_cloture);
|
|
||||||
$cluser->fetch();
|
|
||||||
$this->user_cloture = $cluser;
|
}
|
||||||
}
|
$this->db->free();
|
||||||
|
|
||||||
|
}
|
||||||
}
|
else
|
||||||
$this->db->free();
|
{
|
||||||
|
dolibarr_print_error($this->db);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
dolibarr_print_error($this->db);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user