';
-/* * *********************************************************************************************************************************
+/* * *************************************************************************************************************
* Liste
*
- * ******************************************************************************************************************************** */
+ * ***************************************************************************************************************/
if ($histo->selected == -1)
{
$write = $g_user->check_action(FICADD);
@@ -234,16 +235,25 @@ if ($histo->selected == 3)
$cat_card = new Fiche_Def($cn);
$cat_card->id =$http->get('cat','number');
$aHeading = $cat_card->getAttribut();
- if ( $allcard == 0) echo $str_add_card;
+ $str_add_card="";
+ if ( $allcard == 0 ) {
+ $h_add_card_b = new IButton('add_card');
+ $h_add_card_b->label = _('Créer une nouvelle fiche');
+ $h_add_card_b->javascript = "dis_blank_card({gDossier:$gDossier,fd_id:$fd_id,after_save:1,ref:2})";
+ $str_add_card=$h_add_card_b->input();
+ }
+ echo $str_add_card;
require_once NOALYSS_TEMPLATE.'/result_cat_card_summary.php';
$hid = new IHidden();
- echo '
";
return;
diff --git a/include/lib/ac_common.php b/include/lib/ac_common.php
index df4ae72e8..44ee884ad 100644
--- a/include/lib/ac_common.php
+++ b/include/lib/ac_common.php
@@ -342,7 +342,17 @@ function html_page_start($p_theme="", $p_script="", $p_script2="")
$p_script2 . "
";
echo '
-
+ ';
+
+ if (isset($_SESSION['g_lang']) && $_SESSION['g_lang']=='fr_FR.utf8' )
+ {
+ echo '';
+ }
+ if (isset($_SESSION['g_lang']) && $_SESSION['g_lang']=='nl_NL.utf8' )
+ {
+ echo '';
+ }
+ echo '
';
@@ -1321,9 +1331,8 @@ function is_msie()
*/
function record_log($p_message)
{
- error_log("noalyss".$p_message,0);
- error_log("noalyss GET [".var_export($_GET, true)."]",0);
- error_log( "noalyss POST [".var_export($_POST, true)."]",0);
+ error_log("noalyss".print_r($p_message,true),0);
+ error_log("noalyss GET [".var_export($_GET, true)."] POST [".var_export($_POST, true)."]",0);
}
if(!function_exists('tracedebug')) {
function tracedebug($file,$var, $label = NULL) {
@@ -1365,4 +1374,4 @@ function convert_to_rtf($p_string)
}
}
return $result;
-}
\ No newline at end of file
+}
diff --git a/include/lib/config_file.php b/include/lib/config_file.php
index 42587f287..3f7c7e62a 100644
--- a/include/lib/config_file.php
+++ b/include/lib/config_file.php
@@ -70,6 +70,7 @@ function config_file_form($p_array=null)
$cdbname="";
$chost="localhost";
$cadmin='admin';
+ $cpassword_admin="";
}
else extract ($p_array, EXTR_SKIP);
diff --git a/include/lib/database_core.class.php b/include/lib/database_core.class.php
index 098b7d6ca..2bcba2307 100644
--- a/include/lib/database_core.class.php
+++ b/include/lib/database_core.class.php
@@ -75,9 +75,11 @@ class DatabaseCore
}
$this->is_open = TRUE;
+
}
+
public function verify()
{
// Verify that the elt we want to add is correct
diff --git a/include/lib/html_input.class.php b/include/lib/html_input.class.php
index f67c83f2c..4b69ab42c 100755
--- a/include/lib/html_input.class.php
+++ b/include/lib/html_input.class.php
@@ -605,11 +605,24 @@ class HtmlInput
}
}
}
- }
-
+ }
+
+ return $r;
+ }
+ /**
+ * Transform a double array as a HTML string with hidden html value
+ * array has the formarray ["name"]="x",array['value']="y") the key name will be the hidden input name;
+ * @param double $array
+ */
+ static function simple_array_to_hidden($array)
+ {
+ if (empty ($array)) return "";
+ $r="";
+ foreach ( $array as $key=>$value) {
+ $r.=HtmlInput::hidden($key, $value);
+ }
return $r;
}
-
/**
* @brief transform a json to hidden
* @param json $p_json
diff --git a/include/lib/manage_table_sql.class.php b/include/lib/manage_table_sql.class.php
index 68a4da608..67b58351e 100644
--- a/include/lib/manage_table_sql.class.php
+++ b/include/lib/manage_table_sql.class.php
@@ -1037,7 +1037,7 @@ function check()
{
$s1=$xml->createElement("status", "NOK");
$s2=$xml->createElement("ctl_row",
- $this->object_name+"_"+$this->table->get_pk_value());
+ $this->object_name."_".$this->table->get_pk_value());
$s4=$xml->createElement("ctl", $this->object_name);
$s3=$xml->createElement("html", $ex->getTraceAsString());
$root=$xml->createElement("data");
@@ -1113,7 +1113,7 @@ function check()
$s1=$xml->createElement("status", "NOK");
$s3=$xml->createElement("ctl", $this->object_name);
$s2=$xml->createElement("ctl_row",
- $this->object_name+"_"+$this->table->get_pk_value());
+ $this->object_name."_".$this->table->get_pk_value());
$s4=$xml->createElement("html", $ex->getTraceAsString());
$root=$xml->createElement("data");
diff --git a/include/lib/message_javascript.php b/include/lib/message_javascript.php
index 6e54ab8d8..e9b9d1ebf 100644
--- a/include/lib/message_javascript.php
+++ b/include/lib/message_javascript.php
@@ -74,8 +74,8 @@ content[40]=" à zéro pour effacer la ligne"))?>";
content[42]="";
content[43]="";
-content[44]="";
-content[45]="";
+content[44]="";
+content[45]="";
content[46]="";
content[47]="";
content[48]="";
@@ -107,4 +107,4 @@ content[73]="";
content[75]="";
content[76]="";
-
\ No newline at end of file
+
diff --git a/include/lib/select_box.class.php b/include/lib/select_box.class.php
index 82c5547c4..28e6bc740 100644
--- a/include/lib/select_box.class.php
+++ b/include/lib/select_box.class.php
@@ -36,7 +36,8 @@ class Select_Box
private $cnt;
private $filter; //!< allow a dynamic not case sensitive search
var $default_value;
-
+ private $position ; //!< change depending if we are in an absolute block or not
+
/**
* Default constructor
* @param type $p_id javascript DOMid
@@ -52,6 +53,98 @@ class Select_Box
$this->default_value=-1;
$this->style_box="";
$this->filter="";
+ $this->position="normal";
+ }
+ public function get_position()
+ {
+ return $this->position;
+ }
+
+ public function set_position($position)
+ {
+ if ( ! in_array($position,array("normal","in-absolute") ) ) {
+ throw new Exception("SB0005",EXC_PARAM_VALUE);
+ }
+ $this->position=$position;
+ return $this;
+ }
+
+ private function compute_position()
+ {
+ $list_id=sprintf('%s_list', $this->id);
+ switch ($this->position)
+ {
+ case "normal":
+
+ // Show when click
+ $javascript=sprintf('$("%s_bt").onclick=function() {
+ try {
+ var newDiv=$("select_box%s");
+ var pos=$("%s_bt").cumulativeOffset();
+ newDiv.setStyle({display:"block",position:"fixed",top:pos.top+25+"px",left:pos.left+5+"px"});
+
+ if ( $("search_%s") ) { $("search_%s").focus();}
+
+ } catch(e) {
+ alert(e.message);
+ }
+ }
+ ', $this->id, $this->id, $this->id, $list_id, $list_id);
+ // Hide when out of the zone
+ $javascript.=sprintf('$("select_box%s").onmouseleave=function() {
+ try {
+ var newDiv=$("select_box%s");
+ newDiv.setStyle({display:"none"});
+ } catch(e) {
+ alert(e.message);
+ }
+ }',$this->id,$this->id);
+ break;
+ case "in-absolute":
+ // Show when click
+ $javascript=sprintf('
+ $("%s_bt").onclick=function() {
+ try {
+
+
+ if (! document.getElementById("select_box_content") ) {
+
+ var newDiv=new Element("div");
+ newDiv.id="select_box_content";
+ document.body.appendChild(newDiv);
+ newDiv.addClassName("select_box");
+ $("select_box_content").onmouseleave=function() {
+ try {
+ var newDiv=$("select_box_content");
+ newDiv.setStyle({display:"none"});
+ } catch(e) {
+ alert(e.message);
+ }
+ }
+ } else {
+ var newDiv=document.getElementById("select_box_content");
+ }
+ newDiv.innerHTML=$("select_box%s").innerHTML;
+ var pos=$("%s_bt").cumulativeOffset();
+ var nTop=pos.top;
+ var viewport = document.viewport.getDimensions();
+ if ( nTop> viewport.height-newDiv.getHeight()-20) { nTop-=newDiv.getHeight()-5}
+
+ newDiv.setStyle({display:"block",position:"absolute",top:nTop+"px",left:pos.left+5+"px","z-index":999});
+
+ if ( $("search_%s") ) { $("search_%s").focus();}
+ } catch(e) {
+ alert(e.message);
+ }
+ }
+ ', $this->id, $this->id, $this->id, $list_id, $list_id);
+
+ break;
+
+ default:
+ break;
+ }
+ return $javascript;
}
function input()
@@ -59,36 +152,16 @@ class Select_Box
$list_id=sprintf('%s_list',$this->id);
// Show when click
- $javascript=sprintf('$("%s_bt").onclick=function() {
- try {
- var newDiv=$("select_box%s");
- var pos=$("%s_bt").cumulativeOffset();
- newDiv.setStyle({display:"block",position:"fixed",top:pos.top+25+"px",left:pos.left+5+"px"});
-
- if ( $("search_%s") ) { $("search_%s").focus();}
-
- } catch(e) {
- alert(e.message);
- }
- }
- ', $this->id, $this->id, $this->id, $list_id,$list_id);
+ $javascript=$this->compute_position();
+
- // Hide when out of the zone
- $javascript.=sprintf('$("select_box%s").onmouseleave=function() {
- try {
- var newDiv=$("select_box%s");
- newDiv.setStyle({display:"none"});
- } catch(e) {
- alert(e.message);
- }
- }',$this->id,$this->id);
// display the button
- printf('
',
+ printf('
',
$this->id, $this->value);
printf('
', $this->id,
$this->id, $this->default_value);
- printf('
',
+ printf('
',
$this->id, $this->style_box);
// Show the filter if there is one,
diff --git a/include/lib/sendmail_core.class.php b/include/lib/sendmail_core.class.php
index 11a5180af..b62061d0c 100644
--- a/include/lib/sendmail_core.class.php
+++ b/include/lib/sendmail_core.class.php
@@ -78,7 +78,8 @@ class Sendmail_Core
*/
function set_message($p_message)
{
- $this->message = $p_message;
+ // $this->message =wordwrap($p_message,70,"\r\n");
+ $this->message =$p_message;
}
/**
@@ -134,24 +135,26 @@ class Sendmail_Core
$this->content .= "Content-Type: text/plain; charset=\"utf-8\"" . $eol;
$this->content .= "Content-Transfer-Encoding: 7bit" . $eol.$eol ;
$this->content .= $this->message . $eol ;
-
- // attachment
- for ($i = 0; $i < count($this->afile); $i++)
+ if ( ! empty($this->afile ) )
{
- $file = $this->afile[$i];
- $file_size = filesize($file->full_name);
- $handle = fopen($file->full_name, "r");
- $content = fread($handle, $file_size);
- fclose($handle);
- $content = chunk_split(base64_encode($content));
- $this->content .= "--" . $separator . $eol;
- $this->content .= "Content-Type: " . $file->type . "; name=\"" . $file->filename . "\"" . $eol;
- $this->content .= "Content-Disposition: attachment; filename=\"" . $file->filename . "\"" . $eol;
- $this->content .= "Content-Transfer-Encoding: base64" . $eol;
- $this->content.=$eol;
- $this->content .= $content . $eol ;
+ // attachment
+ for ($i = 0; $i < count($this->afile); $i++)
+ {
+ $file = $this->afile[$i];
+ $file_size = filesize($file->full_name);
+ $handle = fopen($file->full_name, "r");
+ $content = fread($handle, $file_size);
+ fclose($handle);
+ $content = chunk_split(base64_encode($content));
+ $this->content .= "--" . $separator . $eol;
+ $this->content .= "Content-Type: " . $file->type . "; name=\"" . $file->filename . "\"" . $eol;
+ $this->content .= "Content-Disposition: attachment; filename=\"" . $file->filename . "\"" . $eol;
+ $this->content .= "Content-Transfer-Encoding: base64" . $eol;
+ $this->content.=$eol;
+ $this->content .= $content . $eol ;
+ }
}
- if ( count ($this->afile) == 0 ) $this->content.=$eol;
+ if ( empty ($this->afile) ) $this->content.=$eol;
$this->content .= "--" . $separator . "--";
}
diff --git a/include/recover.php b/include/recover.php
index ec082d1fc..cf9dac818 100644
--- a/include/recover.php
+++ b/include/recover.php
@@ -25,6 +25,7 @@ define('SIZE_REQUEST', 70);
require_once NOALYSS_INCLUDE.'/lib/html_input.class.php';
require_once NOALYSS_INCLUDE.'/lib/http_input.class.php';
+require_once NOALYSS_INCLUDE.'/class/sendmail.class.php';
/**
* @brief generate a random string of char
* @param $car int length of the string
@@ -95,12 +96,22 @@ elseif ($action=="send_email") :
if ($valid==true):
$request_id=generate_random(SIZE_REQUEST);
$user_password=generate_random(10);
- /*
- * save the request into
- */
- $cn->exec_sql("insert into recover_pass(use_id,request,password,created_on,created_host) "
- ." values ($1,$2,$3,now(),$4)", array($user_id, $request_id, $user_password, $_SERVER['REMOTE_ADDR']));
-
+ // exist a valid request for this user ?
+ $exist_request= $cn->get_array("select request , password from recover_pass
+ where use_id=$1 and created_on > now() - interval '12 hours'",[$user_id]);
+ if ( empty($exist_request ) ) {
+ /* save the request into */
+ $cn->exec_sql("insert into recover_pass(use_id,request,password,created_on,created_host) "
+ ." values ($1,$2,$3,now(),$4)", array($user_id, $request_id, $user_password, $_SERVER['REMOTE_ADDR']));
+ } else {
+ $request_id=$exist_request[0]["request"];
+ $user_password=$exist_request[0]['password'];
+ /* if too many request , there is a bug somewhere , so record an warning */
+ if ( count($exist_request)> 1 ){
+ error_log("WRE109 Trop de request pour ".var_export($exist_request,true));
+ }
+
+ }
/*
* send an email
*/
diff --git a/include/sql/patch/upgrade143.sql b/include/sql/patch/upgrade143.sql
new file mode 100644
index 000000000..03ab785ce
--- /dev/null
+++ b/include/sql/patch/upgrade143.sql
@@ -0,0 +1,8 @@
+begin;
+
+insert into menu_ref (me_code,me_description ,me_file) values ('PDF:operation_detail','Export Operation','export_operation_pdf.php');
+insert into profile_menu(me_code,p_id,p_type_display ,pm_default ) select 'PDF:operation_detail',p_id,'P',0 from profile ;
+
+insert into version (val,v_description) values (144,'Export Operation PDF');
+
+commit;
diff --git a/include/sql/patch/upgrade36.sql b/include/sql/patch/upgrade36.sql
index 82e2f3a5d..3b74bb2d3 100644
--- a/include/sql/patch/upgrade36.sql
+++ b/include/sql/patch/upgrade36.sql
@@ -177,8 +177,7 @@ CREATE TABLE bud_hypothese
CONSTRAINT fk_bud_hypo_pa_id FOREIGN KEY (pa_id)
REFERENCES plan_analytique (pa_id) MATCH SIMPLE
ON UPDATE CASCADE ON DELETE CASCADE
-)
-WITHOUT OIDS;
+);
create sequence seq_bud_hypothese_bh_id;
diff --git a/include/template/ledger_detail_bottom.php b/include/template/ledger_detail_bottom.php
index a92a35f24..37625db7f 100644
--- a/include/template/ledger_detail_bottom.php
+++ b/include/template/ledger_detail_bottom.php
@@ -1,5 +1,6 @@
set_position("in-absolute");
$cn=Dossier::connect();
// Contains all the linked actions
$a_followup = Follow_Up::get_all_operation($jr_id);
@@ -199,7 +204,6 @@ if ($aRap != null ) {
$e
);
$remove=Icon_Action::trash(uniqid(), $js);
-// $remove=$rmReconciliation->input();
}
else
$remove='';
@@ -315,25 +319,35 @@ if ( $div != 'popup' ) {
echo HtmlInput::submit('save',_('Sauver'),'onClick="return verify_ca(\'popup\');"');
$owner=new Noalyss_Parameter_Folder($cn);
if ($owner->MY_ANALYTIC != 'nu' /*&& $div=='popup' */){
- echo '
';
+
+ $select_box->add_javascript(_("Vérification CA"), sprintf("verify_ca('%s')",$div));
}
$per=new Periode($cn,$obj->det->jr_tech_per);
if ( $per->is_closed() == 0 && $owner->MY_STRICT=='N' && $g_user->check_action(RMOPER)==1)
{
- $remove=new IButton('Effacer');
- $remove->label=_('Effacer');
- $remove->javascript="return confirm_box(null,content[50],function () {removeOperation('".$obj->det->jr_id."',".dossier::id().",'".$div."')})";
- echo $remove->input();
+ $javascript="return confirm_box(null,content[50],function () {removeOperation('".$obj->det->jr_id."',".dossier::id().",'".$div."')})";
+ $select_box->add_javascript(_("Effacer"), $javascript);
}
//----------------------------------------------------
// Extourne
//----------------------------------------------------
- $reverse=new IButton('bext'.$div);
- $reverse->label=_('Extourner');
- $reverse->javascript="g('ext".$div."').style.display='block'";
- echo $reverse->input();
- echo '';
+ $select_box->add_javascript(_("Extourne"), sprintf("g('ext%s').style.display='block'",$div));
+
+ //-------------------------------------------------------------------
+ // Duplicate
+ //-------------------------------------------------------------------
+ $select_box->add_javascript(_("Duplicate"),sprintf("duplicate_operation('%s','%s')",Dossier::id(),$obj->jr_id));
+
+ //-------------------------------------------------------------------
+ // Export PDF
+ //-------------------------------------------------------------------
+ $select_box->add_url(_("Export PDF"), "export.php?".
+ http_build_query(array("act"=>"PDF:operation_detail","gDossier"=>Dossier::id(),"operation_id"=>$obj->jr_id)));
+
+
+echo $select_box->input();
+echo '';
echo '';
echo '
';
@@ -341,7 +355,7 @@ echo '';
$extourne_label=new IText("ext_label");
$extourne_label->size=40;
$r="