107 |
*/ |
*/ |
108 |
var $di_reopened = null; |
var $di_reopened = null; |
109 |
|
|
110 |
|
/** |
111 |
|
* Méthode appelée par le module_manager lors de la récupération des modules de cet objet. |
112 |
|
* Permet d'ajouer des modules en plus de ceux récupérer par défaut par le module_manager. |
113 |
|
* |
114 |
|
* @return array Liste de modules supplémentaires pour cet objet |
115 |
|
*/ |
116 |
|
public function get_modules_append() { |
117 |
|
$modules = array(); |
118 |
|
|
119 |
|
// si on est dans le cadre de l'affichage d'une nouvelle instruction |
120 |
|
$action = $this->f->get_submitted_get_value('action'); |
121 |
|
if ($action == '0') { |
122 |
|
|
123 |
|
// si on est sur un dossier d'instruction |
124 |
|
if ($this->f->contexte_dossier_instruction()) { |
125 |
|
$idx = $this->f->get_submitted_get_value('idxformulaire'); |
126 |
|
if (! empty($idx)) { |
127 |
|
|
128 |
|
// ajoute les modules des évènements possible sur le dossier courant |
129 |
|
$evenements_data = $this->get_var_sql_forminc__sql_evenement(); |
130 |
|
$evenements_ids = array_map(function($item) { return $item['evenement']; }, $evenements_data); |
131 |
|
$this->f->log(__METHOD__, 'evenements: '.implode(',', $evenements_ids)); |
132 |
|
$modules = $this->f->module_manager->get_modules_for_object_name_and_ids( |
133 |
|
'evenement', $evenements_ids, $this, false); |
134 |
|
} |
135 |
|
} |
136 |
|
} |
137 |
|
return $modules; |
138 |
|
} |
139 |
|
|
140 |
// {{{ Gestion de la confidentialité des données spécifiques |
// {{{ Gestion de la confidentialité des données spécifiques |
141 |
|
|
142 |
/** |
/** |
543 |
"permission_suffix" => "modifier", |
"permission_suffix" => "modifier", |
544 |
); |
); |
545 |
|
|
546 |
|
// ACTION - 412 - Vérifie le dépassement de la date limite de notification |
547 |
|
$this->class_actions[412] = array( |
548 |
|
"identifier" => "is_date_limite_notification_dossier_depasse", |
549 |
|
"view" => "is_date_limite_notification_dossier_depasse", |
550 |
|
"permission_suffix" => "modifier", |
551 |
|
); |
552 |
|
|
553 |
// ACTION - 420 - Notifier les services consultés (mail) |
// ACTION - 420 - Notifier les services consultés (mail) |
554 |
$this->class_actions[420] = array( |
$this->class_actions[420] = array( |
555 |
"identifier" => "overlay_notification_service_consulte", |
"identifier" => "overlay_notification_service_consulte", |
1253 |
|
|
1254 |
|
|
1255 |
function setType(&$form, $maj) { |
function setType(&$form, $maj) { |
1256 |
|
$data = array('form' => &$form, 'maj' => &$maj); |
1257 |
|
$this->f->module_manager->run_hooks('setType_pre', $this, $data); |
1258 |
|
|
1259 |
// Récupération du mode de l'action |
// Récupération du mode de l'action |
1260 |
$crud = $this->get_action_crud($maj); |
$crud = $this->get_action_crud($maj); |
1261 |
// Récupère la collectivité du dossier d'instruction |
// Récupère la collectivité du dossier d'instruction |
1474 |
&& $maj == 3) { |
&& $maj == 3) { |
1475 |
$form->setType("date_envoi_controle_legalite", "hiddenstatic"); |
$form->setType("date_envoi_controle_legalite", "hiddenstatic"); |
1476 |
} |
} |
1477 |
|
$data = array('form' => &$form, 'maj' => &$maj); |
1478 |
|
$this->f->module_manager->run_hooks('setType_post', $this, $data); |
1479 |
} |
} |
1480 |
|
|
1481 |
function setOnchange(&$form,$maj){ |
function setOnchange(&$form,$maj){ |
1482 |
|
$this->f->log(__METHOD__, 'BEGIN'); |
1483 |
|
$data = array('form' => &$form, 'maj' => &$maj); |
1484 |
|
$this->f->module_manager->run_hooks('setOnchange_pre', $this, $data); |
1485 |
|
|
1486 |
parent::setOnchange($form,$maj); |
parent::setOnchange($form,$maj); |
1487 |
|
|
1488 |
// MODE AJOUTER |
// MODE AJOUTER |
1493 |
manage_instruction_evenement_commentaire(this.value, '".addslashes($this->getParameter('idxformulaire'))."');" |
manage_instruction_evenement_commentaire(this.value, '".addslashes($this->getParameter('idxformulaire'))."');" |
1494 |
); |
); |
1495 |
} |
} |
1496 |
|
|
1497 |
|
$data = array('form' => &$form, 'maj' => &$maj); |
1498 |
|
$this->f->module_manager->run_hooks('setOnchange_post', $this, $data); |
1499 |
|
$this->f->log(__METHOD__, 'END'); |
1500 |
} |
} |
1501 |
|
|
1502 |
function evenement_has_an_edition($evenement_id) { |
function evenement_has_an_edition($evenement_id) { |
1728 |
*/ |
*/ |
1729 |
function get_var_sql_forminc__sql_evenement() { |
function get_var_sql_forminc__sql_evenement() { |
1730 |
// Récupération du numéro de dossier |
// Récupération du numéro de dossier |
1731 |
$dossier = $this->getParameter("idxformulaire"); |
$dossier = $this->getParameter("idxformulaire") ?? $_GET['idxformulaire']; |
1732 |
|
$this->f->log(__METHOD__, 'dossier: '.var_export($dossier, true)); |
1733 |
// Si changement de décision par instructeur commune |
// Si changement de décision par instructeur commune |
1734 |
$filter = ''; |
$filter = ''; |
1735 |
if ($this->f->isUserInstructeur() === true |
if ($this->f->isUserInstructeur() === true |
1736 |
|
// TODO faire autrement car ça instancier le dossier et donc charge ses modules ! |
1737 |
&& $this->getDivisionFromDossier($dossier) != $_SESSION["division"] |
&& $this->getDivisionFromDossier($dossier) != $_SESSION["division"] |
1738 |
&& $this->isInstrCanChangeDecision($dossier) === true) { |
&& $this->isInstrCanChangeDecision($dossier) === true) { |
1739 |
$filter = "AND evenement.type IN ('arrete', 'changement_decision')"; |
$filter = "AND evenement.type IN ('arrete', 'changement_decision')"; |
2186 |
* @return void |
* @return void |
2187 |
*/ |
*/ |
2188 |
function setValsousformulaire(&$form, $maj, $validation, $idxformulaire, $retourformulaire, $typeformulaire, &$dnu1 = null, $dnu2 = null) { |
function setValsousformulaire(&$form, $maj, $validation, $idxformulaire, $retourformulaire, $typeformulaire, &$dnu1 = null, $dnu2 = null) { |
2189 |
|
$data = array('form' => &$form, 'maj' => &$maj, 'validation' => &$validation, 'idxformulaire' => &$idxformulaire, 'retourformulaire' => &$retourformulaire, 'typeformulaire' => &$typeformulaire); |
2190 |
|
$this->f->module_manager->run_hooks('setValsousformulaire_pre', $this, $data); |
2191 |
|
|
2192 |
// parent::setValsousformulaire($form, $maj, $validation, $idxformulaire, $retourformulaire, $typeformulaire); |
// parent::setValsousformulaire($form, $maj, $validation, $idxformulaire, $retourformulaire, $typeformulaire); |
2193 |
// |
// |
2194 |
$this->retourformulaire = $retourformulaire; |
$this->retourformulaire = $retourformulaire; |
2208 |
} |
} |
2209 |
// |
// |
2210 |
$this->set_form_default_values($form, $maj, $validation); |
$this->set_form_default_values($form, $maj, $validation); |
2211 |
|
|
2212 |
|
$data = array('form' => &$form, 'maj' => &$maj, 'validation' => &$validation, 'idxformulaire' => &$idxformulaire, 'retourformulaire' => &$retourformulaire, 'typeformulaire' => &$typeformulaire); |
2213 |
|
$this->f->module_manager->run_hooks('setValsousformulaire_post', $this, $data); |
2214 |
} |
} |
2215 |
|
|
2216 |
/** |
/** |
2219 |
* @return void |
* @return void |
2220 |
*/ |
*/ |
2221 |
function set_form_default_values(&$form, $maj, $validation) { |
function set_form_default_values(&$form, $maj, $validation) { |
2222 |
// |
$data = array('form' => &$form, 'maj' => &$maj, 'validation' => &$validation); |
2223 |
|
$this->f->module_manager->run_hooks('set_form_default_values_pre', $this, $data); |
2224 |
|
|
2225 |
if ($maj == 0) { |
if ($maj == 0) { |
2226 |
// si contexte DI |
// si contexte DI |
2227 |
if ($this->getParameter("retourformulaire") == "dossier" |
if ($this->getParameter("retourformulaire") == "dossier" |
2259 |
$form->setVal("bible3", "bible(3)"); |
$form->setVal("bible3", "bible(3)"); |
2260 |
$form->setVal("bible4", "bible(4)"); |
$form->setVal("bible4", "bible(4)"); |
2261 |
} |
} |
2262 |
// |
// TODO à faire autrement car ça génère une requête à chaque fois, plus l'instanciation du dossier d'instruction et donc de ses modules ! |
2263 |
$collectivite_di = $this->get_dossier_instruction_om_collectivite(); |
$collectivite_di = $this->get_dossier_instruction_om_collectivite(); |
2264 |
if ($maj == 1 |
if ($maj == 1 |
2265 |
&& $this->f->is_option_preview_pdf_enabled($collectivite_di) === true |
&& $this->f->is_option_preview_pdf_enabled($collectivite_di) === true |
2301 |
} |
} |
2302 |
} |
} |
2303 |
} |
} |
2304 |
|
$data = array('form' => &$form, 'maj' => &$maj, 'validation' => &$validation); |
2305 |
|
$this->f->module_manager->run_hooks('set_form_default_values_post', $this, $data); |
2306 |
} |
} |
2307 |
|
|
2308 |
function setLayout(&$form, $maj){ |
function setLayout(&$form, $maj){ |
2309 |
|
$data = array('form' => &$form, 'maj' => &$maj); |
2310 |
|
$this->f->module_manager->run_hooks('setLayout_pre', $this, $data); |
2311 |
|
|
2312 |
$form->setBloc('evenement','D',"","sousform-instruction-action-".$maj); |
$form->setBloc('evenement','D',"","sousform-instruction-action-".$maj); |
2313 |
|
|
2314 |
$form->setFieldset('evenement','D',_('Evenement')); |
$form->setFieldset('evenement','D',_('Evenement')); |
2407 |
$form->setFieldset('corps_om_htmletatex','DF',_('Corps')); |
$form->setFieldset('corps_om_htmletatex','DF',_('Corps')); |
2408 |
$form->setBloc('corps_om_htmletatex','F'); |
$form->setBloc('corps_om_htmletatex','F'); |
2409 |
} |
} |
2410 |
|
$data = array('form' => &$form, 'maj' => &$maj); |
2411 |
|
$this->f->module_manager->run_hooks('setLayout_post', $this, $data); |
2412 |
} |
} |
2413 |
|
|
2414 |
function setLib(&$form, $maj) { |
function setLib(&$form, $maj) { |
2415 |
|
$data = array('form' => &$form, 'maj' => &$maj); |
2416 |
|
$this->f->module_manager->run_hooks('setLib_pre', $this, $data); |
2417 |
// |
// |
2418 |
parent::setLib($form, $maj); |
parent::setLib($form, $maj); |
2419 |
// |
// |
2462 |
$form->setLib('date_evenement', sprintf($help_text_template, _('date_evenement'), $help_text)); |
$form->setLib('date_evenement', sprintf($help_text_template, _('date_evenement'), $help_text)); |
2463 |
$form->setLib('signataire_arrete', sprintf($help_text_template, _('signataire_arrete'), $help_text)); |
$form->setLib('signataire_arrete', sprintf($help_text_template, _('signataire_arrete'), $help_text)); |
2464 |
} |
} |
2465 |
|
$data = array('form' => &$form, 'maj' => &$maj); |
2466 |
|
$this->f->module_manager->run_hooks('setLib_post', $this, $data); |
2467 |
} |
} |
2468 |
|
|
2469 |
/** |
/** |
2560 |
*/ |
*/ |
2561 |
function triggerajouter($id, &$dnu1 = null, $val = array(), $dnu2 = null) { |
function triggerajouter($id, &$dnu1 = null, $val = array(), $dnu2 = null) { |
2562 |
$this->addToLog(__METHOD__."(): start", EXTRA_VERBOSE_MODE); |
$this->addToLog(__METHOD__."(): start", EXTRA_VERBOSE_MODE); |
2563 |
|
$data = array('val' => &$val, 'id' => $id); |
2564 |
|
$this->f->module_manager->run_hooks('triggerajouter_pre', $this, $data); |
2565 |
/** |
/** |
2566 |
* Le code suivant permet de récupérer des valeurs des tables evenement |
* Le code suivant permet de récupérer des valeurs des tables evenement |
2567 |
* et dossier pour les stocker dans l'instruction : |
* et dossier pour les stocker dans l'instruction : |
2672 |
); |
); |
2673 |
$row = array_shift($qres['result']); |
$row = array_shift($qres['result']); |
2674 |
$this->updateArchiveData($row); |
$this->updateArchiveData($row); |
2675 |
|
|
2676 |
// Récupération de la duree de validite du dossier d'autorisation |
// Récupération de la duree de validite du dossier d'autorisation |
2677 |
$qres = $this->f->get_one_result_from_db_query( |
$qres = $this->f->get_one_result_from_db_query( |
2678 |
sprintf( |
sprintf( |
2710 |
if (! empty($this->valF['lettretype'])) { |
if (! empty($this->valF['lettretype'])) { |
2711 |
$this->set_precharge_complement($this->valF['evenement'], $this->valF['dossier']); |
$this->set_precharge_complement($this->valF['evenement'], $this->valF['dossier']); |
2712 |
} |
} |
2713 |
|
|
2714 |
|
$res = true; |
2715 |
|
$data = array('val' => &$val, 'id' => $id, 'result' => &$res); |
2716 |
|
$this->f->module_manager->run_hooks('triggerajouter_post', $this, $data); |
2717 |
|
return $res; |
2718 |
} |
} |
2719 |
|
|
2720 |
/** |
/** |
2988 |
|
|
2989 |
|
|
2990 |
/** |
/** |
2991 |
|
* Calcul une regle à partir des données de l'url et affiche son |
2992 |
|
* résultat au format json |
2993 |
|
*/ |
2994 |
|
public function is_date_limite_notification_dossier_depasse() { |
2995 |
|
// Récupération de la date limite |
2996 |
|
$dossier = $this->f->get_inst__om_dbform(array( |
2997 |
|
'obj' => 'dossier', |
2998 |
|
'idx' => $this->getVal('dossier') |
2999 |
|
)); |
3000 |
|
$date_limite = $dossier->getVal('incomplet_notifie') !== 't' ? |
3001 |
|
$dossier->getVal('date_limite') : |
3002 |
|
$dossier->getVal('date_limite_incompletude'); |
3003 |
|
// Ajout d'un jour à la date limite (reglementaire lors de la notification |
3004 |
|
// par demat) |
3005 |
|
$date_limite = $this->f->mois_date($date_limite, "1", "+", "jour"); |
3006 |
|
// Compare la date limite à j+1 et la date du jour |
3007 |
|
// La date du jour est récupérée via la fonction date pour pouvoir comparer |
3008 |
|
// des timestamps de début de journée |
3009 |
|
echo strtotime($date_limite) < strtotime(date("Y-m-d")) ? 'True' : 'False'; |
3010 |
|
} |
3011 |
|
|
3012 |
|
/** |
3013 |
* Calcul des règle d'action selon leur type. |
* Calcul des règle d'action selon leur type. |
3014 |
* |
* |
3015 |
* Types de règle : |
* Types de règle : |
3030 |
|
|
3031 |
// Supprime tous les espaces de la chaîne de caractère |
// Supprime tous les espaces de la chaîne de caractère |
3032 |
$rule = str_replace(' ', '', $rule); |
$rule = str_replace(' ', '', $rule); |
3033 |
|
// On force les minuscules |
3034 |
|
$rule = strtolower($rule); |
3035 |
// Coupe la chaîne au niveau de l'opérateur |
// Coupe la chaîne au niveau de l'opérateur |
3036 |
$operands = explode ("+", $rule); |
$operands = explode ("+", $rule); |
3037 |
// Nombre d'opérande |
// Nombre d'opérande |
3063 |
"regle_date_ait", |
"regle_date_ait", |
3064 |
"regle_date_transmission_parquet", |
"regle_date_transmission_parquet", |
3065 |
"regle_date_affichage", |
"regle_date_affichage", |
3066 |
|
"duree_validite", |
3067 |
|
"duree_validite_parametrage", |
3068 |
); |
); |
3069 |
// Tableau des champs de type numérique |
// Tableau des champs de type numérique |
3070 |
$rule_type_numeric = array( |
$rule_type_numeric = array( |
3071 |
|
); |
3072 |
|
// Tableau des champs de type text |
3073 |
|
$rule_type_time_delai = array( |
3074 |
"regle_delai", |
"regle_delai", |
3075 |
"regle_delai_incompletude", |
"regle_delai_incompletude", |
3076 |
); |
); |
3123 |
$type = "specific"; |
$type = "specific"; |
3124 |
} |
} |
3125 |
if (in_array($rule_name, $rule_type_technical_data) === true) { |
if (in_array($rule_name, $rule_type_technical_data) === true) { |
3126 |
$type = 'text'; |
$type = 'technical_text'; |
3127 |
} |
} |
3128 |
if (in_array($rule_name, $rule_type_simple) === true) { |
if (in_array($rule_name, $rule_type_simple) === true) { |
3129 |
$type = 'simple'; |
$type = 'simple'; |
3130 |
} |
} |
3131 |
|
if (in_array($rule_name, $rule_type_time_delai) === true) { |
3132 |
|
$type = "time_delai"; |
3133 |
|
} |
3134 |
|
|
3135 |
// Si c'est un type spécifique ou booléen alors il n'a qu'un opérande |
// Si c'est un type spécifique ou booléen alors il n'a qu'un opérande |
3136 |
// Récupère directement la valeur de l'opérande |
// Récupère directement la valeur de l'opérande |
3140 |
} |
} |
3141 |
|
|
3142 |
// Initialisation des variables |
// Initialisation des variables |
|
$key_date = 0; |
|
3143 |
$total_numeric = 0; |
$total_numeric = 0; |
3144 |
$res_text = ''; |
$res_text = ''; |
3145 |
|
$final_date = 0; |
3146 |
|
|
3147 |
// Pour chaque opérande |
// Pour chaque opérande |
3148 |
foreach ($operands as $key => $operand) { |
foreach ($operands as $key => $operand) { |
|
|
|
3149 |
// Si c'est une règle de type date |
// Si c'est une règle de type date |
3150 |
if ($type == 'date') { |
if ($type == 'date') { |
3151 |
// Vérifie si au moins une des opérandes est une date |
if (is_numeric($operand) === false){ |
3152 |
if (is_numeric($operand) === false |
$rule_value = $this->get_value_for_rule($operand); |
3153 |
&& $this->get_value_for_rule($operand) !== null |
if ( |
3154 |
&& $this->f->check_date($this->get_value_for_rule($operand)) == true) { |
$rule_value !== null |
3155 |
// Récupère la position de la date |
&& ( |
3156 |
$key_date = $key; |
strpos($operand, 'mois') !== false |
3157 |
|
|| strpos($operand, 'jour') !== false |
3158 |
|
) |
3159 |
|
){ |
3160 |
|
$rule_value = $operand; |
3161 |
|
} |
3162 |
|
if ($rule_value !== null){ |
3163 |
|
// Vérifie si l'opérande est une date |
3164 |
|
if ($this->f->check_date($rule_value) == true) { |
3165 |
|
// Affecte la date |
3166 |
|
$final_date = $rule_value; |
3167 |
|
}else{ |
3168 |
|
// Gère les opérandes |
3169 |
|
preg_match_all('/(\d+) *([a-zA-Z]*)/', $rule_value, $matches, PREG_OFFSET_CAPTURE); |
3170 |
|
|
3171 |
|
// Ajoute l'opérande au total |
3172 |
|
foreach ($matches[1] as $matche_key => $matche_value) { |
3173 |
|
$timelength = $matches[1][$matche_key][0]; |
3174 |
|
$timetype = 'mois'; |
3175 |
|
if ( $matches[2][$matche_key][0] != ''){ |
3176 |
|
$timetype = $matches[2][$matche_key][0]; |
3177 |
|
} |
3178 |
|
// Ajout au calcul de la date |
3179 |
|
$final_date = $this->f->mois_date( |
3180 |
|
$final_date, |
3181 |
|
$timelength, |
3182 |
|
"+", |
3183 |
|
$timetype |
3184 |
|
); |
3185 |
|
} |
3186 |
|
} |
3187 |
|
} |
3188 |
} |
} |
3189 |
// Les autres opérandes doivent être que des numériques |
// Les autres opérandes doivent être que des numériques |
3190 |
if (is_numeric($operand) == true) { |
if (is_numeric($operand) == true) { |
3191 |
// Ajoute l'opérande au total |
// Ajoute l'opérande au total |
3192 |
$total_numeric += $operand; |
// Ajout au calcul de la date |
3193 |
} |
$final_date = $this->f->mois_date($final_date, |
3194 |
if (is_numeric($operand) === false |
$operand, "+"); |
|
&& $this->get_value_for_rule($operand) !== null |
|
|
&& is_numeric($this->get_value_for_rule($operand)) == true) { |
|
|
// Ajoute l'opérande au total |
|
|
$total_numeric += $this->get_value_for_rule($operand); |
|
3195 |
} |
} |
3196 |
} |
} |
3197 |
|
|
3211 |
} |
} |
3212 |
|
|
3213 |
// Si c'est une règle de type text |
// Si c'est une règle de type text |
3214 |
if ($type === 'text') { |
if ($type === 'text' || $type === 'technical_text') { |
3215 |
// Concatène toutes les chaînes de caractère |
// Concatène toutes les chaînes de caractère |
3216 |
$res_text .= $this->get_value_for_rule($operand); |
$res_text .= $this->get_value_for_rule($operand); |
3217 |
} |
} |
3218 |
|
|
3219 |
|
// Si c'est une règle de type time_delai |
3220 |
|
if ($type === 'time_delai') { |
3221 |
|
$rule_value = $this->get_value_for_rule($operand); |
3222 |
|
if ( strlen($res_text) != 0) { |
3223 |
|
$res_text .= "+"; |
3224 |
|
} |
3225 |
|
if ($rule_value != null && $rule_value != ''){ |
3226 |
|
// Supprime tous les espaces de la chaîne de caractère |
3227 |
|
// Concatène toutes les chaînes de caractère |
3228 |
|
$res_text .= $rule_value; |
3229 |
|
} else { |
3230 |
|
$res_text .= $operand; |
3231 |
|
} |
3232 |
|
} |
3233 |
|
|
3234 |
} |
} |
3235 |
|
|
3236 |
// Résultat pour une règle de type date |
// Résultat pour une règle de type date |
3237 |
if ($type == 'date') { |
if ($type == 'date') { |
3238 |
// Retourne le calcul de la date |
// Retourne la date |
3239 |
return $this->f->mois_date($this->valF[$operands[$key_date]], |
return $final_date; |
|
$total_numeric, "+"); |
|
3240 |
} |
} |
3241 |
|
|
3242 |
// Résultat pour une règle de type numérique |
// Résultat pour une règle de type numérique |
3246 |
} |
} |
3247 |
|
|
3248 |
// Résultat pour une règle de type text |
// Résultat pour une règle de type text |
3249 |
if ($type === 'text') { |
if (in_array($type, array('text', 'technical_text')) === true) { |
3250 |
// Retourne la chaîne de caractère |
// Retourne la chaîne de caractère |
3251 |
return $res_text; |
return $res_text; |
3252 |
} |
} |
3253 |
|
|
3254 |
|
// Résultat pour une règle de type text |
3255 |
|
if (in_array($type, array('time_delai')) === true) { |
3256 |
|
// Traitement de la valeur à afficher |
3257 |
|
$res_text = str_replace(' ', '', $res_text); |
3258 |
|
$res_text = preg_replace('/(\d+)/', '$1 ', $res_text); |
3259 |
|
$res_text = preg_replace('/(\+)/', ' $1 ', $res_text); |
3260 |
|
$res_text = trim(preg_replace('/\s\s+/', ' ', strtolower($res_text))); |
3261 |
|
return $res_text; |
3262 |
|
} |
3263 |
|
|
3264 |
if ($type === 'simple' || $type === 'bool') { |
if ($type === 'simple' || $type === 'bool') { |
3265 |
// Retourne la valeur du champs rule |
// Retourne la valeur du champs rule |
3266 |
return $rule; |
return $rule; |
3354 |
*/ |
*/ |
3355 |
function triggerajouterapres($id, &$dnu1 = null, $val = array(), $dnu2 = null) { |
function triggerajouterapres($id, &$dnu1 = null, $val = array(), $dnu2 = null) { |
3356 |
$this->addToLog(__METHOD__."(): start", EXTRA_VERBOSE_MODE); |
$this->addToLog(__METHOD__."(): start", EXTRA_VERBOSE_MODE); |
3357 |
|
$data = array('val' => &$val, 'id' => $id); |
3358 |
|
$this->f->module_manager->run_hooks('triggerajouterapres_pre', $this, $data); |
3359 |
|
|
3360 |
// On a besoin de l'instance du dossier lié à l'événement d'instruction |
// On a besoin de l'instance du dossier lié à l'événement d'instruction |
3361 |
$inst_di = $this->get_inst_dossier($this->valF['dossier']); |
$inst_di = $this->get_inst_dossier($this->valF['dossier']); |
3991 |
/** |
/** |
3992 |
* Historisation de la vie du DI. |
* Historisation de la vie du DI. |
3993 |
*/ |
*/ |
3994 |
// |
|
3995 |
return $this->add_log_to_dossier($id, array_merge($val, $this->valF)); |
$res = $this->add_log_to_dossier($id, array_merge($val, $this->valF)); |
3996 |
|
|
3997 |
|
$data = array('val' => &$val, 'id' => $id, 'result' => &$res); |
3998 |
|
$this->f->module_manager->run_hooks('triggerajouterapres_post', $this, $data); |
3999 |
|
return $res; |
4000 |
} |
} |
4001 |
|
|
4002 |
/** |
/** |
4507 |
*/ |
*/ |
4508 |
function triggermodifierapres($id, &$dnu1 = null, $val = array(), $dnu2 = null) { |
function triggermodifierapres($id, &$dnu1 = null, $val = array(), $dnu2 = null) { |
4509 |
$this->addToLog(__METHOD__."(): start", EXTRA_VERBOSE_MODE); |
$this->addToLog(__METHOD__."(): start", EXTRA_VERBOSE_MODE); |
4510 |
|
$data = array('val' => &$val, 'id' => $id); |
4511 |
|
$this->f->module_manager->run_hooks('triggermodifierapres_pre', $this, $data); |
4512 |
$collectivite_di = $this->get_dossier_instruction_om_collectivite($val['dossier']); |
$collectivite_di = $this->get_dossier_instruction_om_collectivite($val['dossier']); |
4513 |
$message = ''; |
$message = ''; |
4514 |
|
|
5059 |
} |
} |
5060 |
} |
} |
5061 |
|
|
5062 |
return $this->add_log_to_dossier($id, $val); |
$res = $this->add_log_to_dossier($id, $val); |
5063 |
|
$data = array('val' => &$val, 'id' => $id, 'result' => &$res); |
5064 |
|
$this->f->module_manager->run_hooks('triggermodifierapres_post', $this, $data); |
5065 |
|
return $res; |
5066 |
} |
} |
5067 |
|
|
5068 |
/** |
/** |
5072 |
*/ |
*/ |
5073 |
function triggersupprimer($id, &$dnu1 = null, $val = array(), $dnu2 = null) { |
function triggersupprimer($id, &$dnu1 = null, $val = array(), $dnu2 = null) { |
5074 |
$this->addToLog(__METHOD__."(): start", EXTRA_VERBOSE_MODE); |
$this->addToLog(__METHOD__."(): start", EXTRA_VERBOSE_MODE); |
5075 |
|
$data = array('val' => &$val, 'id' => $id); |
5076 |
|
$this->f->module_manager->run_hooks('triggersupprimer_pre', $this, $data); |
5077 |
/** |
/** |
5078 |
* L'objectif ici est de repositionner les valeurs récupérées en |
* L'objectif ici est de repositionner les valeurs récupérées en |
5079 |
* archive dans le dossier d'instruction avant de supprimer l'événement |
* archive dans le dossier d'instruction avant de supprimer l'événement |
5210 |
$this->addToMessage(_("Suppression de l'instruction")." [".$this->f->db->affectedRows()." "._('enregistrement')." "._('mis_a_jour')."]"); |
$this->addToMessage(_("Suppression de l'instruction")." [".$this->f->db->affectedRows()." "._('enregistrement')." "._('mis_a_jour')."]"); |
5211 |
|
|
5212 |
// Mise à jour de la demande si un récépissé d'instruction correspond à l'instruction à supprimer |
// Mise à jour de la demande si un récépissé d'instruction correspond à l'instruction à supprimer |
5213 |
|
|
5214 |
|
$res = true; |
5215 |
|
$data = array('val' => &$val, 'id' => $id, 'result' => &$res); |
5216 |
|
$this->f->module_manager->run_hooks('triggersupprimer_post', $this, $data); |
5217 |
|
return $res; |
5218 |
} |
} |
5219 |
|
|
5220 |
/** |
/** |
5224 |
*/ |
*/ |
5225 |
function triggersupprimerapres($id, &$dnu1 = null, $val = array(), $dnu2 = null) { |
function triggersupprimerapres($id, &$dnu1 = null, $val = array(), $dnu2 = null) { |
5226 |
$this->addToLog(__METHOD__."(): start", EXTRA_VERBOSE_MODE); |
$this->addToLog(__METHOD__."(): start", EXTRA_VERBOSE_MODE); |
5227 |
|
$data = array('val' => &$val, 'id' => $id); |
5228 |
|
$this->f->module_manager->run_hooks('triggersupprimerapres_pre', $this, $data); |
5229 |
/** |
/** |
5230 |
* Mise à jour de la date de dernière modification du dossier |
* Mise à jour de la date de dernière modification du dossier |
5231 |
* d'instruction |
* d'instruction |
5283 |
|
|
5284 |
// |
// |
5285 |
$val['evenement'] = $this->getVal('evenement'); |
$val['evenement'] = $this->getVal('evenement'); |
5286 |
return $this->add_log_to_dossier($id, $val); |
$res = $this->add_log_to_dossier($id, $val); |
5287 |
|
$data = array('val' => &$val, 'id' => $id, 'result' => &$res); |
5288 |
|
$this->f->module_manager->run_hooks('triggersupprimerapres_post', $this, $data); |
5289 |
|
return $res; |
5290 |
} |
} |
5291 |
|
|
5292 |
/** |
/** |
8842 |
} |
} |
8843 |
$pdf_output = $pdf_lettre_rar->output("lettre_rar".date("dmYHis").".pdf","S"); |
$pdf_output = $pdf_lettre_rar->output("lettre_rar".date("dmYHis").".pdf","S"); |
8844 |
$om_edition = $this->f->get_inst__om_edition(); |
$om_edition = $this->f->get_inst__om_edition(); |
8845 |
|
$om_edition->set_object_linked($this); |
8846 |
$om_edition->expose_pdf_output($pdf_output, "lettre_rar".date("dmYHis").".pdf"); |
$om_edition->expose_pdf_output($pdf_output, "lettre_rar".date("dmYHis").".pdf"); |
8847 |
} |
} |
8848 |
} |
} |
11408 |
} |
} |
11409 |
|
|
11410 |
/** |
/** |
11411 |
* Gestion de l'affichage PDF spécial vue la dif |
* Gestion spécifique de l'affichage des documents dans le tableau des |
11412 |
|
* documents d'instruction. |
11413 |
|
* Prend en compte qu'une instruction peut également avoir un document lié |
11414 |
|
* dans la table storage. |
11415 |
|
* |
11416 |
|
* @return void |
11417 |
*/ |
*/ |
11418 |
function view_telecharger_editions () { |
public function view_telecharger_editions() { |
11419 |
/** |
// Récupère l'identifiant du document dans l'URL appelant l'action |
11420 |
* Affiche le contenu du fichier |
$idx = $this->f->get_submitted_get_value('idx'); |
11421 |
* @param string $uid Identifiant unique du fichier |
$obj = $this->table; |
11422 |
* @param object $f Instance de la classe utils |
$champ = 'om_fichier_instruction'; |
11423 |
* @param string $dl Téléchargement |
// Cas d'un document historisé (dans la table storage) |
11424 |
* @param string $mode Mode permettant de définir l'endroit où se situe le fichier |
if (strpos($idx, 'STORAGE_') !== false) { |
11425 |
* @ignore |
$idx = substr($idx, 8); |
11426 |
*/ |
$obj = 'storage'; |
11427 |
function display_file_content($uid, $dl, $f, $mode) { |
$champ = 'uid'; |
11428 |
|
} |
11429 |
// Choix du support du filestorage |
// Ouvre le document |
11430 |
switch ($mode) { |
$lien = '../app/index.php?module=form&snippet=file&obj='.$obj.'&champ='.$champ.'&id='.$idx; |
11431 |
case 'temporary': |
header("Location: ".$lien); |
11432 |
$file = $f->storage->get_temporary($uid); |
} |
|
break; |
|
|
|
|
|
default: |
|
|
$file = $f->storage->get($uid); |
|
|
break; |
|
|
} |
|
|
|
|
|
// Affichage du contenu du fichier |
|
|
if($file != null) { |
|
|
|
|
|
// Headers |
|
|
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 |
|
|
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date dans le passé |
|
|
header("Content-Type: ".$file['metadata']['mimetype']); |
|
|
header("Accept-Ranges: bytes"); |
|
|
|
|
|
// Vérification pour la valeur de $dl |
|
|
if (!in_array($dl, array("download", "inline"))) { |
|
|
if ($f->getParameter("edition_output") == "download") { |
|
|
$dl="download"; |
|
|
} else { |
|
|
$dl="inline"; |
|
|
} |
|
|
} |
|
|
|
|
|
// Vérification si on affiche simplement l'image, sinon envoi un dialogue de sauvegarde |
|
|
if ($dl=="download") { |
|
|
header("Content-Disposition: attachment; filename=\"".$file['metadata']['filename']."\";" ); |
|
|
} else { |
|
|
header("Content-Disposition: inline; filename=\"".$file['metadata']['filename']."\";" ); |
|
|
|
|
|
} |
|
|
|
|
|
// Rendu du fichier |
|
|
echo $file['file_content']; |
|
|
|
|
|
} else { |
|
|
// Retour à l'accueil + affichage de l'erreur |
|
|
$f->displayMessage("error", __("Le fichier n'existe pas ou n'est pas accessible.")); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
$this->f->displayMessage("info", __("TEST Page Start. ")); |
|
|
|
|
|
$f = $this->f; |
|
|
// |
|
|
$f->disableLog(); |
|
|
// Initialisation des paramètres |
|
|
$params = array( |
|
|
"uid" => array( |
|
|
"default_value" => "", |
|
|
), |
|
|
"dl" => array( |
|
|
"default_value" => "", |
|
|
), |
|
|
"mode" => array( |
|
|
"default_value" => "filestorage", |
|
|
), |
|
|
"obj" => array( |
|
|
"default_value" => "", |
|
|
), |
|
|
"champ" => array( |
|
|
"default_value" => "", |
|
|
), |
|
|
"idx" => array( |
|
|
"default_value" => "", |
|
|
), |
|
|
); |
|
|
foreach ($this->f->get_initialized_parameters($params) as $key => $value) { |
|
|
${$key} = $value; |
|
|
} |
|
|
// Si les paramètres nécessaires ne sont pas correctement fournis |
|
|
if (($obj == "" || $champ == "" || $idx == "")) { |
|
|
$this->f->displayMessage("error", __("Les parametres transmis ne sont pas corrects.")); |
|
|
return; |
|
|
} |
|
|
|
|
|
$this->addToLog(__METHOD__."(): idx = ".$idx." ", DEBUG_MODE); |
|
|
|
|
|
if ( strpos($idx, 'STORAGE_') !== FALSE) { |
|
|
$idx = substr($idx, 8); |
|
|
$obj = 'storage'; |
|
|
$champ = 'uid'; |
|
|
} |
|
|
$object = $this->f->get_inst__om_dbform(array( |
|
|
"obj" => $obj, |
|
|
"idx" => $idx, |
|
|
)); |
|
|
|
|
|
// Si pas d'objet envoi message de retour |
|
|
if ($object === null) { |
|
|
$f->displayMessage("error", __("Objet inexistant.")); |
|
|
die(); |
|
|
} |
|
|
$uid = $object->getVal($champ); |
|
|
|
|
|
//Affichage du fichier |
|
|
display_file_content($uid, $dl, $f, $mode); |
|
|
|
|
|
return; |
|
|
} |
|
11433 |
} |
} |