Fix: Pb in price level management

This commit is contained in:
Laurent Destailleur 2009-03-28 19:11:38 +00:00
parent 53cf18e3e8
commit e9aae286cd
2 changed files with 50 additions and 45 deletions

View File

@ -18,20 +18,20 @@
*/ */
/** /**
\file htdocs/lib/agenda.lib.php * \file htdocs/lib/agenda.lib.php
\brief Ensemble de fonctions de base de dolibarr sous forme d'include * \brief Ensemble de fonctions de base de dolibarr sous forme d'include
\version $Id$ * \version $Id$
*/ */
/** /**
\brief Show actions to do array * \brief Show actions to do array
\param max Max nb of records * \param max Max nb of records
*/ */
function show_array_actions_to_do($max=5) function show_array_actions_to_do($max=5)
{ {
global $langs, $conf, $user, $db, $bc, $socid; global $langs, $conf, $user, $db, $bc, $socid;
include_once(DOL_DOCUMENT_ROOT.'/actioncomm.class.php'); include_once(DOL_DOCUMENT_ROOT.'/actioncomm.class.php');
include_once(DOL_DOCUMENT_ROOT.'/client.class.php'); include_once(DOL_DOCUMENT_ROOT.'/client.class.php');
@ -93,13 +93,13 @@ function show_array_actions_to_do($max=5)
if ($obj->percent > 0 && $obj->percent < 100 && $obj->dp2 && date("U",$obj->dp2) < time()) $late=1; if ($obj->percent > 0 && $obj->percent < 100 && $obj->dp2 && date("U",$obj->dp2) < time()) $late=1;
if ($obj->percent > 0 && $obj->percent < 100 && ! $obj->dp2 && $obj->dp && date("U",$obj->dp) < time()) $late=1; if ($obj->percent > 0 && $obj->percent < 100 && ! $obj->dp2 && $obj->dp && date("U",$obj->dp) < time()) $late=1;
if ($late) print img_warning($langs->trans("Late")); if ($late) print img_warning($langs->trans("Late"));
print "</td>"; print "</td>";
// Statut // Statut
print "<td align=\"center\" width=\"14\">".$staticaction->LibStatut($obj->percent,3)."</td>\n"; print "<td align=\"center\" width=\"14\">".$staticaction->LibStatut($obj->percent,3)."</td>\n";
print "</tr>\n"; print "</tr>\n";
$i++; $i++;
} }
print "</table><br>"; print "</table><br>";
@ -120,7 +120,7 @@ function show_array_actions_to_do($max=5)
function show_array_last_actions_done($max=5) function show_array_last_actions_done($max=5)
{ {
global $langs, $conf, $user, $db, $bc, $socid; global $langs, $conf, $user, $db, $bc, $socid;
$sql = "SELECT a.id, a.percent, ".$db->pdate("a.datep")." as da, ".$db->pdate("a.datep2")." as da2, a.fk_user_author, a.label,"; $sql = "SELECT a.id, a.percent, ".$db->pdate("a.datep")." as da, ".$db->pdate("a.datep2")." as da2, a.fk_user_author, a.label,";
$sql.= " c.code, c.libelle,"; $sql.= " c.code, c.libelle,";
$sql.= " s.rowid, s.nom as sname, s.client"; $sql.= " s.rowid, s.nom as sname, s.client";
@ -160,7 +160,7 @@ function show_array_last_actions_done($max=5)
$var=!$var; $var=!$var;
print "<tr $bc[$var]>"; print "<tr $bc[$var]>";
$staticaction->code=$obj->code; $staticaction->code=$obj->code;
$staticaction->libelle=$obj->libelle; $staticaction->libelle=$obj->libelle;
$staticaction->id=$obj->id; $staticaction->id=$obj->id;
@ -175,7 +175,7 @@ function show_array_last_actions_done($max=5)
// Date // Date
print '<td width="100" align="right">'.dol_print_date($obj->da2,'day'); print '<td width="100" align="right">'.dol_print_date($obj->da2,'day');
print "</td>"; print "</td>";
// Statut // Statut
print "<td align=\"center\" width=\"14\">".$staticaction->LibStatut($obj->percent,3)."</td>\n"; print "<td align=\"center\" width=\"14\">".$staticaction->LibStatut($obj->percent,3)."</td>\n";

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2007 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2007-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2007 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2007 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
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -16,8 +16,12 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* or see http://www.gnu.org/ * or see http://www.gnu.org/
* */
* $Id$
/**
* \file htdocs/lib/agenda.lib.php
* \brief Page called by Ajax request for produts
* \version $Id$
*/ */
function ajax_indicator($htmlname,$indicator='working') function ajax_indicator($htmlname,$indicator='working')
@ -27,14 +31,14 @@ function ajax_indicator($htmlname,$indicator='working')
} }
/** /**
\brief Recupere la valeur d'un champ, effectue un traitement Ajax et affiche le resultat * \brief Recupere la valeur d'un champ, effectue un traitement Ajax et affiche le resultat
\param htmlname nom et id du champ * \param htmlname nom et id du champ
\param keysearch nom et id complementaire du champ de collecte * \param keysearch nom et id complementaire du champ de collecte
\param url chemin du fichier de reponse : /chemin/fichier.php * \param url chemin du fichier de reponse : /chemin/fichier.php
\param option champ supplementaire de recherche dans les parametres * \param option champ supplementaire de recherche dans les parametres
\param indicator Nom de l'image gif sans l'extension * \param indicator Nom de l'image gif sans l'extension
\return script script complet * \return script script complet
*/ */
function ajax_updater($htmlname,$keysearch,$url,$option='',$indicator='working') function ajax_updater($htmlname,$keysearch,$url,$option='',$indicator='working')
{ {
$script = '<input type="hidden" name="'.$htmlname.'" id="'.$htmlname.'" value="">'; $script = '<input type="hidden" name="'.$htmlname.'" id="'.$htmlname.'" value="">';
@ -46,7 +50,7 @@ function ajax_updater($htmlname,$keysearch,$url,$option='',$indicator='working')
Element.show(\'indicator'.$htmlname.'\'); Element.show(\'indicator'.$htmlname.'\');
} }
}, },
onComplete: function() { onComplete: function() {
if(Ajax.activeRequestCount == 0){ if(Ajax.activeRequestCount == 0){
Element.hide(\'indicator'.$htmlname.'\'); Element.hide(\'indicator'.$htmlname.'\');
@ -54,6 +58,7 @@ function ajax_updater($htmlname,$keysearch,$url,$option='',$indicator='working')
} }
};'; };';
$script.='Ajax.Responders.register(myIndicator'.$htmlname.');'; $script.='Ajax.Responders.register(myIndicator'.$htmlname.');';
//print 'param='.$keysearch.'="+$F("'.$keysearch.$htmlname.'")+"&htmlname='.$htmlname.$option; exit;
$script.='new Form.Element.Observer($("'.$keysearch.$htmlname.'"), 1, $script.='new Form.Element.Observer($("'.$keysearch.$htmlname.'"), 1,
function(){ function(){
var myAjax = new Ajax.Updater( { var myAjax = new Ajax.Updater( {
@ -65,20 +70,20 @@ function ajax_updater($htmlname,$keysearch,$url,$option='',$indicator='working')
});'; });';
$script.='</script>'; $script.='</script>';
$script.='<div class="nocellnopadd" id="ajdynfield'.$htmlname.'"></div>'; $script.='<div class="nocellnopadd" id="ajdynfield'.$htmlname.'"></div>';
return $script; return $script;
} }
/** /**
\brief Récupére la valeur d'un champ, effectue un traitement Ajax et affiche le résultat * \brief Get value of a field, do Ajax process and show result
\param htmlname nom et id du champ * \param htmlname nom et id du champ
\param keysearch nom et id complémentaire du champ de collecte * \param keysearch nom et id complementaire du champ de collecte
\param id ID du champ a modifier * \param id ID du champ a modifier
\param url chemin du fichier de réponse : /chemin/fichier.php * \param url chemin du fichier de reponse : /chemin/fichier.php
\param option champ supplémentaire de recherche dans les paramétres * \param option champ supplementaire de recherche dans les parametres
\param indicator Nom de l'image gif sans l'extension * \param indicator Nom de l'image gif sans l'extension
\return script script complet * \return script script complet
*/ */
function ajax_updaterWithID($htmlname,$keysearch,$id,$url,$option='',$indicator='working') function ajax_updaterWithID($htmlname,$keysearch,$id,$url,$option='',$indicator='working')
{ {
$script = '<input type="hidden" name="'.$htmlname.'" id="'.$htmlname.'" value="">'; $script = '<input type="hidden" name="'.$htmlname.'" id="'.$htmlname.'" value="">';
@ -90,7 +95,7 @@ function ajax_updaterWithID($htmlname,$keysearch,$id,$url,$option='',$indicator=
Element.show(\'indicator'.$htmlname.'\'); Element.show(\'indicator'.$htmlname.'\');
} }
}, },
onComplete: function() { onComplete: function() {
if(Ajax.activeRequestCount == 0){ if(Ajax.activeRequestCount == 0){
Element.hide(\'indicator'.$htmlname.'\'); Element.hide(\'indicator'.$htmlname.'\');
@ -107,17 +112,17 @@ function ajax_updaterWithID($htmlname,$keysearch,$id,$url,$option='',$indicator=
var myAjax = new Ajax.Updater(elementHTML,url,o_options); var myAjax = new Ajax.Updater(elementHTML,url,o_options);
});'; });';
$script.='</script>'; $script.='</script>';
return $script; return $script;
} }
/** /**
\brief Récupére la valeur d'un champ, effectue un traitement Ajax et affiche le résultat * \brief Get vlaue of field, do Ajax process and return result
\param htmlname nom et id du champ * \param htmlname nom et id du champ
\param url chemin du fichier de réponse : /chemin/fichier.php * \param url chemin du fichier de reponse : /chemin/fichier.php
\param indicator nom de l'image gif sans l'extension * \param indicator nom de l'image gif sans l'extension
\return script script complet * \return script script complet
*/ */
function ajax_autocompleter($selected='',$htmlname,$url,$indicator='working') function ajax_autocompleter($selected='',$htmlname,$url,$indicator='working')
{ {
if ($indicator) $script.= ajax_indicator($htmlname,$indicator); if ($indicator) $script.= ajax_indicator($htmlname,$indicator);
@ -132,7 +137,7 @@ function ajax_autocompleter($selected='',$htmlname,$url,$indicator='working')
afterUpdateElement: ac_return afterUpdateElement: ac_return
});'; });';
$script.= '</script>'; $script.= '</script>';
return $script; return $script;
} }