diff --git a/htdocs/admin/facture.php b/htdocs/admin/facture.php
index 5a56b90c369..73bb1537c45 100644
--- a/htdocs/admin/facture.php
+++ b/htdocs/admin/facture.php
@@ -37,7 +37,7 @@ $langs->load("bills");
$langs->load("other");
if (!$user->admin)
- accessforbidden();
+accessforbidden();
$typeconst=array('yesno','texte','chaine');
$dir = DOL_DOCUMENT_ROOT."/includes/modules/facture/";
@@ -94,108 +94,108 @@ if ($_GET["action"] == 'specimen')
if ($_GET["action"] == 'set')
{
$type='invoice';
- $sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES ('".$_GET["value"]."','".$type."',".$conf->entity.")";
- if ($db->query($sql))
- {
+ $sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES ('".$_GET["value"]."','".$type."',".$conf->entity.")";
+ if ($db->query($sql))
+ {
- }
+ }
}
if ($_GET["action"] == 'del')
{
- $type='invoice';
- $sql = "DELETE FROM ".MAIN_DB_PREFIX."document_model";
- $sql.= " WHERE nom = '".$_GET["value"];
- $sql.= " AND type = '".$type."'";
- $sql.= " AND entity = ".$conf->entity;
+ $type='invoice';
+ $sql = "DELETE FROM ".MAIN_DB_PREFIX."document_model";
+ $sql.= " WHERE nom = '".$_GET["value"];
+ $sql.= " AND type = '".$type."'";
+ $sql.= " AND entity = ".$conf->entity;
- if ($db->query($sql))
- {
+ if ($db->query($sql))
+ {
- }
+ }
}
if ($_GET["action"] == 'setdoc')
{
$db->begin();
- if (dolibarr_set_const($db, "FACTURE_ADDON_PDF",$_GET["value"],'chaine',0,'',$conf->entity))
- {
- $conf->global->FACTURE_ADDON_PDF = $_GET["value"];
- }
+ if (dolibarr_set_const($db, "FACTURE_ADDON_PDF",$_GET["value"],'chaine',0,'',$conf->entity))
+ {
+ $conf->global->FACTURE_ADDON_PDF = $_GET["value"];
+ }
- // On active le modele
- $type='invoice';
- $sql_del = "DELETE FROM ".MAIN_DB_PREFIX."document_model";
- $sql_del.= " WHERE nom = '".$_GET["value"];
- $sql_del.= " AND type = '".$type."'";
- $sql_del.= " AND entity = ".$conf->entity;
- $result1=$db->query($sql_del);
- $sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom,type,entity) VALUES ('".$_GET["value"]."','".$type."',".$conf->entity.")";
- $result2=$db->query($sql);
- if ($result1 && $result2)
- {
+ // On active le modele
+ $type='invoice';
+ $sql_del = "DELETE FROM ".MAIN_DB_PREFIX."document_model";
+ $sql_del.= " WHERE nom = '".$_GET["value"];
+ $sql_del.= " AND type = '".$type."'";
+ $sql_del.= " AND entity = ".$conf->entity;
+ $result1=$db->query($sql_del);
+ $sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom,type,entity) VALUES ('".$_GET["value"]."','".$type."',".$conf->entity.")";
+ $result2=$db->query($sql);
+ if ($result1 && $result2)
+ {
$db->commit();
- }
- else
- {
- $db->rollback();
- }
+ }
+ else
+ {
+ $db->rollback();
+ }
}
if ($_GET["action"] == 'setmod')
{
- // TODO Verifier si module numerotation choisi peut etre active
- // par appel methode canBeActivated
+ // TODO Verifier si module numerotation choisi peut etre active
+ // par appel methode canBeActivated
dolibarr_set_const($db, "FACTURE_ADDON",$_GET["value"],'chaine',0,'',$conf->entity);
}
if ($_POST["action"] == 'setribchq')
{
- dolibarr_set_const($db, "FACTURE_RIB_NUMBER",$_POST["rib"],'chaine',0,'',$conf->entity);
- dolibarr_set_const($db, "FACTURE_CHQ_NUMBER",$_POST["chq"],'chaine',0,'',$conf->entity);
+ dolibarr_set_const($db, "FACTURE_RIB_NUMBER",$_POST["rib"],'chaine',0,'',$conf->entity);
+ dolibarr_set_const($db, "FACTURE_CHQ_NUMBER",$_POST["chq"],'chaine',0,'',$conf->entity);
}
if ($_POST["action"] == 'set_FACTURE_DRAFT_WATERMARK')
{
- dolibarr_set_const($db, "FACTURE_DRAFT_WATERMARK",trim($_POST["FACTURE_DRAFT_WATERMARK"]),'chaine',0,'',$conf->entity);
+ dolibarr_set_const($db, "FACTURE_DRAFT_WATERMARK",trim($_POST["FACTURE_DRAFT_WATERMARK"]),'chaine',0,'',$conf->entity);
}
if ($_POST["action"] == 'set_FACTURE_FREE_TEXT')
{
- dolibarr_set_const($db, "FACTURE_FREE_TEXT",$_POST["FACTURE_FREE_TEXT"],'chaine',0,'',$conf->entity);
+ dolibarr_set_const($db, "FACTURE_FREE_TEXT",$_POST["FACTURE_FREE_TEXT"],'chaine',0,'',$conf->entity);
}
if ($_POST["action"] == 'setforcedate')
{
- dolibarr_set_const($db, "FAC_FORCE_DATE_VALIDATION",$_POST["forcedate"],'chaine',0,'',$conf->entity);
+ dolibarr_set_const($db, "FAC_FORCE_DATE_VALIDATION",$_POST["forcedate"],'chaine',0,'',$conf->entity);
}
if ($_POST["action"] == 'set_enable_editdelete')
{
- dolibarr_set_const($db, "FACTURE_ENABLE_EDITDELETE",$_POST["enable_editdelete"],'chaine',0,'',$conf->entity);
+ dolibarr_set_const($db, "FACTURE_ENABLE_EDITDELETE",$_POST["enable_editdelete"],'chaine',0,'',$conf->entity);
}
if ($_POST["action"] == 'set_use_bill_contact_as_recipient')
{
- dolibarr_set_const($db, "FACTURE_USE_BILL_CONTACT_AS_RECIPIENT",$_POST["use_bill_contact_as_recipient"],'chaine',0,'',$conf->entity);
+ dolibarr_set_const($db, "FACTURE_USE_BILL_CONTACT_AS_RECIPIENT",$_POST["use_bill_contact_as_recipient"],'chaine',0,'',$conf->entity);
}
if ($_POST["action"] == 'update' || $_POST["action"] == 'add')
{
if (! dolibarr_set_const($db, $_POST["constname"],$_POST["constvalue"],$typeconst[$_POST["consttype"]],0,isset($_POST["constnote"])?$_POST["constnote"]:'',$conf->entity));
{
- dol_print_error($db);
+ dol_print_error($db);
}
}
if ($_GET["action"] == 'delete')
{
- if (! dolibarr_del_const($db, $_GET["rowid"],$conf->entity));
- {
- dol_print_error($db);
- }
+ if (! dolibarr_del_const($db, $_GET["rowid"],$conf->entity));
+ {
+ dol_print_error($db);
+ }
}
// defini les constantes du modele pluton
@@ -248,96 +248,107 @@ print ''."\n";
clearstatcache();
-$handle=opendir($dir);
-
$var=true;
-while (($file = readdir($handle))!==false)
+foreach ($conf->file->dol_document_root as $dirroot)
{
- if (is_dir($dir.$file) && substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS')
- {
- $filebis = $file."/".$file.".modules.php";
- if (is_readable($dir.$filebis))
+ $dir = $dirroot . "/includes/modules/facture/";
+
+ if (is_dir($dir))
+ {
+ $handle = opendir($dir);
+ if ($handle)
{
- // Chargement de la classe de num�rotation
- require_once($dir.$filebis);
- $classname = "mod_facture_".$file;
- $module = new $classname($db);
-
- // Show modules according to features level
- if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
- if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
-
- if ($module->isEnabled())
- {
- $var = !$var;
- print '
| ';
- echo "$file";
- print " | \n";
-
- print $module->info();
-
- print ' | ';
-
- // Affiche example
- print ''.$module->getExample().' | ';
-
- print '';
- if ($conf->global->FACTURE_ADDON == "$file")
- {
- print img_tick($langs->trans("Activated"));
- }
- else
- {
- print ''.$langs->trans("Default").'';
- }
- print ' | ';
-
- $facture=new Facture($db);
- $facture->initAsSpecimen();
-
- // Example for standard invoice
- $htmltooltip='';
- $htmltooltip.=''.$langs->trans("Version").': '.$module->getVersion().'
';
- $facture->type=0;
- $nextval=$module->getNextValue($mysoc,$facture);
- if ("$nextval" != $langs->trans("NotAvailable")) // Keep " on nextval
+ while (($file = readdir($handle))!==false)
+ {
+ if (is_dir($dir.$file) && substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS')
{
- $htmltooltip.=$langs->trans("NextValueForInvoices").': ';
- if ($nextval)
+ $filebis = $file."/".$file.".modules.php";
+
+ if (is_readable($dir.$filebis))
{
- $htmltooltip.=$nextval.'
';
- }
- else
- {
- $htmltooltip.=$langs->trans($module->error).'
';
+ // Chargement de la classe de num�rotation
+ require_once($dir.$filebis);
+ $classname = "mod_facture_".$file;
+ $module = new $classname($db);
+
+ // Show modules according to features level
+ if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
+ if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
+
+ if ($module->isEnabled())
+ {
+ $var = !$var;
+ print '
| ';
+ echo "$file";
+ print " | \n";
+
+ print $module->info();
+
+ print ' | ';
+
+ // Affiche example
+ print ''.$module->getExample().' | ';
+
+ print '';
+ if ($conf->global->FACTURE_ADDON == "$file")
+ {
+ print img_tick($langs->trans("Activated"));
+ }
+ else
+ {
+ print ''.$langs->trans("Default").'';
+ }
+ print ' | ';
+
+ $facture=new Facture($db);
+ $facture->initAsSpecimen();
+
+ // Example for standard invoice
+ $htmltooltip='';
+ $htmltooltip.=''.$langs->trans("Version").': '.$module->getVersion().'
';
+ $facture->type=0;
+ $nextval=$module->getNextValue($mysoc,$facture);
+ if ("$nextval" != $langs->trans("NotAvailable")) // Keep " on nextval
+ {
+ $htmltooltip.=$langs->trans("NextValueForInvoices").': ';
+ if ($nextval)
+ {
+ $htmltooltip.=$nextval.'
';
+ }
+ else
+ {
+ $htmltooltip.=$langs->trans($module->error).'
';
+ }
+ }
+ // Example for credit invoice
+ $facture->type=2;
+ $nextval=$module->getNextValue($mysoc,$facture);
+ if ("$nextval" != $langs->trans("NotAvailable")) // Keep " on nextval
+ {
+ $htmltooltip.=$langs->trans("NextValueForCreditNotes").': ';
+ if ($nextval)
+ {
+ $htmltooltip.=$nextval;
+ }
+ else
+ {
+ $htmltooltip.=$langs->trans($module->error);
+ }
+ }
+
+ print '';
+ print $html->textwithpicto('',$htmltooltip,1,0);
+ print ' | ';
+
+ print "
\n";
+ }
}
}
- // Example for credit invoice
- $facture->type=2;
- $nextval=$module->getNextValue($mysoc,$facture);
- if ("$nextval" != $langs->trans("NotAvailable")) // Keep " on nextval
- {
- $htmltooltip.=$langs->trans("NextValueForCreditNotes").': ';
- if ($nextval)
- {
- $htmltooltip.=$nextval;
- }
- else
- {
- $htmltooltip.=$langs->trans($module->error);
- }
- }
-
- print '';
- print $html->textwithpicto('',$htmltooltip,1,0);
- print ' | ';
-
- print "\n";
- }
+ }
+ closedir($handle);
}
- }
+ }
}
-closedir($handle);
print '';
@@ -387,20 +398,20 @@ $handle=opendir($dir);
$var=True;
while (($file = readdir($handle))!==false)
{
- if (preg_match('/\.modules\.php$/i',$file) && substr($file,0,4) == 'pdf_')
- {
- $var = !$var;
- $name = substr($file, 4, strlen($file) -16);
- $classname = substr($file, 0, strlen($file) -12);
+ if (preg_match('/\.modules\.php$/i',$file) && substr($file,0,4) == 'pdf_')
+ {
+ $var = !$var;
+ $name = substr($file, 4, strlen($file) -16);
+ $classname = substr($file, 0, strlen($file) -12);
- print '| ';
- echo "$name";
- print " | \n";
+ print ' |
| ';
+ echo "$name";
+ print " | \n";
- require_once($dir.$file);
- $module = new $classname($db);
- print $module->description;
- print ' | ';
+ require_once($dir.$file);
+ $module = new $classname($db);
+ print $module->description;
+ print '';
// Active
if (in_array($name, $def))
@@ -438,28 +449,28 @@ while (($file = readdir($handle))!==false)
print '';
// Info
- $htmltooltip = ''.$langs->trans("Name").': '.$module->name;
- $htmltooltip.='
'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
- $htmltooltip.='
'.$langs->trans("Height").'/'.$langs->trans("Width").': '.$module->page_hauteur.'/'.$module->page_largeur;
- $htmltooltip.='
'.$langs->trans("FeaturesSupported").':';
- $htmltooltip.='
'.$langs->trans("Logo").': '.yn($module->option_logo,1,1);
- $htmltooltip.='
'.$langs->trans("PaymentMode").': '.yn($module->option_modereg,1,1);
- $htmltooltip.='
'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg,1,1);
- $htmltooltip.='
'.$langs->trans("Escompte").': '.yn($module->option_escompte,1,1);
- $htmltooltip.='
'.$langs->trans("CreditNote").': '.yn($module->option_credit_note,1,1);
- $htmltooltip.='
'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang,1,1);
+ $htmltooltip = ''.$langs->trans("Name").': '.$module->name;
+ $htmltooltip.='
'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
+ $htmltooltip.='
'.$langs->trans("Height").'/'.$langs->trans("Width").': '.$module->page_hauteur.'/'.$module->page_largeur;
+ $htmltooltip.='
'.$langs->trans("FeaturesSupported").':';
+ $htmltooltip.='
'.$langs->trans("Logo").': '.yn($module->option_logo,1,1);
+ $htmltooltip.='
'.$langs->trans("PaymentMode").': '.yn($module->option_modereg,1,1);
+ $htmltooltip.='
'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg,1,1);
+ $htmltooltip.='
'.$langs->trans("Escompte").': '.yn($module->option_escompte,1,1);
+ $htmltooltip.='
'.$langs->trans("CreditNote").': '.yn($module->option_credit_note,1,1);
+ $htmltooltip.='
'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang,1,1);
$htmltooltip.='
'.$langs->trans("WatermarkOnDraftInvoices").': '.yn($module->option_draft_watermark,1,1);
- print '';
- print $html->textwithpicto('',$htmltooltip,1,0);
- print ' | ';
- print '';
- print ''.img_object($langs->trans("Preview"),'bill').'';
- print ' | ';
+ print '';
+ print $html->textwithpicto('',$htmltooltip,1,0);
+ print ' | ';
+ print '';
+ print ''.img_object($langs->trans("Preview"),'bill').'';
+ print ' | ';
- print "
\n";
- }
+ print "\n";
+ }
}
closedir($handle);
@@ -490,39 +501,39 @@ print "".$langs->trans("SuggestPaymentByRIBOnAccount")." | ";
print "";
if ($conf->banque->enabled)
{
- $sql = "SELECT rowid, label";
- $sql.= " FROM ".MAIN_DB_PREFIX."bank_account";
- $sql.= " WHERE clos = 0";
- $sql.= " AND courant = 1";
- $sql.= " AND entity = ".$conf->entity;
- $resql=$db->query($sql);
- if ($resql)
- {
- $num = $db->num_rows($resql);
- $i = 0;
- if ($num > 0) {
- print "";
+ } else {
+ print "".$langs->trans("NoActiveBankAccountDefined")."";
+ }
+ }
}
else
{
- print $langs->trans("BankModuleNotActive");
+ print $langs->trans("BankModuleNotActive");
}
print " | ";
$var=!$var;
@@ -542,18 +553,18 @@ $var=True;
$resql=$db->query($sql);
if ($resql)
{
- $num = $db->num_rows($resql);
- $i = 0;
- while ($i < $num)
+ $num = $db->num_rows($resql);
+ $i = 0;
+ while ($i < $num)
{
- $var=!$var;
- $row = $db->fetch_row($resql);
+ $var=!$var;
+ $row = $db->fetch_row($resql);
- print '';
+ print '';
- $i++;
+ $i++;
}
}
print "";
@@ -602,19 +613,19 @@ print "\n";
print '';
/*
-$var=! $var;
-print '';
-*/
+ $var=! $var;
+ print '';
+ */
$var=! $var;
print '