Fix: Accès à l'onglet pour passer une commande à facturer n'était pas possible si module compta non actif.
This commit is contained in:
parent
372e93d622
commit
e9b25e506e
@ -643,7 +643,7 @@ class Commande
|
|||||||
{
|
{
|
||||||
$sql = 'SELECT c.rowid, c.date_creation, c.ref, c.fk_soc, c.fk_user_author, c.fk_statut, c.amount_ht, c.total_ht, c.total_ttc, c.tva, c.fk_cond_reglement, c.fk_mode_reglement,';
|
$sql = 'SELECT c.rowid, c.date_creation, c.ref, c.fk_soc, c.fk_user_author, c.fk_statut, c.amount_ht, c.total_ht, c.total_ttc, c.tva, c.fk_cond_reglement, c.fk_mode_reglement,';
|
||||||
$sql.= ' '.$this->db->pdate('c.date_commande').' as date_commande, '.$this->db->pdate('c.date_livraison').' as date_livraison,';
|
$sql.= ' '.$this->db->pdate('c.date_commande').' as date_commande, '.$this->db->pdate('c.date_livraison').' as date_livraison,';
|
||||||
$sql.= ' c.fk_projet, c.remise_percent, c.remise, c.remise_absolue, c.source, c.facture, c.note, c.note_public, c.ref_client, c.model_pdf, c.fk_adresse_livraison';
|
$sql.= ' c.fk_projet, c.remise_percent, c.remise, c.remise_absolue, c.source, c.facture as facturee, c.note, c.note_public, c.ref_client, c.model_pdf, c.fk_adresse_livraison';
|
||||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'commande as c';
|
$sql.= ' FROM '.MAIN_DB_PREFIX.'commande as c';
|
||||||
$sql.= ' WHERE c.rowid = '.$id;
|
$sql.= ' WHERE c.rowid = '.$id;
|
||||||
|
|
||||||
@ -666,7 +666,7 @@ class Commande
|
|||||||
$this->remise_percent = $obj->remise_percent;
|
$this->remise_percent = $obj->remise_percent;
|
||||||
$this->remise_absolue = $obj->remise_absolue;
|
$this->remise_absolue = $obj->remise_absolue;
|
||||||
$this->source = $obj->source;
|
$this->source = $obj->source;
|
||||||
$this->facturee = $obj->facture;
|
$this->facturee = $obj->facturee;
|
||||||
$this->note = $obj->note;
|
$this->note = $obj->note;
|
||||||
$this->note_public = $obj->note_public;
|
$this->note_public = $obj->note_public;
|
||||||
$this->projet_id = $obj->fk_projet;
|
$this->projet_id = $obj->fk_projet;
|
||||||
@ -1723,7 +1723,7 @@ class Commande
|
|||||||
*/
|
*/
|
||||||
function getLibStatut($mode)
|
function getLibStatut($mode)
|
||||||
{
|
{
|
||||||
return $this->LibStatut($this->statut,$this->facture,$mode);
|
return $this->LibStatut($this->statut,$this->facturee,$mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -50,6 +50,10 @@ if ($user->societe_id > 0)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Affichage page
|
||||||
|
*/
|
||||||
|
|
||||||
llxHeader();
|
llxHeader();
|
||||||
|
|
||||||
$begin=$_GET['begin'];
|
$begin=$_GET['begin'];
|
||||||
@ -62,7 +66,8 @@ if (! $sortorder) $sortorder='DESC';
|
|||||||
$limit = $conf->liste_limit;
|
$limit = $conf->liste_limit;
|
||||||
$offset = $limit * $_GET['page'] ;
|
$offset = $limit * $_GET['page'] ;
|
||||||
|
|
||||||
$sql = 'SELECT s.nom, s.idp, c.rowid, c.ref, c.total_ht,'.$db->pdate('c.date_commande').' as date_commande, c.fk_statut';
|
$sql = 'SELECT s.nom, s.idp, c.rowid, c.ref, c.total_ht,';
|
||||||
|
$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 && !$socidp) $sql .= ", sc.fk_soc, sc.fk_user";
|
||||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'societe as s, '.MAIN_DB_PREFIX.'commande as c';
|
$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 && !$socidp) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||||
@ -95,7 +100,7 @@ if (isset($_GET['status']))
|
|||||||
{
|
{
|
||||||
$sql .= " AND fk_statut = ".$_GET['status'];
|
$sql .= " AND fk_statut = ".$_GET['status'];
|
||||||
}
|
}
|
||||||
if (isset($_GET['afacturer']))
|
if (isset($_GET['afacturer']) && $_GET['afacturer'] == 1)
|
||||||
{
|
{
|
||||||
$sql .= ' AND c.facture = 0';
|
$sql .= ' AND c.facture = 0';
|
||||||
}
|
}
|
||||||
@ -178,7 +183,7 @@ if ($resql)
|
|||||||
print strftime('%Y',$objp->date_commande).'</a>';
|
print strftime('%Y',$objp->date_commande).'</a>';
|
||||||
if (($objp->fk_statut > 0) && ($objp->fk_statut < 3) && $objp->date_commande < (time() - $conf->commande->warning_delay)) print img_picto($langs->trans("Late"),"warning");
|
if (($objp->fk_statut > 0) && ($objp->fk_statut < 3) && $objp->date_commande < (time() - $conf->commande->warning_delay)) print img_picto($langs->trans("Late"),"warning");
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td align="right">'.$generic_commande->LibStatut($objp->fk_statut,5).'</td>';
|
print '<td align="right">'.$generic_commande->LibStatut($objp->fk_statut,$objp->facturee,5).'</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
$total = $total + $objp->price;
|
$total = $total + $objp->price;
|
||||||
$subtotal = $subtotal + $objp->price;
|
$subtotal = $subtotal + $objp->price;
|
||||||
|
|||||||
@ -126,10 +126,22 @@ if ($_GET["id"] > 0)
|
|||||||
|
|
||||||
// Société
|
// Société
|
||||||
print '<tr><td>'.$langs->trans('Company').'</td>';
|
print '<tr><td>'.$langs->trans('Company').'</td>';
|
||||||
print '<td colspan="2">';
|
print '<td colspan="3">';
|
||||||
print '<a href="'.DOL_URL_ROOT.'/comm/fiche.php?socid='.$soc->id.'">'.$soc->nom.'</a></td>';
|
print '<a href="'.DOL_URL_ROOT.'/comm/fiche.php?socid='.$soc->id.'">'.$soc->nom.'</a></td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
|
// Ligne info remises tiers
|
||||||
|
print '<tr><td>'.$langs->trans('Info').'</td><td colspan="3">';
|
||||||
|
if ($soc->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_client);
|
||||||
|
else print $langs->trans("CompanyHasNoRelativeDiscount");
|
||||||
|
$aboslute_discount=$soc->getCurrentDiscount();
|
||||||
|
print '. ';
|
||||||
|
if ($aboslute_discount) print $langs->trans("CompanyHasAbsoluteDiscount",$absolute_discount);
|
||||||
|
else print $langs->trans("CompanyHasNoAbsoluteDiscount");
|
||||||
|
print '.';
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
|
// Date
|
||||||
print '<tr><td>'.$langs->trans('Date').'</td>';
|
print '<tr><td>'.$langs->trans('Date').'</td>';
|
||||||
print '<td colspan="2">'.dolibarr_print_date($commande->date,'%A %d %B %Y').'</td>';
|
print '<td colspan="2">'.dolibarr_print_date($commande->date,'%A %d %B %Y').'</td>';
|
||||||
print '<td width="50%">'.$langs->trans('Source').' : ' . $commande->sources[$commande->source] ;
|
print '<td width="50%">'.$langs->trans('Source').' : ' . $commande->sources[$commande->source] ;
|
||||||
@ -373,7 +385,9 @@ if ($_GET["id"] > 0)
|
|||||||
* Lignes de remise
|
* Lignes de remise
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Remise relative
|
// Réductions relatives (Remises-Ristournes-Rabbais)
|
||||||
|
/* Une réduction doit s'appliquer obligatoirement sur des lignes de factures
|
||||||
|
et non globalement
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
print '<form name="updateligne" action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
print '<form name="updateligne" action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||||
print '<input type="hidden" name="action" value="setremisepercent">';
|
print '<input type="hidden" name="action" value="setremisepercent">';
|
||||||
@ -427,8 +441,10 @@ if ($_GET["id"] > 0)
|
|||||||
}
|
}
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
print '</form>';
|
print '</form>';
|
||||||
|
*/
|
||||||
|
|
||||||
// Remise absolue
|
// Réductions (Remises-Ristournes-Rabbais)
|
||||||
|
/* Les remises absolues doivent s'appliquer par ajout de lignes spécialisées
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
print '<form name="updateligne" action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
print '<form name="updateligne" action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||||
print '<input type="hidden" name="action" value="setremiseabsolue">';
|
print '<input type="hidden" name="action" value="setremiseabsolue">';
|
||||||
@ -479,7 +495,7 @@ if ($_GET["id"] > 0)
|
|||||||
}
|
}
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
print '</form>';
|
print '</form>';
|
||||||
|
*/
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
|
|||||||
@ -77,7 +77,7 @@ if (isset($_GET["status"]))
|
|||||||
{
|
{
|
||||||
$sql .= " AND fk_statut = ".$_GET["status"];
|
$sql .= " AND fk_statut = ".$_GET["status"];
|
||||||
}
|
}
|
||||||
if (isset($_GET["afacturer"]))
|
if (isset($_GET["afacturer"]) && $_GET['afacturer'] == 1)
|
||||||
{
|
{
|
||||||
$sql .= " AND fk_statut >=1 AND c.facture = 0";
|
$sql .= " AND fk_statut >=1 AND c.facture = 0";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -333,7 +333,7 @@ class MenuLeft {
|
|||||||
if ($conf->commande->enabled )
|
if ($conf->commande->enabled )
|
||||||
{
|
{
|
||||||
$langs->load("orders");
|
$langs->load("orders");
|
||||||
if ($conf->facture->enabled) $newmenu->add(DOL_URL_ROOT."/compta/commande/liste.php?leftmenu=orders&status=3", $langs->trans("MenuOrdersToBill"), 0, $user->rights->commande->lire);
|
if ($conf->facture->enabled) $newmenu->add(DOL_URL_ROOT."/compta/commande/liste.php?leftmenu=orders&status=3&afacturer=1", $langs->trans("MenuOrdersToBill"), 0, $user->rights->commande->lire);
|
||||||
// if ($leftmenu=="orders") $newmenu->add_submenu(DOL_URL_ROOT."/commande/", $langs->trans("StatusOrderToBill"), 1 ,$user->rights->commande->lire);
|
// if ($leftmenu=="orders") $newmenu->add_submenu(DOL_URL_ROOT."/commande/", $langs->trans("StatusOrderToBill"), 1 ,$user->rights->commande->lire);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -53,7 +53,8 @@ function commande_prepare_head($commande)
|
|||||||
$h++;
|
$h++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($conf->compta->enabled || $conf->comptaexpert->enabled)
|
// Commande à facturer
|
||||||
|
if ($conf->facture->enabled)
|
||||||
{
|
{
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/compta/commande/fiche.php?id='.$commande->id;
|
$head[$h][0] = DOL_URL_ROOT.'/compta/commande/fiche.php?id='.$commande->id;
|
||||||
$head[$h][1] = $langs->trans("ComptaCard");
|
$head[$h][1] = $langs->trans("ComptaCard");
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user