[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpcompta-dev] r4243 - phpcompta/branches/rel600-dynamic-menu/include
From: |
phpcompta-dev |
Subject: |
[Phpcompta-dev] r4243 - phpcompta/branches/rel600-dynamic-menu/include |
Date: |
Thu, 27 Oct 2011 22:28:37 +0200 (CEST) |
Author: danydb
Date: 2011-10-27 22:28:36 +0200 (Thu, 27 Oct 2011)
New Revision: 4243
Modified:
phpcompta/branches/rel600-dynamic-menu/include/action.inc.php
phpcompta/branches/rel600-dynamic-menu/include/adm.inc.php
phpcompta/branches/rel600-dynamic-menu/include/balance_card.inc.php
phpcompta/branches/rel600-dynamic-menu/include/client.inc.php
phpcompta/branches/rel600-dynamic-menu/include/forecast.inc.php
phpcompta/branches/rel600-dynamic-menu/include/impress_poste.inc.php
phpcompta/branches/rel600-dynamic-menu/include/lettering.gestion.inc.php
phpcompta/branches/rel600-dynamic-menu/include/suivi_adm.inc.php
phpcompta/branches/rel600-dynamic-menu/include/suivi_supplier.inc.php
phpcompta/branches/rel600-dynamic-menu/include/supplier.inc.php
phpcompta/branches/rel600-dynamic-menu/include/user_action_gl.php
Log:
#241 : modularity : gestion customer + supplier + forecast + follow up
Modified: phpcompta/branches/rel600-dynamic-menu/include/action.inc.php
===================================================================
--- phpcompta/branches/rel600-dynamic-menu/include/action.inc.php
2011-10-27 19:54:39 UTC (rev 4242)
+++ phpcompta/branches/rel600-dynamic-menu/include/action.inc.php
2011-10-27 20:28:36 UTC (rev 4243)
@@ -22,10 +22,10 @@
* \brief Page who manage the different actions (meeting, letter)
*/
require_once('class_ipopup.php');
-global $User;
-$User->can_request(GECOUR);
+global $g_user;
+$g_user->can_request(GECOUR);
-$retour=HtmlInput::button_anchor(_('Retour'),'?p_action=suivi_courrier&my_action&'.dossier::get());
+$retour=HtmlInput::button_anchor(_('Retour'),'?ac='.$_REQUEST['ac'].'&my_action&'.dossier::get());
//-----------------------------------------------------
// Action
//-----------------------------------------------------
Modified: phpcompta/branches/rel600-dynamic-menu/include/adm.inc.php
===================================================================
--- phpcompta/branches/rel600-dynamic-menu/include/adm.inc.php 2011-10-27
19:54:39 UTC (rev 4242)
+++ phpcompta/branches/rel600-dynamic-menu/include/adm.inc.php 2011-10-27
20:28:36 UTC (rev 4243)
@@ -32,13 +32,13 @@
require_once('class_ipopup.php');
require_once('class_admin.php');
-global $User;
+global $g_user;
$low_action=(isset($_REQUEST['sb']))?$_REQUEST['sb']:"list";
/*! \file
* \brief Called from the module "Gestion" to manage the customer
*/
-$User->can_request(GECUST);
+$g_user->can_request(GECUST);
$href=basename($_SERVER['PHP_SELF']);
// by default open liste
@@ -51,7 +51,7 @@
//-----------------------------------------------------
if ( isset($_POST['delete_card'] ) )
{
- if ( $User->check_action(FICADD) == 0 )
+ if ( $g_user->check_action(FICADD) == 0 )
{
alert('Vous ne pouvez pas enlever de fiche');
return;
@@ -144,7 +144,7 @@
if ( $low_action=="insert" )
{
/* security : check if user can add card */
- if ( $User->check_action(FICADD) == 0 )
+ if ( $g_user->check_action(FICADD) == 0 )
{
alert('Vous ne pouvez pas ajouter de fiche');
return;
Modified: phpcompta/branches/rel600-dynamic-menu/include/balance_card.inc.php
===================================================================
--- phpcompta/branches/rel600-dynamic-menu/include/balance_card.inc.php
2011-10-27 19:54:39 UTC (rev 4242)
+++ phpcompta/branches/rel600-dynamic-menu/include/balance_card.inc.php
2011-10-27 20:28:36 UTC (rev 4243)
@@ -24,12 +24,12 @@
* \brief show the status of a card
*/
require_once('class_exercice.php');
-global $User;
+global $g_user;
echo '<div class="content" style="width:80%;margin-left:10%">';
$exercice=new Exercice($cn);
$old='';
$fiche=new Fiche($cn,$_GET['f_id']);
-$year=$User->get_exercice();
+$year=$g_user->get_exercice();
if ( $year == 0 )
{
$html="erreur aucune période par défaut, allez dans préférence pour en
choisir une";
Modified: phpcompta/branches/rel600-dynamic-menu/include/client.inc.php
===================================================================
--- phpcompta/branches/rel600-dynamic-menu/include/client.inc.php
2011-10-27 19:54:39 UTC (rev 4242)
+++ phpcompta/branches/rel600-dynamic-menu/include/client.inc.php
2011-10-27 20:28:36 UTC (rev 4243)
@@ -15,10 +15,10 @@
* You should have received a copy of the GNU General Public License
* along with PhpCompta; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*/
+ */
/* $Revision$ */
// Copyright Author Dany De Bontridder address@hidden
-/*!\brief include from client.inc.php and concerned only the customer card and
+/* !\brief include from client.inc.php and concerned only the customer card and
* the customer category
*/
require_once("class_iselect.php");
@@ -32,149 +32,143 @@
require_once('class_ipopup.php');
echo ICard::ipopup('ipop_newcard');
-$ip_cat=new IPopup('ipop_cat');
-$ip_cat->title=_('Ajout d\'une catégorie');
-$ip_cat->value='';
+$ip_cat = new IPopup('ipop_cat');
+$ip_cat->title = _('Ajout d\'une catégorie');
+$ip_cat->value = '';
echo $ip_cat->input();
echo IPoste::ipopup('ipop_account');
-$search_card=new IPopup('ipop_card');
-$search_card->title=_('Recherche de fiche');
-$search_card->value='';
+$search_card = new IPopup('ipop_card');
+$search_card->title = _('Recherche de fiche');
+$search_card->value = '';
echo $search_card->input();
echo ICard::ipopup('ipopcard');
-$low_action=(isset($_REQUEST['sb']))?$_REQUEST['sb']:"list";
-/*! \file
+$low_action = (isset($_REQUEST['sb'])) ? $_REQUEST['sb'] : "list";
+/* ! \file
* \brief Called from the module "Gestion" to manage the customer
*/
-$href=basename($_SERVER['PHP_SELF']);
+$href = basename($_SERVER['PHP_SELF']);
// by default open liste
-if ( $low_action == "" )
- $low_action="list";
+if ($low_action == "")
+ $low_action = "list";
//-----------------------------------------------------
// Remove a card
//-----------------------------------------------------
-if ( isset($_POST['delete_card'] ) )
+if (isset($_POST['delete_card']))
{
- if ( $User->check_action(FICADD) == 0 )
+ if ($g_user->check_action(FICADD) == 0)
{
- alert(j(_('Vous ne pouvez pas enlever de fiche')));
- return;
+ alert(j(_('Vous ne pouvez pas enlever de fiche')));
+ return;
}
- $f_id=$_REQUEST['f_id'];
+ $f_id = $_REQUEST['f_id'];
- $fiche=new Customer($cn,$f_id);
+ $fiche = new Customer($cn, $f_id);
$fiche->remove();
- $low_action="list";
-
+ $low_action = "list";
}
//-----------------------------------------------------
// list of customer
//-----------------------------------------------------
-if ( $low_action == "list" )
+if ($low_action == "list")
{
-
?>
- <div class="content">
- <span style="position:float;float:left">
- <form method="get" action="<?php echo $href; ?>">
-<?php
- echo dossier::hidden();
- $a=(isset($_GET['query']))?$_GET['query']:"";
- printf (_('Recherche').' <input class="input_text" type="text"
name="query" value="%s">',
- $a);
- $sel_card=new ISelect('cat');
- $sel_card->value=$cn->make_array('select fd_id, fd_label from fiche_def '.
- ' where frd_id='.FICHE_TYPE_CLIENT.
- ' order by fd_label ',1);
- $sel_card->selected=(isset($_GET['cat']))?$_GET['cat']:-1;
- $sel_card->javascript=' onchange="submit(this);"';
- echo _('Catégorie :').$sel_card->input();
- $nooperation=new ICheckBox('noop');
- $nooperation->selected=(isset($_GET['noop']))?true:false;
+ <div class="content">
+ <span style="position:float;float:left">
+ <form method="get" action="<?php echo $href;?>">
+ <?php
+ echo dossier::hidden();
+ $a = (isset($_GET['query'])) ? $_GET['query'] : "";
+ printf(_('Recherche') . ' <input class="input_text" type="text"
name="query" value="%s">', $a);
+ $sel_card = new ISelect('cat');
+ $sel_card->value = $cn->make_array('select fd_id, fd_label from
fiche_def ' .
+ ' where frd_id=' . FICHE_TYPE_CLIENT .
+ ' order by fd_label ', 1);
+ $sel_card->selected = (isset($_GET['cat'])) ? $_GET['cat'] : -1;
+ $sel_card->javascript = ' onchange="submit(this);"';
+ echo _('Catégorie :') . $sel_card->input();
+ $nooperation = new ICheckBox('noop');
+ $nooperation->selected = (isset($_GET['noop'])) ? true : false;
- echo _('Inclure les clients sans opération :').$nooperation->input();
+ echo _('Inclure les clients sans opération :') .
$nooperation->input();
+ ?>
+ <input type="submit" class="button" name="submit_query" value="<?=
_('recherche')?>">
+ <input type="hidden" name="ac" value="<?= $_REQUEST['ac']?>">
+ </form>
+ </span>
+ <?php
+ $client = new Customer($cn);
+ $search = (isset($_GET['query'])) ? $_GET['query'] : "";
+ $sql = "";
+ if (isset($_GET['cat']))
+ {
+ if ($_GET['cat'] != -1)
+ $sql = sprintf(" and fd_id = %d", $_GET['cat']);
+ }
+ $noop = (isset($_GET['noop'])) ? false : true;
+ echo '<div class="content">';
+ echo $client->Summary($search, 'client', $sql, $noop);
- ?>
- <input type="submit" class="button" name="submit_query"
value="<?=_('recherche')?>">
- <input type="hidden" name="ac"
value="<?=$_REQUEST['ac']?>">
- </form>
- </span>
- <?php
-
$client=new Customer($cn);
- $search=(isset($_GET['query']))?$_GET['query']:"";
- $sql="";
- if ( isset($_GET['cat']))
-{
- if ( $_GET['cat'] != -1) $sql=sprintf(" and fd_id = %d",$_GET['cat']);
- }
- $noop=(isset($_GET['noop']))?false:true;
- echo '<div class="content">';
- echo $client->Summary($search,'client',$sql,$noop);
-
- echo '<br>';
- echo '<br>';
- echo '<br>';
- /* Add button */
- $f_add_button=new IButton('add_card');
- $f_add_button->label=_('Créer une nouvelle fiche');
- $f_add_button->set_attribute('ipopup','ipop_newcard');
- $f_add_button->set_attribute('win_refresh','yes');
+ echo '<br>';
+ echo '<br>';
+ echo '<br>';
+ /* Add button */
+ $f_add_button = new IButton('add_card');
+ $f_add_button->label = _('Créer une nouvelle fiche');
+ $f_add_button->set_attribute('ipopup', 'ipop_newcard');
+ $f_add_button->set_attribute('win_refresh', 'yes');
// $list=$cn->make_list("select fd_id from fiche_def where
frd_id=$1",array(FICHE_TYPE_CLIENT));
- $f_add_button->set_attribute('type_cat',FICHE_TYPE_CLIENT);
- $f_add_button->javascript=" select_card_type(this);";
- echo $f_add_button->input();
+ $f_add_button->set_attribute('type_cat', FICHE_TYPE_CLIENT);
+ $f_add_button->javascript = " select_card_type(this);";
+ echo $f_add_button->input();
- $f_cat_button=new IButton('add_cat');
- $f_cat_button->set_attribute('ipopup','ipop_cat');
- $f_cat_button->set_attribute('type_cat',FICHE_TYPE_CLIENT);
- $f_cat_button->label=_('Ajout d\'une catégorie');
- $f_cat_button->javascript='add_category(this)';
- echo $f_cat_button->input();
- echo '</div>';
- echo '</div>';
-
-
-}
-/*----------------------------------------------------------------------
- * Detail for a card, Suivi, Contact, Operation,... *
- * cc stands for customer card
- *----------------------------------------------------------------------*/
-if ( $low_action == 'detail')
-{
- /* Menu */
- require_once('client_card.inc.php');
- exit();
-}
-
-if ( $low_action=="insert" )
-{
- /* security : check if user can add card */
- if ( $User->check_action(FICADD) == 0 )
+ $f_cat_button = new IButton('add_cat');
+ $f_cat_button->set_attribute('ipopup', 'ipop_cat');
+ $f_cat_button->set_attribute('type_cat', FICHE_TYPE_CLIENT);
+ $f_cat_button->label = _('Ajout d\'une catégorie');
+ $f_cat_button->javascript = 'add_category(this)';
+ echo $f_cat_button->input();
+ echo '</div>';
+ echo '</div>';
+ }
+ /* ----------------------------------------------------------------------
+ * Detail for a card, Suivi, Contact, Operation,... *
+ * cc stands for customer card
+ * ----------------------------------------------------------------------
*/
+ if ($low_action == 'detail')
{
- alert('Vous ne pouvez pas ajouter de fiche');
- return;
+ /* Menu */
+ require_once('client_card.inc.php');
+ exit();
}
- $customer=new Customer($cn);
- $customer->Save($_REQUEST['fd_id']);
- echo '<div class="content">';
- echo "<table>";
- echo $customer->Display(true);
- echo "</table>";
- $retour=new IAction();
- $retour->label="Retour";
- $retour->value="?ac=".$_REQUEST["ac"]."&".dossier::get();
- echo $retour->input();
- echo '</div>';
+ if ($low_action == "insert")
+ {
+ /* security : check if user can add card */
+ if ($g_user->check_action(FICADD) == 0)
+ {
+ alert('Vous ne pouvez pas ajouter de fiche');
+ return;
+ }
-}
+ $customer = new Customer($cn);
+ $customer->Save($_REQUEST['fd_id']);
+ echo '<div class="content">';
+ echo "<table>";
+ echo $customer->Display(true);
+ echo "</table>";
+ $retour = new IAction();
+ $retour->label = "Retour";
+ $retour->value = "?ac=" . $_REQUEST["ac"] . "&" . dossier::get();
+ echo $retour->input();
+ echo '</div>';
+ }
-html_page_stop();
-?>
+ html_page_stop();
+ ?>
Modified: phpcompta/branches/rel600-dynamic-menu/include/forecast.inc.php
===================================================================
--- phpcompta/branches/rel600-dynamic-menu/include/forecast.inc.php
2011-10-27 19:54:39 UTC (rev 4242)
+++ phpcompta/branches/rel600-dynamic-menu/include/forecast.inc.php
2011-10-27 20:28:36 UTC (rev 4243)
@@ -1,4 +1,5 @@
<?php
+
/*
* This file is part of PhpCompta.
*
@@ -20,379 +21,369 @@
// Copyright Author Dany De Bontridder address@hidden
-/*!\file
+/* !\file
* \brief display, add, delete and modify forecast
*/
require_once 'class_anticipation.php';
-$sa=(isset($_REQUEST['sa']))?$_REQUEST['sa']:'';
-/**********************************************************************
+$sa = (isset($_REQUEST['sa'])) ? $_REQUEST['sa'] : '';
+/* * ********************************************************************
* Remove a anticipation
*
*
- **********************************************************************/
+ * ******************************************************************** */
/**
* @todo add security for forecast.inc.php
*/
-if ( isset($_GET['del']))
+if (isset($_GET['del']))
{
- $forecast=new Forecast($cn,$_GET['f_id']);
+ $forecast = new Forecast($cn, $_GET['f_id']);
$forecast->delete();
}
/*
* Cloning
*/
-if (isset ($_REQUEST ['clone']))
- {
+if (isset($_REQUEST ['clone']))
+{
echo "<h2> cloning</h2>";
/*
* We need to clone the forecast
*/
- $anti=new Forecast($cn,$_REQUEST ['f_id']);
+ $anti = new Forecast($cn, $_REQUEST ['f_id']);
$anti->object_clone();
-
- }
-/**********************************************************************
+}
+/* * ********************************************************************
* Save the modification mod_cat_save
*
*
- **********************************************************************/
-if ( isset($_POST['mod_cat_save']))
- {
- /*
- * We save the forecast
- */
- $anti=new Forecast($cn,$_POST['f_id']);
- try
- {
- $cn->start();
- /* Save forecast */
- $anti->set_parameter('name',$_POST['an_name']);
- $anti->set_parameter('start_date',$_POST['start_date']);
- $anti->set_parameter('end_date',$_POST['end_date']);
+ * ******************************************************************** */
+if (isset($_POST['mod_cat_save']))
+{
+ /*
+ * We save the forecast
+ */
+ $anti = new Forecast($cn, $_POST['f_id']);
+ try
+ {
+ $cn->start();
+ /* Save forecast */
+ $anti->set_parameter('name', $_POST['an_name']);
+ $anti->set_parameter('start_date', $_POST['start_date']);
+ $anti->set_parameter('end_date', $_POST['end_date']);
- $anti->save();
+ $anti->save();
- /* add new category */
- for ($i=0;$i<MAX_CAT;$i++)
- {
- if( isset($_POST['fr_cat_new'.$i]))
- {
- if (strlen(trim($_POST['fr_cat_new'.$i])) != 0 )
- {
- $c=new Forecast_Cat($cn);
- $c->set_parameter('order',$_POST['fc_order_new'.$i]);
- $c->set_parameter('desc',$_POST['fr_cat_new'.$i]);
- $c->set_parameter('forecast',$_POST['f_id']);
- $c->save();
- }
- }
- }
+ /* add new category */
+ for ($i = 0; $i < MAX_CAT; $i++)
+ {
+ if (isset($_POST['fr_cat_new' . $i]))
+ {
+ if (strlen(trim($_POST['fr_cat_new' . $i])) != 0)
+ {
+ $c = new Forecast_Cat($cn);
+ $c->set_parameter('order', $_POST['fc_order_new' . $i]);
+ $c->set_parameter('desc', $_POST['fr_cat_new' . $i]);
+ $c->set_parameter('forecast', $_POST['f_id']);
+ $c->save();
+ }
+ }
+ }
- /* update existing cat */
- foreach ($_POST as $key=>$value)
- {
- $var=sscanf($key,'fr_cat%d');
- $idx=sprintf("fr_cat%d",$var[0]);
- if (isset($_POST[$idx]))
- {
- $fc=new Forecast_Cat($cn,$var[0]);
- if (strlen(trim($_POST[$idx]))==0)
- {
- $fc->delete();
- }
- else
- {
- $fc->set_parameter('order',$_POST['fc_order'.$var[0]]);
- $fc->set_parameter('desc',$_POST['fr_cat'.$var[0]]);
- $fc->set_parameter('forecast',$_POST['f_id']);
- $fc->save();
- }
+ /* update existing cat */
+ foreach ($_POST as $key => $value)
+ {
+ $var = sscanf($key, 'fr_cat%d');
+ $idx = sprintf("fr_cat%d", $var[0]);
+ if (isset($_POST[$idx]))
+ {
+ $fc = new Forecast_Cat($cn, $var[0]);
+ if (strlen(trim($_POST[$idx])) == 0)
+ {
+ $fc->delete();
+ }
+ else
+ {
+ $fc->set_parameter('order', $_POST['fc_order' . $var[0]]);
+ $fc->set_parameter('desc', $_POST['fr_cat' . $var[0]]);
+ $fc->set_parameter('forecast', $_POST['f_id']);
+ $fc->save();
+ }
+ }
+ }
- }
- }
-
- $cn->commit();
- }
- catch (Exception $e)
- {
- alert($e->getMessage());
- $cn->rollback();
-
- }
- $sa='vw';
-
- }
-/**********************************************************************
+ $cn->commit();
+ }
+ catch (Exception $e)
+ {
+ alert($e->getMessage());
+ $cn->rollback();
+ }
+ $sa = 'vw';
+}
+/* * ********************************************************************
* Save first the data for new
*
*
- **********************************************************************/
-if ( $sa == 'new' || isset ($_POST['step3']))
+ * ******************************************************************** */
+if ($sa == 'new' || isset($_POST['step3']))
{
- $correct=0;
+ $correct = 0;
if (isset($_POST['step3']))
{
- /*save all the items */
- try
- {
- $cn->start();
- for ($i=0;$i<$_POST['nbrow'];$i++)
- {
+ /* save all the items */
+ try
+ {
+ $cn->start();
+ for ($i = 0; $i < $_POST['nbrow']; $i++)
+ {
- // Delete if needed
- if ( isset($_POST['fi_id'.$i]))
- {
- if (strlen(trim($_POST['an_cat_acc'.$i]))==0
&&strlen(trim($_POST['an_qc'.$i]))== 0)
- {
- $e=new Forecast_item($cn);
- $e->set_parameter("id",$_POST['fi_id'.$i]);
- $e->delete();
- }
- }
+ // Delete if needed
+ if (isset($_POST['fi_id' . $i]))
+ {
+ if (strlen(trim($_POST['an_cat_acc' . $i])) == 0 &&
strlen(trim($_POST['an_qc' . $i])) == 0)
+ {
+ $e = new Forecast_item($cn);
+ $e->set_parameter("id", $_POST['fi_id' . $i]);
+ $e->delete();
+ }
+ }
- if (strlen(trim($_POST['an_cat_acc'.$i]))!=0 ||
strlen(trim($_POST['an_qc'.$i]))!= 0)
- {
- /* we save only if there is something */
- $e=new Forecast_item($cn);
- if ( isset($_POST['fi_id'.$i]))
- {
- $e->set_parameter("id",$_POST['fi_id'.$i]);
- }
- $e->set_parameter('text',$_POST['an_label'.$i]);
- $e->set_parameter('amount',$_POST['an_cat_amount'.$i]);
- $e->set_parameter('debit',$_POST['an_deb'.$i]);
- $e->set_parameter('cat_id',$_POST['an_cat'.$i]);
- $e->set_parameter('account',$_POST['an_cat_acc'.$i]);
- $e->set_parameter('periode',$_POST['month'.$i]);
- $f=new Fiche($cn);
- if ( $f->get_by_qcode($_POST['an_qc'.$i],false) == 0 )
- $e->set_parameter('card',$f->id);
- else
- $e->set_parameter('card',null);
- $e->set_parameter('order',$i);
- $e->save();
- }
- }
- $cn->commit();
- $sa='vw'; // to avoid to restart the add of new anticipation
- }
- catch (Exception $e)
- {
- $cn->rollback();
- alert($e->getMessage());
- $correct=1;
- }
-
+ if (strlen(trim($_POST['an_cat_acc' . $i])) != 0 ||
strlen(trim($_POST['an_qc' . $i])) != 0)
+ {
+ /* we save only if there is something */
+ $e = new Forecast_item($cn);
+ if (isset($_POST['fi_id' . $i]))
+ {
+ $e->set_parameter("id", $_POST['fi_id' . $i]);
+ }
+ $e->set_parameter('text', $_POST['an_label' . $i]);
+ $e->set_parameter('amount', $_POST['an_cat_amount' . $i]);
+ $e->set_parameter('debit', $_POST['an_deb' . $i]);
+ $e->set_parameter('cat_id', $_POST['an_cat' . $i]);
+ $e->set_parameter('account', $_POST['an_cat_acc' . $i]);
+ $e->set_parameter('periode', $_POST['month' . $i]);
+ $f = new Fiche($cn);
+ if ($f->get_by_qcode($_POST['an_qc' . $i], false) == 0)
+ $e->set_parameter('card', $f->id);
+ else
+ $e->set_parameter('card', null);
+ $e->set_parameter('order', $i);
+ $e->save();
+ }
+ }
+ $cn->commit();
+ $sa = 'vw'; // to avoid to restart the add of new anticipation
+ }
+ catch (Exception $e)
+ {
+ $cn->rollback();
+ alert($e->getMessage());
+ $correct = 1;
+ }
}
/* Second step : we save the name and category
* and propose the items we add the item */
- if ($correct==2 || isset ($_POST['step2']))
+ if ($correct == 2 || isset($_POST['step2']))
{
- try
- {
- $cn->start();
- /* Save forecast */
- $a=new Forecast($cn);
- $a->set_parameter('name',$_POST['an_name']);
- $a->set_parameter('start_date',$_POST['start_date']);
- $a->set_parameter('end_date',$_POST['end_date']);
+ try
+ {
+ $cn->start();
+ /* Save forecast */
+ $a = new Forecast($cn);
+ $a->set_parameter('name', $_POST['an_name']);
+ $a->set_parameter('start_date', $_POST['start_date']);
+ $a->set_parameter('end_date', $_POST['end_date']);
- $a->save();
- $id=$a->get_parameter("id");
- /* save cat */
- for ($i=0;$i<MAX_CAT;$i++)
- {
- if( strlen(trim($_POST['fr_cat'.$i])) != 0 )
- {
- $c=new Forecast_Cat($cn);
- $c->set_parameter('order',$_POST['fr_order'.$i]);
- $c->set_parameter('desc',$_POST['fr_cat'.$i]);
- $c->set_parameter('forecast',$id);
- $c->save();
- }
- }
- $cn->commit();
- }
- catch (Exception $e)
- {
- alert($e->getMessage());
- $correct=1;
- unset($_POST['step2']);
- $cn->rollback();
- }
-
+ $a->save();
+ $id = $a->get_parameter("id");
+ /* save cat */
+ for ($i = 0; $i < MAX_CAT; $i++)
+ {
+ if (strlen(trim($_POST['fr_cat' . $i])) != 0)
+ {
+ $c = new Forecast_Cat($cn);
+ $c->set_parameter('order', $_POST['fr_order' . $i]);
+ $c->set_parameter('desc', $_POST['fr_cat' . $i]);
+ $c->set_parameter('forecast', $id);
+ $c->save();
+ }
+ }
+ $cn->commit();
+ }
+ catch (Exception $e)
+ {
+ alert($e->getMessage());
+ $correct = 1;
+ unset($_POST['step2']);
+ $cn->rollback();
+ }
}
-
}
-/**********************************************************************
+/* * ********************************************************************
* Display menu
*
*
- **********************************************************************/
+ * ******************************************************************** */
// display button add and list of forecast to display
-$aForecast=Forecast::load_all($cn);
-$menu=array();
-$get_dossier=dossier::get();
+$aForecast = Forecast::load_all($cn);
+$menu = array();
+$get_dossier = dossier::get();
-for ($i = 0;$i<count($aForecast);$i++)
+for ($i = 0; $i < count($aForecast); $i++)
{
- $href="?p_action=prev&sa=vw&".$get_dossier.'&f_id='.$aForecast[$i]['f_id'];
- $name=h($aForecast[$i]['f_name']);
- $menu[]=array($href,$name,$name,$aForecast[$i]['f_id']);
+ $href = "?ac=" . $_REQUEST['ac'] . "&sa=vw&" . $get_dossier . '&f_id=' .
$aForecast[$i]['f_id'];
+ $name = h($aForecast[$i]['f_name']);
+ $menu[] = array($href, $name, $name, $aForecast[$i]['f_id']);
}
-$href="?p_action=prev&sa=new&".$get_dossier;
-$menu[]=array($href,_("Ajout prévision"),_("Ajout d'une prévision"),0);
-$def=(isset($_REQUEST['f_id']))?$_REQUEST['f_id']:-1;
+$href = "?ac=" . $_REQUEST['ac'] . "&sa=new&" . $get_dossier;
+$menu[] = array($href, _("Ajout prévision"), _("Ajout d'une prévision"), 0);
+$def = (isset($_REQUEST['f_id'])) ? $_REQUEST['f_id'] : -1;
echo '<div class="lmenu">';
-echo ShowItem($menu,'H','mtitle','mtitle',$def);
+echo ShowItem($menu, 'H', 'mtitle', 'mtitle', $def);
echo '</div>';
-/**********************************************************************
+/* * ********************************************************************
* Ask for a new anticipation (forecast)
*
*
- **********************************************************************/
-if ( $sa == 'new')
+ * ******************************************************************** */
+if ($sa == 'new')
{
/* Second step : we save the name and category
* and propose the items we add the item */
- if ($correct==2 || isset ($_POST['step2']))
+ if ($correct == 2 || isset($_POST['step2']))
{
- /* Propose a form for the items
- */
- $anticip=new Anticipation($cn,$a->get_parameter("id"));
- echo '<div class="content">';
- echo ICard::ipopup('ipopcard');
- echo IPoste::ipopup('ipop_account');
- $search_card=new IPopup('ipop_card');
- $search_card->title=_('Recherche de fiche');
- $search_card->value='';
- echo $search_card->input();
+ /* Propose a form for the items
+ */
+ $anticip = new Anticipation($cn, $a->get_parameter("id"));
+ echo '<div class="content">';
+ echo ICard::ipopup('ipopcard');
+ echo IPoste::ipopup('ipop_account');
+ $search_card = new IPopup('ipop_card');
+ $search_card->title = _('Recherche de fiche');
+ $search_card->value = '';
+ echo $search_card->input();
- echo '<form method="post" action="?">';
- echo dossier::hidden();
- echo HtmlInput::hidden('sa','new');
- echo HtmlInput::hidden('p_action','prev');
- echo HtmlInput::hidden('f_id',$id);
- echo $anticip->form_item();
- echo HtmlInput::submit('step3',_('Sauver'));
- echo '</form>';
- echo '</div>';
-
+ echo '<form method="post" action="?">';
+ echo dossier::hidden();
+ echo HtmlInput::hidden('sa', 'new');
+ echo HtmlInput::hidden('ac', $_REQUEST['ac']);
+ echo HtmlInput::hidden('f_id', $id);
+ echo $anticip->form_item();
+ echo HtmlInput::submit('step3', _('Sauver'));
+ echo '</form>';
+ echo '</div>';
}
/* First step, the name and the category */
- if ( ! isset ($_POST['step2']) || $correct==1)
+ if (!isset($_POST['step2']) || $correct == 1)
{
- $anc=new Anticipation($cn);
- echo '<div class="content">';
- /* display a blank form for name and category */
- echo '<form method="post" action="?">';
- echo dossier::hidden();
- echo HtmlInput::hidden('sa','new');
- echo HtmlInput::hidden('p_action','prev');
- echo $anc->form_cat();
- echo HtmlInput::submit('step2',_('Sauver'));
- echo '</form>';
- echo '</div>';
+ $anc = new Anticipation($cn);
+ echo '<div class="content">';
+ /* display a blank form for name and category */
+ echo '<form method="post" action="?">';
+ echo dossier::hidden();
+ echo HtmlInput::hidden('sa', 'new');
+ echo HtmlInput::hidden('ac', $_REQUEST['ac']);
+ echo $anc->form_cat();
+ echo HtmlInput::submit('step2', _('Sauver'));
+ echo '</form>';
+ echo '</div>';
}
-
}
-/**********************************************************************
+/* * ********************************************************************
* If we request to modify the category or the name
*
*
- **********************************************************************/
-if ( isset($_GET['mod_cat']))
+ * ******************************************************************** */
+if (isset($_GET['mod_cat']))
{
- $anc=new Anticipation($cn,$_GET['f_id']);
+ $anc = new Anticipation($cn, $_GET['f_id']);
echo '<div class="content">';
/* display a blank form for name and category */
echo '<form method="post" action="?">';
echo dossier::hidden();
- echo HtmlInput::hidden('sa','mod');
- echo HtmlInput::hidden('p_action','prev');
+ echo HtmlInput::hidden('sa', 'mod');
+ echo HtmlInput::hidden('ac', $_REQUEST['ac']);
echo $anc->form_cat();
- echo HtmlInput::submit('mod_cat_save',_('Sauver'));
+ echo HtmlInput::submit('mod_cat_save', _('Sauver'));
echo '</form>';
echo '</div>';
}
-/**********************************************************************
+/* * ********************************************************************
* If we request to modify the items
*
*
- **********************************************************************/
+ * ******************************************************************** */
if (isset($_GET['mod_item']))
{
/* Propose a form for the items
*/
- $anticip=new Anticipation($cn,$_GET['f_id']);
+ $anticip = new Anticipation($cn, $_GET['f_id']);
echo '<div class="content">';
echo ICard::ipopup('ipopcard');
echo IPoste::ipopup('ipop_account');
- $search_card=new IPopup('ipop_card');
- $search_card->title=_('Recherche de fiche');
- $search_card->value='';
+ $search_card = new IPopup('ipop_card');
+ $search_card->title = _('Recherche de fiche');
+ $search_card->value = '';
echo $search_card->input();
echo '<form method="post" action="?">';
echo dossier::hidden();
- echo HtmlInput::hidden('sa','new');
- echo HtmlInput::hidden('p_action','prev');
- echo HtmlInput::hidden('f_id',$_GET['f_id']);
+ echo HtmlInput::hidden('sa', 'new');
+ echo HtmlInput::hidden('ac', $_REQUEST['ac']);
+ echo HtmlInput::hidden('f_id', $_GET['f_id']);
echo $anticip->form_item();
- echo HtmlInput::submit('step3',_('Sauver'));
+ echo HtmlInput::submit('step3', _('Sauver'));
echo '</form>';
echo '</div>';
}
-/**********************************************************************
+/* * ********************************************************************
* if a forecast is asked we display the result
*
*
- **********************************************************************/
-if ( isset($_REQUEST['f_id']) && $sa=="vw")
+ * ******************************************************************** */
+if (isset($_REQUEST['f_id']) && $sa == "vw")
{
echo '<div class="content">';
- $forecast=new Anticipation($cn);
- $forecast->set_parameter("id",$_REQUEST['f_id']);
- try {
- echo $forecast->display();
- echo '<div class="noprint">';
- echo '<form method="get">';
- echo dossier::hidden();
- echo HtmlInput::hidden('f_id',$_REQUEST['f_id']);
- echo HtmlInput::submit('mod_cat',_('Modifier nom ou catégories'));
- echo HtmlInput::submit('mod_item',_('Modifier éléments'));
- //echo HtmlInput::submit('cvs',_('Export CVS'));
- echo HtmlInput::submit('del',_('Effacer'),'onclick="return
confirm(\''._('Vous confirmez l\\\' effacement').'\')"');
- echo HtmlInput::submit('clone',_('Cloner'),'onclick="return
confirm(\''._('Vous confirmez le clonage ').'\')"');
-
- echo HtmlInput::hidden('p_action','prev');
- echo '</form>';
- echo '</div>';
- echo '</div>';
- exit();
- }
- catch (Exception $e)
- {
- echo "<div class=\"error\"><p>"._("Erreur :
").$e->getMessage().'</p><p>'._('Vous devez corriger').'</p></div>';
- $anc=new Anticipation($cn,$_GET['f_id']);
+ $forecast = new Anticipation($cn);
+ $forecast->set_parameter("id", $_REQUEST['f_id']);
+ try
+ {
+ echo $forecast->display();
+ echo '<div class="noprint">';
+ echo '<form method="get">';
+ echo dossier::hidden();
+ echo HtmlInput::hidden('f_id', $_REQUEST['f_id']);
+ echo HtmlInput::submit('mod_cat', _('Modifier nom ou catégories'));
+ echo HtmlInput::submit('mod_item', _('Modifier éléments'));
+ //echo HtmlInput::submit('cvs',_('Export CVS'));
+ echo HtmlInput::submit('del', _('Effacer'), 'onclick="return
confirm(\'' . _('Vous confirmez l\\\' effacement') . '\')"');
+ echo HtmlInput::submit('clone', _('Cloner'), 'onclick="return
confirm(\'' . _('Vous confirmez le clonage ') . '\')"');
+ echo HtmlInput::hidden('ac', $_REQUEST['ac']);
+ echo '</form>';
+ echo '</div>';
+ echo '</div>';
+ exit();
+ }
+ catch (Exception $e)
+ {
+ echo "<div class=\"error\"><p>" . _("Erreur : ") . $e->getMessage() .
'</p><p>' . _('Vous devez corriger') . '</p></div>';
+ $anc = new Anticipation($cn, $_GET['f_id']);
echo '<div class="content">';
/* display a blank form for name and category */
echo '<form method="post" action="?">';
echo dossier::hidden();
- echo HtmlInput::hidden('sa','mod');
- echo HtmlInput::hidden('p_action','prev');
+ echo HtmlInput::hidden('sa', 'mod');
+ echo HtmlInput::hidden('ac', $_REQUEST['ac']);
echo $anc->form_cat();
- echo HtmlInput::submit('mod_cat_save',_('Sauver'));
+ echo HtmlInput::submit('mod_cat_save', _('Sauver'));
echo '</form>';
- echo '</div>';
- }
+ echo '</div>';
+ }
}
-
?>
Modified: phpcompta/branches/rel600-dynamic-menu/include/impress_poste.inc.php
===================================================================
--- phpcompta/branches/rel600-dynamic-menu/include/impress_poste.inc.php
2011-10-27 19:54:39 UTC (rev 4242)
+++ phpcompta/branches/rel600-dynamic-menu/include/impress_poste.inc.php
2011-10-27 20:28:36 UTC (rev 4243)
@@ -139,7 +139,7 @@
require_once("class_acc_account_ledger.php");
$go=0;
// we ask a poste_id
- if ( isset($_GET['poste_id']) && strlen(trim($_GET['poste_id'])) != 0 &&
isNumber($_GET['poste_id']) )
+ if ( isset($_GET['poste_id']) && strlen(trim($_GET['poste_id'])) != 0 )
{
if ( isset ($_GET['poste_fille']) )
{
Modified:
phpcompta/branches/rel600-dynamic-menu/include/lettering.gestion.inc.php
===================================================================
--- phpcompta/branches/rel600-dynamic-menu/include/lettering.gestion.inc.php
2011-10-27 19:54:39 UTC (rev 4242)
+++ phpcompta/branches/rel600-dynamic-menu/include/lettering.gestion.inc.php
2011-10-27 20:28:36 UTC (rev 4243)
@@ -1,6 +1,6 @@
<?php
require_once('class_lettering.php');
-global $User;
+global $g_user;
echo '<div class="content">';
echo '<div id="search">';
echo '<FORM METHOD="GET">';
@@ -13,7 +13,7 @@
echo '<table width="50%">';
// limit of the year
-$exercice=$User->get_exercice();
+$exercice=$g_user->get_exercice();
$periode=new Periode($cn);
list($first_per,$last_per)=$periode->get_limit($exercice);
Modified: phpcompta/branches/rel600-dynamic-menu/include/suivi_adm.inc.php
===================================================================
--- phpcompta/branches/rel600-dynamic-menu/include/suivi_adm.inc.php
2011-10-27 19:54:39 UTC (rev 4242)
+++ phpcompta/branches/rel600-dynamic-menu/include/suivi_adm.inc.php
2011-10-27 20:28:36 UTC (rev 4243)
@@ -28,7 +28,7 @@
* - $cn = database connection
*/
require_once('class_action.php');
-$User->can_request(GECOUR);
+$g_user->can_request(GECOUR);
/**
*\note fix problem with ShowActionList, this function is local
Modified: phpcompta/branches/rel600-dynamic-menu/include/suivi_supplier.inc.php
===================================================================
--- phpcompta/branches/rel600-dynamic-menu/include/suivi_supplier.inc.php
2011-10-27 19:54:39 UTC (rev 4242)
+++ phpcompta/branches/rel600-dynamic-menu/include/suivi_supplier.inc.php
2011-10-27 20:28:36 UTC (rev 4243)
@@ -28,7 +28,7 @@
* - $cn = database connection
*/
require_once('class_action.php');
-$User->can_request(GECOUR);
+$g_user->can_request(GECOUR);
/**
*\note problem with ShowActionList, this function is local
Modified: phpcompta/branches/rel600-dynamic-menu/include/supplier.inc.php
===================================================================
--- phpcompta/branches/rel600-dynamic-menu/include/supplier.inc.php
2011-10-27 19:54:39 UTC (rev 4242)
+++ phpcompta/branches/rel600-dynamic-menu/include/supplier.inc.php
2011-10-27 20:28:36 UTC (rev 4243)
@@ -30,13 +30,13 @@
require_once('class_iaction.php');
require_once('class_fiche_def.php');
require_once('class_ipopup.php');
-global $User;
+global $g_user;
$low_action=(isset($_REQUEST['sb']))?$_REQUEST['sb']:"list";
/*! \file
* \brief Called from the module "Gestion" to manage the supplier
*/
-$User->can_request(GECUST);
+$g_user->can_request(GECUST);
$href=basename($_SERVER['PHP_SELF']);
// by default open liste
@@ -49,7 +49,7 @@
//-----------------------------------------------------
if ( isset($_POST['delete_card'] ) )
{
- if ( $User->check_action(FICADD) == 0 )
+ if ( $g_user->check_action(FICADD) == 0 )
{
alert('Vous ne pouvez pas enlever de fiche');
return;
@@ -146,7 +146,7 @@
if ( $low_action=="insert" )
{
/* security : check if user can add card */
- if ( $User->check_action(FICADD) == 0 )
+ if ( $g_user->check_action(FICADD) == 0 )
{
alert('Vous ne pouvez pas ajouter de fiche');
return;
Modified: phpcompta/branches/rel600-dynamic-menu/include/user_action_gl.php
===================================================================
--- phpcompta/branches/rel600-dynamic-menu/include/user_action_gl.php
2011-10-27 19:54:39 UTC (rev 4242)
+++ phpcompta/branches/rel600-dynamic-menu/include/user_action_gl.php
2011-10-27 20:28:36 UTC (rev 4243)
@@ -27,6 +27,7 @@
include_once("class_user.php");
require_once("class_iselect.php");
require_once('class_acc_ledger.php');
+$gDossier=Dossier::id();
$cn=new Database($gDossier);
require_once('class_iposte.php');
@@ -41,6 +42,10 @@
}
else
$Ledger->id=$_REQUEST['p_jrn'];
+/*
+ * @todo usefull ?
+ */
+$_GET['ledger_type']='ALL';
echo $Ledger->display_search_form();
echo '<hr>';
/* compute the sql stmt */
@@ -54,7 +59,6 @@
$bar=jrn_navigation_bar($offset,$max_line,$step,$page);
-echo HtmlInput::hidden("p_action",$_REQUEST['p_action']);
if (isset($_REQUEST['sa'])) echo HtmlInput::hidden("sa",$_REQUEST['sa']);
if (isset($_REQUEST['sb'])) echo HtmlInput::hidden("sb",$_REQUEST['sb']);
if (isset($_REQUEST['sc'])) echo HtmlInput::hidden("sc",$_REQUEST['sc']);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpcompta-dev] r4243 - phpcompta/branches/rel600-dynamic-menu/include,
phpcompta-dev <=