This commit is contained in:
Rodolphe Quiedeville 2004-02-14 12:25:48 +00:00
parent 3a7e9f3060
commit 6d0d0ab834
3 changed files with 55 additions and 95 deletions

View File

@ -39,18 +39,16 @@ if (!$user->admin)
exit;
}
if ($action == 'set')
if ($_GET["action"] == 'set')
{
$sql = "INSERT INTO ".MAIN_DB_PREFIX."propal_model_pdf (nom) VALUES ('".$value."')";
$file = DOL_DOCUMENT_ROOT . '/includes/modules/expedition/methode_expedition_'.$_GET["value"].'.modules.php';
$classname = 'methode_expedition_'.$_GET["value"];
require_once($file);
$obj = new $classname();
if ($db->query($sql))
{
}
}
if ($action == 'del')
{
$sql = "DELETE FROM ".MAIN_DB_PREFIX."propal_model_pdf WHERE nom='".$value."'";
$sql = "REPLACE INTO ".MAIN_DB_PREFIX."expedition_methode (rowid,code,libelle, description, statut)";
$sql .= " VALUES (".$obj->id.",'".$obj->code."','".$obj->name."','".addslashes($obj->description)."',".$_GET["statut"].")";
if ($db->query($sql))
{
@ -62,7 +60,7 @@ if ($action == 'del')
$expedition_addon_var_pdf = EXPEDITION_ADDON_PDF;
if ($action == 'setpdf')
if (action == 'setpdf')
{
$sql = "REPLACE INTO ".MAIN_DB_PREFIX."const SET name = 'EXPEDITION_ADDON_PDF', value='".$value."', visible=0";
@ -83,17 +81,17 @@ if ($action == 'setpdf')
}
}
$expedition_addon_var = EXPEDITION_ADDON;
$expedition_default = EXPEDITION_DEFAULT;
if ($action == 'setmod')
if ($_GET["action"] == 'setdef')
{
$sql = "REPLACE INTO ".MAIN_DB_PREFIX."const SET name = 'EXPEDITION_ADDON', value='".$value."', visible=0";
$sql = "REPLACE INTO ".MAIN_DB_PREFIX."const SET name = 'EXPEDITION_ADDON', value='".$value."', visible=0";
if ($db->query($sql))
{
// la constante qui a été lue en avant du nouveau set
// on passe donc par une variable pour avoir un affichage cohérent
$expedition_addon_var = $value;
$expedition_default = $_GET["value"];
}
}
@ -103,62 +101,6 @@ if ($action == 'setmod')
*
*/
print_titre("Module de numérotation");
print '<table class="border" cellpadding="3" cellspacing="0">';
print '<TR class="liste_titre">';
print '<td>Nom</td>';
print '<td>Info</td>';
print '<td align="center">Activé</td>';
print '<td>&nbsp;</td>';
print "</TR>\n";
clearstatcache();
$dir = "../includes/modules/expedition/";
$handle = opendir($dir);
if ($handle)
{
while (($file = readdir($handle))!==false)
{
if (substr($file, 0, 12) == 'mod_expedition_' && substr($file, strlen($file)-3, 3) == 'php')
{
$file = substr($file, 0, strlen($file)-4);
require_once(DOL_DOCUMENT_ROOT ."/includes/modules/expedition/".$file.".php");
$modExpedition = new $file;
print '<tr class="pair"><td>'.$file."</td><td>\n";
print $modExpedition->info();
print '</td><td align="center">';
if ($expedition_addon_var == "$file")
{
print '<img src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/tick.png" border="0"></a>';
}
else
{
print "&nbsp;";
}
print "</td><td>\n";
print '<a href="expedition.php?action=setmod&amp;value='.$file.'">activer</a>';
print '</td></tr>';
}
}
closedir($handle);
}
print '</table>';
/*
* PDF
*/
$def = array();
$sql = "SELECT nom FROM ".MAIN_DB_PREFIX."propal_model_pdf";
@ -177,7 +119,7 @@ else
print $db->error();
}
$dir = "../includes/modules/expedition/";
$dir = DOL_DOCUMENT_ROOT."/includes/modules/expedition/";
/*
* Méthode de livraison
@ -192,25 +134,23 @@ print '<td align="center" colspan="2">Actif</td>';
print '<td align="center" colspan="2">Défaut</td>';
print "</tr>\n";
clearstatcache();
$handle=opendir($dir);
while (($file = readdir($handle))!==false)
{
if (substr($file, strlen($file) -12) == '.modules.php' && substr($file,0,19) == 'methode_expedition_')
{
$name = substr($file, 19, strlen($file) - 27);
$name = substr($file, 19, strlen($file) - 31);
$classname = substr($file, 0, strlen($file) - 12);
require_once($dir.$file);
$obj = new $classname();
print '<tr class="pair"><td>';
echo $obj->name;
print "</td><td>\n";
print $obj->description;
print '</td><td align="center">';
@ -219,18 +159,18 @@ while (($file = readdir($handle))!==false)
{
print '<img src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/tick.png" border="0"></a>';
print "</td><td>\n";
print '<a href="expedition.php?action=del&amp;value='.$name.'">désactiver</a>';
print '<a href="expedition.php?action=set&amp;statut=0&amp;value='.$name.'">désactiver</a>';
}
else
{
print "&nbsp;";
print "</td><td>\n";
print '<a href="expedition.php?action=set&amp;value='.$name.'">activer</a>';
print '<a href="expedition.php?action=set&amp;statut=1&amp;value='.$name.'">activer</a>';
}
print '</td><td align="center">';
if ($expedition_addon_var_pdf == "$name")
if ($expedition_default == "$name")
{
print '<img src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/tick.png" border="0"></a>';
}
@ -241,7 +181,7 @@ while (($file = readdir($handle))!==false)
print "</td><td>\n";
print '<a href="expedition.php?action=setpdf&amp;value='.$name.'">activer</a>';
print '<a href="expedition.php?action=setdef&amp;value='.$name.'">activer</a>';
print '</td></tr>';
}

View File

@ -147,7 +147,7 @@ if ($action == 'create')
$smonth = 1;
$syear = date("Y", time());
print '<table border="1" cellpadding="3" cellspacing="0" width="100%">';
print '<table class="border" cellpadding="3" cellspacing="0" width="100%">';
print "<tr><td>Société</td><td><b>".$objsoc->nom."</td></tr>";
@ -194,7 +194,6 @@ if ($action == 'create')
print "<tr><td>Durée (en jours)</td><td><input name=\"duree\"></td></tr>\n";
/*
*
* Projet associé
*
*/
@ -207,11 +206,12 @@ if ($action == 'create')
{
$i = 0 ;
$numprojet = $db->num_rows();
while ($i < $numprojet) {
$projet = $db->fetch_object($i);
print "<option value=\"$projet->rowid\">$projet->title</option>";
$i++;
}
while ($i < $numprojet)
{
$projet = $db->fetch_object($i);
print "<option value=\"$projet->rowid\">$projet->title</option>";
$i++;
}
$db->free();
} else {
print $db->error();
@ -219,7 +219,7 @@ if ($action == 'create')
print '</select>';
if ($numprojet==0) {
print 'Cette société n\'a pas de projet.&nbsp;';
print '<a href='.DOL_URL_ROOT.'/comm/projet/fiche.php?socidp='.$socidp.'&action=create>Créer un projet</a>';
print '<a href='.DOL_URL_ROOT.'/projet/fiche.php?socidp='.$socidp.'&action=create>Créer un projet</a>';
}
print '</td></tr>';
@ -262,7 +262,7 @@ if ($action == 'edit')
print "<form action=\"$PHP_SELF?id=$id\" method=\"post\">";
print '<table border="1" cellpadding="3" cellspacing="0" width="100%">';
print '<table class="border" cellpadding="3" cellspacing="0" width="100%">';
print "<tr><td>Date</td><td>";
/*
* set $reday, $remonth, $reyear
@ -328,7 +328,7 @@ if ($id)
{
$fichinter->fetch_client();
print '<table border="1" cellpadding="3" cellspacing="0" width="100%">';
print '<table class="border" cellpadding="3" cellspacing="0" width="100%">';
print '<tr><td>Société</td><td><a href="../comm/fiche.php?socid='.$fichinter->client->id.'">'.$fichinter->client->nom.'</a></td></tr>';
print '<tr><td width="20%">Date</td><td>'.strftime("%A %d %B %Y",$fichinter->date).'</td></tr>';
print '<tr><td>Numéro</td><td>'.$fichinter->ref.'</td></tr>';
@ -345,7 +345,7 @@ if ($id)
/*
*
*/
print '<br><table border="1" cellpadding="3" cellspacing="0" width="100%"><tr>';
print '<br><table class="border" cellpadding="3" cellspacing="0" width="100%"><tr>';
if ($user->societe_id == 0)
{
@ -395,9 +395,9 @@ if ($id)
print '</tr></table>';
print "<table width=\"50%\" cellspacing=2><tr><td width=\"50%\" valign=\"top\">";
print '<table width="50%" cellspacing="2"><tr><td width="50%" valign="top">';
print_titre("Documents générés");
print "<table width=\"100%\" cellspacing=0 border=1 cellpadding=3>";
print '<table width="100%" cellspacing="0" class="border" cellpadding="3">';
$file = FICHEINTER_OUTPUTDIR . "/$fichinter->ref/$fichinter->ref.pdf";
if (file_exists($file))

View File

@ -42,10 +42,8 @@ class Entrepot
*/
Function create($user)
{
if ($this->db->query("BEGIN") )
{
$sql = "INSERT INTO ".MAIN_DB_PREFIX."entrepot (datec, fk_user_author)";
$sql .= " VALUES (now(),".$user->id.")";
@ -161,5 +159,27 @@ class Entrepot
}
return $liste;
}
/**
* Renvoie la liste des entrepôts ouverts
*
*/
Function nb_products()
{
$sql = "SELECT sum(reel) FROM llx_product_stock WHERE fk_entrepot = ".$this->id;
$result = $this->db->query($sql) ;
if ( $result )
{
$row = $this->db->fetch_row(0);
return $row[0];
$this->db->free();
}
else
{
return 0;
}
}
}
?>