cvsimport

This commit is contained in:
Regis Houssin 2011-09-21 15:02:10 +00:00
commit d647e8040e
45 changed files with 5951 additions and 6220 deletions

View File

@ -105,7 +105,7 @@ INLINE_INHERITED_MEMB = NO
# path before files name in the file list and in the header files. If set # path before files name in the file list and in the header files. If set
# to NO the shortest path that makes the file name unique will be used. # to NO the shortest path that makes the file name unique will be used.
FULL_PATH_NAMES = YES FULL_PATH_NAMES = NO
# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag # If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
# can be used to strip a user-defined part of the path. Stripping is # can be used to strip a user-defined part of the path. Stripping is
@ -114,7 +114,7 @@ FULL_PATH_NAMES = YES
# If left blank the directory from which doxygen is run is used as the # If left blank the directory from which doxygen is run is used as the
# path to strip. # path to strip.
STRIP_FROM_PATH = "/var/lib/hudson/jobs/dolibarr-develop/workspace" STRIP_FROM_PATH = ""
# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of # The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
# the path mentioned in the documentation of a class, which tells # the path mentioned in the documentation of a class, which tells

View File

@ -40,7 +40,7 @@ accessforbidden();
$typeconst=array('yesno','texte','chaine'); $typeconst=array('yesno','texte','chaine');
$action = getpost("action"); $action = GETPOST("action");
// Action mise a jour ou ajout d'une constante // Action mise a jour ou ajout d'une constante

View File

@ -28,24 +28,24 @@ require_once(DOL_DOCUMENT_ROOT."/lib/admin.lib.php");
$langs->load("admin"); $langs->load("admin");
if (!$user->admin) if (!$user->admin) accessforbidden();
accessforbidden();
$action = GETPOST("action");
$action = getpost("action");
/* /*
* Actions * Actions
*/ */
if ($action == 'setvalue' && $user->admin) if ($action == 'setvalue' && $user->admin)
{ {
$result=dolibarr_set_const($db, "CLICKTODIAL_URL",GETPOST("url"),'chaine',0,'',$conf->entity); $result=dolibarr_set_const($db, "CLICKTODIAL_URL",GETPOST("url"),'chaine',0,'',$conf->entity);
if ($result >= 0) if ($result >= 0)
{ {
$mesg = "<font class=\"ok\">".$langs->trans("SetupSaved")."</font>"; $mesg = "<font class=\"ok\">".$langs->trans("SetupSaved")."</font>";
} }
else else
{ {
$mesg = "<font class=\"error\">".$langs->trans("Error")."</font>"; $mesg = "<font class=\"error\">".$langs->trans("Error")."</font>";
} }
} }
@ -87,11 +87,11 @@ print '<tr><td colspan="3" align="center"><br><input type="submit" class="button
print '</table></form>'; print '</table></form>';
/*if (! empty($conf->global->CLICKTODIAL_URL)) /*if (! empty($conf->global->CLICKTODIAL_URL))
{ {
print $langs->trans("Test"); print $langs->trans("Test");
// Add a phone number to test // Add a phone number to test
} }
*/ */
dol_htmloutput_mesg($mesg); dol_htmloutput_mesg($mesg);

View File

@ -28,8 +28,7 @@ require_once(DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php');
$langs->load("admin"); $langs->load("admin");
$langs->load("errors"); $langs->load("errors");
if (!$user->admin) if (!$user->admin) accessforbidden();
accessforbidden();
$action = GETPOST("action"); $action = GETPOST("action");
$value = GETPOST("value"); $value = GETPOST("value");
@ -46,13 +45,13 @@ if (empty($conf->global->CONTRACT_ADDON))
if ($action == 'updateMask') if ($action == 'updateMask')
{ {
$maskconst=$_POST['maskconstcontract']; $maskconst=$_POST['maskconstcontract'];
$maskvalue=$_POST['maskcontract']; $maskvalue=$_POST['maskcontract'];
if ($maskconst) $res = dolibarr_set_const($db,$maskconst,$maskvalue,'chaine',0,'',$conf->entity); if ($maskconst) $res = dolibarr_set_const($db,$maskconst,$maskvalue,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++; if (! $res > 0) $error++;
if (! $error) if (! $error)
{ {
$mesg = "<font class=\"ok\">".$langs->trans("SetupSaved")."</font>"; $mesg = "<font class=\"ok\">".$langs->trans("SetupSaved")."</font>";
} }
@ -64,16 +63,16 @@ if ($action == 'updateMask')
if ($action == 'setmod') if ($action == 'setmod')
{ {
dolibarr_set_const($db, "CONTRACT_ADDON",$value,'chaine',0,'',$conf->entity); dolibarr_set_const($db, "CONTRACT_ADDON",$value,'chaine',0,'',$conf->entity);
} }
/* /*
// constants of magre model // constants of magre model
if ($action == 'updateMatrice') dolibarr_set_const($db, "CONTRACT_NUM_MATRICE",$_POST["matrice"],'chaine',0,'',$conf->entity); if ($action == 'updateMatrice') dolibarr_set_const($db, "CONTRACT_NUM_MATRICE",$_POST["matrice"],'chaine',0,'',$conf->entity);
if ($action == 'updatePrefix') dolibarr_set_const($db, "CONTRACT_NUM_PREFIX",$_POST["prefix"],'chaine',0,'',$conf->entity); if ($action == 'updatePrefix') dolibarr_set_const($db, "CONTRACT_NUM_PREFIX",$_POST["prefix"],'chaine',0,'',$conf->entity);
if ($action == 'setOffset') dolibarr_set_const($db, "CONTRACT_NUM_DELTA",$_POST["offset"],'chaine',0,'',$conf->entity); if ($action == 'setOffset') dolibarr_set_const($db, "CONTRACT_NUM_DELTA",$_POST["offset"],'chaine',0,'',$conf->entity);
if ($action == 'setNumRestart') dolibarr_set_const($db, "CONTRACT_NUM_RESTART_BEGIN_YEAR",$_POST["numrestart"],'chaine',0,'',$conf->entity); if ($action == 'setNumRestart') dolibarr_set_const($db, "CONTRACT_NUM_RESTART_BEGIN_YEAR",$_POST["numrestart"],'chaine',0,'',$conf->entity);
*/ */
/* /*
* View * View
@ -106,29 +105,29 @@ $dir = "../includes/modules/contract/";
$handle = opendir($dir); $handle = opendir($dir);
if (is_resource($handle)) if (is_resource($handle))
{ {
$var=true; $var=true;
while (($file = readdir($handle))!==false) while (($file = readdir($handle))!==false)
{ {
if (substr($file, 0, 13) == 'mod_contract_' && substr($file, dol_strlen($file)-3, 3) == 'php') if (substr($file, 0, 13) == 'mod_contract_' && substr($file, dol_strlen($file)-3, 3) == 'php')
{ {
$file = substr($file, 0, dol_strlen($file)-4); $file = substr($file, 0, dol_strlen($file)-4);
require_once(DOL_DOCUMENT_ROOT ."/includes/modules/contract/".$file.".php"); require_once(DOL_DOCUMENT_ROOT ."/includes/modules/contract/".$file.".php");
$module = new $file; $module = new $file;
// Show modules according to features level // Show modules according to features level
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue; if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue; if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
if ($module->isEnabled()) if ($module->isEnabled())
{ {
$var=!$var; $var=!$var;
print '<tr '.$bc[$var].'><td>'.$module->nom."</td>\n"; print '<tr '.$bc[$var].'><td>'.$module->nom."</td>\n";
print '<td>'; print '<td>';
print $module->info(); print $module->info();
print '</td>'; print '</td>';
// Show example of numbering module // Show example of numbering module
print '<td nowrap="nowrap">'; print '<td nowrap="nowrap">';
@ -137,49 +136,49 @@ if (is_resource($handle))
else print $tmp; else print $tmp;
print '</td>'."\n"; print '</td>'."\n";
print '<td align="center">'; print '<td align="center">';
if ($conf->global->CONTRACT_ADDON == "$file") if ($conf->global->CONTRACT_ADDON == "$file")
{ {
print img_picto($langs->trans("Activated"),'switch_on'); print img_picto($langs->trans("Activated"),'switch_on');
} }
else else
{ {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&amp;value='.$file.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&amp;value='.$file.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">';
print img_picto($langs->trans("Disabled"),'switch_off'); print img_picto($langs->trans("Disabled"),'switch_off');
print '</a>'; print '</a>';
} }
print '</td>'; print '</td>';
$contract=new Contrat($db); $contract=new Contrat($db);
$contract->initAsSpecimen(); $contract->initAsSpecimen();
// Info // Info
$htmltooltip=''; $htmltooltip='';
$htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>'; $htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
$facture->type=0; $facture->type=0;
$nextval=$module->getNextValue($mysoc,$contract); $nextval=$module->getNextValue($mysoc,$contract);
if ("$nextval" != $langs->trans("NotAvailable")) // Keep " on nextval if ("$nextval" != $langs->trans("NotAvailable")) // Keep " on nextval
{ {
$htmltooltip.=''.$langs->trans("NextValue").': '; $htmltooltip.=''.$langs->trans("NextValue").': ';
if ($nextval) if ($nextval)
{ {
$htmltooltip.=$nextval.'<br>'; $htmltooltip.=$nextval.'<br>';
} }
else else
{ {
$htmltooltip.=$langs->trans($module->error).'<br>'; $htmltooltip.=$langs->trans($module->error).'<br>';
} }
} }
print '<td align="center">'; print '<td align="center">';
print $html->textwithpicto('',$htmltooltip,1,0); print $html->textwithpicto('',$htmltooltip,1,0);
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
} }
} }
} }
closedir($handle); closedir($handle);
} }
print '</table><br>'; print '</table><br>';

View File

@ -27,53 +27,53 @@ require_once(DOL_DOCUMENT_ROOT."/compta/dons/class/don.class.php");
$langs->load("admin"); $langs->load("admin");
$langs->load("donations"); $langs->load("donations");
if (!$user->admin) if (!$user->admin) accessforbidden();
accessforbidden();
$typeconst=array('yesno','texte','chaine'); $typeconst=array('yesno','texte','chaine');
/* /*
* Action * Action
*/ */
if ($_GET["action"] == 'specimen') if ($_GET["action"] == 'specimen')
{ {
$modele=$_GET["module"]; $modele=$_GET["module"];
$don = new Don($db); $don = new Don($db);
$don->initAsSpecimen(); $don->initAsSpecimen();
// Charge le modele // Charge le modele
$dir = DOL_DOCUMENT_ROOT . "/includes/modules/dons/"; $dir = DOL_DOCUMENT_ROOT . "/includes/modules/dons/";
$file = $modele.".modules.php"; $file = $modele.".modules.php";
if (file_exists($dir.$file)) if (file_exists($dir.$file))
{ {
$classname = $modele; $classname = $modele;
require_once($dir.$file); require_once($dir.$file);
$obj = new $classname($db); $obj = new $classname($db);
if ($obj->write_file($don,$langs) > 0) if ($obj->write_file($don,$langs) > 0)
{ {
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=donation&file=SPECIMEN.html"); header("Location: ".DOL_URL_ROOT."/document.php?modulepart=donation&file=SPECIMEN.html");
return; return;
} }
else else
{ {
$mesg='<div class="error">'.$obj->error.'</div>'; $mesg='<div class="error">'.$obj->error.'</div>';
dol_syslog($obj->error, LOG_ERR); dol_syslog($obj->error, LOG_ERR);
} }
} }
else else
{ {
$mesg='<div class="error">'.$langs->trans("ErrorModuleNotFound").'</div>'; $mesg='<div class="error">'.$langs->trans("ErrorModuleNotFound").'</div>';
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
} }
} }
if ($_GET["action"] == 'setdoc') if ($_GET["action"] == 'setdoc')
{ {
$db->begin(); $db->begin();
if (dolibarr_set_const($db, "DON_ADDON_MODEL",$_GET["value"],'chaine',0,'',$conf->entity)) if (dolibarr_set_const($db, "DON_ADDON_MODEL",$_GET["value"],'chaine',0,'',$conf->entity))
{ {
@ -94,17 +94,17 @@ if ($_GET["action"] == 'setdoc')
$result2=$db->query($sql); $result2=$db->query($sql);
if ($result1 && $result2) if ($result1 && $result2)
{ {
$db->commit(); $db->commit();
} }
else else
{ {
$db->rollback(); $db->rollback();
} }
} }
if ($_GET["action"] == 'set') if ($_GET["action"] == 'set')
{ {
$type='donation'; $type='donation';
$sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity, libelle, description)"; $sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity, libelle, description)";
$sql.= " VALUES ('".$db->escape($_GET["value"])."','".$type."',".$conf->entity.", "; $sql.= " VALUES ('".$db->escape($_GET["value"])."','".$type."',".$conf->entity.", ";
$sql.= ($_GET["label"]?"'".$db->escape($_GET["label"])."'":'null').", "; $sql.= ($_GET["label"]?"'".$db->escape($_GET["label"])."'":'null').", ";
@ -148,18 +148,18 @@ $sql.= " WHERE type = '".$type."'";
$resql=$db->query($sql); $resql=$db->query($sql);
if ($resql) if ($resql)
{ {
$i = 0; $i = 0;
$num_rows=$db->num_rows($resql); $num_rows=$db->num_rows($resql);
while ($i < $num_rows) while ($i < $num_rows)
{ {
$array = $db->fetch_array($resql); $array = $db->fetch_array($resql);
array_push($def, $array[0]); array_push($def, $array[0]);
$i++; $i++;
} }
} }
else else
{ {
dol_print_error($db); dol_print_error($db);
} }
print '<table class="noborder" width=\"100%\">'; print '<table class="noborder" width=\"100%\">';
@ -186,74 +186,74 @@ if (is_resource($handle))
$name = substr($file, 0, dol_strlen($file) -12); $name = substr($file, 0, dol_strlen($file) -12);
$classname = substr($file, 0, dol_strlen($file) -12); $classname = substr($file, 0, dol_strlen($file) -12);
require_once($dir.'/'.$file); require_once($dir.'/'.$file);
$module=new $classname($db); $module=new $classname($db);
// Show modules according to features level // Show modules according to features level
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue; if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue; if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
if ($module->isEnabled()) if ($module->isEnabled())
{ {
print '<tr '.$bc[$var].'><td width=\"100\">'; print '<tr '.$bc[$var].'><td width=\"100\">';
echo $module->name; echo $module->name;
print '</td>'; print '</td>';
print '<td>'; print '<td>';
print $module->description; print $module->description;
print '</td>'; print '</td>';
// Active // Active
if (in_array($name, $def)) if (in_array($name, $def))
{ {
print "<td align=\"center\">\n"; print "<td align=\"center\">\n";
if ($conf->global->DON_ADDON_MODEL == $name) if ($conf->global->DON_ADDON_MODEL == $name)
{ {
print img_picto($langs->trans("Enabled"),'on'); print img_picto($langs->trans("Enabled"),'on');
} }
else else
{ {
print '&nbsp;'; print '&nbsp;';
print '</td><td align="center">'; print '</td><td align="center">';
print '<a href="dons.php?action=setdoc&value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Enabled"),'on').'</a>'; print '<a href="dons.php?action=setdoc&value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Enabled"),'on').'</a>';
} }
print '</td>'; print '</td>';
} }
else else
{ {
print "<td align=\"center\">\n"; print "<td align=\"center\">\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
print "</td>"; print "</td>";
} }
// Defaut // Defaut
print "<td align=\"center\">"; print "<td align=\"center\">";
if ($conf->global->DON_ADDON_MODEL == "$name") if ($conf->global->DON_ADDON_MODEL == "$name")
{ {
print img_picto($langs->trans("Default"),'on'); print img_picto($langs->trans("Default"),'on');
} }
else else
{ {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
} }
print '</td>'; print '</td>';
// Info // Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name; $htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); $htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
if ($module->type == 'pdf') if ($module->type == 'pdf')
{ {
$htmltooltip.='<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur; $htmltooltip.='<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
} }
$htmltooltip.='<br><br><u>'.$langs->trans("FeaturesSupported").':</u>'; $htmltooltip.='<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
$htmltooltip.='<br>'.$langs->trans("Logo").': '.yn($module->option_logo,1,1); $htmltooltip.='<br>'.$langs->trans("Logo").': '.yn($module->option_logo,1,1);
$htmltooltip.='<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang,1,1); $htmltooltip.='<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang,1,1);
$text='<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'" target="specimen">'.img_object($langs->trans("Preview"),'generic').'</a>'; $text='<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'" target="specimen">'.img_object($langs->trans("Preview"),'generic').'</a>';
print '<td align="center">'; print '<td align="center">';
print $html->textwithpicto(' &nbsp; '.$text,$htmltooltip,-1,0); print $html->textwithpicto(' &nbsp; '.$text,$htmltooltip,-1,0);
print '</td>'; print '</td>';
print "</tr>\n"; print "</tr>\n";
} }
} }
} }
closedir($handle); closedir($handle);

