Fix: Removed log

This commit is contained in:
Laurent Destailleur 2008-09-02 01:34:37 +00:00
parent 3944d45613
commit 8dcd445f7a

View File

@ -22,11 +22,11 @@
*/ */
/** /**
\file htdocs/admin/expedition.php \file htdocs/admin/expedition.php
\ingroup expedition \ingroup expedition
\brief Page d'administration/configuration du module Expedition \brief Page d'administration/configuration du module Expedition
\version $Id$ \version $Id$
*/ */
require("./pre.inc.php"); require("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT."/lib/admin.lib.php"); require_once(DOL_DOCUMENT_ROOT."/lib/admin.lib.php");
@ -83,124 +83,122 @@ if ($_GET["action"] == 'specimen')
if ($_GET["action"] == 'set') if ($_GET["action"] == 'set')
{ {
$type='shipping'; $type='shipping';
$sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type) VALUES ('".$_GET["value"]."','".$type."')"; $sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type) VALUES ('".$_GET["value"]."','".$type."')";
if ($db->query($sql)) if ($db->query($sql))
{ {
} }
} }
if ($_GET["action"] == 'del') if ($_GET["action"] == 'del')
{ {
$type='shipping'; $type='shipping';
$sql = "DELETE FROM ".MAIN_DB_PREFIX."document_model"; $sql = "DELETE FROM ".MAIN_DB_PREFIX."document_model";
$sql .= " WHERE nom = '".$_GET["value"]."' AND type = '".$type."'"; $sql .= " WHERE nom = '".$_GET["value"]."' AND type = '".$type."'";
if ($db->query($sql)) if ($db->query($sql))
{ {
} }
} }
if ($_GET["action"] == 'setdoc') if ($_GET["action"] == 'setdoc')
{ {
$db->begin(); $db->begin();
if (dolibarr_set_const($db, "EXPEDITION_ADDON_PDF",$_GET["value"])) if (dolibarr_set_const($db, "EXPEDITION_ADDON_PDF",$_GET["value"]))
{ {
$conf->global->EXPEDITION_ADDON_PDF = $_GET["value"]; $conf->global->EXPEDITION_ADDON_PDF = $_GET["value"];
} }
// On active le modele // On active le modele
$type='shipping'; $type='shipping';
$sql_del = "DELETE FROM ".MAIN_DB_PREFIX."document_model"; $sql_del = "DELETE FROM ".MAIN_DB_PREFIX."document_model";
$sql_del .= " WHERE nom = '".$_GET["value"]."' AND type = '".$type."'"; $sql_del .= " WHERE nom = '".$_GET["value"]."' AND type = '".$type."'";
$result1=$db->query($sql_del); $result1=$db->query($sql_del);
$sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom,type) VALUES ('".$_GET["value"]."','".$type."')"; $sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom,type) VALUES ('".$_GET["value"]."','".$type."')";
$result2=$db->query($sql); $result2=$db->query($sql);
if ($result1 && $result2) if ($result1 && $result2)
{ {
$db->commit(); $db->commit();
} }
else else
{ {
$db->rollback(); $db->rollback();
} }
} }
// \todo A quoi servent les methode d'expedition ? // \todo A quoi servent les methode d'expedition ?
if ($_GET["action"] == 'setmethod' || $_GET["action"] == 'setmod') if ($_GET["action"] == 'setmethod' || $_GET["action"] == 'setmod')
{ {
$module=$_GET["module"];
$moduleid=$_GET["moduleid"];
$statut=$_GET["statut"];
require_once(DOL_DOCUMENT_ROOT."/expedition/mods/methode_expedition_$module.modules.php");
$module=$_GET["module"]; $class = "methode_expedition_$module";
$moduleid=$_GET["moduleid"]; $expem = new $class($db);
$statut=$_GET["statut"];
require_once(DOL_DOCUMENT_ROOT."/expedition/mods/methode_expedition_$module.modules.php"); $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."expedition_methode WHERE rowid = ".$moduleid;
$resql = $db->query($sql);
if ($resql && ($statut == 1 || $_GET["action"] == 'setmod'))
{
$db->begin();
$class = "methode_expedition_$module"; $sqlu = "UPDATE ".MAIN_DB_PREFIX."expedition_methode";
$expem = new $class($db); $sqlu.= " SET statut=1";
$sqlu.= " WHERE rowid=".$moduleid;
$result=$db->query($sqlu);
if ($result)
{
$db->commit();
}
else
{
$db->rollback();
}
}
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."expedition_methode WHERE rowid = ".$moduleid; if ($statut == 1 || $_GET["action"] == 'setmod')
$resql = $db->query($sql); {
if ($resql && ($statut == 1 || $_GET["action"] == 'setmod')) $db->begin();
{
$db->begin();
$sqlu = "UPDATE ".MAIN_DB_PREFIX."expedition_methode"; $sql = "INSERT INTO ".MAIN_DB_PREFIX."expedition_methode (rowid,code,libelle,description,statut)";
$sqlu.= " SET statut=1"; $sql.= " VALUES (".$moduleid.",'".$expem->code."','".$expem->name."','".$expem->description."',1)";
$sqlu.= " WHERE rowid=".$moduleid; $result=$db->query($sql);
$result=$db->query($sqlu); if ($result)
if ($result) {
{ $db->commit();
$db->commit(); }
} else
else {
{ //dolibarr_print_error($db);
$db->rollback(); $db->rollback();
} }
} }
else if ($statut == 0)
{
$db->begin();
if ($statut == 1 || $_GET["action"] == 'setmod') $sql = "UPDATE ".MAIN_DB_PREFIX."expedition_methode";
{ $sql.= " SET statut=0";
$db->begin(); $sql.= " WHERE rowid=".$moduleid;
$result=$db->query($sql);
$sql = "INSERT INTO ".MAIN_DB_PREFIX."expedition_methode (rowid,code,libelle,description,statut)"; if ($result)
$sql.= " VALUES (".$moduleid.",'".$expem->code."','".$expem->name."','".$expem->description."',1)"; {
$result=$db->query($sql); $db->commit();
if ($result) }
{ else
$db->commit(); {
} $db->rollback();
else }
{ }
print $sql;
$db->rollback();
}
}
else if ($statut == 0)
{
$db->begin();
$sql = "UPDATE ".MAIN_DB_PREFIX."expedition_methode";
$sql.= " SET statut=0";
$sql.= " WHERE rowid=".$moduleid;
$result=$db->query($sql);
if ($result)
{
$db->commit();
}
else
{
$db->rollback();
}
}
} }
if ($_GET["action"] == 'setmod') if ($_GET["action"] == 'setmod')
{ {
// \todo Verifier si module numerotation choisi peut etre active // \todo Verifier si module numerotation choisi peut etre active
// par appel methode canBeActivated // par appel methode canBeActivated
dolibarr_set_const($db, "EXPEDITION_ADDON",$_GET["module"]); dolibarr_set_const($db, "EXPEDITION_ADDON",$_GET["module"]);
} }
@ -250,14 +248,14 @@ $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."expedition_methode WHERE statut = 1"
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql)
{ {
$i = 0; $i = 0;
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
while ($i < $num) while ($i < $num)
{ {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
$mods[$i]=$obj->rowid; $mods[$i]=$obj->rowid;
$i++; $i++;
} }
} }
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
@ -446,12 +444,12 @@ if(is_dir($dir))
$htmltooltip.='<br><b>'.$langs->trans("Width").'/'.$langs->trans("Height").'</b>: '.$module->page_largeur.'/'.$module->page_hauteur; $htmltooltip.='<br><b>'.$langs->trans("Width").'/'.$langs->trans("Height").'</b>: '.$module->page_largeur.'/'.$module->page_hauteur;
$htmltooltip.='<br><br>'.$langs->trans("FeaturesSupported").':'; $htmltooltip.='<br><br>'.$langs->trans("FeaturesSupported").':';
$htmltooltip.='<br><b>'.$langs->trans("Logo").'</b>: '.yn($module->option_logo); $htmltooltip.='<br><b>'.$langs->trans("Logo").'</b>: '.yn($module->option_logo);
print '<td align="center">'; print '<td align="center">';
print $html->textwithhelp('',$htmltooltip,1,0); print $html->textwithhelp('',$htmltooltip,1,0);
print '</td>'; print '</td>';
print '<td align="center">'; print '<td align="center">';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"),'sending').'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"),'sending').'</a>';
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
} }
@ -465,9 +463,9 @@ else
print '</table>'; print '</table>';
/* /*
* *
* *
*/ */
$db->close(); $db->close();