Qual: Factorisation du code de gestion des onglets pour les propales
This commit is contained in:
parent
490e293947
commit
59a18bbb55
File diff suppressed because it is too large
Load Diff
@ -30,6 +30,12 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
require("./pre.inc.php");
|
require("./pre.inc.php");
|
||||||
|
require_once(DOL_DOCUMENT_ROOT.'/propal.class.php');
|
||||||
|
require_once(DOL_DOCUMENT_ROOT."/lib/propal.lib.php");
|
||||||
|
if ($conf->projet->enabled) {
|
||||||
|
require_once(DOL_DOCUMENT_ROOT."/project.class.php");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$user->getrights('propale');
|
$user->getrights('propale');
|
||||||
|
|
||||||
@ -40,22 +46,15 @@ $langs->load('propal');
|
|||||||
$langs->load("bills");
|
$langs->load("bills");
|
||||||
$langs->load('compta');
|
$langs->load('compta');
|
||||||
|
|
||||||
|
// Sécurité accés client
|
||||||
require_once(DOL_DOCUMENT_ROOT.'/propal.class.php');
|
|
||||||
if ($conf->projet->enabled) {
|
|
||||||
require_once(DOL_DOCUMENT_ROOT."/project.class.php");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Sécurité accés client
|
|
||||||
*/
|
|
||||||
if ($user->societe_id > 0)
|
if ($user->societe_id > 0)
|
||||||
{
|
{
|
||||||
$action = '';
|
$action = '';
|
||||||
$socidp = $user->societe_id;
|
$socidp = $user->societe_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
llxHeader();
|
llxHeader();
|
||||||
|
|
||||||
$html = new Form($db);
|
$html = new Form($db);
|
||||||
@ -66,45 +65,17 @@ $html = new Form($db);
|
|||||||
/* */
|
/* */
|
||||||
/* *************************************************************************** */
|
/* *************************************************************************** */
|
||||||
|
|
||||||
if ($_GET["propalid"] > 0) {
|
if ($_GET["propalid"] > 0)
|
||||||
|
{
|
||||||
$propal = new Propal($db);
|
$propal = new Propal($db);
|
||||||
|
|
||||||
if ( $propal->fetch($_GET["propalid"], $user->societe_id) > 0)
|
if ( $propal->fetch($_GET["propalid"], $user->societe_id) > 0)
|
||||||
{
|
{
|
||||||
$soc = new Societe($db, $propal->socidp);
|
$soc = new Societe($db, $propal->socidp);
|
||||||
$soc->fetch($propal->socidp);
|
$soc->fetch($propal->socidp);
|
||||||
|
|
||||||
$h=0;
|
$head = propal_prepare_head($propal);
|
||||||
|
dolibarr_fiche_head($head, 'preview', $langs->trans('Proposal'));
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/comm/propal.php?propalid='.$propal->id;
|
|
||||||
$head[$h][1] = $langs->trans('CommercialCard');
|
|
||||||
$h++;
|
|
||||||
|
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/compta/propal.php?propalid='.$propal->id;
|
|
||||||
$head[$h][1] = $langs->trans('AccountancyCard');
|
|
||||||
$h++;
|
|
||||||
|
|
||||||
if ($conf->use_preview_tabs)
|
|
||||||
{
|
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/comm/propal/apercu.php?propalid='.$propal->id;
|
|
||||||
$head[$h][1] = $langs->trans("Preview");
|
|
||||||
$hselected=$h;
|
|
||||||
$h++;
|
|
||||||
}
|
|
||||||
|
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/comm/propal/note.php?propalid='.$propal->id;
|
|
||||||
$head[$h][1] = $langs->trans('Note');
|
|
||||||
$h++;
|
|
||||||
|
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/comm/propal/info.php?propalid='.$propal->id;
|
|
||||||
$head[$h][1] = $langs->trans('Info');
|
|
||||||
$h++;
|
|
||||||
|
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/comm/propal/document.php?propalid='.$propal->id;
|
|
||||||
$head[$h][1] = $langs->trans('Documents');
|
|
||||||
$h++;
|
|
||||||
|
|
||||||
dolibarr_fiche_head($head, $hselected, $langs->trans('Proposal'));
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -131,18 +102,11 @@ if ($_GET["propalid"] > 0) {
|
|||||||
print '<tr><td width="30%">'.$langs->trans('Ref').'</td><td colspan="5">'.$propal->ref_url.'</td></tr>';
|
print '<tr><td width="30%">'.$langs->trans('Ref').'</td><td colspan="5">'.$propal->ref_url.'</td></tr>';
|
||||||
|
|
||||||
$rowspan=3;
|
$rowspan=3;
|
||||||
|
|
||||||
// ligne 1
|
// ligne 1
|
||||||
// partie Gauche
|
// partie Gauche
|
||||||
print '<tr><td>'.$langs->trans('Company').'</td><td colspan="3">';
|
print '<tr><td>'.$langs->trans('Company').'</td><td colspan="3">'.$societe->getNomUrl(1).'</td>';
|
||||||
if ($societe->client == 1)
|
|
||||||
{
|
|
||||||
$url = DOL_URL_ROOT.'/comm/fiche.php?socid='.$societe->id;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$url = DOL_URL_ROOT.'/comm/prospect/fiche.php?socid='.$societe->id;
|
|
||||||
}
|
|
||||||
print '<a href="'.$url.'">'.$societe->nom.'</a></td>';
|
|
||||||
// partie Droite
|
// partie Droite
|
||||||
print '<td align="left">'.$langs->trans("PaymentConditions").'</td>';
|
print '<td align="left">'.$langs->trans("PaymentConditions").'</td>';
|
||||||
print '<td>'.' '.'</td>';
|
print '<td>'.' '.'</td>';
|
||||||
|
|||||||
@ -31,6 +31,7 @@
|
|||||||
|
|
||||||
require('./pre.inc.php');
|
require('./pre.inc.php');
|
||||||
require_once(DOL_DOCUMENT_ROOT."/propal.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/propal.class.php");
|
||||||
|
require_once(DOL_DOCUMENT_ROOT."/lib/propal.lib.php");
|
||||||
|
|
||||||
$user->getrights('propale');
|
$user->getrights('propale');
|
||||||
|
|
||||||
@ -110,37 +111,8 @@ if ($propalid > 0)
|
|||||||
$societe = new Societe($db);
|
$societe = new Societe($db);
|
||||||
$societe->fetch($propal->socidp);
|
$societe->fetch($propal->socidp);
|
||||||
|
|
||||||
$h=0;
|
$head = propal_prepare_head($propal);
|
||||||
|
dolibarr_fiche_head($head, 'document', $langs->trans('Proposal'));
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/comm/propal.php?propalid='.$propal->id;
|
|
||||||
$head[$h][1] = $langs->trans('CommercialCard');
|
|
||||||
$h++;
|
|
||||||
|
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/compta/propal.php?propalid='.$propal->id;
|
|
||||||
$head[$h][1] = $langs->trans('AccountancyCard');
|
|
||||||
$h++;
|
|
||||||
|
|
||||||
if ($conf->use_preview_tabs)
|
|
||||||
{
|
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/comm/propal/apercu.php?propalid='.$propal->id;
|
|
||||||
$head[$h][1] = $langs->trans("Preview");
|
|
||||||
$h++;
|
|
||||||
}
|
|
||||||
|
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/comm/propal/note.php?propalid='.$propal->id;
|
|
||||||
$head[$h][1] = $langs->trans('Note');
|
|
||||||
$h++;
|
|
||||||
|
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/comm/propal/info.php?propalid='.$propal->id;
|
|
||||||
$head[$h][1] = $langs->trans('Info');
|
|
||||||
$h++;
|
|
||||||
|
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/comm/propal/document.php?propalid='.$propal->id;
|
|
||||||
$head[$h][1] = $langs->trans('Documents');
|
|
||||||
$hselected=$h;
|
|
||||||
$h++;
|
|
||||||
|
|
||||||
dolibarr_fiche_head($head, $hselected, $langs->trans('Proposal'));
|
|
||||||
|
|
||||||
// Construit liste des fichiers
|
// Construit liste des fichiers
|
||||||
clearstatcache();
|
clearstatcache();
|
||||||
@ -178,17 +150,7 @@ if ($propalid > 0)
|
|||||||
print '<tr><td width="30%">'.$langs->trans('Ref').'</td><td colspan="3">'.$propal->ref_url.'</td></tr>';
|
print '<tr><td width="30%">'.$langs->trans('Ref').'</td><td colspan="3">'.$propal->ref_url.'</td></tr>';
|
||||||
|
|
||||||
// Société
|
// Société
|
||||||
print '<tr><td>'.$langs->trans('Company').'</td><td colspan="5">';
|
print '<tr><td>'.$langs->trans('Company').'</td><td colspan="5">'.$societe->getNomUrl(1).'</td></tr>';
|
||||||
if ($societe->client == 1)
|
|
||||||
{
|
|
||||||
$url ='fiche.php?socid='.$societe->id;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$url = DOL_URL_ROOT.'/comm/prospect/fiche.php?socid='.$societe->id;
|
|
||||||
}
|
|
||||||
print '<a href="'.$url.'">'.$societe->nom.'</a></td>';
|
|
||||||
print '</tr>';
|
|
||||||
|
|
||||||
print '<tr><td>'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.sizeof($filearray).'</td></tr>';
|
print '<tr><td>'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.sizeof($filearray).'</td></tr>';
|
||||||
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>';
|
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>';
|
||||||
|
|||||||
@ -30,6 +30,7 @@
|
|||||||
|
|
||||||
require('./pre.inc.php');
|
require('./pre.inc.php');
|
||||||
require_once(DOL_DOCUMENT_ROOT."/propal.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/propal.class.php");
|
||||||
|
require_once(DOL_DOCUMENT_ROOT."/lib/propal.lib.php");
|
||||||
|
|
||||||
$langs->load('propal');
|
$langs->load('propal');
|
||||||
$langs->load('compta');
|
$langs->load('compta');
|
||||||
@ -56,37 +57,9 @@ $propal->fetch($_GET['propalid']);
|
|||||||
|
|
||||||
$societe = new Societe($db);
|
$societe = new Societe($db);
|
||||||
$societe->fetch($propal->soc_id);
|
$societe->fetch($propal->soc_id);
|
||||||
$h=0;
|
|
||||||
|
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/comm/propal.php?propalid='.$propal->id;
|
$head = propal_prepare_head($propal);
|
||||||
$head[$h][1] = $langs->trans('CommercialCard');
|
dolibarr_fiche_head($head, 'info', $langs->trans('Proposal'));
|
||||||
$h++;
|
|
||||||
|
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/compta/propal.php?propalid='.$propal->id;
|
|
||||||
$head[$h][1] = $langs->trans('AccountancyCard');
|
|
||||||
$h++;
|
|
||||||
|
|
||||||
if ($conf->use_preview_tabs)
|
|
||||||
{
|
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/comm/propal/apercu.php?propalid='.$propal->id;
|
|
||||||
$head[$h][1] = $langs->trans("Preview");
|
|
||||||
$h++;
|
|
||||||
}
|
|
||||||
|
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/comm/propal/note.php?propalid='.$propal->id;
|
|
||||||
$head[$h][1] = $langs->trans('Note');
|
|
||||||
$h++;
|
|
||||||
|
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/comm/propal/info.php?propalid='.$propal->id;
|
|
||||||
$head[$h][1] = $langs->trans('Info');
|
|
||||||
$hselected=$h;
|
|
||||||
$h++;
|
|
||||||
|
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/comm/propal/document.php?propalid='.$propal->id;
|
|
||||||
$head[$h][1] = $langs->trans('Documents');
|
|
||||||
$h++;
|
|
||||||
|
|
||||||
dolibarr_fiche_head($head, $hselected, $langs->trans('Proposal'));
|
|
||||||
|
|
||||||
$propal->info($propal->id);
|
$propal->info($propal->id);
|
||||||
|
|
||||||
|
|||||||
@ -31,6 +31,7 @@
|
|||||||
|
|
||||||
require('./pre.inc.php');
|
require('./pre.inc.php');
|
||||||
require_once(DOL_DOCUMENT_ROOT."/propal.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/propal.class.php");
|
||||||
|
require_once(DOL_DOCUMENT_ROOT."/lib/propal.lib.php");
|
||||||
|
|
||||||
$langs->load('propal');
|
$langs->load('propal');
|
||||||
$langs->load('compta');
|
$langs->load('compta');
|
||||||
@ -109,55 +110,27 @@ if ($_GET['propalid'])
|
|||||||
$societe = new Societe($db);
|
$societe = new Societe($db);
|
||||||
if ( $societe->fetch($propal->soc_id) )
|
if ( $societe->fetch($propal->soc_id) )
|
||||||
{
|
{
|
||||||
$h=0;
|
$head = propal_prepare_head($propal);
|
||||||
|
dolibarr_fiche_head($head, 'note', $langs->trans('Proposal'));
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/comm/propal.php?propalid='.$propal->id;
|
|
||||||
$head[$h][1] = $langs->trans('CommercialCard');
|
|
||||||
$h++;
|
|
||||||
|
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/compta/propal.php?propalid='.$propal->id;
|
|
||||||
$head[$h][1] = $langs->trans('AccountancyCard');
|
|
||||||
$h++;
|
|
||||||
|
|
||||||
if ($conf->use_preview_tabs)
|
|
||||||
{
|
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/comm/propal/apercu.php?propalid='.$propal->id;
|
|
||||||
$head[$h][1] = $langs->trans("Preview");
|
|
||||||
$h++;
|
|
||||||
}
|
|
||||||
|
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/comm/propal/note.php?propalid='.$propal->id;
|
|
||||||
$head[$h][1] = $langs->trans('Note');
|
|
||||||
$hselected=$h;
|
|
||||||
$h++;
|
|
||||||
|
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/comm/propal/info.php?propalid='.$propal->id;
|
|
||||||
$head[$h][1] = $langs->trans('Info');
|
|
||||||
$h++;
|
|
||||||
|
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/comm/propal/document.php?propalid='.$propal->id;
|
|
||||||
$head[$h][1] = $langs->trans('Documents');
|
|
||||||
$h++;
|
|
||||||
|
|
||||||
dolibarr_fiche_head($head, $hselected, $langs->trans("Proposal"));
|
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
print '<tr><td width="25%">'.$langs->trans('Ref').'</td><td colspan="3">'.$propal->ref_url.'</td></tr>';
|
print '<tr><td width="25%">'.$langs->trans('Ref').'</td><td colspan="3">'.$propal->ref_url.'</td></tr>';
|
||||||
|
|
||||||
// Société
|
// Société
|
||||||
print '<tr><td>'.$langs->trans('Company').'</td><td colspan="5">';
|
print '<tr><td>'.$langs->trans('Company').'</td><td colspan="5">'.$societe->getNomUrl(1).'</td></tr>';
|
||||||
if ($societe->client == 1)
|
|
||||||
{
|
|
||||||
$url ='fiche.php?socid='.$societe->id;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$url = DOL_URL_ROOT.'/comm/prospect/fiche.php?socid='.$societe->id;
|
|
||||||
}
|
|
||||||
print '<a href="'.$url.'">'.$societe->nom.'</a></td>';
|
|
||||||
print '</tr>';
|
|
||||||
|
|
||||||
|
// Ligne info remises tiers
|
||||||
|
print '<tr><td>'.$langs->trans('Discounts').'</td><td colspan="5">';
|
||||||
|
if ($societe->remise_client) print $langs->trans("CompanyHasRelativeDiscount",$societe->remise_client);
|
||||||
|
else print $langs->trans("CompanyHasNoRelativeDiscount");
|
||||||
|
$absolute_discount=$societe->getCurrentDiscount();
|
||||||
|
print '. ';
|
||||||
|
if ($absolute_discount) print $langs->trans("CompanyHasAbsoluteDiscount",$absolute_discount,$langs->trans("Currency".$conf->monnaie));
|
||||||
|
else print $langs->trans("CompanyHasNoAbsoluteDiscount");
|
||||||
|
print '.';
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
// Date
|
// Date
|
||||||
print '<tr><td>'.$langs->trans('Date').'</td><td>';
|
print '<tr><td>'.$langs->trans('Date').'</td><td>';
|
||||||
print dolibarr_print_date($propal->date,'%a %d %B %Y');
|
print dolibarr_print_date($propal->date,'%a %d %B %Y');
|
||||||
|
|||||||
@ -30,6 +30,7 @@
|
|||||||
|
|
||||||
require("./pre.inc.php");
|
require("./pre.inc.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT."/propal.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/propal.class.php");
|
||||||
|
require_once(DOL_DOCUMENT_ROOT."/lib/propal.lib.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT."/lib/CMailFile.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/lib/CMailFile.class.php");
|
||||||
if ($conf->projet->enabled) require_once(DOL_DOCUMENT_ROOT.'/project.class.php');
|
if ($conf->projet->enabled) require_once(DOL_DOCUMENT_ROOT.'/project.class.php');
|
||||||
if ($conf->commande->enabled) require_once(DOL_DOCUMENT_ROOT.'/commande/commande.class.php');
|
if ($conf->commande->enabled) require_once(DOL_DOCUMENT_ROOT.'/commande/commande.class.php');
|
||||||
@ -121,37 +122,9 @@ if ($_GET["propalid"] > 0)
|
|||||||
|
|
||||||
$propal = new Propal($db);
|
$propal = new Propal($db);
|
||||||
$propal->fetch($_GET["propalid"]);
|
$propal->fetch($_GET["propalid"]);
|
||||||
$h=0;
|
|
||||||
|
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/comm/propal.php?propalid='.$propal->id;
|
$head = propal_prepare_head($propal);
|
||||||
$head[$h][1] = $langs->trans('CommercialCard');
|
dolibarr_fiche_head($head, 'compta', $langs->trans('Proposal'));
|
||||||
$h++;
|
|
||||||
|
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/compta/propal.php?propalid='.$propal->id;
|
|
||||||
$head[$h][1] = $langs->trans('AccountancyCard');
|
|
||||||
$hselected=$h;
|
|
||||||
$h++;
|
|
||||||
|
|
||||||
if ($conf->use_preview_tabs)
|
|
||||||
{
|
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/comm/propal/apercu.php?propalid='.$propal->id;
|
|
||||||
$head[$h][1] = $langs->trans("Preview");
|
|
||||||
$h++;
|
|
||||||
}
|
|
||||||
|
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/comm/propal/note.php?propalid='.$propal->id;
|
|
||||||
$head[$h][1] = $langs->trans('Note');
|
|
||||||
$h++;
|
|
||||||
|
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/comm/propal/info.php?propalid='.$propal->id;
|
|
||||||
$head[$h][1] = $langs->trans('Info');
|
|
||||||
$h++;
|
|
||||||
|
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/comm/propal/document.php?propalid='.$propal->id;
|
|
||||||
$head[$h][1] = $langs->trans('Documents');
|
|
||||||
$h++;
|
|
||||||
|
|
||||||
dolibarr_fiche_head($head, $hselected, $langs->trans('Proposal'));
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -182,17 +155,7 @@ if ($_GET["propalid"] > 0)
|
|||||||
$rowspan=9;
|
$rowspan=9;
|
||||||
|
|
||||||
// Société
|
// Société
|
||||||
print '<tr><td>'.$langs->trans('Company').'</td><td colspan="5">';
|
print '<tr><td>'.$langs->trans('Company').'</td><td colspan="5">'.$societe->getNomUrl(1).'</td></tr>';
|
||||||
if ($societe->client == 1)
|
|
||||||
{
|
|
||||||
$url ='fiche.php?socid='.$societe->id;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$url = DOL_URL_ROOT.'/comm/prospect/fiche.php?socid='.$societe->id;
|
|
||||||
}
|
|
||||||
print '<a href="'.$url.'">'.$societe->nom.'</a></td>';
|
|
||||||
print '</tr>';
|
|
||||||
|
|
||||||
// Ligne info remises tiers
|
// Ligne info remises tiers
|
||||||
print '<tr><td>'.$langs->trans('Discounts').'</td><td colspan="5">';
|
print '<tr><td>'.$langs->trans('Discounts').'</td><td colspan="5">';
|
||||||
|
|||||||
@ -450,13 +450,13 @@ class Form
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Retourne la liste déroulante des sociétés
|
* \brief Retourne la liste déroulante des sociétés
|
||||||
* \param selected Societe présélectionnée
|
* \param selected Societe présélectionnée
|
||||||
* \param htmlname Nom champ formulaire
|
* \param htmlname Nom champ formulaire
|
||||||
* \param filter Criteres optionnels de filtre
|
* \param filter Criteres optionnels de filtre
|
||||||
*/
|
*/
|
||||||
function select_societes($selected='',$htmlname='soc_id',$filter='')
|
function select_societes($selected='',$htmlname='soc_id',$filter='')
|
||||||
{
|
{
|
||||||
// On recherche les societes
|
// On recherche les societes
|
||||||
$sql = "SELECT s.idp, s.nom FROM";
|
$sql = "SELECT s.idp, s.nom FROM";
|
||||||
@ -494,6 +494,54 @@ class Form
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Retourne la liste déroulante des remises fixes
|
||||||
|
* \param selected Id remise fixe présélectionnée
|
||||||
|
* \param htmlname Nom champ formulaire
|
||||||
|
* \param filter Criteres optionnels de filtre
|
||||||
|
*/
|
||||||
|
function select_remises($selected='',$htmlname='remise_id',$filter='',$socid)
|
||||||
|
{
|
||||||
|
global $langs,$conf;
|
||||||
|
|
||||||
|
// On recherche les societes
|
||||||
|
$sql = "SELECT re.rowid, re.amount_ht as amount, re.description FROM";
|
||||||
|
$sql.= " ".MAIN_DB_PREFIX ."societe_remise_except as re";
|
||||||
|
$sql.= " WHERE fk_soc = ".$socid;
|
||||||
|
if ($filter) $sql.= " AND $filter";
|
||||||
|
$sql.= " ORDER BY re.description ASC";
|
||||||
|
|
||||||
|
$resql=$this->db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
print '<select class="flat" name="'.$htmlname.'">';
|
||||||
|
$num = $this->db->num_rows($resql);
|
||||||
|
$i = 0;
|
||||||
|
if ($num)
|
||||||
|
{
|
||||||
|
print '<option value="0"> </option>';
|
||||||
|
while ($i < $num)
|
||||||
|
{
|
||||||
|
$obj = $this->db->fetch_object($resql);
|
||||||
|
if ($selected > 0 && $selected == $obj->rowid)
|
||||||
|
{
|
||||||
|
print '<option value="'.$obj->rowid.'" selected="true">'.dolibarr_trunc($obj->description,40).' ('.$obj->amount.' '.$langs->trans("Currency".$conf->monnaie).')'.'</option>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<option value="'.$obj->rowid.'">'.dolibarr_trunc($obj->description,40).' ('.$obj->amount.' '.$langs->trans("Currency".$conf->monnaie).')'.'</option>';
|
||||||
|
}
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
print '</select>';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
dolibarr_print_error($this->db);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Retourne la liste déroulante des contacts d'une société donnée
|
* \brief Retourne la liste déroulante des contacts d'une société donnée
|
||||||
* \param socid Id de la société
|
* \param socid Id de la société
|
||||||
@ -1588,23 +1636,24 @@ class Form
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Affiche formulaire de selection de la remise avoir
|
* \brief Affiche formulaire de selection de la remise fixe
|
||||||
* \param page Page
|
* \param page Page
|
||||||
* \param selected Valeur à appliquer
|
* \param selected Valeur à appliquer
|
||||||
* \param htmlname Nom du formulaire select. Si none, non modifiable
|
* \param htmlname Nom du formulaire select. Si none, non modifiable
|
||||||
*/
|
*/
|
||||||
function form_remise($page, $selected='', $htmlname='remise')
|
function form_remise_dispo($page, $selected='', $htmlname='remise_id',$socid)
|
||||||
{
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
if ($htmlname != "none")
|
if ($htmlname != "none")
|
||||||
{
|
{
|
||||||
print '<form method="post" action="'.$page.'">';
|
print '<form method="post" action="'.$page.'">';
|
||||||
print '<input type="hidden" name="action" value="setremise">';
|
print '<input type="hidden" name="action" value="setabsolutediscount">';
|
||||||
print '<table class="noborder" cellpadding="0" cellspacing="0">';
|
print '<table class="nobordernopadding" cellpadding="0" cellspacing="0">';
|
||||||
print '<tr><td>';
|
print '<tr><td>';
|
||||||
print '<input type="text" name="'.$htmlname.'" size="1" value="'.$selected.'">';
|
print $langs->trans("AvailableGlobalDiscounts").': ';
|
||||||
|
print $this->select_remises('',$htmlname,'fk_facture IS NULL',$socid);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '<td align="left"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
|
print '<td align="left"> <input type="submit" class="button" value="'.$langs->trans("UseDiscount").'"></td>';
|
||||||
print '</tr></table></form>';
|
print '</tr></table></form>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@ -82,6 +82,8 @@ CompanyHasAbsoluteDiscount=This customer has a %s %s discount credit
|
|||||||
CompanyHasNoAbsoluteDiscount=This customer has no discount credit available
|
CompanyHasNoAbsoluteDiscount=This customer has no discount credit available
|
||||||
CustomerAbsoluteDiscountAllUsers=Absolute discounts (granted by all users)
|
CustomerAbsoluteDiscountAllUsers=Absolute discounts (granted by all users)
|
||||||
CustomerAbsoluteDiscountMy=Absolute discounts (granted by yourself)
|
CustomerAbsoluteDiscountMy=Absolute discounts (granted by yourself)
|
||||||
|
DefaultDiscount=Default discount
|
||||||
|
AvailableGlobalDiscounts=Absolute discounts available
|
||||||
DiscountNone=None
|
DiscountNone=None
|
||||||
Supplier=Supplier
|
Supplier=Supplier
|
||||||
CompanyList=Companies' list
|
CompanyList=Companies' list
|
||||||
|
|||||||
@ -83,6 +83,7 @@ CompanyHasNoAbsoluteDiscount=Ce client n'a pas ou plus de remises fixes disponib
|
|||||||
CustomerAbsoluteDiscountAllUsers=Remises fixes en cours (accordées par tout utilisateur)
|
CustomerAbsoluteDiscountAllUsers=Remises fixes en cours (accordées par tout utilisateur)
|
||||||
CustomerAbsoluteDiscountMy=Remises fixes en cours (accordées personnellement)
|
CustomerAbsoluteDiscountMy=Remises fixes en cours (accordées personnellement)
|
||||||
DefaultDiscount=Remise par défaut
|
DefaultDiscount=Remise par défaut
|
||||||
|
AvailableGlobalDiscounts=Remises fixes disponibles
|
||||||
DiscountNone=Aucune
|
DiscountNone=Aucune
|
||||||
Supplier=Fournisseur
|
Supplier=Fournisseur
|
||||||
CompanyList=Liste des sociétés
|
CompanyList=Liste des sociétés
|
||||||
|
|||||||
@ -532,6 +532,27 @@ function dolibarr_trunc($string,$size=40)
|
|||||||
return $string;
|
return $string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
\brief Complète une chaine à une taille donnée par des espaces
|
||||||
|
\param string Chaine à compléter
|
||||||
|
\param size Longueur de la chaine.
|
||||||
|
\param side 0=Complétion à droite, 1=Complétion à gauche
|
||||||
|
\param char Chaine de complétion
|
||||||
|
\return string Chaine complétée
|
||||||
|
*/
|
||||||
|
function dolibarr_pad($string,$size,$side,$char=' ')
|
||||||
|
{
|
||||||
|
$taille=sizeof($string);
|
||||||
|
$i=0;
|
||||||
|
while($i < ($size - $taille))
|
||||||
|
{
|
||||||
|
if ($side > 0) $string.=$char;
|
||||||
|
else $string=$char.$string;
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
return $string;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\brief Affiche picto propre à une notion/module (fonction générique)
|
\brief Affiche picto propre à une notion/module (fonction générique)
|
||||||
\param alt Texte sur le alt de l'image
|
\param alt Texte sur le alt de l'image
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user