View File

@ -30,8 +30,7 @@ require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
$langs->load("admin"); $langs->load("admin");
$langs->load("fckeditor"); $langs->load("fckeditor");
if (!$user->admin) if (!$user->admin) accessforbidden();
accessforbidden();
// Constante et traduction de la description du module // Constante et traduction de la description du module
$modules = array( $modules = array(
@ -67,26 +66,25 @@ $picto = array(
* Actions * Actions
*/ */
foreach($modules as $const => $desc) foreach($modules as $const => $desc)
{ {
if ($_GET["action"] == 'activate_'.strtolower($const)) if ($_GET["action"] == 'activate_'.strtolower($const))
{ {
dolibarr_set_const($db, "FCKEDITOR_ENABLE_".$const, "1",'chaine',0,'',$conf->entity); dolibarr_set_const($db, "FCKEDITOR_ENABLE_".$const, "1",'chaine',0,'',$conf->entity);
// Si fckeditor est active dans la description produit/service, on l'active dans les formulaires // Si fckeditor est active dans la description produit/service, on l'active dans les formulaires
if ($const == 'PRODUCTDESC' && $conf->global->PRODUIT_DESC_IN_FORM) if ($const == 'PRODUCTDESC' && $conf->global->PRODUIT_DESC_IN_FORM)
{ {
dolibarr_set_const($db, "FCKEDITOR_ENABLE_DETAILS", "1",'chaine',0,'',$conf->entity); dolibarr_set_const($db, "FCKEDITOR_ENABLE_DETAILS", "1",'chaine',0,'',$conf->entity);
} }
Header("Location: ".$_SERVER["PHP_SELF"]); Header("Location: ".$_SERVER["PHP_SELF"]);
exit; exit;
} }
if ($_GET["action"] == 'disable_'.strtolower($const)) if ($_GET["action"] == 'disable_'.strtolower($const))
{ {
dolibarr_del_const($db, "FCKEDITOR_ENABLE_".$const,$conf->entity); dolibarr_del_const($db, "FCKEDITOR_ENABLE_".$const,$conf->entity);
Header("Location: ".$_SERVER["PHP_SELF"]); Header("Location: ".$_SERVER["PHP_SELF"]);
exit; exit;
} }
} }
if ($_POST["save"]) if ($_POST["save"])
@ -118,34 +116,34 @@ print "</tr>\n";
// Modules // Modules
foreach($modules as $const => $desc) foreach($modules as $const => $desc)
{ {
// Si condition non remplie, on ne propose pas l'option // Si condition non remplie, on ne propose pas l'option
if (! $conditions[$const]) continue; if (! $conditions[$const]) continue;
$var=!$var; $var=!$var;
print "<tr ".$bc[$var].">"; print "<tr ".$bc[$var].">";
print '<td width="16">'.img_object("",$picto[$const]).'</td>'; print '<td width="16">'.img_object("",$picto[$const]).'</td>';
print '<td>'.$langs->trans($desc).'</td>'; print '<td>'.$langs->trans($desc).'</td>';
print '<td align="center" width="20">'; print '<td align="center" width="20">';
$constante = 'FCKEDITOR_ENABLE_'.$const; $constante = 'FCKEDITOR_ENABLE_'.$const;
$value = $conf->global->$constante; $value = $conf->global->$constante;
print $value == 1 ? img_picto($langs->trans("Active"),'tick') : '&nbsp;'; print $value == 1 ? img_picto($langs->trans("Active"),'tick') : '&nbsp;';
print '</td>'; print '</td>';
print '<td align="center" width="100">'; print '<td align="center" width="100">';
if($value == 0) if($value == 0)
{ {
print '<a href="fckeditor.php?action=activate_'.strtolower($const).'">'.$langs->trans("Activate").'</a>'; print '<a href="fckeditor.php?action=activate_'.strtolower($const).'">'.$langs->trans("Activate").'</a>';
} }
else if($value == 1) else if($value == 1)
{ {
print '<a href="fckeditor.php?action=disable_'.strtolower($const).'">'.$langs->trans("Disable").'</a>'; print '<a href="fckeditor.php?action=disable_'.strtolower($const).'">'.$langs->trans("Disable").'</a>';
} }
print "</td>"; print "</td>";
print '</tr>'; print '</tr>';
} }
print '</table>'."\n"; print '</table>'."\n";
@ -162,11 +160,11 @@ print '<center><br><input class="button" type="submit" name="save" value="'.$lan
print '</form>'."\n"; print '</form>'."\n";
/* /*
print '<!-- Result -->'; print '<!-- Result -->';
print $_POST["formtestfield"]; print $_POST["formtestfield"];
print '<!-- Result -->'; print '<!-- Result -->';
print $conf->global->FCKEDITOR_TEST; print $conf->global->FCKEDITOR_TEST;
*/ */
$db->close(); $db->close();

View File

@ -48,7 +48,7 @@ $value = GETPOST("value");
if ($action == 'updateMask') if ($action == 'updateMask')
{ {
$maskconst=GETPOST("maskconst"); $maskconst=GETPOST("maskconst");
$maskvalue=getpost("maskvalue"); $maskvalue=GETPOST("maskvalue");
if ($maskconst) $res = dolibarr_set_const($db,$maskconst,$maskvalue,'chaine',0,'',$conf->entity); if ($maskconst) $res = dolibarr_set_const($db,$maskconst,$maskvalue,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++; if (! $res > 0) $error++;

View File

@ -42,7 +42,7 @@ if ($action == 'set')
{ {
$error=0; $error=0;
$gimcdf= getpost("GEOIPMAXMIND_COUNTRY_DATAFILE"); $gimcdf= GETPOST("GEOIPMAXMIND_COUNTRY_DATAFILE");
if (! $gimcdf && ! file_exists($gimcdf)) if (! $gimcdf && ! file_exists($gimcdf))
{ {

View File

@ -30,10 +30,13 @@ $langs->load("admin");
$langs->load("users"); $langs->load("users");
$langs->load("other"); $langs->load("other");
if (!$user->admin) if (!$user->admin) accessforbidden();
accessforbidden();
/*
* Actions
*/
if ($_GET["action"] == 'add') if ($_GET["action"] == 'add')
{ {
$sql = "UPDATE ".MAIN_DB_PREFIX."rights_def SET bydefault=1"; $sql = "UPDATE ".MAIN_DB_PREFIX."rights_def SET bydefault=1";
@ -79,56 +82,56 @@ $modulesdir = array();
foreach ($conf->file->dol_document_root as $type => $dirroot) foreach ($conf->file->dol_document_root as $type => $dirroot)
{ {
$modulesdir[] = $dirroot . "/includes/modules/"; $modulesdir[] = $dirroot . "/includes/modules/";
if ($type == 'alt') if ($type == 'alt')
{ {
$handle=@opendir($dirroot); $handle=@opendir($dirroot);
if (is_resource($handle)) if (is_resource($handle))
{ {
while (($file = readdir($handle))!==false) while (($file = readdir($handle))!==false)
{ {
if (is_dir($dirroot.'/'.$file) && substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS' && $file != 'includes') if (is_dir($dirroot.'/'.$file) && substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS' && $file != 'includes')
{ {
if (is_dir($dirroot . '/' . $file . '/includes/modules/')) if (is_dir($dirroot . '/' . $file . '/includes/modules/'))
{ {
$modulesdir[] = $dirroot . '/' . $file . '/includes/modules/'; $modulesdir[] = $dirroot . '/' . $file . '/includes/modules/';
} }
} }
} }
closedir($handle); closedir($handle);
} }
} }
} }
foreach ($modulesdir as $dir) foreach ($modulesdir as $dir)
{ {
// Load modules attributes in arrays (name, numero, orders) from dir directory // Load modules attributes in arrays (name, numero, orders) from dir directory
//print $dir."\n<br>"; //print $dir."\n<br>";
$handle=@opendir($dir); $handle=@opendir($dir);
if (is_resource($handle)) if (is_resource($handle))
{ {
while (($file = readdir($handle))!==false) while (($file = readdir($handle))!==false)
{ {
if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, dol_strlen($file) - 10) == '.class.php') if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, dol_strlen($file) - 10) == '.class.php')
{ {
$modName = substr($file, 0, dol_strlen($file) - 10); $modName = substr($file, 0, dol_strlen($file) - 10);
if ($modName) if ($modName)
{ {
include_once($dir."/".$file); include_once($dir."/".$file);
$objMod = new $modName($db); $objMod = new $modName($db);
if ($objMod->rights_class) { if ($objMod->rights_class) {
$ret=$objMod->insert_permissions(0); $ret=$objMod->insert_permissions(0);
$modules[$objMod->rights_class]=$objMod; $modules[$objMod->rights_class]=$objMod;
//print "modules[".$objMod->rights_class."]=$objMod;"; //print "modules[".$objMod->rights_class."]=$objMod;";
} }
} }
} }
} }
} }
} }
$db->commit(); $db->commit();

View File

@ -33,74 +33,79 @@ $langs->load("admin");
$langs->load("withdrawals"); $langs->load("withdrawals");
// Security check // Security check
if (!$user->admin) if (!$user->admin) accessforbidden();
accessforbidden();
$action = GETPOST("action"); $action = GETPOST("action");
/*
* Actions
*/
if ($action == "set") if ($action == "set")
{ {
$db->begin(); $db->begin();
for ($i = 0 ; $i < 2 ; $i++) for ($i = 0 ; $i < 2 ; $i++)
{
$res = dolibarr_set_const($db, $_POST["nom$i"], $_POST["value$i"],'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
}
$id=$_POST["PRELEVEMENT_ID_BANKACCOUNT"];
$account = new Account($db, $id);
if($account->fetch($id)>0)
{
$res = dolibarr_set_const($db, "PRELEVEMENT_ID_BANKACCOUNT", $id,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
$res = dolibarr_set_const($db, "PRELEVEMENT_CODE_BANQUE", $account->code_banque,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
$res = dolibarr_set_const($db, "PRELEVEMENT_CODE_GUICHET", $account->code_guichet,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
$res = dolibarr_set_const($db, "PRELEVEMENT_NUMERO_COMPTE", $account->number,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
$res = dolibarr_set_const($db, "PRELEVEMENT_NUMBER_KEY", $account->cle_rib,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
$res = dolibarr_set_const($db, "PRELEVEMENT_IBAN", $account->iban,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
$res = dolibarr_set_const($db, "PRELEVEMENT_BIC", $account->bic,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
$res = dolibarr_set_const($db, "PRELEVEMENT_RAISON_SOCIALE", $account->proprio,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
}
else $error++;
if (! $error)
{ {
$db->commit(); $res = dolibarr_set_const($db, $_POST["nom$i"], $_POST["value$i"],'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
}
$id=$_POST["PRELEVEMENT_ID_BANKACCOUNT"];
$account = new Account($db, $id);
if($account->fetch($id)>0)
{
$res = dolibarr_set_const($db, "PRELEVEMENT_ID_BANKACCOUNT", $id,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
$res = dolibarr_set_const($db, "PRELEVEMENT_CODE_BANQUE", $account->code_banque,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
$res = dolibarr_set_const($db, "PRELEVEMENT_CODE_GUICHET", $account->code_guichet,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
$res = dolibarr_set_const($db, "PRELEVEMENT_NUMERO_COMPTE", $account->number,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
$res = dolibarr_set_const($db, "PRELEVEMENT_NUMBER_KEY", $account->cle_rib,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
$res = dolibarr_set_const($db, "PRELEVEMENT_IBAN", $account->iban,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
$res = dolibarr_set_const($db, "PRELEVEMENT_BIC", $account->bic,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
$res = dolibarr_set_const($db, "PRELEVEMENT_RAISON_SOCIALE", $account->proprio,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
}
else $error++;
if (! $error)
{
$db->commit();
$mesg = "<font class=\"ok\">".$langs->trans("SetupSaved")."</font>"; $mesg = "<font class=\"ok\">".$langs->trans("SetupSaved")."</font>";
} }
else else
{ {
$db->rollback(); $db->rollback();
$mesg = "<font class=\"error\">".$langs->trans("Error")."</font>"; $mesg = "<font class=\"error\">".$langs->trans("Error")."</font>";
} }
} }
if ($action == "addnotif") if ($action == "addnotif")
{ {
$bon = new BonPrelevement($db); $bon = new BonPrelevement($db);
$bon->AddNotification($db,$_POST["user"],$_POST["action"]); $bon->AddNotification($db,$_POST["user"],$_POST["action"]);
Header("Location: prelevement.php"); Header("Location: prelevement.php");
exit; exit;
} }
if ($action == "deletenotif") if ($action == "deletenotif")
{ {
$bon = new BonPrelevement($db); $bon = new BonPrelevement($db);
$bon->DeleteNotificationById($_GET["notif"]); $bon->DeleteNotificationById($_GET["notif"]);
Header("Location: prelevement.php"); Header("Location: prelevement.php");
exit; exit;
} }
/* /*
* View * View
*/ */
@ -157,35 +162,35 @@ print '<br>';
if ($conf->global->MAIN_MODULE_NOTIFICATION) if ($conf->global->MAIN_MODULE_NOTIFICATION)
{ {
$langs->load("mails"); $langs->load("mails");
print_titre($langs->trans("Notifications")); print_titre($langs->trans("Notifications"));
$sql = "SELECT rowid, name, firstname, fk_societe, email"; $sql = "SELECT rowid, name, firstname, fk_societe, email";
$sql.= " FROM ".MAIN_DB_PREFIX."user"; $sql.= " FROM ".MAIN_DB_PREFIX."user";
$sql.= " WHERE entity IN (0,".$conf->entity.")"; $sql.= " WHERE entity IN (0,".$conf->entity.")";
$resql=$db->query($sql); $resql=$db->query($sql);
if ($resql) if ($resql)
{ {
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
$var = true; $var = true;
$i = 0; $i = 0;
while ($i < $num) while ($i < $num)
{ {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
$var=!$var; $var=!$var;
if (!$obj->fk_societe) if (!$obj->fk_societe)
{ {
$username= $obj->firstname.' '.$obj->name; $username= $obj->firstname.' '.$obj->name;
$internalusers[$obj->rowid] = $username; $internalusers[$obj->rowid] = $username;
} }
$i++; $i++;
} }
$db->free($resql); $db->free($resql);
} }
$sql = "SELECT rowid, code, label"; $sql = "SELECT rowid, code, label";
$sql.= " FROM ".MAIN_DB_PREFIX."c_action_trigger"; $sql.= " FROM ".MAIN_DB_PREFIX."c_action_trigger";
$sql.= " WHERE elementtype = 'withdraw'"; $sql.= " WHERE elementtype = 'withdraw'";
$sql.= " ORDER BY rang ASC"; $sql.= " ORDER BY rang ASC";
@ -207,24 +212,24 @@ if ($conf->global->MAIN_MODULE_NOTIFICATION)
} }
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?action=addnotif">'; print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?action=addnotif">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td>'.$langs->trans("User").'</td>'; print '<td>'.$langs->trans("User").'</td>';
print '<td>'.$langs->trans("Value").'</td>'; print '<td>'.$langs->trans("Value").'</td>';
print '<td align="right">'.$langs->trans("Action").'</td>'; print '<td align="right">'.$langs->trans("Action").'</td>';
print "</tr>\n"; print "</tr>\n";
print '<tr class="impair"><td align="left">'; print '<tr class="impair"><td align="left">';
print $html->selectarray('user',$internalusers);// select_users(0,'user',0); print $html->selectarray('user',$internalusers);// select_users(0,'user',0);
print '</td>'; print '</td>';
print '<td>'; print '<td>';
print $html->selectarray('action',$actions);// select_users(0,'user',0); print $html->selectarray('action',$actions);// select_users(0,'user',0);
print '</td>'; print '</td>';
print '<td align="right"><input type="submit" class="button" value="'.$langs->trans("Add").'"></td></tr>'; print '<td align="right"><input type="submit" class="button" value="'.$langs->trans("Add").'"></td></tr>';
} }
// List of current notifications for objet_type='withdraw' // List of current notifications for objet_type='withdraw'
$sql = "SELECT u.name, u.firstname"; $sql = "SELECT u.name, u.firstname";
@ -239,23 +244,23 @@ $sql.= " AND u.entity IN (0,".$conf->entity.")";
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql)
{ {
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
$i = 0; $i = 0;
$var = false; $var = false;
while ($i < $num) while ($i < $num)
{ {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
$var=!$var; $var=!$var;
print "<tr $bc[$var]>"; print "<tr $bc[$var]>";
print '<td>'.$obj->firstname." ".$obj->name.'</td>'; print '<td>'.$obj->firstname." ".$obj->name.'</td>';
$label=($langs->trans("Notify_".$obj->code)!="Notify_".$obj->code?$langs->trans("Notify_".$obj->code):$obj->label); $label=($langs->trans("Notify_".$obj->code)!="Notify_".$obj->code?$langs->trans("Notify_".$obj->code):$obj->label);
print '<td>'.$label.'</td>'; print '<td>'.$label.'</td>';
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=deletenotif&amp;notif='.$obj->rowid.'">'.img_delete().'</a></td>'; print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=deletenotif&amp;notif='.$obj->rowid.'">'.img_delete().'</a></td>';
print '</tr>'; print '</tr>';
$i++; $i++;
} }
$db->free($resql); $db->free($resql);
} }
print '</table>'; print '</table>';

View File

@ -41,96 +41,96 @@ $upload_dir=$conf->admin->dir_temp;
if ($_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC)) if ($_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
{ {
require_once(DOL_DOCUMENT_ROOT."/lib/files.lib.php"); require_once(DOL_DOCUMENT_ROOT."/lib/files.lib.php");
$result=create_exdir($upload_dir); // Create dir if not exists $result=create_exdir($upload_dir); // Create dir if not exists
if ($result >= 0) if ($result >= 0)
{ {
$resupload=dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $upload_dir . "/" . $_FILES['userfile']['name'],1,0,$_FILES['userfile']['error']); $resupload=dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $upload_dir . "/" . $_FILES['userfile']['name'],1,0,$_FILES['userfile']['error']);
if (is_numeric($resupload) && $resupload > 0) if (is_numeric($resupload) && $resupload > 0)
{ {
$mesg = '<div class="ok">'.$langs->trans("FileTransferComplete").'</div>'; $mesg = '<div class="ok">'.$langs->trans("FileTransferComplete").'</div>';
include_once(DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'); include_once(DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php');
$formmail = new FormMail($db); $formmail = new FormMail($db);
$formmail->add_attached_files($upload_dir . "/" . $_FILES['addedfile']['name'],$_FILES['addedfile']['name'],$_FILES['addedfile']['type']); $formmail->add_attached_files($upload_dir . "/" . $_FILES['addedfile']['name'],$_FILES['addedfile']['name'],$_FILES['addedfile']['type']);
} }
else else
{ {
$langs->load("errors"); $langs->load("errors");
if ($resupload < 0) // Unknown error if ($resupload < 0) // Unknown error
{ {
$mesg = '<div class="error">'.$langs->trans("ErrorFileNotUploaded").'</div>'; $mesg = '<div class="error">'.$langs->trans("ErrorFileNotUploaded").'</div>';
} }
else if (preg_match('/ErrorFileIsInfectedWithAVirus.(.*)/',$resupload,$reg)) // Files infected by a virus else if (preg_match('/ErrorFileIsInfectedWithAVirus.(.*)/',$resupload,$reg)) // Files infected by a virus
{ {
$mesg = '<div class="error">'.$langs->trans("ErrorFileIsInfectedWithAVirus"); $mesg = '<div class="error">'.$langs->trans("ErrorFileIsInfectedWithAVirus");
$mesg.= '<br>'.$langs->trans("Information").': '.$langs->trans($reg[1]); $mesg.= '<br>'.$langs->trans("Information").': '.$langs->trans($reg[1]);
$mesg.= '</div>'; $mesg.= '</div>';
} }
else // Known error else // Known error
{ {
$mesg = '<div class="error">'.$langs->trans($resupload).'</div>'; $mesg = '<div class="error">'.$langs->trans($resupload).'</div>';
} }
} }
} }
} }
if ($_GET["action"] == 'activate_captcha') if ($_GET["action"] == 'activate_captcha')
{ {
dolibarr_set_const($db, "MAIN_SECURITY_ENABLECAPTCHA", '1','chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_SECURITY_ENABLECAPTCHA", '1','chaine',0,'',$conf->entity);
Header("Location: security_other.php"); Header("Location: security_other.php");
exit; exit;
} }
else if ($_GET["action"] == 'disable_captcha') else if ($_GET["action"] == 'disable_captcha')
{ {
dolibarr_del_const($db, "MAIN_SECURITY_ENABLECAPTCHA",$conf->entity); dolibarr_del_const($db, "MAIN_SECURITY_ENABLECAPTCHA",$conf->entity);
Header("Location: security_other.php"); Header("Location: security_other.php");
exit; exit;
} }
if ($_GET["action"] == 'activate_advancedperms') if ($_GET["action"] == 'activate_advancedperms')
{ {
dolibarr_set_const($db, "MAIN_USE_ADVANCED_PERMS", '1','chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_USE_ADVANCED_PERMS", '1','chaine',0,'',$conf->entity);
Header("Location: security_other.php"); Header("Location: security_other.php");
exit; exit;
} }
else if ($_GET["action"] == 'disable_advancedperms') else if ($_GET["action"] == 'disable_advancedperms')
{ {
dolibarr_del_const($db, "MAIN_USE_ADVANCED_PERMS",$conf->entity); dolibarr_del_const($db, "MAIN_USE_ADVANCED_PERMS",$conf->entity);
Header("Location: security_other.php"); Header("Location: security_other.php");
exit; exit;
} }
if ($_GET["action"] == 'MAIN_SESSION_TIMEOUT') if ($_GET["action"] == 'MAIN_SESSION_TIMEOUT')
{ {
if (! dolibarr_set_const($db, "MAIN_SESSION_TIMEOUT", $_POST["MAIN_SESSION_TIMEOUT"],'chaine',0,'',$conf->entity)) dol_print_error($db); if (! dolibarr_set_const($db, "MAIN_SESSION_TIMEOUT", $_POST["MAIN_SESSION_TIMEOUT"],'chaine',0,'',$conf->entity)) dol_print_error($db);
else $mesg=$langs->trans("RecordModifiedSuccessfully"); else $mesg=$langs->trans("RecordModifiedSuccessfully");
} }
if ($_GET["action"] == 'MAIN_UPLOAD_DOC') if ($_GET["action"] == 'MAIN_UPLOAD_DOC')
{ {
if (! dolibarr_set_const($db, 'MAIN_UPLOAD_DOC',$_POST["MAIN_UPLOAD_DOC"],'chaine',0,'',$conf->entity)) dol_print_error($db); if (! dolibarr_set_const($db, 'MAIN_UPLOAD_DOC',$_POST["MAIN_UPLOAD_DOC"],'chaine',0,'',$conf->entity)) dol_print_error($db);
else $mesg=$langs->trans("RecordModifiedSuccessfully"); else $mesg=$langs->trans("RecordModifiedSuccessfully");
} }
if ($_GET["action"] == 'MAIN_UMASK') if ($_GET["action"] == 'MAIN_UMASK')
{ {
if (! dolibarr_set_const($db, "MAIN_UMASK", $_POST["MAIN_UMASK"],'chaine',0,'',$conf->entity)) dol_print_error($db); if (! dolibarr_set_const($db, "MAIN_UMASK", $_POST["MAIN_UMASK"],'chaine',0,'',$conf->entity)) dol_print_error($db);
else $mesg=$langs->trans("RecordModifiedSuccessfully"); else $mesg=$langs->trans("RecordModifiedSuccessfully");
} }
if ($_GET["action"] == 'MAIN_ANTIVIRUS_COMMAND') if ($_GET["action"] == 'MAIN_ANTIVIRUS_COMMAND')
{ {
if (! dolibarr_set_const($db, "MAIN_ANTIVIRUS_COMMAND", $_POST["MAIN_ANTIVIRUS_COMMAND"],'chaine',0,'',$conf->entity)) dol_print_error($db); if (! dolibarr_set_const($db, "MAIN_ANTIVIRUS_COMMAND", $_POST["MAIN_ANTIVIRUS_COMMAND"],'chaine',0,'',$conf->entity)) dol_print_error($db);
else $mesg=$langs->trans("RecordModifiedSuccessfully"); else $mesg=$langs->trans("RecordModifiedSuccessfully");
} }
if ($_GET["action"] == 'MAIN_ANTIVIRUS_PARAM') if ($_GET["action"] == 'MAIN_ANTIVIRUS_PARAM')
{ {
if (! dolibarr_set_const($db, "MAIN_ANTIVIRUS_PARAM", $_POST["MAIN_ANTIVIRUS_PARAM"],'chaine',0,'',$conf->entity)) dol_print_error($db); if (! dolibarr_set_const($db, "MAIN_ANTIVIRUS_PARAM", $_POST["MAIN_ANTIVIRUS_PARAM"],'chaine',0,'',$conf->entity)) dol_print_error($db);
else $mesg=$langs->trans("RecordModifiedSuccessfully"); else $mesg=$langs->trans("RecordModifiedSuccessfully");
} }
@ -199,20 +199,20 @@ print '<td colspan="3">'.$langs->trans("UseCaptchaCode").'</td>';
print '<td align="right">'; print '<td align="right">';
if (function_exists("imagecreatefrompng")) if (function_exists("imagecreatefrompng"))
{ {
if ($conf->global->MAIN_SECURITY_ENABLECAPTCHA == 0) if ($conf->global->MAIN_SECURITY_ENABLECAPTCHA == 0)
{ {
print '<a href="security_other.php?action=activate_captcha">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>'; print '<a href="security_other.php?action=activate_captcha">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
} }
if($conf->global->MAIN_SECURITY_ENABLECAPTCHA == 1) if($conf->global->MAIN_SECURITY_ENABLECAPTCHA == 1)
{ {
print '<a href="security_other.php?action=disable_captcha">'.img_picto($langs->trans("Enabled"),'switch_on').'</a>'; print '<a href="security_other.php?action=disable_captcha">'.img_picto($langs->trans("Enabled"),'switch_on').'</a>';
} }
} }
else else
{ {
$html = new Form($db); $html = new Form($db);
$desc = $html->textwithpicto('',$langs->transnoentities("EnableGDLibraryDesc"),1,'warning'); $desc = $html->textwithpicto('',$langs->transnoentities("EnableGDLibraryDesc"),1,'warning');
print $desc; print $desc;
} }
print "</td>"; print "</td>";
@ -226,11 +226,11 @@ print '<td colspan="3">'.$langs->trans("UseAdvancedPerms").'</td>';
print '<td align="right">'; print '<td align="right">';
if ($conf->global->MAIN_USE_ADVANCED_PERMS == 0) if ($conf->global->MAIN_USE_ADVANCED_PERMS == 0)
{ {
print '<a href="security_other.php?action=activate_advancedperms">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>'; print '<a href="security_other.php?action=activate_advancedperms">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
} }
if($conf->global->MAIN_USE_ADVANCED_PERMS == 1) if($conf->global->MAIN_USE_ADVANCED_PERMS == 1)
{ {
print '<a href="security_other.php?action=disable_advancedperms">'.img_picto($langs->trans("Enabled"),'switch_on').'</a>'; print '<a href="security_other.php?action=disable_advancedperms">'.img_picto($langs->trans("Enabled"),'switch_on').'</a>';
} }
print "</td>"; print "</td>";
@ -296,14 +296,14 @@ print '</td>';
print '<td>'; print '<td>';
if (ini_get('safe_mode') && ! empty($conf->global->MAIN_ANTIVIRUS_COMMAND)) if (ini_get('safe_mode') && ! empty($conf->global->MAIN_ANTIVIRUS_COMMAND))
{ {
$langs->load("errors"); $langs->load("errors");
$basedir=preg_replace('/"/','',dirname($conf->global->MAIN_ANTIVIRUS_COMMAND)); $basedir=preg_replace('/"/','',dirname($conf->global->MAIN_ANTIVIRUS_COMMAND));
$listdir=explode(';',ini_get('safe_mode_exec_dir')); $listdir=explode(';',ini_get('safe_mode_exec_dir'));
if (! in_array($basedir,$listdir)) if (! in_array($basedir,$listdir))
{ {
print img_warning($langs->trans('WarningSafeModeOnCheckExecDir')); print img_warning($langs->trans('WarningSafeModeOnCheckExecDir'));
dol_syslog("safe_mode is on, basedir is ".$basedir.", safe_mode_exec_dir is ".ini_get('safe_mode_exec_dir'), LOG_WARNING); dol_syslog("safe_mode is on, basedir is ".$basedir.", safe_mode_exec_dir is ".ini_get('safe_mode_exec_dir'), LOG_WARNING);
} }
} }
print '<input type="text" name="MAIN_ANTIVIRUS_COMMAND" size="72" value="'.htmlentities($conf->global->MAIN_ANTIVIRUS_COMMAND).'">'; print '<input type="text" name="MAIN_ANTIVIRUS_COMMAND" size="72" value="'.htmlentities($conf->global->MAIN_ANTIVIRUS_COMMAND).'">';
print "</td>"; print "</td>";

View File

@ -31,11 +31,10 @@ require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php");
$langs->load("admin"); $langs->load("admin");
if (!$user->admin) if (!$user->admin) accessforbidden();
accessforbidden();
$action=GETPOST("action"); $action=GETPOST("action");
$value = GETPOST("value"); $value=GETPOST("value");
/* /*

View File

@ -29,10 +29,9 @@ $langs->load("admin");
$langs->load("stocks"); $langs->load("stocks");
// Securit check // Securit check
if (!$user->admin) if (!$user->admin) accessforbidden();
accessforbidden();
$action = getpost("action"); $action = GETPOST("action");
/* /*

View File

@ -26,8 +26,7 @@
require("../main.inc.php"); require("../main.inc.php");
require_once(DOL_DOCUMENT_ROOT."/lib/admin.lib.php"); require_once(DOL_DOCUMENT_ROOT."/lib/admin.lib.php");
if (!$user->admin) if (!$user->admin) accessforbidden();
accessforbidden();
$langs->load("admin"); $langs->load("admin");
$langs->load("other"); $langs->load("other");
@ -37,6 +36,7 @@ $action = GETPOST("action");
/* /*
* Actions * Actions
*/ */
if ($action== 'setlevel') if ($action== 'setlevel')
{ {
$level = GETPOST("level"); $level = GETPOST("level");

View File

@ -29,8 +29,7 @@ require_once(DOL_DOCUMENT_ROOT."/lib/admin.lib.php");
$langs->load('admin'); $langs->load('admin');
if (!$user->admin) if (!$user->admin) accessforbidden();
accessforbidden();
$action = GETPOST("action"); $action = GETPOST("action");
@ -54,40 +53,40 @@ $tax_mode = empty($conf->global->TAX_MODE)?0:$conf->global->TAX_MODE;
if ($action == 'settaxmode') if ($action == 'settaxmode')
{ {
$tax_mode = GETPOST("tax_mode"); $tax_mode = GETPOST("tax_mode");
$db->begin(); $db->begin();
$res = dolibarr_set_const($db, 'TAX_MODE', $tax_mode,'chaine',0,'',$conf->entity); $res = dolibarr_set_const($db, 'TAX_MODE', $tax_mode,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++; if (! $res > 0) $error++;
switch ($tax_mode) switch ($tax_mode)
{
case 0:
$value = 'payment';
break;
case 1:
$value = 'invoice';
break;
}
$res = dolibarr_set_const($db, 'TAX_MODE_SELL_PRODUCT', 'invoice','chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
$res = dolibarr_set_const($db, 'TAX_MODE_BUY_PRODUCT', 'invoice','chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
$res = dolibarr_set_const($db, 'TAX_MODE_SELL_SERVICE', $value,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
$res = dolibarr_set_const($db, 'TAX_MODE_BUY_SERVICE', $value,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
if (! $error)
{ {
$db->commit(); case 0:
$value = 'payment';
break;
case 1:
$value = 'invoice';
break;
}
$res = dolibarr_set_const($db, 'TAX_MODE_SELL_PRODUCT', 'invoice','chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
$res = dolibarr_set_const($db, 'TAX_MODE_BUY_PRODUCT', 'invoice','chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
$res = dolibarr_set_const($db, 'TAX_MODE_SELL_SERVICE', $value,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
$res = dolibarr_set_const($db, 'TAX_MODE_BUY_SERVICE', $value,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
if (! $error)
{
$db->commit();
$mesg = "<font class=\"ok\">".$langs->trans("SetupSaved")."</font>"; $mesg = "<font class=\"ok\">".$langs->trans("SetupSaved")."</font>";
} }
else else
{ {
$db->rollback(); $db->rollback();
$mesg = "<font class=\"error\">".$langs->trans("Error")."</font>"; $mesg = "<font class=\"error\">".$langs->trans("Error")."</font>";
} }
@ -95,22 +94,22 @@ if ($action == 'settaxmode')
} }
/* /*
if ($_POST['action'] == 'update' || $_POST['action'] == 'add') 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)); if (! dolibarr_set_const($db, $_POST['constname'], $_POST['constvalue'], $typeconst[$_POST['consttype']], 0, isset($_POST['constnote']) ? $_POST['constnote'] : '',$conf->entity));
{ {
print $db->error(); print $db->error();
} }
} }
if ($_GET['action'] == 'delete') if ($_GET['action'] == 'delete')
{ {
if (! dolibarr_del_const($db, $_GET['constname'],$conf->entity)); if (! dolibarr_del_const($db, $_GET['constname'],$conf->entity));
{ {
print $db->error(); print $db->error();
} }
} }
*/ */
/* /*
@ -127,50 +126,50 @@ print_fiche_titre($langs->trans('TaxSetup'),$linkback,'setup');
print '<br>'; print '<br>';
if (empty($mysoc->tva_assuj)) if (empty($mysoc->tva_assuj))
{ {
print $langs->trans("YourCompanyDoesNotUseVAT").'<br>'; print $langs->trans("YourCompanyDoesNotUseVAT").'<br>';
} }
else else
{ {
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
// Cas des parametres TAX_MODE_SELL/BUY_SERVICE/PRODUCT // Cas des parametres TAX_MODE_SELL/BUY_SERVICE/PRODUCT
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">'; print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="settaxmode">'; print '<input type="hidden" name="action" value="settaxmode">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td>'.$langs->trans('OptionVatMode').'</td><td>'.$langs->trans('Description').'</td>'; print '<td>'.$langs->trans('OptionVatMode').'</td><td>'.$langs->trans('Description').'</td>';
print '<td align="right"><input class="button" type="submit" value="'.$langs->trans('Modify').'"></td>'; print '<td align="right"><input class="button" type="submit" value="'.$langs->trans('Modify').'"></td>';
print "</tr>\n"; print "</tr>\n";
print '<tr '.$bc[false].'><td width="200"><input type="radio" name="tax_mode" value="0"'.($tax_mode != 1 ? ' checked' : '').'> '.$langs->trans('OptionVATDefault').'</td>'; print '<tr '.$bc[false].'><td width="200"><input type="radio" name="tax_mode" value="0"'.($tax_mode != 1 ? ' checked' : '').'> '.$langs->trans('OptionVATDefault').'</td>';
print '<td colspan="2">'.nl2br($langs->trans('OptionVatDefaultDesc')); print '<td colspan="2">'.nl2br($langs->trans('OptionVatDefaultDesc'));
print "</td></tr>\n"; print "</td></tr>\n";
print '<tr '.$bc[true].'><td width="200"><input type="radio" name="tax_mode" value="1"'.($tax_mode == 1 ? ' checked' : '').'> '.$langs->trans('OptionVATDebitOption').'</td>'; print '<tr '.$bc[true].'><td width="200"><input type="radio" name="tax_mode" value="1"'.($tax_mode == 1 ? ' checked' : '').'> '.$langs->trans('OptionVATDebitOption').'</td>';
print '<td colspan="2">'.nl2br($langs->trans('OptionVatDebitOptionDesc'))."</td></tr>\n"; print '<td colspan="2">'.nl2br($langs->trans('OptionVatDebitOptionDesc'))."</td></tr>\n";
print '</form>'; print '</form>';
print "</table>\n"; print "</table>\n";
print '<br><br>'; print '<br><br>';
print_fiche_titre($langs->trans("SummaryOfVatExigibilityUsedByDefault"),'',''); print_fiche_titre($langs->trans("SummaryOfVatExigibilityUsedByDefault"),'','');
//print ' ('.$langs->trans("CanBeChangedWhenMakingInvoice").')'; //print ' ('.$langs->trans("CanBeChangedWhenMakingInvoice").')';
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
print '<tr><td>&nbsp;</td><td>'.$langs->trans("Buy").'</td><td>'.$langs->trans("Sell").'</td></tr>'; print '<tr><td>&nbsp;</td><td>'.$langs->trans("Buy").'</td><td>'.$langs->trans("Sell").'</td></tr>';
// Products // Products
print '<tr><td>'.$langs->trans("Product").'</td>'; print '<tr><td>'.$langs->trans("Product").'</td>';
print '<td>'; print '<td>';
print $langs->trans("OnDelivery"); print $langs->trans("OnDelivery");
print ' ('.$langs->trans("SupposedToBeInvoiceDate").')'; print ' ('.$langs->trans("SupposedToBeInvoiceDate").')';
print '</td>'; print '</td>';
print '<td>'; print '<td>';
print $langs->trans("OnDelivery"); print $langs->trans("OnDelivery");
print ' ('.$langs->trans("SupposedToBeInvoiceDate").')'; print ' ('.$langs->trans("SupposedToBeInvoiceDate").')';
print '</td></tr>'; print '</td></tr>';
// Services // Services
print '<tr><td>'.$langs->trans("Services").'</td>'; print '<tr><td>'.$langs->trans("Services").'</td>';
print '<td>'; print '<td>';
if ($tax_mode == 0) if ($tax_mode == 0)
{ {
print $langs->trans("OnPayment"); print $langs->trans("OnPayment");
@ -181,21 +180,21 @@ else
print $langs->trans("OnInvoice"); print $langs->trans("OnInvoice");
print ' ('.$langs->trans("InvoiceDateUsed").')'; print ' ('.$langs->trans("InvoiceDateUsed").')';
} }
print '</td>'; print '</td>';
print '<td>'; print '<td>';
if ($tax_mode == 0) if ($tax_mode == 0)
{ {
print $langs->trans("OnPayment"); print $langs->trans("OnPayment");
print ' ('.$langs->trans("SupposedToBePaymentDate").')'; print ' ('.$langs->trans("SupposedToBePaymentDate").')';
} }
if ($tax_mode == 1) if ($tax_mode == 1)
{ {
print $langs->trans("OnInvoice"); print $langs->trans("OnInvoice");
print ' ('.$langs->trans("InvoiceDateUsed").')'; print ' ('.$langs->trans("InvoiceDateUsed").')';
} }
print '</td></tr>'; print '</td></tr>';
print '</table>'; print '</table>';
} }
dol_htmloutput_mesg($mesg); dol_htmloutput_mesg($mesg);

View File

@ -1,4 +1,4 @@
<?PHP <?PHP
/* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify

View File

@ -1,4 +1,4 @@
<?php <?php
/* Copyright (C) 2011 Auguria <anthony.poiret@auguria.net> /* Copyright (C) 2011 Auguria <anthony.poiret@auguria.net>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify

View File

@ -28,7 +28,7 @@ require_once(DOL_DOCUMENT_ROOT ."/core/class/commonobject.class.php");
/** /**
* \class Don * \class Don
* \brief Classe permettant la gestion des dons * \brief Class to manage donations
*/ */
class Don extends CommonObject class Don extends CommonObject
{ {
@ -56,8 +56,9 @@ class Don extends CommonObject
var $projet; var $projet;
/** /**
* \brief Constructeur * Constructor
* \param DB Handler d'acces base *
* @param DoliDB $DB Database handler
*/ */
function Don($DB) function Don($DB)
{ {
@ -79,9 +80,10 @@ class Don extends CommonObject
/** /**
* \brief Retourne le libelle du statut d'un don (brouillon, validee, abandonnee, payee) * Retourne le libelle du statut d'un don (brouillon, validee, abandonnee, payee)
* \param mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long *
* \return string Libelle * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long
* @return string Libelle
*/ */
function getLibStatut($mode=0) function getLibStatut($mode=0)
{ {
@ -89,10 +91,11 @@ class Don extends CommonObject
} }
/** /**
* \brief Renvoi le libelle d'un statut donne * Renvoi le libelle d'un statut donne
* \param statut Id statut *
* \param mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @param int $statut Id statut
* \return string Libelle du statut * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Libelle du statut
*/ */
function LibStatut($statut,$mode=0) function LibStatut($statut,$mode=0)
{ {
@ -195,8 +198,10 @@ class Don extends CommonObject
/** /**
* Check params
* *
* * @param int $minimum Minimum
* @return int 0 if KO, >0 if OK
*/ */
function check($minimum=0) function check($minimum=0)
{ {
@ -238,7 +243,8 @@ class Don extends CommonObject
$this->amount = trim($this->amount); $this->amount = trim($this->amount);
$map = range(0,9); $map = range(0,9);
for ($i = 0; $i < dol_strlen($this->amount); $i++) $len=dol_strlen($this->amount);
for ($i = 0; $i < $len; $i++)
{ {
if (!isset($map[substr($this->amount, $i, 1)] )) if (!isset($map[substr($this->amount, $i, 1)] ))
{ {
@ -279,10 +285,11 @@ class Don extends CommonObject
} }
/** /**
* Create donation record into database * Create donation record into database
* @param user Objet utilisateur qui cree le don *
* @return int Id don cree si ok, <0 si ko * @param User $user Objet utilisateur qui cree le don
* TODO add numbering module for Ref * @return int Id don cree si ok, <0 si ko
* TODO add numbering module for Ref
*/ */
function create($user) function create($user)
{ {
@ -348,9 +355,10 @@ class Don extends CommonObject
} }
/** /**
* Update a donation record * Update a donation record
* @param user Objet utilisateur qui met a jour le don *
* @return int >0 if OK, <0 if KO * @param User $user Objet utilisateur qui met a jour le don
* @return int >0 if OK, <0 if KO
*/ */
function update($user) function update($user)
{ {
@ -390,7 +398,8 @@ class Don extends CommonObject
/** /**
* Delete a donation * Delete a donation
* @param rowid Id of donation to delete *
* @param int $rowid Id of donation to delete
*/ */
function delete($rowid) function delete($rowid)
{ {
@ -418,9 +427,10 @@ class Don extends CommonObject
/** /**
* Load donation from database * Load donation from database
* @param rowid Id of donation to load *
* @param ref Ref of donation to load * @param int $rowid Id of donation to load
* @return int <0 if KO, >0 if OK * @param string $ref Ref of donation to load
* @return int <0 if KO, >0 if OK
*/ */
function fetch($rowid,$ref='') function fetch($rowid,$ref='')
{ {
@ -481,9 +491,10 @@ class Don extends CommonObject
/** /**
* Valide une promesse de don * Valide une promesse de don
* @param rowid id du don a modifier *
* @param userid utilisateur qui valide la promesse * @param int $rowid id du don a modifier
* @return int <0 if KO, >0 if OK * @param int $userid utilisateur qui valide la promesse
* @return int <0 if KO, >0 if OK
*/ */
function valid_promesse($rowid, $userid) function valid_promesse($rowid, $userid)
{ {
@ -512,9 +523,10 @@ class Don extends CommonObject
/** /**
* Classe le don comme paye, le don a ete recu * Classe le don comme paye, le don a ete recu
* @param rowid id du don a modifier *
* @param modepaiementd mode de paiement * @param int $rowid id du don a modifier
* @return int <0 if KO, >0 if OK * @param int $modepaiementd mode de paiement
* @return int <0 if KO, >0 if OK
*/ */
function set_paye($rowid, $modepaiement='') function set_paye($rowid, $modepaiement='')
{ {
@ -548,8 +560,9 @@ class Don extends CommonObject
/** /**
* Classe le don comme encaisse * Classe le don comme encaisse
* @param rowid id du don a modifier *
* @return int <0 if KO, >0 if OK * @param int $rowid id du don a modifier
* @return int <0 if KO, >0 if OK
*/ */
function set_encaisse($rowid) function set_encaisse($rowid)
{ {
@ -578,8 +591,9 @@ class Don extends CommonObject
/** /**
* Set donation sto status canceled * Set donation sto status canceled
* @param rowid id du don a modifier *
* @return int <0 if KO, >0 if OK * @param int $rowid id du don a modifier
* @return int <0 if KO, >0 if OK
*/ */
function set_cancel($rowid) function set_cancel($rowid)
{ {
@ -606,8 +620,10 @@ class Don extends CommonObject
} }
/** /**
* \brief Somme des dons * Somme des dons
* \param param 1=promesses de dons validees , 2=xxx, 3=encaisses *
* @param string $param 1=promesses de dons validees , 2=xxx, 3=encaisses
* @return int Summ of donations
*/ */
function sum_donations($param) function sum_donations($param)
{ {
@ -632,9 +648,10 @@ class Don extends CommonObject
/** /**
* \brief Return clicable name (with picto eventually) * Return clicable name (with picto eventually)
* \param withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul *
* \return string Chaine avec URL * @param int $withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul
* @return string Chaine avec URL
*/ */
function getNomUrl($withpicto=0) function getNomUrl($withpicto=0)
{ {
@ -657,10 +674,11 @@ class Don extends CommonObject
/** /**
* Return full name (civility+' '+name+' '+lastname) * Return full name (civility+' '+name+' '+lastname)
* @param langs Language object for translation of civility *
* @param option 0=No option, 1=Add civility * @param Translate $langs Language object for translation of civility
* @param nameorder -1=Auto, 0=Lastname+Firstname, 1=Firstname+Lastname * @param int $option 0=No option, 1=Add civility
* @return string String with full name * @param int $nameorder -1=Auto, 0=Lastname+Firstname, 1=Firstname+Lastname
* @return string String with full name
*/ */
function getFullName($langs,$option=0,$nameorder=-1) function getFullName($langs,$option=0,$nameorder=-1)
{ {

View File

@ -95,17 +95,17 @@ class BonPrelevement extends CommonObject
} }
/** /**
* Add facture to withdrawal * Add facture to withdrawal
* *
* @param int $facture_id id invoice to add * @param int $facture_id id invoice to add
* @param int $client_id id invoice customer * @param int $client_id id invoice customer
* @param string $client_nom name of cliente * @param string $client_nom name of cliente
* @param int $amount amount of invoice * @param int $amount amount of invoice
* @param string $code_banque code of bank withdrawal * @param string $code_banque code of bank withdrawal
* @param string $code_guichet code of bank's office * @param string $code_guichet code of bank's office
* @param string $number bank account number * @param string $number bank account number
* @param string $number_key number key of account number * @param string $number_key number key of account number
* @return int >0 if OK, <0 if KO * @return int >0 if OK, <0 if KO
*/ */
function AddFacture($facture_id, $client_id, $client_nom, $amount, $code_banque, $code_guichet, $number, $number_key) function AddFacture($facture_id, $client_id, $client_nom, $amount, $code_banque, $code_guichet, $number, $number_key)
{ {
@ -305,8 +305,7 @@ class BonPrelevement extends CommonObject
} }
else else
{ {
dol_syslog("BonPrelevement::Fetch Erreur "); dol_syslog("BonPrelevement::Fetch Erreur sql=".$sql, LOG_ERR);
dol_syslog($sql);
return -2; return -2;
} }
} }
@ -966,11 +965,8 @@ class BonPrelevement extends CommonObject
$sql.= " WHERE rowid = ".$fac[1]; $sql.= " WHERE rowid = ".$fac[1];
dol_syslog("Bon-Prelevement::Create sql=".$sql, LOG_DEBUG); dol_syslog("Bon-Prelevement::Create sql=".$sql, LOG_DEBUG);
if ($this->db->query($sql)) $resql=$this->db->query($sql);
{ if (! $resql)
}
else
{ {
$error++; $error++;
dol_syslog("Erreur mise a jour des demandes"); dol_syslog("Erreur mise a jour des demandes");
@ -1212,14 +1208,14 @@ class BonPrelevement extends CommonObject
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
$esaeb19->agregaRecibo( $esaeb19->agregaRecibo(
$idOrdenante, $idOrdenante,
"idcliente".$i+1, "idcliente".$i+1,
$obj->client_nom, $obj->client_nom,
$obj->code_banque, $obj->code_banque,
$obj->code_guichet, $obj->code_guichet,
$obj->cle_rib, $obj->cle_rib,
$obj->number, $obj->number,
$obj->amount, $obj->amount,
"Fra.".$obj->facnumber." ".$obj->amount "Fra.".$obj->facnumber." ".$obj->amount
); );
@ -1307,14 +1303,14 @@ class BonPrelevement extends CommonObject
$row = $this->db->fetch_row($resql); $row = $this->db->fetch_row($resql);
$this->EnregDestinataire( $this->EnregDestinataire(
$row[0], $row[0],
$row[1], $row[1],
$row[2], $row[2],
$row[3], $row[3],
$row[4], $row[4],
$row[5], $row[5],
$row[6], $row[6],
$row[7] $row[7]
); );
$this->total = $this->total + $row[5]; $this->total = $this->total + $row[5];

View File

@ -1,353 +0,0 @@
<?php
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/compta/stats/comp.php
* \ingroup commercial
* TODO Remove or add page in menus
*/
require('../../main.inc.php');
require_once(DOL_DOCUMENT_ROOT."/lib/accountancy.lib.php");
// Security check
if ($user->societe_id > 0)
{
$socid = $user->societe_id;
}
function propals ($db, $year, $month)
{
global $bc,$langs,$conf;
$sql = "SELECT s.nom, s.rowid as socid, p.rowid as propalid, p.price, p.ref, p.datep as dp, p.fk_statut as statutid, c.label as statut";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql.= ", ".MAIN_DB_PREFIX."propal as p";
$sql.= ", ".MAIN_DB_PREFIX."c_propalst as c";
$sql.= " WHERE p.fk_soc = s.rowid AND p.fk_statut = c.id";
$sql.= " AND p.entity = ".$conf->entity;
$sql.= " AND p.fk_statut in (1,2,4)";
// TODO Use between instead of date_format
$sql.= " AND date_format(p.datep, '%Y') = '".$year."'";
$sql.= " AND round(date_format(p.datep, '%m')) = '".$month."'";
$sql.= " ORDER BY p.fk_statut";
$result = $db->query($sql);
$num = $db->num_rows($result);
$i = 0;
print "<table class=\"noborder\" width=\"100%\" cellspacing=\"0\" cellpadding=\"4\">";
print "<tr class=\"liste_titre\"><td colspan=\"5\"><b>Propal</b></td></tr>";
$oldstatut = -1;
$subtotal = 0;
while ($i < $num) {
$objp = $db->fetch_object($result);
if ($objp->statut <> $oldstatut ) {
$oldstatut = $objp->statut;
if ($i > 0) {
print "<tr><td align=\"right\" colspan=\"4\">".$langs->trans("Total").": <b>".price($subtotal)."</b></td>\n";
print "<td align=\"left\">".$langs->trans("Currency".$conf->monnaie)."</td></tr>\n";
}
$subtotal = 0;
print "<tr class=\"liste_titre\">";
print "<td>Societe</td>";
print "<td>".$langs->trans("Ref")."</td>";
print "<td align=\"right\">".$langs->trans("Date")."</td>";
print "<td align=\"right\">".$langs->trans("Price")."</td>";
print "<td align=\"center\">".$langs->trans("Status")."</td>";
print "</tr>\n";
$var=True;
}
$var=!$var;
print "<tr $bc[$var]>";
print "<td><a href=\"comp.php?socid=".$objp->socid."\">".$objp->nom."</a></td>\n";
print "<td><a href=\"".DOL_URL_ROOT."/comm/propal.php?id=".$objp->propalid."\">".$objp->ref."</a></td>\n";
print "<td align=\"right\">".dol_print_date($db->jdate($objp->dp))."</td>\n";
print "<td align=\"right\">".price($objp->price)."</td>\n";
print "<td align=\"center\">".$objp->statut."</td>\n";
print "</tr>\n";
$total = $total + $objp->price;
$subtotal = $subtotal + $objp->price;
$i++;
}
print "<tr><td align=\"right\" colspan=\"4\">".$langs->trans("Total").": <b>".price($subtotal)."</b></td>\n";
print "<td align=\"left\">".$langs->trans("Currency".$conf->monnaie)."</td></tr>\n";
print "<tr>";
print "<td colspan=\"3\" align=\"right\"><b>".$langs->trans("Total").": ".price($total)."</b></td>";
print "<td align=\"left\"><b>".$langs->trans("Currency".$conf->monnaie)."</b></td></tr>";
print "</table>";
$db->free();
}
function factures ($db, $year, $month, $paye)
{
global $bc,$conf;
$sql = "SELECT s.nom, s.rowid as socid, f.facnumber, f.total, f.datef as df, f.paye, f.rowid as facid ";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql.= ",".MAIN_DB_PREFIX."facture as f";
$sql.= " WHERE f.fk_statut = 1";
$sql.= " AND f.entity = ".$conf->entity;
if ($conf->compta->mode != 'CREANCES-DETTES') $sql.= " AND f.paye = ".$paye;
$sql.= " AND f.fk_soc = s.rowid";
$sql.= " AND date_format(f.datef, '%Y') = '".$year."'";
$sql.= " AND round(date_format(f.datef, '%m')) = ".$month;
$sql.= " ORDER BY f.datef DESC ";
$result = $db->query($sql);
if ($result)
{
$num = $db->num_rows($result);
if ($num > 0)
{
$i = 0;
print "<table class=\"noborder\" width=\"100%\" cellspacing=\"0\" cellpadding=\"3\">";
print "<tr class=\"liste_titre\"><td colspan=\"5\"><b>Factures</b></td></tr>";
print "<tr class=\"liste_titre\">";
print "<td>Societe</td>";
print "<td>Num</td>";
print "<td align=\"right\">Date</td>";
print "<td align=\"right\">Montant</td>";
print "<td align=\"right\">Pay<61></td>";
print "</tr>\n";
$var=True;
while ($i < $num)
{
$objp = $db->fetch_object($result);
$var=!$var;
print "<tr $bc[$var]>";
print "<td><a href=\"comp.php?socid=".$objp->socid."\">".$objp->nom."</a></td>\n";
print "<td><a href=\"../facture.php?facid=".$objp->facid."\">".$objp->facnumber."</a></td>\n";
if ($objp->df > 0 )
{
print "<td align=\"right\">".dol_print_date($db->jdate($objp->df))."</td>\n";
}
else
{
print "<td align=\"right\"><b>!!!</b></td>\n";
}
print "<td align=\"right\">".price($objp->total)."</td>\n";
$payes[1] = "oui";
$payes[0] = "<b>non</b>";
print "<td align=\"right\">".$payes[$objp->paye]."</td>\n";
print "</tr>\n";
$total = $total + $objp->total;
$i++;
}
print "<tr><td colspan=\"4\" align=\"right\">";
print "<b>Total : ".price($total)."</b></td><td></td></tr>";
print "</table>";
$db->free();
}
}
else
{
print $db->error();
}
}
function pt ($db, $sql, $year)
{
global $bc, $langs;
$result = $db->query($sql);
if ($result) {
$num = $db->num_rows($result);
$i = 0; $total = 0 ;
print '<table class="border" width="100%" cellspacing="0" cellpadding="3">';
print "<tr class=\"liste_titre\">";
print '<td>'.$langs->trans("Month").'</td>';
print "<td align=\"right\">Montant</td></tr>\n";
$var=True;
$month = 1 ;
while ($i < $num) {
$obj = $db->fetch_object($result);
$var=!$var;
if ($obj->dm > $month ) {
for ($b = $month ; $b < $obj->dm ; $b++) {
print "<tr $bc[$var]>";
print "<td>".dol_print_date(dol_mktime(12,0,0,$b, 1, $year),"%b")."</td>\n";
print "<td align=\"right\">0</td>\n";
print "</tr>\n";
$var=!$var;
$ca[$b] = 0;
}
}
if ($obj->sum > 0) {
print "<tr $bc[$var]>";
print "<td><a href=\"comp.php?details=1&year=$year&month=$obj->dm\">";
print dol_print_date(dol_mktime(12,0,0,$obj->dm, 1, $year),"%b")."</td>\n";
print "<td align=\"right\">".price($obj->sum)."</td>\n";
print "</TR>\n";
$month = $obj->dm + 1;
$ca[$obj->dm] = $obj->sum;
$total = $total + $obj->sum;
}
$i++;
}
if ($num) {
$beg = $obj->dm;
} else {
$beg = 0 ;
}
if ($beg <= 12 ) {
for ($b = $beg + 1 ; $b < 13 ; $b++) {
$var=!$var;
print "<tr $bc[$var]>";
print "<td>".dol_print_date(dol_mktime(12,0,0,$b, 1, $year),"%b")."</td>\n";
print "<td align=\"right\">0</td>\n";
print "</tr>\n";
$ca[$b] = 0;
}
}
print "<tr class=\"total\"><td align=\"right\">Total :</td><td align=\"right\"><b>".price($total)."</b></td></tr>";
print "</table>";
$db->free();
return $ca;
} else {
print $db->error();
}
}
function ppt ($db, $year, $socid)
{
global $bc,$conf,$langs;
print "<table width=\"100%\">";
print '<tr class="liste_titre"><td align="center" valign="top" width="30%">';
print "CA Previsionnel base sur les propal $year";
print "</td><td align=\"center\" valign=\"top\">CA Realise $year</td>";
print "<td align=\"center\" valign=\"top\">Delta $year</td></tr>";
print '<tr><td valign="top" align="center" width="30%">';
$sql = "SELECT sum(p.price) as sum, round(date_format(p.datep,'%m')) as dm";
$sql.= " FROM ".MAIN_DB_PREFIX."propal as p";
$sql.= " WHERE p.fk_statut in (1,2,4)";
$sql.= " AND p.entity = ".$conf->entity;
$sql.= " AND date_format(p.datep,'%Y') = '".$year."'";
if ($socid) $sql.= " AND p.fk_soc = ".$socid;
$sql.= " GROUP BY dm";
$prev = pt($db, $sql, $year);
print "</td><td valign=\"top\" width=\"30%\">";
$sql = "SELECT sum(f.total) as sum, round(date_format(f.datef, '%m')) as dm";
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f";
$sql.= " WHERE f.fk_statut in (1,2)";
$sql.= " AND f.entity = ".$conf->entity;
if ($conf->compta->mode != 'CREANCES-DETTES') $sql.= " AND f.paye = 1";
$sql.= " AND date_format(f.datef,'%Y') = '".$year."'";
if ($socid) $sql.= " AND f.fk_soc = ".$socid;
$sql.= " GROUP BY dm";
$ca = pt($db, $sql, $year);
print "</td><td valign=\"top\" width=\"30%\">";
print '<table class="border" width="100%" cellspacing="0" cellpadding="3">';
print "<tr class=\"liste_titre\">";
print '<td>'.$langs->trans("Month").'</td>';
print '<td align="right">'.$langs->trans("Amount").'</td>';
print "</tr>\n";
$var = 1 ;
for ($b = 1 ; $b <= 12 ; $b++)
{
$var=!$var;
$delta = $ca[$b] - $prev[$b];
$deltat = $deltat + $delta ;
print "<tr $bc[$var]>";
print "<td>".dol_print_date(dol_mktime(12,0,0,$b, 1, $year),"%b")."</td>\n";
print "<td align=\"right\">".price($delta)."</td>\n";
print "</tr>\n";
}
$ayear = $year - 1;
$acat = get_ca($db, $ayear, $socid) - get_ca_propal($db, $ayear, $socid);
print "<tr class=\"total\"><td align=\"right\">Total :</td><td align=\"right\">".price($deltat)."</td></tr>";
print "<tr class=\"total\"><td align=\"right\">Rappel $ayear :</td><td align=\"right\">".price($acat)."</td></tr>";
print "<tr class=\"total\"><td align=\"right\">Soit :</td><td align=\"right\"><b>".price($acat+$deltat)."</b></td></tr>";
print "</table>";
print "</td></tr></table>";
}
/*
* View
*/
llxHeader();
$cyear = isset($_GET["year"])?$_GET["year"]:0;
if (! $cyear) { $cyear = strftime ("%Y", time()); }
print_fiche_titre("Chiffre d'Affaire transform<72> (pr<70>vu-r<>alis<69>)",($cyear?"<a href='comp.php?year=".($cyear-1)."'>".img_previous()."</a> Ann<6E>e $cyear <a href='comp.php?year=".($cyear+1)."'>".img_next()."</a>":""));
ppt($db, $cyear, $socid);
if ($details == 1)
{
print "<TABLE border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"4\"><tr><td valign=\"top\" width=\"50%\">";
factures ($db, $year, $month, 1);
print "</td><td valign=\"top\" width=\"50%\">";
propals ($db, $year, $month);
print "</td></tr></table>";
}
$db->close();
llxFooter();
?>

File diff suppressed because it is too large Load Diff

View File

@ -54,14 +54,17 @@ class DolCookie
/** /**
* Encrypt en create the cookie * Encrypt en create the cookie
*
* @return void
*/ */
function cryptCookie() function cryptCookie()
{ {
if (!empty($this->myKey)) if (!empty($this->myKey))
{ {
$valuecrypt = base64_encode($this->myValue); $valuecrypt = base64_encode($this->myValue);
for ($f=0 ; $f<=dol_strlen($valuecrypt)-1; $f++) $max=dol_strlen($valuecrypt)-1;
for ($f=0 ; $f <= $max; $f++)
{ {
$this->cookie .= intval(ord($valuecrypt[$f]))*$this->myKey."|"; $this->cookie .= intval(ord($valuecrypt[$f]))*$this->myKey."|";
} }
@ -75,7 +78,9 @@ class DolCookie
} }
/** /**
* Decrypt the cookie * Decrypt the cookie
*
* @return void
*/ */
function decryptCookie() function decryptCookie()
{ {
@ -98,14 +103,15 @@ class DolCookie
} }
/** /**
* Set and create the cookie * Set and create the cookie
* *
* @param string $cookie Cookie name * @param string $cookie Cookie name
* @param string $value Cookie value * @param string $value Cookie value
* @param string $expire Expiration * @param string $expire Expiration
* @param string $path Path of cookie * @param string $path Path of cookie
* @param string $domaine Domain name * @param string $domaine Domain name
* @param int $secure 0 or 1 * @param int $secure 0 or 1
* @return void
*/ */
function _setCookie($cookie, $value, $expire=0, $path="/", $domain="", $secure=0) function _setCookie($cookie, $value, $expire=0, $path="/", $domain="", $secure=0)
{ {

View File

@ -30,7 +30,8 @@
/** /**
* Encode a string for vCard * Encode a string for vCard
* *
* @param string String to encode * @param string $string String to encode
* @return string String encoded
*/ */
function encode($string) function encode($string)
{ {
@ -42,10 +43,11 @@ function encode($string)
* Taken from php documentation comments * Taken from php documentation comments
* No more used * No more used
* *
* @param input String * @param string $input String
* @param line_max Max length of lines * @param int $line_max Max length of lines
* @return string Encoded string
*/ */
function dol_quoted_printable_encode($input, $line_max = 76) function dol_quoted_printable_encode($input, $line_max=76)
{ {
$hex = array('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'); $hex = array('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F');
$lines = preg_split("/(\?:\r\n|\r|\n)/", $input); $lines = preg_split("/(\?:\r\n|\r|\n)/", $input);
@ -98,10 +100,12 @@ class vCard
/** /**
* mise en forme du numero de telephone * mise en forme du numero de telephone
* *
* @param number numero de telephone * @param int $number numero de telephone
* @param type * @param string $type Type
* @return void
*/ */
function setPhoneNumber($number, $type="") { function setPhoneNumber($number, $type="")
{
// type may be PREF | WORK | HOME | VOICE | FAX | MSG | CELL | PAGER | BBS | CAR | MODEM | ISDN | VIDEO or any senseful combination, e.g. "PREF;WORK;VOICE" // type may be PREF | WORK | HOME | VOICE | FAX | MSG | CELL | PAGER | BBS | CAR | MODEM | ISDN | VIDEO or any senseful combination, e.g. "PREF;WORK;VOICE"
$key = "TEL"; $key = "TEL";
if ($type!="") $key .= ";".$type; if ($type!="") $key .= ";".$type;
@ -113,32 +117,38 @@ class vCard
* mise en forme de la photo * mise en forme de la photo
* warning NON TESTE ! * warning NON TESTE !
* *
* @param type * @param string $type Type
* @param photo * @param string $photo Photo
*/ * @return void
function setPhoto($type, $photo) { // $type = "GIF" | "JPEG" */
function setPhoto($type, $photo)
{ // $type = "GIF" | "JPEG"
$this->properties["PHOTO;TYPE=$type;ENCODING=BASE64"] = base64_encode($photo); $this->properties["PHOTO;TYPE=$type;ENCODING=BASE64"] = base64_encode($photo);
} }
/** /**
* mise en forme du nom formate * mise en forme du nom formate
* *
* @param name * @param string $name Name
* @return void
*/ */
function setFormattedName($name) { function setFormattedName($name)
{
$this->properties["FN;CHARSET=".$this->encoding] = encode($name); $this->properties["FN;CHARSET=".$this->encoding] = encode($name);
} }
/** /**
* mise en forme du nom complet * mise en forme du nom complet
* *
* @param family * @param string $family Family
* @param first * @param string $first First
* @param additional * @param string $additional Additionnal
* @param prefix * @param string $prefix Prefix
* @param suffix * @param string $suffix Suffix
* @return void
*/ */
function setName($family="", $first="", $additional="", $prefix="", $suffix="") { function setName($family="", $first="", $additional="", $prefix="", $suffix="")
{
$this->properties["N;CHARSET=".$this->encoding] = encode($family).";".encode($first).";".encode($additional).";".encode($prefix).";".encode($suffix); $this->properties["N;CHARSET=".$this->encoding] = encode($family).";".encode($first).";".encode($additional).";".encode($prefix).";".encode($suffix);
$this->filename = "$first%20$family.vcf"; $this->filename = "$first%20$family.vcf";
if ($this->properties["FN"]=="") $this->setFormattedName(trim("$prefix $first $additional $family $suffix")); if ($this->properties["FN"]=="") $this->setFormattedName(trim("$prefix $first $additional $family $suffix"));
@ -147,32 +157,37 @@ class vCard
/** /**
* mise en forme de l'anniversaire * mise en forme de l'anniversaire
* *
* @param date * @param timestamp $date Date
* @return void
*/ */
function setBirthday($date) { // $date format is YYYY-MM-DD function setBirthday($date)
{ // $date format is YYYY-MM-DD
$this->properties["BDAY"] = $date; $this->properties["BDAY"] = $date;
} }
/** /**
* mise en forme de l'adresse * mise en forme de l'adresse
* *
* @param postoffice * @param string $postoffice Postoffice
* @param extended * @param string $extended Extended
* @param street * @param string $street Street
* @param city * @param string $city City
* @param region * @param string $region Region
* @param zip * @param string $zip Zip
* @param country * @param string $country Country
* @param type * @param string $type Type
* @return void
*/ */
function setAddress($postoffice="", $extended="", $street="", $city="", $region="", $zip="", $country="", $type="HOME;POSTAL") { function setAddress($postoffice="", $extended="", $street="", $city="", $region="", $zip="", $country="", $type="HOME;POSTAL")
{
// $type may be DOM | INTL | POSTAL | PARCEL | HOME | WORK or any combination of these: e.g. "WORK;PARCEL;POSTAL" // $type may be DOM | INTL | POSTAL | PARCEL | HOME | WORK or any combination of these: e.g. "WORK;PARCEL;POSTAL"
$key = "ADR"; $key = "ADR";
if ($type!="") $key.= ";$type"; if ($type!="") $key.= ";$type";
$key.= ";CHARSET=".$this->encoding; $key.= ";CHARSET=".$this->encoding;
$this->properties[$key] = encode($name).";".encode($extended).";".encode($street).";".encode($city).";".encode($region).";".encode($zip).";".encode($country); $this->properties[$key] = encode($name).";".encode($extended).";".encode($street).";".encode($city).";".encode($region).";".encode($zip).";".encode($country);
if ($this->properties["LABEL;$type;CHARSET=".$this->encoding] == "") { if ($this->properties["LABEL;$type;CHARSET=".$this->encoding] == "")
{
//$this->setLabel($postoffice, $extended, $street, $city, $region, $zip, $country, $type); //$this->setLabel($postoffice, $extended, $street, $city, $region, $zip, $country, $type);
} }
} }
@ -180,14 +195,15 @@ class vCard
/** /**
* mise en forme du label * mise en forme du label
* *
* @param postoffice * @param string $postoffice Postoffice
* @param extended * @param string $extended Extended
* @param street * @param string $street Street
* @param city * @param string $city City
* @param region * @param string $region Region
* @param zip * @param string $zip Zip
* @param country * @param string $country Country
* @param type * @param string $type Type
* @return void
*/ */
function setLabel($postoffice="", $extended="", $street="", $city="", $region="", $zip="", $country="", $type="HOME;POSTAL") { function setLabel($postoffice="", $extended="", $street="", $city="", $region="", $zip="", $country="", $type="HOME;POSTAL") {
$label = ""; $label = "";
@ -205,28 +221,34 @@ class vCard
/** /**
* mise en forme de l'email * mise en forme de l'email
* *
* @param address EMail * @param string $address EMail
* @param type Vcard type * @param string $type Vcard type
* @return void
*/ */
function setEmail($address,$type="internet,pref") { function setEmail($address,$type="internet,pref")
{
$this->properties["EMAIL;TYPE=".$type] = $address; $this->properties["EMAIL;TYPE=".$type] = $address;
} }
/** /**
* mise en forme de la note * mise en forme de la note
* *
* @param note * @param string $note Note
* @return void
*/ */
function setNote($note) { function setNote($note)
{
$this->properties["NOTE;CHARSET=".$this->encoding] = encode($note); $this->properties["NOTE;CHARSET=".$this->encoding] = encode($note);
} }
/** /**
* mise en forme de la fonction * mise en forme de la fonction
* *
* @param title * @param string $title Title
* @return void
*/ */
function setTitle($title) { function setTitle($title)
{
$this->properties["TITLE;CHARSET=".$this->encoding] = encode($title); $this->properties["TITLE;CHARSET=".$this->encoding] = encode($title);
} }
@ -234,9 +256,11 @@ class vCard
/** /**
* mise en forme de la societe * mise en forme de la societe
* *
* @param org * @param string $org Org
* @return void
*/ */
function setOrg($org) { function setOrg($org)
{
$this->properties["ORG;CHARSET=".$this->encoding] = encode($org); $this->properties["ORG;CHARSET=".$this->encoding] = encode($org);
} }
@ -244,9 +268,11 @@ class vCard
/** /**
* mise en forme du logiciel generateur * mise en forme du logiciel generateur
* *
* @param prodid * @param string $prodid Prodid
* @return void
*/ */
function setProdId($prodid) { function setProdId($prodid)
{
$this->properties["PRODID;CHARSET=".$this->encoding] = encode($prodid); $this->properties["PRODID;CHARSET=".$this->encoding] = encode($prodid);
} }
@ -254,9 +280,11 @@ class vCard
/** /**
* mise en forme du logiciel generateur * mise en forme du logiciel generateur
* *
* @param uid * @param string $uid Uid
* @return void
*/ */
function setUID($uid) { function setUID($uid)
{
$this->properties["UID;CHARSET=".$this->encoding] = encode($uid); $this->properties["UID;CHARSET=".$this->encoding] = encode($uid);
} }
@ -264,10 +292,12 @@ class vCard
/** /**
* mise en forme de l'url * mise en forme de l'url
* *
* @param url * @param string $url URL
* @param type * @param string $type Type
* @return void
*/ */
function setURL($url, $type="") { function setURL($url, $type="")
{
// $type may be WORK | HOME // $type may be WORK | HOME
$key = "URL"; $key = "URL";
if ($type!="") $key.= ";$type"; if ($type!="") $key.= ";$type";
@ -276,12 +306,16 @@ class vCard
/** /**
* permet d'obtenir une vcard * permet d'obtenir une vcard
*
* @return void
*/ */
function getVCard() { function getVCard()
{
$text = "BEGIN:VCARD\r\n"; $text = "BEGIN:VCARD\r\n";
//$text.= "VERSION:3.0\r\n"; //$text.= "VERSION:3.0\r\n";
$text.= "VERSION:2.1\r\n"; $text.= "VERSION:2.1\r\n";
foreach($this->properties as $key => $value) { foreach($this->properties as $key => $value)
{
$text.= "$key:$value\r\n"; $text.= "$key:$value\r\n";
} }
$text.= "REV:".date("Y-m-d")."T".date("H:i:s")."Z\r\n"; $text.= "REV:".date("Y-m-d")."T".date("H:i:s")."Z\r\n";
@ -292,9 +326,13 @@ class vCard
/** /**
* permet d'obtenir le nom de fichier * permet d'obtenir le nom de fichier
*
* @return string Filename
*/ */
function getFileName() { function getFileName()
{
return $this->filename; return $this->filename;
} }
} }
?> ?>

View File

@ -1,4 +1,4 @@
<?php <?php
/* Copyright (C) 2007 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
* *

View File

@ -1,4 +1,4 @@
<?php <?php
/* Copyright (C) 2003-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>

View File

@ -1,4 +1,4 @@
<?php <?php
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org> * Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>

View File

@ -1,4 +1,4 @@
<?php <?php
/* Copyright (C) 2007-2009 Regis Houssin <regis@dolibarr.fr> /* Copyright (C) 2007-2009 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2008 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2008 Laurent Destailleur <eldy@users.sourceforge.net>
* *

View File

@ -1,4 +1,4 @@
<?php <?php
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005-2008 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2005-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>

View File

@ -40,23 +40,35 @@ function check_authentication($authentication,&$error,&$errorcode,&$errorlabel)
$error++; $error++;
$errorcode='BAD_VALUE_FOR_SECURITY_KEY'; $errorlabel='Value provided into dolibarrkey entry field does not match security key defined in Webservice module setup'; $errorcode='BAD_VALUE_FOR_SECURITY_KEY'; $errorlabel='Value provided into dolibarrkey entry field does not match security key defined in Webservice module setup';
} }
if (! $error && ! empty($authentication['entity']) && ! is_numeric($authentication['entity']))
{
$error++;
$errorcode='BAD_PARAMETERS'; $errorlabel="Parameter entity must be empty (or filled with numeric id of instance if multicompany module is used).";
}
if (! $error) if (! $error)
{ {
$result=$fuser->fetch('',$authentication['login'],'',0); $result=$fuser->fetch('',$authentication['login'],'',0);
if ($result <= 0) $error++; if ($result <= 0) $error++;
// TODO Check password // Validation of login with a third party login module method
if (! $error)
{
$test=true;
if (is_array($conf->login_method_modules) && !empty($conf->login_method_modules))
{
$login = getLoginMethod($authentication['login'],$authentication['password'],$authentication['entity']);
if ($login) $test=false;
}
if ($test) $error++;
}
if ($error) if ($error)
{ {
$errorcode='BAD_CREDENTIALS'; $errorlabel='Bad value for login or password'; $errorcode='BAD_CREDENTIALS'; $errorlabel='Bad value for login or password';
} }
} }
if (! $error && ! empty($authentication['entity']) && ! is_numeric($authentication['entity']))
{
$error++;
$errorcode='BAD_PARAMETERS'; $errorlabel="Parameter entity must be empty (or a numeric with id of instance if multicompany module is used).";
}
return $fuser; return $fuser;
} }

View File

@ -1,4 +1,4 @@
<?php <?php
/* Copyright (C) 2010-2011 Laurent Destailleur <eldy@users.sourceforge.org> /* Copyright (C) 2010-2011 Laurent Destailleur <eldy@users.sourceforge.org>
* Copyright (C) 2011 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2011 Regis Houssin <regis@dolibarr.fr>
* *

View File

@ -51,6 +51,9 @@ class ActionsCardCompany extends ActionsCardCommon
/** /**
* Return the title of card * Return the title of card
*
* @param string $action Action code
* @return string Title
*/ */
private function getTitle($action) private function getTitle($action)
{ {
@ -70,6 +73,7 @@ class ActionsCardCompany extends ActionsCardCommon
* Execute actions * Execute actions
* *
* @param int $socid Id of object (may be empty for creation) * @param int $socid Id of object (may be empty for creation)
* @return int <0 if KO, >0 if OK
*/ */
function doActions($socid) function doActions($socid)
{ {
@ -82,6 +86,7 @@ class ActionsCardCompany extends ActionsCardCommon
* Assign custom values for canvas (for example into this->tpl to be used by templates) * Assign custom values for canvas (for example into this->tpl to be used by templates)
* *
* @param string $action Type of action * @param string $action Type of action
* @return void
*/ */
function assign_values($action) function assign_values($action)
{ {
@ -208,14 +213,15 @@ class ActionsCardCompany extends ActionsCardCommon
/** /**
* Check permissions of a user to show a page and an object. Check read permission * Check permissions of a user to show a page and an object. Check read permission
* If $_REQUEST['action'] defined, we also check write permission. * If $_REQUEST['action'] defined, we also check write permission.
* @param user User to check *
* @param features Features to check (in most cases, it's module name) * @param User $user User to check
* @param objectid Object ID if we want to check permission on a particular record (optionnal) * @param string $features Features to check (in most cases, it's module name)
* @param dbtablename Table name where object is stored. Not used if objectid is null (optionnal) * @param int $objectid Object ID if we want to check permission on a particular record (optionnal)
* @param feature2 Feature to check (second level of permission) * @param string $dbtablename Table name where object is stored. Not used if objectid is null (optionnal)
* @param dbt_keyfield Field name for socid foreign key if not fk_soc. (optionnal) * @param string $feature2 Feature to check (second level of permission)
* @param dbt_select Field name for select if not rowid. (optionnal) * @param string $dbt_keyfield Field name for socid foreign key if not fk_soc. (optionnal)
* @return int 1 * @param string $dbt_select Field name for select if not rowid. (optionnal)
* @return int 1
*/ */
function restrictedArea($user, $features='societe', $objectid=0, $dbtablename='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid') function restrictedArea($user, $features='societe', $objectid=0, $dbtablename='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid')
{ {

View File

@ -51,6 +51,9 @@ class ActionsCardIndividual extends ActionsCardCommon
/** /**
* Return the title of card * Return the title of card
*
* @param string $action Action code
* @return string Title
*/ */
private function getTitle($action) private function getTitle($action)
{ {
@ -67,9 +70,10 @@ class ActionsCardIndividual extends ActionsCardCommon
/** /**
* Execute actions * Execute actions
* *
* @param int $socid Id of object (may be empty for creation) * @param int $socid Id of object (may be empty for creation)
* @return int <0 if KO, >0 if OK
*/ */
function doActions($socid) function doActions($socid)
{ {
@ -79,9 +83,10 @@ class ActionsCardIndividual extends ActionsCardCommon
} }
/** /**
* Assign custom values for canvas (for example into this->tpl to be used by templates) * Assign custom values for canvas (for example into this->tpl to be used by templates)
* *
* @param string $action Type of action * @param string $action Type of action
* @return void
*/ */
function assign_values($action) function assign_values($action)
{ {
@ -107,14 +112,15 @@ class ActionsCardIndividual extends ActionsCardCommon
/** /**
* Check permissions of a user to show a page and an object. Check read permission * Check permissions of a user to show a page and an object. Check read permission
* If $_REQUEST['action'] defined, we also check write permission. * If $_REQUEST['action'] defined, we also check write permission.
* @param user User to check *
* @param features Features to check (in most cases, it's module name) * @param User $user User to check
* @param objectid Object ID if we want to check permission on a particular record (optionnal) * @param string $features Features to check (in most cases, it's module name)
* @param dbtablename Table name where object is stored. Not used if objectid is null (optionnal) * @param int $objectid Object ID if we want to check permission on a particular record (optionnal)
* @param feature2 Feature to check (second level of permission) * @param string $dbtablename Table name where object is stored. Not used if objectid is null (optionnal)
* @param dbt_keyfield Field name for socid foreign key if not fk_soc. (optionnal) * @param string $feature2 Feature to check (second level of permission)
* @param dbt_select Field name for select if not rowid. (optionnal) * @param string $dbt_keyfield Field name for socid foreign key if not fk_soc. (optionnal)
* @return int 1 * @param string $dbt_select Field name for select if not rowid. (optionnal)
* @return int 1
*/ */
function restrictedArea($user, $features='societe', $objectid=0, $dbtablename='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid') function restrictedArea($user, $features='societe', $objectid=0, $dbtablename='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid')
{ {

View File

@ -1,4 +1,4 @@
/* /*
* FCKeditor - The text editor for Internet - http://www.fckeditor.net * FCKeditor - The text editor for Internet - http://www.fckeditor.net
* Copyright (C) 2003-2008 Frederico Caldeira Knabben * Copyright (C) 2003-2008 Frederico Caldeira Knabben
* *

View File

@ -1,4 +1,4 @@
/* /*
* FCKeditor - The text editor for Internet - http://www.fckeditor.net * FCKeditor - The text editor for Internet - http://www.fckeditor.net
* Copyright (C) 2003-2008 Frederico Caldeira Knabben * Copyright (C) 2003-2008 Frederico Caldeira Knabben
* *

View File

@ -1,4 +1,4 @@
/* /*
* FCKeditor - The text editor for Internet - http://www.fckeditor.net * FCKeditor - The text editor for Internet - http://www.fckeditor.net
* Copyright (C) 2003-2008 Frederico Caldeira Knabben * Copyright (C) 2003-2008 Frederico Caldeira Knabben
* *

View File

@ -1,4 +1,4 @@
/* /*
* FCKeditor - The text editor for Internet - http://www.fckeditor.net * FCKeditor - The text editor for Internet - http://www.fckeditor.net
* Copyright (C) 2003-2008 Frederico Caldeira Knabben * Copyright (C) 2003-2008 Frederico Caldeira Knabben
* *

View File

@ -1,4 +1,4 @@
/* /*
* FCKeditor - The text editor for Internet - http://www.fckeditor.net * FCKeditor - The text editor for Internet - http://www.fckeditor.net
* Copyright (C) 2003-2008 Frederico Caldeira Knabben * Copyright (C) 2003-2008 Frederico Caldeira Knabben
* *

View File

@ -1,4 +1,4 @@
/* /*
* FCKeditor - The text editor for Internet - http://www.fckeditor.net * FCKeditor - The text editor for Internet - http://www.fckeditor.net
* Copyright (C) 2003-2008 Frederico Caldeira Knabben * Copyright (C) 2003-2008 Frederico Caldeira Knabben
* *

View File

@ -1,4 +1,4 @@
/* /*
* FCKeditor - The text editor for Internet - http://www.fckeditor.net * FCKeditor - The text editor for Internet - http://www.fckeditor.net
* Copyright (C) 2003-2008 Frederico Caldeira Knabben * Copyright (C) 2003-2008 Frederico Caldeira Knabben
* *

View File

@ -1,4 +1,4 @@
/* /*
* FCKeditor - The text editor for Internet - http://www.fckeditor.net * FCKeditor - The text editor for Internet - http://www.fckeditor.net
* Copyright (C) 2003-2008 Frederico Caldeira Knabben * Copyright (C) 2003-2008 Frederico Caldeira Knabben
* *

View File

@ -1,4 +1,4 @@
<?php <?php
/* Copyright (C) 2009-2010 Regis Houssin <regis@dolibarr.fr> /* Copyright (C) 2009-2010 Regis Houssin <regis@dolibarr.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify

View File

@ -422,7 +422,7 @@ else // Open and return file
$original_file_osencoded=dol_osencode($original_file); $original_file_osencoded=dol_osencode($original_file);
// This test if file exists should be useless. We keep it to find bug more easily // This test if file exists should be useless. We keep it to find bug more easily
if (! dol_is_file($original_file_osencoded)) if (! dol_is_file($original_file_osencoded))
{ {
$error='Error: File '.$_GET["file"].' does not exists or filesystems permissions are not allowed'; $error='Error: File '.$_GET["file"].' does not exists or filesystems permissions are not allowed';
dol_print_error(0,$error); dol_print_error(0,$error);