diff --git a/include/class/anticipation.class.php b/include/class/anticipation.class.php index 67360c17b..a8abf88a5 100644 --- a/include/class/anticipation.class.php +++ b/include/class/anticipation.class.php @@ -220,7 +220,8 @@ EOF; for ($j = 0; $j < count($aCat); $j++) { // Item of the category, estimation for a specific month - $aItem[$j] = $this->cn->get_array('select fi_card,fi_account,fi_text,fi_amount,fi_debit + $aItem[$j] = $this->cn->get_array('select fi_card,fi_account,fi_text,fi_amount,fi_debit , + fi_amount_initial from forecast_item where fc_id=$1 and fi_pid=0 order by fi_order ', array($aCat[$j]['fc_id'])); diff --git a/include/class/forecast_item_mtable.class.php b/include/class/forecast_item_mtable.class.php index f65913430..cbb4364b3 100644 --- a/include/class/forecast_item_mtable.class.php +++ b/include/class/forecast_item_mtable.class.php @@ -187,6 +187,8 @@ class Forecast_Item_MTable extends Manage_Table_SQL $object_sql->setp("fi_amount",$http->post('fi_amount',"number")); $object_sql->setp("fi_pid",$http->post('fi_pid',"number")); $object_sql->setp("fi_debit",$http->post('fi_debit')); + $object_sql->setp("fi_amount_initial",$http->post("fi_amount_initial","number")); + $card=trim($http->post("fi_card")); if ( $card !="") { $f_id=$object_sql->cn->get_value("select f_id from fiche_detail where ad_value=upper($1) and ad_id=23",[$card]); diff --git a/include/database/forecast_item_sql.class.php b/include/database/forecast_item_sql.class.php index a86063a37..0bafd8cfe 100644 --- a/include/database/forecast_item_sql.class.php +++ b/include/database/forecast_item_sql.class.php @@ -18,9 +18,8 @@ * along with NOALYSS; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -require_once NOALYSS_INCLUDE . '/lib/noalyss_sql.class.php'; -require_once NOALYSS_INCLUDE . '/class/database.class.php'; - +require_once NOALYSS_INCLUDE.'/lib/noalyss_sql.class.php'; +require_once NOALYSS_INCLUDE.'/class/database.class.php'; /** * class_forecast_item_sql.php @@ -31,47 +30,48 @@ require_once NOALYSS_INCLUDE . '/class/database.class.php'; class Forecast_Item_SQL extends Noalyss_SQL { - function __construct(DatabaseCore $p_cn, $p_id = -1) + function __construct(DatabaseCore $p_cn, $p_id=-1) { - $this->table = "public.forecast_item"; - $this->primary_key = "fi_id"; + $this->table="public.forecast_item"; + $this->primary_key="fi_id"; /* * List of columns */ - $this->name = array( - "fi_id" => "fi_id" - , "fi_text" => "fi_text" - , "fi_account" => "fi_account" - , "fi_card" => "fi_card" - , "fi_order" => "fi_order" - , "fc_id" => "fc_id" - , "fi_amount" => "fi_amount" - , "fi_debit" => "fi_debit" - , "fi_pid" => "fi_pid" + $this->name=array( + "fi_id"=>"fi_id" + , "fi_text"=>"fi_text" + , "fi_account"=>"fi_account" + , "fi_card"=>"fi_card" + , "fi_order"=>"fi_order" + , "fc_id"=>"fc_id" + , "fi_amount"=>"fi_amount" + , "fi_debit"=>"fi_debit" + , "fi_pid"=>"fi_pid" + , "fi_amount_initial"=>"fi_amount_initial" ); /* * Type of columns */ - $this->type = array( - "fi_id" => "numeric" - , "fi_text" => "text" - , "fi_account" => "text" - , "fi_card" => "numeric" - , "fi_order" => "numeric" - , "fc_id" => "numeric" - , "fi_amount" => "numeric" - , "fi_debit" => "char" - , "fi_pid" => "numeric" + $this->type=array( + "fi_id"=>"numeric" + , "fi_text"=>"text" + , "fi_account"=>"text" + , "fi_card"=>"numeric" + , "fi_order"=>"numeric" + , "fc_id"=>"numeric" + , "fi_amount"=>"numeric" + , "fi_debit"=>"char" + , "fi_pid"=>"numeric" + , "fi_amount_initial"=>"numeric" ); - $this->default = array( - "fi_id" => "auto" + $this->default=array( + "fi_id"=>"auto" ); - $this->date_format = "DD.MM.YYYY"; + $this->date_format="DD.MM.YYYY"; parent::__construct($p_cn, $p_id); } - -} \ No newline at end of file +} diff --git a/include/sql/patch/upgrade153.sql b/include/sql/patch/upgrade153.sql index 03a276697..82ae3b042 100644 --- a/include/sql/patch/upgrade153.sql +++ b/include/sql/patch/upgrade153.sql @@ -1,5 +1,7 @@ begin ; alter table forecast_cat rename to forecast_category; alter table forecast_category alter f_id set not null; +alter table forecast_item add fi_amount_initial numeric(20,4); +alter table forecast_item alter fi_amount_initial set default 0; insert into version (val,v_description) values (154,'Rewriting of FORECAST'); commit; \ No newline at end of file diff --git a/include/template/anticipation-display.php b/include/template/anticipation-display.php index 393df5a86..203a5dc6a 100644 --- a/include/template/anticipation-display.php +++ b/include/template/anticipation-display.php @@ -7,7 +7,7 @@ Période du à