diff --git a/html/ajax_misc.php b/html/ajax_misc.php
index d5ed12b59..7d71fd109 100644
--- a/html/ajax_misc.php
+++ b/html/ajax_misc.php
@@ -57,7 +57,7 @@ if ($cont != 0)
exit();
extract($_REQUEST);
set_language();
-global $g_user;
+global $g_user,$cn;
$cn = new Database($gDossier);
$g_user = new User($cn);
$g_user->check(true);
@@ -547,6 +547,9 @@ EOF;
case 'modify_menu';
require_once 'ajax_mod_menu.php';
break;
+ case 'mod_stock_repo':
+ require_once 'ajax_mod_stock_repo.php';
+ break;
default:
var_dump($_GET);
}
diff --git a/html/js/scripts.js b/html/js/scripts.js
index db552be84..72c6c0a13 100644
--- a/html/js/scripts.js
+++ b/html/js/scripts.js
@@ -418,7 +418,7 @@ function cat_doc_change(p_dt_id,p_dossier)
removeDiv('change_doc_div');
waiting_box();
var action = new Ajax.Request(
- "ajax_misc.php" ,
+ "ajax_misc.php" ,
{
method:'get', parameters:queryString,
onFailure:ajax_misc_failure,
@@ -1512,4 +1512,30 @@ function set_action_related(p_obj)
alert(e.message);
return false;
}
- }
\ No newline at end of file
+ }
+ /**
+ *@brief change a document_modele
+ */
+function stock_repo_change(p_dossier,r_id)
+{
+ var queryString="gDossier="+p_dossier+"&op=mod_stock_repo"+"&r_id="+r_id;
+ var nTop=calcy(posY);
+ var nLeft="200px";
+ var str_style="top:"+nTop+"px;left:"+nLeft+";width:50em;height:auto";
+
+ removeDiv('change_stock_repo_div');
+ waiting_box();
+ var action = new Ajax.Request(
+ "ajax_misc.php" ,
+ {
+ method:'get', parameters:queryString,
+ onFailure:ajax_misc_failure,
+ onSuccess:function(req){
+ remove_waiting_box();
+ add_div({id:'change_stock_repo_div',style:str_style,cssclass:'inner_box',drag:"1"});
+ $('change_stock_repo_div').innerHTML=req.responseText;
+
+ }
+ }
+ );
+}
diff --git a/include/ajax_mod_stock_repo.php b/include/ajax_mod_stock_repo.php
new file mode 100644
index 000000000..4bb467253
--- /dev/null
+++ b/include/ajax_mod_stock_repo.php
@@ -0,0 +1,80 @@
+
+=HtmlInput::title_box("Ajouter un dépôt","change_stock_repo_div","close")?>
+
';
+require_once("class_own.php");
+if (isset($_POST['record_company']))
+{
+ $m = new Own($cn);
+ extract($_POST);
+ $m->MY_NAME = $p_name;
+ $m->MY_TVA = $p_tva;
+ $m->MY_STREET = $p_street;
+ $m->MY_NUMBER = $p_no;
+ $m->MY_CP = $p_cp;
+ $m->MY_COMMUNE = $p_Commune;
+ $m->MY_TEL = $p_tel;
+ $m->MY_FAX = $p_fax;
+ $m->MY_PAYS = $p_pays;
+ $m->MY_CHECK_PERIODE = $p_check_periode;
+ $m->MY_DATE_SUGGEST = $p_date_suggest;
+ $m->MY_ANALYTIC = $p_compta;
+ $m->MY_STRICT = $p_strict;
+ $m->MY_TVA_USE = $p_tva_use;
+ $m->MY_PJ_SUGGEST = $p_pj;
+ $m->MY_ALPHANUM = $p_alphanum;
+ $m->MY_UPDLAB = $p_updlab;
+ $m->MY_STOCK = $p_stock;
- $m->Update();
- }
+ $m->Update();
+}
- $my=new Own($cn);
- ///// Compta analytic
- $array=array (
- array("value"=>"ob",'label'=>_("obligatoire")),
- array("value"=>"op",'label'=>_("optionnel")),
- array("value"=>"nu",'label'=>_("non utilisé"))
- );
- $strict_array=array(
- array('value'=>'N','label'=>_('Non')),
- array('value'=>'Y','label'=>_('Oui'))
- );
+$my = new Own($cn);
+///// Compta analytic
+$array = array(
+ array("value" => "ob", 'label' => _("obligatoire")),
+ array("value" => "op", 'label' => _("optionnel")),
+ array("value" => "nu", 'label' => _("non utilisé"))
+);
+$strict_array = array(
+ array('value' => 'N', 'label' => _('Non')),
+ array('value' => 'Y', 'label' => _('Oui'))
+);
- $alpha_num_array[0]=array('value'=>'N','label'=>_('Non'));
- $alpha_num_array[1]=array('value'=>'Y','label'=>_('Oui'));
-
- $updlab_array[0]=array('value'=>'N','label'=>_('Non'));
- $updlab_array[1]=array('value'=>'Y','label'=>_('Oui'));
+$alpha_num_array[0] = array('value' => 'N', 'label' => _('Non'));
+$alpha_num_array[1] = array('value' => 'Y', 'label' => _('Oui'));
- $compta=new ISelect();
- $compta->table=1;
- $compta->selected=$my->MY_ANALYTIC;
+$updlab_array[0] = array('value' => 'N', 'label' => _('Non'));
+$updlab_array[1] = array('value' => 'Y', 'label' => _('Oui'));
- $strict=new ISelect();
- $strict->table=1;
- $strict->selected=$my->MY_STRICT;
+$compta = new ISelect();
+$compta->table = 1;
+$compta->selected = $my->MY_ANALYTIC;
- $tva_use=new ISelect();
- $tva_use->table=1;
- $tva_use->selected=$my->MY_TVA_USE;
+$strict = new ISelect();
+$strict->table = 1;
+$strict->selected = $my->MY_STRICT;
- $pj_suggest=new ISelect();
- $pj_suggest->table=1;
- $pj_suggest->selected=$my->MY_PJ_SUGGEST;
+$tva_use = new ISelect();
+$tva_use->table = 1;
+$tva_use->selected = $my->MY_TVA_USE;
- $date_suggest=new ISelect();
- $date_suggest->table=1;
- $date_suggest->selected=$my->MY_DATE_SUGGEST;
+$pj_suggest = new ISelect();
+$pj_suggest->table = 1;
+$pj_suggest->selected = $my->MY_PJ_SUGGEST;
- $check_periode=new ISelect();
- $check_periode->table=1;
- $check_periode->selected=$my->MY_CHECK_PERIODE;
- $alpha_num=new ISelect();
- $alpha_num->table=1;
- $alpha_num->value=$alpha_num_array;
- $alpha_num->selected=$my->MY_ALPHANUM;
+$date_suggest = new ISelect();
+$date_suggest->table = 1;
+$date_suggest->selected = $my->MY_DATE_SUGGEST;
- $updlab=new ISelect();
- $updlab->table=1;
- $updlab->value=$updlab_array;
- $updlab->selected=$my->MY_UPDLAB;
+$check_periode = new ISelect();
+$check_periode->table = 1;
+$check_periode->selected = $my->MY_CHECK_PERIODE;
+$alpha_num = new ISelect();
+$alpha_num->table = 1;
+$alpha_num->value = $alpha_num_array;
+$alpha_num->selected = $my->MY_ALPHANUM;
- // other parameters
- $all=new IText();
- $all->table=1;
- echo '
";
- echo '
';
- exit();
+$stock = new ISelect('p_stock');
+$stock->value = array(
+ array('value' => 'N', 'label' => _('Non')),
+ array('value' => 'Y', 'label' => _('Oui'))
+);
+$stock->selected = $my->MY_STOCK;
+$stock->table = 1;
+// other parameters
+$all = new IText();
+$all->table = 1;
+echo '
+
+
+
+ | =$tb->get_header(0)?> |
+ =$tb->get_header(1)?> |
+ =$tb->get_header(2)?> |
+ =$tb->get_header(3)?> |
+ =$tb->get_header(4)?> |
+
+ for ($i=0;$i
+
+ |
+ =h($array[$i]['r_name'])?>
+ |
+
+ =h($array[$i]['r_adress'])?>
+ |
+
+ =h($array[$i]['r_city'])?>
+ |
+
+ =h($array[$i]['r_country'])?>
+ |
+
+ =h($array[$i]['r_phone'])?>
+ |
+
+
+ $js=' onclick="stock_repo_change(\''.dossier::id().'\',\''.$array[$i]['r_id'].'\')"';
+ echo HtmlInput::button("mod", _("Modifier"), $js);
+ ?>
+ |
+
+
+
+
+ =HtmlInput::button("show_add_depot_d", "Ajout d'un dépot", "onclick=\"$('add_depot_d').show();\"");?>
+
+ =HtmlInput::title_box("Ajouter un dépôt","add_depot_d","hide")?>
+
+
+
diff --git a/sql/upgrade.sql b/sql/upgrade.sql
index 147f9d9b9..f0dc25a99 100644
--- a/sql/upgrade.sql
+++ b/sql/upgrade.sql
@@ -212,3 +212,32 @@ COMMENT ON COLUMN user_sec_action_profile.ua_right IS 'Type of right : R for rea
INSERT INTO profile (p_name, p_id, p_desc, with_calc, with_direct_form) VALUES ('Public', -1, 'faux groupe', NULL, NULL);
insert into user_sec_action_profile(p_id,p_granted,ua_right) select 1,p_id,'W' from profile;
insert into user_sec_action_profile(p_id,p_granted ,ua_right) select 2,p_id,'W' from profile;
+insert into parameter values('MY_STOCK','N');
+
+INSERT INTO menu_ref(me_code, me_menu, me_file, me_url, me_description, me_parameter,
+ me_javascript, me_type)
+ VALUES ('CFGSTOCK', 'Configuration des dépôts', 'stock_cfg.inc.php', null, 'Configuration dépôts', null,null,'ME');
+
+INSERT INTO profile_menu(me_code, me_code_dep, p_id, p_order, p_type_display, pm_default)
+ VALUES ('CFGSTOCK', 'PARAM', 1, 40, 'E', 0);
+
+CREATE TABLE stock_repository
+(
+ r_id bigserial NOT NULL, -- pk
+ r_name text, -- name of the stock
+ r_adress text, -- adress of the stock
+ r_country text, -- country of the stock
+ r_city text, -- City of the stock
+ r_phone text, -- City of the stock
+ CONSTRAINT stock_repository_pkey PRIMARY KEY (r_id )
+);
+
+COMMENT ON TABLE stock_repository IS 'stock repository';
+COMMENT ON COLUMN stock_repository.r_id IS 'pk';
+COMMENT ON COLUMN stock_repository.r_name IS 'name of the stock';
+COMMENT ON COLUMN stock_repository.r_adress IS 'adress of the stock';
+COMMENT ON COLUMN stock_repository.r_country IS 'country of the stock';
+COMMENT ON COLUMN stock_repository.r_city IS 'City of the stock';
+COMMENT ON COLUMN stock_repository.r_phone IS 'Phone number';
+
+insert into stock_repository(r_name) values ('Dépôt par défaut');
\ No newline at end of file