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"]))
{
$conf->global->EXPEDITION_ADDON_PDF = $_GET["value"];
}
// On active le modele if (dolibarr_set_const($db, "EXPEDITION_ADDON_PDF",$_GET["value"]))
$type='shipping'; {
$sql_del = "DELETE FROM ".MAIN_DB_PREFIX."document_model"; $conf->global->EXPEDITION_ADDON_PDF = $_GET["value"];
$sql_del .= " WHERE nom = '".$_GET["value"]."' AND type = '".$type."'"; }
$result1=$db->query($sql_del);
$sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom,type) VALUES ('".$_GET["value"]."','".$type."')"; // On active le modele
$result2=$db->query($sql); $type='shipping';
if ($result1 && $result2) $sql_del = "DELETE FROM ".MAIN_DB_PREFIX."document_model";
{ $sql_del .= " WHERE nom = '".$_GET["value"]."' AND type = '".$type."'";
$result1=$db->query($sql_del);
$sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom,type) VALUES ('".$_GET["value"]."','".$type."')";
$result2=$db->query($sql);
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;
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."expedition_methode WHERE rowid = ".$moduleid; $result=$db->query($sqlu);
$resql = $db->query($sql); if ($result)
if ($resql && ($statut == 1 || $_GET["action"] == 'setmod')) {
{ $db->commit();
$db->begin(); }
else
$sqlu = "UPDATE ".MAIN_DB_PREFIX."expedition_methode"; {
$sqlu.= " SET statut=1"; $db->rollback();
$sqlu.= " WHERE rowid=".$moduleid; }
$result=$db->query($sqlu); }
if ($result)
{
$db->commit();
}
else
{
$db->rollback();
}
}
if ($statut == 1 || $_GET["action"] == 'setmod')
{
$db->begin();
$sql = "INSERT INTO ".MAIN_DB_PREFIX."expedition_methode (rowid,code,libelle,description,statut)"; if ($statut == 1 || $_GET["action"] == 'setmod')
$sql.= " VALUES (".$moduleid.",'".$expem->code."','".$expem->name."','".$expem->description."',1)"; {
$result=$db->query($sql); $db->begin();
if ($result)
{ $sql = "INSERT INTO ".MAIN_DB_PREFIX."expedition_methode (rowid,code,libelle,description,statut)";
$db->commit(); $sql.= " VALUES (".$moduleid.",'".$expem->code."','".$expem->name."','".$expem->description."',1)";
} $result=$db->query($sql);
else if ($result)
{ {
print $sql; $db->commit();
$db->rollback(); }
} else
} {
else if ($statut == 0) //dolibarr_print_error($db);
{ $db->rollback();
$db->begin(); }
}
$sql = "UPDATE ".MAIN_DB_PREFIX."expedition_methode"; else if ($statut == 0)
$sql.= " SET statut=0"; {
$sql.= " WHERE rowid=".$moduleid; $db->begin();
$result=$db->query($sql);
if ($result) $sql = "UPDATE ".MAIN_DB_PREFIX."expedition_methode";
{ $sql.= " SET statut=0";
$db->commit(); $sql.= " WHERE rowid=".$moduleid;
} $result=$db->query($sql);
else if ($result)
{ {
$db->rollback(); $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%">';
@ -325,10 +323,10 @@ if(is_dir($dir))
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&amp;module='.$name.'&amp;moduleid='.$module->id.'">'.$langs->trans("Default").'</a>'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&amp;module='.$name.'&amp;moduleid='.$module->id.'">'.$langs->trans("Default").'</a>';
} }
print '</td>'; print '</td>';
// Info // Info
print '<td>&nbsp;</td>'; print '<td>&nbsp;</td>';
print '</tr>'; print '</tr>';
} }
} }
@ -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();