From 6d0d0ab834eec84c3860063203a94c670fed5b2e Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Sat, 14 Feb 2004 12:25:48 +0000 Subject: [PATCH] Synchro --- htdocs/admin/expedition.php | 100 +++++------------------- htdocs/fichinter/fiche.php | 26 +++--- htdocs/product/stock/entrepot.class.php | 24 +++++- 3 files changed, 55 insertions(+), 95 deletions(-) diff --git a/htdocs/admin/expedition.php b/htdocs/admin/expedition.php index 3dac16c33bf..77237446c8f 100644 --- a/htdocs/admin/expedition.php +++ b/htdocs/admin/expedition.php @@ -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 ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print "\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 ''; - } - } - closedir($handle); -} -print '
NomInfoActivé 
'.$file."\n"; - print $modExpedition->info(); - print ''; - - if ($expedition_addon_var == "$file") - { - print ''; - } - else - { - print " "; - } - - print "\n"; - - print 'activer'; - - print '
'; -/* - * 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 'Actif'; print 'Défaut'; print "\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 ''; echo $obj->name; print "\n"; - print $obj->description; print ''; @@ -219,18 +159,18 @@ while (($file = readdir($handle))!==false) { print ''; print "\n"; - print 'désactiver'; + print 'désactiver'; } else { print " "; print "\n"; - print 'activer'; + print 'activer'; } print ''; - if ($expedition_addon_var_pdf == "$name") + if ($expedition_default == "$name") { print ''; } @@ -241,7 +181,7 @@ while (($file = readdir($handle))!==false) print "\n"; - print 'activer'; + print 'activer'; print ''; } diff --git a/htdocs/fichinter/fiche.php b/htdocs/fichinter/fiche.php index 92f650663b2..6ad6ce2f3fa 100644 --- a/htdocs/fichinter/fiche.php +++ b/htdocs/fichinter/fiche.php @@ -147,7 +147,7 @@ if ($action == 'create') $smonth = 1; $syear = date("Y", time()); - print ''; + print '
'; print ""; @@ -194,7 +194,6 @@ if ($action == 'create') print "\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 ""; - $i++; - } + while ($i < $numprojet) + { + $projet = $db->fetch_object($i); + print ""; + $i++; + } $db->free(); } else { print $db->error(); @@ -219,7 +219,7 @@ if ($action == 'create') print ''; if ($numprojet==0) { print 'Cette société n\'a pas de projet. '; - print 'Créer un projet'; + print 'Créer un projet'; } print ''; @@ -262,7 +262,7 @@ if ($action == 'edit') print ""; - print '
Société".$objsoc->nom."
Durée (en jours)
'; + print '
'; print "
Date"; /* * set $reday, $remonth, $reyear @@ -328,7 +328,7 @@ if ($id) { $fichinter->fetch_client(); - print ''; + print '
'; print ''; print ''; print ''; @@ -345,7 +345,7 @@ if ($id) /* * */ - print '
Société'.$fichinter->client->nom.'
Date'.strftime("%A %d %B %Y",$fichinter->date).'
Numéro'.$fichinter->ref.'
'; + print '
'; if ($user->societe_id == 0) { @@ -395,9 +395,9 @@ if ($id) print '
'; - print "
"; + print '
'; print_titre("Documents générés"); - print ""; + print '
'; $file = FICHEINTER_OUTPUTDIR . "/$fichinter->ref/$fichinter->ref.pdf"; if (file_exists($file)) diff --git a/htdocs/product/stock/entrepot.class.php b/htdocs/product/stock/entrepot.class.php index a50d1029b04..0c8883b53d4 100644 --- a/htdocs/product/stock/entrepot.class.php +++ b/htdocs/product/stock/entrepot.class.php @@ -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; + } + } } ?>