New: Add warning if setup not complete

Fix: Type of invoice line (product/service) must always be visible for suppliers.
This commit is contained in:
Laurent Destailleur 2010-02-09 11:33:13 +00:00
parent c3c9ad111f
commit 1fcad6172b
7 changed files with 31 additions and 17 deletions

View File

@ -903,8 +903,10 @@ if ($id > 0 || ! empty($ref))
print '<tr '.$bc[$var].'>';
print '<td>';
print $html->select_type_of_lines(isset($_POST["type"])?$_POST["type"]:-1,'type',1);
if ($conf->produit->enabled && $conf->service->enabled) print '<br>';
$forceall=1;
print $html->select_type_of_lines(isset($_POST["type"])?$_POST["type"]:-1,'type',1,0,$forceall);
if ($forceall || ($conf->produit->enabled && $conf->service->enabled)
|| (empty($conf->produit->enabled) && empty($conf->service->enabled))) print '<br>';
// Editor wysiwyg
if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_DETAILS)

View File

@ -1065,8 +1065,9 @@ else
print '<tr '.$bc[$var].'>';
print '<td>';
print $html->select_type_of_lines(isset($_POST["type"])?$_POST["type"]:-1,'type',1);
if (($conf->produit->enabled && $conf->service->enabled)
$forceall=1; // For suppliers, we always show all types
print $html->select_type_of_lines(isset($_POST["type"])?$_POST["type"]:-1,'type',1,0,$forceall);
if ($forceall || ($conf->produit->enabled && $conf->service->enabled)
|| (empty($conf->produit->enabled) && empty($conf->service->enabled))) print '<br>';
// Editor wysiwyg

View File

@ -394,15 +394,17 @@ class Form
/**
* \brief Return list of types of lines (product or service)
* \param selected Preselected type
* \param htmlname Name of field in form
* \param htmlname Name of field in html form
* \param showempty Add an empty field
* \param hidetext Do not show label before combo box
* \param forceall Force to show products and services in combo list, whatever are activated modules
*/
function select_type_of_lines($selected='',$htmlname='type',$showempty=0,$hidetext=0)
function select_type_of_lines($selected='',$htmlname='type',$showempty=0,$hidetext=0,$forceall=0)
{
global $db,$langs,$user,$conf;
// If product & services are enabled or both disabled.
if (($conf->produit->enabled && $conf->service->enabled)
if ($forceall || ($conf->produit->enabled && $conf->service->enabled)
|| (empty($conf->produit->enabled) && empty($conf->service->enabled)))
{
if (empty($hidetext)) print $langs->trans("Type").': ';
@ -425,11 +427,11 @@ class Form
print '</select>';
//if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
}
if (empty($conf->produit->enabled) && $conf->service->enabled)
if (! $forceall && empty($conf->produit->enabled) && $conf->service->enabled)
{
print '<input type="hidden" name="'.$htmlname.'" value="1">';
}
if ($conf->produit->enabled && empty($conf->service->enabled))
if (! $forceall && $conf->produit->enabled && empty($conf->service->enabled))
{
print '<input type="hidden" name="'.$htmlname.'" value="0">';
}

View File

@ -335,11 +335,18 @@ class FormFile
}
print '</td>';
print '<td align="center" colspan="'.($delallowed?'2':'1').'">';
print '<input class="button" '.((is_array($modellist) && sizeof($modellist))?'':' disabled="true"').' type="submit" value="'.$buttonlabel.'">';
print '<input class="button" ';
//print ((is_array($modellist) && sizeof($modellist))?'':' disabled="true"') // Always allow button "Generate" (even if no model activated)
print ' type="submit" value="'.$buttonlabel.'">';
if (is_array($modellist) && ! sizeof($modellist))
{
$langs->load("errors");
print ' '.img_warning($langs->trans("WarningNoDocumentModelActivated"));
}
print '</td></tr>';
}
// Recupe liste des fichiers
// Get list of files
$png = '';
$filter = '';
if ($iconPDF==1)
@ -359,12 +366,12 @@ class FormFile
print '<table class="border" summary="listofdocumentstable" width="100%">';
}
// Boucle sur chaque ligne trouvee
// Loop on each file found
foreach($file_list as $i => $file)
{
$var=!$var;
// Defini chemin relatif par rapport au module pour lien download
// Define relative path for download link (depends on module)
$relativepath=$file["name"]; // Cas general
if ($filename) $relativepath=$filename."/".$file["name"]; // Cas propal, facture...
// Autre cas
@ -373,7 +380,7 @@ class FormFile
if (!$iconPDF) print "<tr ".$bc[$var].">";
// Affiche nom fichier avec lien download
// Show file name with link to download
if (!$iconPDF) print '<td>';
print '<a href="'.DOL_URL_ROOT . '/document.php?modulepart='.$modulepart.'&amp;file='.urlencode($relativepath).'">';
if (!$iconPDF)

View File

@ -171,7 +171,7 @@ class ModeleNumRefProjects
*/
function project_pdf_create($db, $comid, $modele,$outputlangs)
{
global $langs;
global $conf,$langs;
$langs->load("projects");
$dir = DOL_DOCUMENT_ROOT."/includes/modules/project/pdf/";

View File

@ -60,4 +60,5 @@ ErrorWrongValueForField=Wrong value for field number <b>%s</b> (value '<b>%s</b>
ErrorsOnXLines=Errors on <b>%s</b> source lines
WarningsOnXLines=Warnings on <b>%s</b> source lines
ErrorFileIsInfectedWithAVirus=The antivirus program was not able to validate the file (file might be infected by a virus)
ErrorSpecialCharNotAllowedForField=Special characters are not allowed for field "%s"
ErrorSpecialCharNotAllowedForField=Special characters are not allowed for field "%s"
WarningNoDocumentModelActivated=No model, for document generation, has been activated. A model will be choosed by default until you check your module setup.

View File

@ -61,4 +61,5 @@ ErrorWrongValueForField=Mauvaise valeur pour le champ numéro <b>%s</b> (la vale
ErrorsOnXLines=Erreurs sur <b>%s</b> lignes sources
WarningsOnXLines=Alertes sur <b>%s</b> lignes sources
ErrorFileIsInfectedWithAVirus=L'antivirus n'a pas pu valider ce fichier (il est probablement infecté par un virus) !
ErrorSpecialCharNotAllowedForField=Les caractères spéciaux ne sont pas admins pour le champ "%s"
ErrorSpecialCharNotAllowedForField=Les caractères spéciaux ne sont pas admins pour le champ "%s"
WarningNoDocumentModelActivated=Aucun modèle, pour la génération de document, n'a été activé. Un modèle sera pris par défaut en attendant la correction de configuration du module.