diff --git a/html/css/style-classic7.css b/html/css/style-classic7.css index 01ef67236..00cc18cd7 100644 --- a/html/css/style-classic7.css +++ b/html/css/style-classic7.css @@ -44,7 +44,6 @@ input:focus { font-style: italic; background-color:transparent; font-size: 100%; - font-weight: 0; padding: 0px; margin: 0px; font-family: sans-serif; @@ -504,7 +503,6 @@ a.detail font-family: 'openSansRegular'; text-decoration: underline; display: block; - // color: #eb2208; font-weight: normal; background-color: transparent; } @@ -2395,6 +2393,7 @@ td.selectedmenu { { margin-top:1px; border:1px solid blue; + min-height: 5rem; } @media only screen and (max-width:850px) { @@ -3410,4 +3409,4 @@ li.li-active { z-index: 12; position: absolute; height: auto; - } \ No newline at end of file + } diff --git a/html/js/acc_ledger.js b/html/js/acc_ledger.js index 5952e76b9..9929335ed 100644 --- a/html/js/acc_ledger.js +++ b/html/js/acc_ledger.js @@ -801,6 +801,8 @@ function view_history_account(p_value, dossier, p_exercice) { onFailure: error_box, onSuccess: function (req, xml) { remove_waiting_box(); + if (req.responseText === 'NOCONX') { reconnect();return;} + add_div(popup); success_box(req, xml); $(idbox).style.top = calcy(140 + (layer * 3)) + "px"; @@ -840,6 +842,8 @@ function view_history_anc_account(p_value, dossier, p_exercice) { onFailure: error_box, onSuccess: function (req, xml) { remove_waiting_box(); + if (req.responseText === 'NOCONX') { reconnect();return;} + add_div(popup); $(idbox).innerHTML = req.responseText; $(idbox).style.top = calcy(140 + (layer * 3)) + "px"; @@ -874,6 +878,8 @@ function update_history_account(obj) { onFailure: error_box, onSuccess: function (req, xml) { remove_waiting_box(); + if (req.responseText === 'NOCONX') { reconnect();return;} + success_box(req, xml); g(obj.div).style.top = calcy(140 + (layer * 3)) + "px"; } @@ -915,6 +921,8 @@ function view_history_card(p_value, dossier, p_exercice) { onFailure: error_box, onSuccess: function (req, xml) { remove_waiting_box(); + if (req.responseText === 'NOCONX') { reconnect();return;} + add_div(popup); success_box(req, xml); g(idbox).style.top = calcy(140 + (layer * 3)) + "px"; @@ -947,6 +955,8 @@ function update_history_card(obj) { parameters: querystring, onFailure: error_box, onSuccess: function (req, xml) { + if (req.responseText === 'NOCONX') { reconnect();return;} + remove_waiting_box(); success_box(req, xml); g(obj.div).style.top = calcy(140 + (layer * 3)) + "px"; diff --git a/html/js/noalyss_script.js b/html/js/noalyss_script.js index 4e8fdaacf..c70142b90 100644 --- a/html/js/noalyss_script.js +++ b/html/js/noalyss_script.js @@ -2430,6 +2430,7 @@ function set_preference(p_dossier) { onFailure: ajax_misc_failure, onSuccess: function (req) { remove_waiting_box(); + if (req.responseText === 'NOCONX') { reconnect();return;} add_div({id: 'preference_div', drag: 1}); $('preference_div').innerHTML = req.responseText; try diff --git a/include/action.common.inc.php b/include/action.common.inc.php index 2bb742526..ea1f14b7d 100644 --- a/include/action.common.inc.php +++ b/include/action.common.inc.php @@ -322,33 +322,32 @@ if ($sub_action == "save_action_st2") { $act = new Follow_Up($cn); $act->fromArray($_POST); - try { - $act->d_id = 0; - $act->ag_id=$http->request("ag_id","number"); - $act->md_id = $http->post('gen_doc','number',0); + try { + $act->d_id = 0; + $act->ag_id = $http->request("ag_id", "number"); + $act->md_id = $http->post('gen_doc', 'number', 0); - $act->verify(); - $sup_parameter=HtmlInput::array_to_string(["sc","sb","f_id","qcode"], $_REQUEST,"&"); - // insert into action_gestion - $act->update(); - - $url = "?sa=detail&ag_id=" . $act->ag_id . '&' . dossier::get()."&ac=".$http->request("ac"). - $sup_parameter; - echo '

' . hb(_('Action Sauvée').' : ' . $act->ag_ref) . '

'; + $act->verify(); + $sup_parameter = HtmlInput::array_to_string(["sc", "sb", "f_id", "qcode"], $_REQUEST, "&"); + // insert into action_gestion + $act->update(); - Follow_Up::show_action_list($cn,$base); - $url = "?sa=detail&ag_id=" . $act->ag_id . '&' . dossier::get()."&ac=".$http->request("ac"). - $sup_parameter; - echo '

' . hb(_('Action Sauvée').' : ' . $act->ag_ref) . '

'; - } catch (Exception $e) - { - echo ''; - echo _("Erreur")." ".$e->getMessage(); - echo ''; - $sub_action="add_action"; - $error_id=$e->getCode(); - record_log($e); - } + $url = "?sa=detail&ag_id=" . $act->ag_id . '&' . dossier::get() . "&ac=" . $http->request("ac") . + $sup_parameter; + echo '

' . hb(_('Action Sauvée') . ' : ' . $act->ag_ref) . '

'; + + Follow_Up::show_action_list($cn, $base); + $url = "?sa=detail&ag_id=" . $act->ag_id . '&' . dossier::get() . "&ac=" . $http->request("ac") . + $sup_parameter; + echo '

' . hb(_('Action Sauvée') . ' : ' . $act->ag_ref) . '

'; + } catch (Exception $e) { + echo ''; + echo _("Erreur") . " " . $e->getMessage(); + echo ''; + $sub_action = "add_action"; + $error_id = $e->getCode(); + record_log($e); + } } //-------------------------------------------------------------------------------- // Add an action diff --git a/include/class/acc_account_ledger.class.php b/include/class/acc_account_ledger.class.php index d4f20e663..61d33887e 100644 --- a/include/class/acc_account_ledger.class.php +++ b/include/class/acc_account_ledger.class.php @@ -304,6 +304,18 @@ class Acc_Account_Ledger } return $this->name; } + /*! + * \brief Return the type of a account + * \returns string ACT,ACTINV,CHA,CHAINV,CON,PAS,PRO + */ + function get_type() + { + $type=$this->db->get_value( + "select pcm_type from tmp_pcmn where + pcm_val=$1",array($this->id)); + return $type; + } + /*!\brief check if the poste exist in the tmp_pcmn *\return the number of line (normally 1 or 0) */ @@ -446,6 +458,20 @@ class Acc_Account_Ledger $rep=""; + $type =$this->get_type(); + // label warning if the saldo is incorrect + $label=""; + if (in_array($type,array('CHA','ACT','PASINV','PROINV')) && $tot_deb<$tot_cred) + { + + $label.=_("Solde créditeur au lieu de débiteur").''; + } + if (in_array($type,array('PRO','PAS','ACTINV','CHAINV')) && $tot_deb>$tot_cred) + { + + $label.=_("Solde débiteur au lieu de créditeur")." ".''; + } + echo ''.$label.''; if ( $from_div == 1) echo ""; @@ -570,6 +596,8 @@ class Acc_Account_Ledger echo ''; echo "
"; + if ( DEBUGNOALYSS>1) echo \Noalyss\Dbg::hidden_info("variable", get_defined_vars()); + if ( DEBUGNOALYSS>1) echo \Noalyss\Dbg::hidden_info("this", $this); return; } diff --git a/include/class/document.class.php b/include/class/document.class.php index bee321778..6a6881d25 100644 --- a/include/class/document.class.php +++ b/include/class/document.class.php @@ -449,7 +449,10 @@ class Document /** * @brief upload a file into document * all the needed data are in $_FILES we don't increment the seq - * @param $p_file : array containing by default $_FILES + * $_FILES : array containing by default $_FILES + * @param int $p_ag_id ACTION_GESTION.AG_ID + * @param int $agc_id ACTION_GESTION_COMMENT.AGC_ID + * @returns array of int DOCUMENT.D_ID (id of saved documents ) * */ function upload($p_ag_id) @@ -463,6 +466,10 @@ class Document // Start Transaction $this->db->start(); $name=$_FILES['file_upload']['name']; + $document_saved=array(); + $http=new HttpInput(); + $aDescription=$http->post("input_desc","array",array()); + $description=""; for ($i=0; $id_lob=$oid; $this->d_filename=$_FILES['file_upload']['name'][$i]; $this->d_mimetype=$_FILES['file_upload']['type'][$i]; - $this->d_description=strip_tags($_POST['input_desc'][$i]); + if ( isset($aDescription[$i])) { + $description=strip_tags($aDescription[$i]??""); + } + $this->d_description=$description; // insert into the table $sql="insert into document (ag_id, d_lob,d_filename,d_mimetype,d_number,d_description)" - . " values ($1,$2,$3,$4,$5,$6)"; - $this->db->exec_sql($sql, + . " values ($1,$2,$3,$4,$5,$6) returning d_id"; + $document_saved[]=$this->db->get_value($sql, array($p_ag_id, $this->d_lob, $this->d_filename, $this->d_mimetype, 1, $this->d_description)); } } /* end for */ $this->db->commit(); + return $document_saved; } /** @@ -540,8 +551,19 @@ class Document $this->db->start(); $ret=$this->db->exec_sql( "select d_id,d_lob,d_filename,d_mimetype from document where d_id=$1", [$this->d_id]); + if (Database::num_row($ret)==0) { + // send it to stdout + ini_set('zlib.output_compression', 'Off'); + header("Pragma: public"); + header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); + header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + header("Cache-Control: must-revalidate"); + header('Content-type: text'); + header('Content-Disposition: attachment;filename="vide.txt"', FALSE); + header("Accept-Ranges: bytes"); + echo "VIDE-EMPTY"; return; } $row=Database::fetch_array($ret, 0); @@ -550,7 +572,7 @@ class Document $this->db->lo_export($row['d_lob'], $tmp); $this->d_mimetype=$row['d_mimetype']; $this->d_filename=$row['d_filename']; - + $file=fopen($tmp, 'r'); // send it to stdout ini_set('zlib.output_compression', 'Off'); header("Pragma: public"); @@ -560,7 +582,6 @@ class Document header('Content-type: '.$this->d_mimetype); header('Content-Disposition: attachment;filename="'.$this->d_filename.'"', FALSE); header("Accept-Ranges: bytes"); - $file=fopen($tmp, 'r'); while (!feof($file)) { echo fread($file, 8192); @@ -568,7 +589,6 @@ class Document fclose($file); unlink($tmp); - $this->db->commit(); } diff --git a/include/class/fiche.class.php b/include/class/fiche.class.php index 1624c329c..62e124acb 100644 --- a/include/class/fiche.class.php +++ b/include/class/fiche.class.php @@ -1366,9 +1366,9 @@ class Fiche /* Filter on the default year */ if ( $g_parameter->MY_REPORT == 'N') { - $amount=$tiers->get_solde_detail($filter_year); - } else { $amount = $tiers->get_solde_detail(); + } else { + $amount=$tiers->get_solde_detail($filter_year); } /* skip the tiers without operation */ diff --git a/include/class/follow_up.class.php b/include/class/follow_up.class.php index e03750c6d..6c8c16c1c 100644 --- a/include/class/follow_up.class.php +++ b/include/class/follow_up.class.php @@ -416,6 +416,7 @@ class Follow_Up /* for new files */ $upload=new IFile(); $upload->name="file_upload[]"; + $upload->set_multiple(true); $upload->setAlertOnSize(true); $upload->readOnly=$readonly; $upload->value=""; @@ -948,7 +949,7 @@ class Follow_Up } // upload documents $doc=new Document($this->db); - $doc->upload($this->ag_id); + $document_saved=$doc->upload($this->ag_id); /* save action details */ $http=new HttpInput(); @@ -966,8 +967,15 @@ class Follow_Up if (trim(strip_tags($this->ag_comment??"")) !='') { $notag_comment=strip_tags($this->ag_comment); - $this->db->exec_sql("insert into action_gestion_comment (ag_id,tech_user,agc_comment,agc_comment_raw) values ($1,$2,$3,$4)" + $action_comment_id=$this->db->get_value("insert into action_gestion_comment (ag_id,tech_user,agc_comment,agc_comment_raw) values ($1,$2,$3,$4) returning agc_id" , array($this->ag_id, $_SESSION[SESSION_KEY.'g_user'], $notag_comment,$this->ag_comment)); + // saved also documents for this comment + if ( ! empty ($document_saved)) { + foreach ($document_saved as $document_id) { + $this->db->exec_sql("insert into action_comment_document(document_id,action_gestion_comment_id) values ($1,$2)", + [$document_id,$action_comment_id]); + } + } } if (trim(strip_tags($this->ag_description??""))!='' ) { diff --git a/include/constant.php b/include/constant.php index 05c93f435..375b47214 100644 --- a/include/constant.php +++ b/include/constant.php @@ -123,7 +123,7 @@ if (!defined("NOALYSS_PACKAGE_REPOSITORY")) { if (!defined("SYSINFO_DISPLAY")) { define("SYSINFO_DISPLAY", TRUE); } -define("DBVERSION", 192); +define("DBVERSION", 193); define("MONO_DATABASE", 25); define("DBVERSIONREPO", 20); define('NOTFOUND', '--not found--'); diff --git a/include/customer.inc.php b/include/customer.inc.php index afc61c3c6..77501a14c 100644 --- a/include/customer.inc.php +++ b/include/customer.inc.php @@ -26,7 +26,7 @@ if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis'); $http=new HttpInput(); -$low_action = (isset($_REQUEST['sb'])) ? $_REQUEST['sb'] : "list"; +$low_action = $http->request("sb","string","list"); /** \file * \brief Called from the module "Gestion" to manage the customer */ diff --git a/include/lib/ac_common.php b/include/lib/ac_common.php index 5aa23874e..88e95ed7f 100644 --- a/include/lib/ac_common.php +++ b/include/lib/ac_common.php @@ -909,7 +909,7 @@ function ajax_disconnected($p_div) echo HtmlInput::title_box(_("Déconnecté"), $p_div); echo h2(_('Données non disponibles'), 'class="error" '); echo h2(_('Veuillez vous reconnecter soit dans une autre fenêtre soit ' - . ' en cliquant sur le lien'), 'class="error"'); + . ' en cliquant sur le bouton'), 'class="error"'); // Reload button $reload=new IButton("reload"); $reload->value=_("Se connecter"); @@ -918,7 +918,7 @@ function ajax_disconnected($p_div) // Link to log in another tab echo '

'; echo $reload->input(); - echo HtmlInput::button_close($p_div); + echo HtmlInput::button_close($p_div,'button'); echo '

'; diff --git a/include/lib/dbg.php b/include/lib/dbg.php index a0570b104..6cf096f11 100644 --- a/include/lib/dbg.php +++ b/include/lib/dbg.php @@ -79,6 +79,8 @@ EOF;
$_REQUEST
+ $_FILES +
diff --git a/include/lib/html_input.class.php b/include/lib/html_input.class.php index 4250f9394..de151e6d6 100755 --- a/include/lib/html_input.class.php +++ b/include/lib/html_input.class.php @@ -444,10 +444,11 @@ class HtmlInput * @see add_div modify_operation * @param $div_name is the name of the div to remove */ - static function button_close($div_name) + static function button_close($div_name,$class='smallbutton') { $a=new IButton('Fermer'); $a->label=_("Fermer"); + $a->class=$class; $a->javascript="removeDiv('".$div_name."')"; $html=$a->input(); diff --git a/include/lib/ifile.class.php b/include/lib/ifile.class.php index a0ee85fc0..60a3f38ba 100644 --- a/include/lib/ifile.class.php +++ b/include/lib/ifile.class.php @@ -31,10 +31,23 @@ class IFile extends HtmlInput { // if true , the size is tested and a box is displaid private $alert_on_size; + private $multiple ; // false by default, if true allow to select several files function __construct($p_name = "", $p_value = "", $p_id = "") { parent::__construct($p_name, $p_value, $p_id); $this->alert_on_size=false; + $this->multiple=false; + } + + public function get_multiple(): bool + { + return $this->multiple; + } + + public function set_multiple(bool $multiple): IFile + { + $this->multiple = $multiple; + return $this; } /** @@ -61,7 +74,11 @@ class IFile extends HtmlInput $this->value=($p_value==null)?$this->value:$p_value; if ( $this->readOnly==true) return $this->display(); if ($this->id=="") $this->id=uniqid("file_"); - $r=sprintf('', + $multiple=""; + if ( $this->multiple) $multiple=" multiple "; + + $r=sprintf('', + $multiple, $this->name, $this->id, $this->value); diff --git a/include/sql/patch/upgrade192.sql b/include/sql/patch/upgrade192.sql new file mode 100644 index 000000000..920f2cf42 --- /dev/null +++ b/include/sql/patch/upgrade192.sql @@ -0,0 +1,10 @@ +begin; +create table action_comment_document (acd_id bigint generated by default as identity primary key + , document_id bigint references document(d_id) on delete cascade on update cascade, + action_gestion_comment_id bigint references action_gestion_comment(agc_id) on delete cascade on update cascade); + +alter table action_comment_document + add constraint action_comment_document_un + unique (document_id, action_gestion_comment_id); +insert into version (val,v_description) values (193,' 2332: Suivi : ajout fichier lié aux commentaires'); +commit; \ No newline at end of file diff --git a/include/template/follow_up-display.php b/include/template/follow_up-display.php index 5d098abca..1c64f9fae 100644 --- a/include/template/follow_up-display.php +++ b/include/template/follow_up-display.php @@ -377,6 +377,7 @@ function small(p_id_textarea){ echo ''; } } + $dossier_id=Dossier::id(); if ( count($acomment) > 0 && Document_Option::can_add_comment($ag_id) && Document_Option::option_comment($this->dt_id) == "SOME_FIXED") @@ -395,7 +396,7 @@ function small(p_id_textarea){ $js=Icon_Action::trash("accom".$acomment[$c]['agc_id'], $rmComment); $comment= h($m_desc.' '.$acomment[$c]['agc_id'].'('.$acomment[$c]['tech_user']." ". $acomment[$c]['str_agc_date'].')').$js. - '
'. + '
'. " ".$acomment[$c]['agc_comment_raw'].'
' ; @@ -414,10 +415,30 @@ function small(p_id_textarea){ Dossier::id().',0)" >\1',$comment); echo '

'; echo $comment; + // link to files to download + $aFile=$this->db->get_array('select d_id,d_filename,d_description,d_mimetype + from action_comment_document + join document on (d_id=document_id) where action_gestion_comment_id=$1' + , array( $acomment[$c]['agc_id'])); + if ( ! empty ($aFile)) { + echo '
'; + echo _("Fichiers :"); + foreach ($aFile as $file) + { + $url="export.php?".http_build_query(array("act"=>'RAW:document' + ,"gDossier"=>$dossier_id + ,"d_id"=>$file["d_id"])); + printf('%s', + $url,h($file['d_filename'])); + + } + echo '
'; + } + } // end for if ( $has_description && $p_view == 'UPD' && Document_Option::can_add_comment($ag_id)) { echo ''; - echo '
'; + echo '
'; echo $desc->input(); echo '
'; } @@ -451,8 +472,26 @@ if ( $this->ag_id > 0 && Document_Option::is_enable_operation_detail($this->dt_i **********************************************************************************************************************/ ?> -
+
+ +
+

Fichiers à ajouter:

+
    +
  1. + input(); + ?> + +
  2. +
+ + "> + +
+
@@ -480,7 +519,19 @@ endif; ?> **********************************************************************************************************************/ ?>
-
+
+ +
+ +
'; + new_element.innerHTML=''; new_element.innerHTML+='" onclick="document.getElementById(\'add_file\').removeChild(this.parentNode)" class="icon">'; @@ -553,26 +607,7 @@ try { catch(exception) { alert(''); alert(exception.message);} } - -
-

Fichiers à ajouter:

-
    -
  1. - input(); - ?> - - - -
  2. -
- - "> - -
- +
Document créé le ag_timestamp ?> par ag_owner?> diff --git a/sql/upgrade.sql b/sql/upgrade.sql index e69de29bb..8b1378917 100644 --- a/sql/upgrade.sql +++ b/sql/upgrade.sql @@ -0,0 +1 @@ +