diff --git a/html/ajax_misc.php b/html/ajax_misc.php index 782d6d7db..fefa7e86f 100644 --- a/html/ajax_misc.php +++ b/html/ajax_misc.php @@ -38,15 +38,16 @@ if ( ! defined('ALLOWED')) define ('ALLOWED',1); require_once '../include/constant.php'; -require_once NOALYSS_INCLUDE.'/class/database.class.php'; -require_once NOALYSS_INCLUDE.'/class/fiche.class.php'; -require_once NOALYSS_INCLUDE.'/lib/iradio.class.php'; -require_once NOALYSS_INCLUDE.'/lib/function_javascript.php'; -require_once NOALYSS_INCLUDE.'/lib/ac_common.php'; -require_once NOALYSS_INCLUDE . '/class/noalyss_user.class.php'; -require_once NOALYSS_INCLUDE.'/lib/http_input.class.php'; -require_once NOALYSS_INCLUDE.'/lib/icon_action.class.php'; -require_once NOALYSS_INCLUDE.'/lib/progress_bar.class.php'; +//require_once NOALYSS_INCLUDE.'/class/database.class.php'; +//require_once NOALYSS_INCLUDE.'/class/fiche.class.php'; +//require_once NOALYSS_INCLUDE.'/lib/iradio.class.php'; +//require_once NOALYSS_INCLUDE.'/lib/function_javascript.php'; +//require_once NOALYSS_INCLUDE.'/lib/ac_common.php'; +//require_once NOALYSS_INCLUDE . '/class/noalyss_user.class.php'; +//require_once NOALYSS_INCLUDE.'/lib/http_input.class.php'; +//require_once NOALYSS_INCLUDE.'/lib/icon_action.class.php'; +//require_once NOALYSS_INCLUDE.'/lib/progress_bar.class.php'; +global $http; $http=new HttpInput(); /* we ask a dg box for disconnecting */ @@ -315,7 +316,9 @@ $path = array( // other_tax "other_tax"=>"ajax_other_tax", //visibility quantity - "update_visibility_quantity"=>"ajax_update_visibility_quantity" + "update_visibility_quantity"=>"ajax_update_visibility_quantity", + // detail customer , supplier operation + "event_display_detail"=>"ajax_event_display_detail" ) ; if (array_key_exists($op, $path)) { diff --git a/html/js/noalyss_script.js b/html/js/noalyss_script.js index 3e08e4016..3e6301e22 100644 --- a/html/js/noalyss_script.js +++ b/html/js/noalyss_script.js @@ -4147,3 +4147,81 @@ function enlarge_text(p_domid,p_size) { } + +/** + * @brief display a box with the customer , supplier or event for today or late + * @param p_detail , what to do + */ +function event_display_detail(p_dossier,p_detail) { + + try + { + // create div if not exists + var dgbox="situation_detail_div"; + waiting_box(); + + var queryString={gDossier:p_dossier,op:'event_display_detail','what':p_detail}; + // call ajax and update content of the div + var action = new Ajax.Request( + "ajax_misc.php" , + { + method:'get', + parameters:queryString, + onFailure:ajax_misc_failure, + onSuccess:function(req){ + remove_waiting_box(); + if (req.responseText == 'NOCONX') { + reconnect(); + return; + } + if ( ! document.getElementById(dgbox)) { + var div_style="position:absolute;"+";top:30%"; + add_div({id:dgbox,cssclass:'inner_box',html:loading(),style:div_style,drag:true}); + + } + + $(dgbox).update(req.responseText) + + } + } + ); + event_display_main(p_dossier); + }catch( e) + { + alert_box(e.message); + } +} + +/** + * @brief refresh the main display in the dashboard to reflect possible changes + * @param p_dossier + */ +function event_display_main(p_dossier) { + try + { + waiting_box(); + var dgbox="situation_div"; + var queryString={gDossier:p_dossier,op:'event_display_detail','what':"main_display"}; + var action = new Ajax.Request( + "ajax_misc.php" , + { + method:'GET', + parameters:queryString, + onFailure:ajax_misc_failure, + onSuccess:function(req){ + remove_waiting_box(); + if (req.responseText == 'NOCONX') { + reconnect(); + return; + } + + $(dgbox).update(req.responseText) + + } + } + ); + }catch( e) + { + alert_box(e.message); + } +} \ No newline at end of file diff --git a/include/ajax/ajax_event_display_detail.php b/include/ajax/ajax_event_display_detail.php new file mode 100644 index 000000000..ee1dba6be --- /dev/null +++ b/include/ajax/ajax_event_display_detail.php @@ -0,0 +1,43 @@ + +global $g_user; + +if (!defined('ALLOWED')) die('Appel direct ne sont pas permis'); + +if ( $g_user->check_module("DASHBOARD") == 0) die(); + +global $http,$cn; + +try { + $what=$http->get("what"); +} catch (\Exception $e) { + echo $e->getMessage(); + throw $e; +} + +if ( $what == 'main_display') +{ + status_Operation_Event::main_display($cn); +}else { + $status_operation_event=new Status_Operation_Event($cn); + $status_operation_event->display($what); +} + + diff --git a/include/class/database.class.php b/include/class/database.class.php index f153f20bd..deee87aff 100644 --- a/include/class/database.class.php +++ b/include/class/database.class.php @@ -179,7 +179,7 @@ class Database extends DatabaseCore if ($i == 17) { $this->execute_script(NOALYSS_INCLUDE . '/sql/patch/upgrade17.sql'); $max = $this->get_value('select last_value from s_jnt_fic_att_value'); - $this->alter_seq($p_cn, 's_jnt_fic_att_value', $max + 1); + $this->alter_seq('s_jnt_fic_att_value', $max + 1); } // version // reset sequence in the modele //-- diff --git a/include/class/status_operation_event.class.php b/include/class/status_operation_event.class.php new file mode 100644 index 000000000..67546d47a --- /dev/null +++ b/include/class/status_operation_event.class.php @@ -0,0 +1,96 @@ +cn=$cn; + $this->dialog_box_id="situation_detail_div"; + } + + public function __toString(): string + { + return "status_operation"; + } + + + function display_event($p_title,$p_array,$p_what) + { + require_once NOALYSS_TEMPLATE."/status_operation_event-display_event.php"; + } + /** + * @brief Display a box with the contains + * @param array $p_array Data to display + * @param string $p_title Title of the box + * @param div_name $p_div id of the box + */ + function display_operation($p_title,$p_array,$p_what) + { + require_once NOALYSS_TEMPLATE."/status_operation_event-display_operation.php"; + } + + /** + * @brief display what it is asked + * @param string $p_what + */ + function display($p_what) { + $Ledger=new Acc_Ledger($this->cn,0); + $last_ledger=array(); + $last_ledger=$Ledger->get_last(20); + + switch ($p_what) { + case 'supplier_now': + $this->display_operation(_("Fournisseurs à payer aujourd'hui"),$Ledger->get_supplier_now(),$p_what); + break; + case 'supplier_late': + $this->display_operation(_("Fournisseurs en retard"),$Ledger->get_supplier_late(),$p_what); + break; + case 'customer_now': + $this->display_operation(_("Client à payer aujourd'hui"),$Ledger->get_customer_now(),$p_what); + break; + case 'customer_late': + $this->display_operation(_("Client en retard"),$Ledger->get_customer_late(), $p_what); + break; + case 'action_now': + $Operation=new Follow_Up($this->cn); + $this->display_event(_("Action aujourd'hui"),$Operation->get_today(),$p_what); + case 'action_late': + $Operation=new Follow_Up($this->cn); + $this->display_event(_("Action en retard"),$Operation->get_late(),$p_what); + break; + default: + throw new \Exception("Unknown operation [$p_what]",EXC_PARAM_VALUE); + } + } + static function main_display(Database $cn) + { + + require_once NOALYSS_TEMPLATE."/status_operation_event-main_display.php"; + } +} \ No newline at end of file diff --git a/include/dashboard.inc.php b/include/dashboard.inc.php index 3e7c9fdaa..b0f0e1e43 100644 --- a/include/dashboard.inc.php +++ b/include/dashboard.inc.php @@ -16,27 +16,9 @@ $cal->get_preference(); $obj=sprintf("{gDossier:%d,invalue:'%s',outdiv:'%s','distype':'%s'}", dossier::id(),'per','calendar_zoom_div','cal'); -$Operation=new Follow_Up($cn); -$last_operation=$Operation->get_today(); -$late_operation=$Operation->get_late(); -$Ledger=new Acc_Ledger($cn,0); -$last_ledger=array(); -$last_ledger=$Ledger->get_last(20); -// Supplier late and now -$supplier_now=$Ledger->get_supplier_now(); -$supplier_late=$Ledger->get_supplier_late(); - -// Customer late and now -$customer_now=$Ledger->get_customer_now(); -$customer_late=$Ledger->get_customer_late(); - -ob_start(); require_once NOALYSS_TEMPLATE.'/dashboard.php'; -$ret=ob_get_contents(); -ob_end_clean(); -echo $ret; -echo ''; + ?> diff --git a/include/lib/ac_common.php b/include/lib/ac_common.php index 1268bebda..b9559d6a8 100644 --- a/include/lib/ac_common.php +++ b/include/lib/ac_common.php @@ -1273,66 +1273,7 @@ function ajax_xml_error($p_code,$p_string) EOF; } -/** - * @brief Display a box with the contains - * @param type $p_array Data to display - * @param type $p_title Title of the box - * @param type $p_div id of the box - */ -function display_dashboard_operation($p_array,$p_title,$p_div) -{ - ?> - -get_type(); @@ -1641,7 +1578,7 @@ function noalyss_round($p_first,$p_second) } /** - * to avoid deprecated in PHP8.1 : explode cannot use a null + * @brief to avoid deprecated in PHP8.1 : explode cannot use a null * @param $separator * @param $string * @return array | empty string diff --git a/include/lib/function_javascript.php b/include/lib/function_javascript.php index 0b0a4a654..8c30a80c9 100644 --- a/include/lib/function_javascript.php +++ b/include/lib/function_javascript.php @@ -2787,7 +2787,7 @@ EOF; } /** - * Send header and json object + * @brief Send header and json object * @param array $p_answer this array will be converted to json object * @see json_encode */ diff --git a/include/template/dashboard.php b/include/template/dashboard.php index ad242980f..5b1b7c0e7 100644 --- a/include/template/dashboard.php +++ b/include/template/dashboard.php @@ -37,100 +37,7 @@ if ( ! empty ($array) ) {
- - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - -
- - - 0): ?> - - - -   - - - - 0 - - - 0): ?> - - -   - - - - 0 - -
- - - 0): ?> - -   - - - - 0 - - - 0): ?> - -   - - - - 0 - -
- - - 0): ?> - -   - - - - 0 - - - 0): ?> - -   - - - - 0 - -
+
@@ -199,6 +106,10 @@ endif; get_last(20); + for($i=0;$i @@ -279,85 +190,6 @@ echo HtmlInput::button('hide',_('Annuler'),'onClick="Effect.Fold(\'add_todo_list ?> + - - - - - - - - - diff --git a/include/template/status_operation_event-display_event.php b/include/template/status_operation_event-display_event.php new file mode 100644 index 000000000..762995bf4 --- /dev/null +++ b/include/template/status_operation_event-display_event.php @@ -0,0 +1,66 @@ + + + dialog_box_id,"close","","y") + ?> +
    + 0) : + + for($i=0;$i +
  1. + + + + + + + + + + + + + +
  2. + +
+ +

+ + + + + diff --git a/include/template/status_operation_event-main_display.php b/include/template/status_operation_event-main_display.php new file mode 100644 index 000000000..f2e504383 --- /dev/null +++ b/include/template/status_operation_event-main_display.php @@ -0,0 +1,140 @@ +get_today(); +$late_operation=$Operation->get_late(); + +$Ledger=new Acc_Ledger($cn,0); + +// Supplier late and now +$supplier_now=$Ledger->get_supplier_now(); +$supplier_late=$Ledger->get_supplier_late(); + +// Customer late and now +$customer_now=$Ledger->get_customer_now(); +$customer_late=$Ledger->get_customer_late(); + +$gDossier_id=Dossier::id(); +?> + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+ + + 0): ?> + + + +   + + + + 0 + + + 0): ?> + + +   + + + + 0 + +
+ + + 0): ?> + +   + + + + 0 + + + 0): ?> + +   + + + + 0 + +
+ + + 0): ?> + +   + + + + 0 + + + 0): ?> + +   + + + + 0 + +
+