echo '<p><a class="mtitle" href="' . $url . '">' . hb(_('Evènement Sauvée') . '  : ' . $act->ag_ref) . '</a></p>';
        Follow_Up::show_action_list($cn, $base);
        $url = "?{$base}&sa=detail&ag_id=" . $act->ag_id . '&' . dossier::get();
        echo '<p><a class="mtitle" href="' . $url . '">' . hb(_('Evènement Sauvée') . '  : ' . $act->ag_ref) . '</a></p>';
    } catch (Exception $e) {
        echo '<span class="notice">';
        echo _("Erreur") . " " . $e->getMessage();
        echo '</span>';
        $sub_action = "add_action";
        $error_id = $e->getCode();
    }
}
//--------------------------------------------------------------------------------
// Add an action
if ($sub_action == "add_action") {
    $act = new Follow_Up($cn);
    $act->fromArray($_POST);
    $act->ag_id = 0;
    $act->d_id = 0;
    echo '<div class="content">';
    // Add hidden tag
    echo '<form method="post" action="do.php" name="form_add" id="form_add" enctype="multipart/form-data" >';
    echo $supl_hidden;
    echo dossier::hidden();
    $act->ag_comment = isset($_POST['ag_comment']) ? Decode($_POST['ag_comment']) : "";
    if (isset($_REQUEST['qcode'])) {
        $act->qcode_dest = $_REQUEST['qcode'];
    }
    echo $act->Display('NEW', false, $base, $retour);
    echo '<input type="hidden" name="ac" value="' . $_REQUEST["ac"] . '">';
    echo '<input type="hidden" name="sa" value="save_action_st2">';
<hr>
<?php 
/**
//This file is part of NOALYSS and is under GPL 
//see licence.txt
*/
/**
 * @brief show the common parts of operation details 
 * 
 * Variables : $div = popup or box (det[0-9]
 * 
 */
// Contains all the linked actions
$a_followup = Follow_Up::get_all_operation($jr_id);
//
// Contains all the linked operations
$oRap = new Acc_Reconciliation($cn);
$oRap->jr_id = $jr_id;
$aRap = $oRap->get();
// Detail of operation
$detail = new Acc_Misc($cn, $obj->jr_id);
$detail->get();
$nb_document = $detail->det->jr_pj_name != "" ? 1 : 0;
// Array of tab
//
$a_tab['writing_div'] = array('id' => 'writing_div' . $div, 'label' => _('Ecriture Comptable'), 'display' => 'none');
$a_tab['info_operation_div'] = array('id' => 'info_operation_div' . $div, 'label' => _('Information'), 'display' => 'none');
$a_tab['linked_operation_div'] = array('id' => 'linked_operation_div' . $div, 'label' => _('Opérations liées') . '(' . count($aRap) . ')', 'display' => 'none');
$a_tab['document_operation_div'] = array('id' => 'document_operation_div' . $div, 'label' => _('Document') . '(' . $nb_document . ')', 'display' => 'block');
$a_tab['linked_action_div'] = array('id' => 'linked_action_div' . $div, 'label' => _('Actions Gestion') . '(' . count($a_followup) . ')', 'display' => 'none');
$a_tab['analytic_div'] = array('id' => 'analytic_div' . $div, 'label' => _('Comptabilité Analytique'), 'display' => 'none');
Example #3
0
 function Replace($p_tag, $p_array)
 {
     global $g_parameter;
     $p_tag = strtoupper($p_tag);
     $p_tag = str_replace('=', '', $p_tag);
     $r = "Tag inconnu";
     switch ($p_tag) {
         case 'DATE':
             $r = isset($p_array['ag_timestamp']) ? $p_array['ag_timestamp'] : $p_array['e_date'];
             break;
         case 'DATE_CALC':
             $r = ' Date inconnue ';
             // Date are in $p_array['ag_date']
             // or $p_array['e_date']
             if (isset($p_array['ag_timestamp'])) {
                 $date = format_date($p_array['ag_timestamp'], 'DD.MM.YYYY', 'YYYY-MM-DD');
                 $r = $date;
             }
             if (isset($p_array['e_date'])) {
                 $date = format_date($p_array['e_date'], 'DD.MM.YYYY', 'YYYY-MM-DD');
                 $r = $date;
             }
             break;
             //
             //  the company priv
         //
         //  the company priv
         case 'MY_NAME':
             $r = $g_parameter->MY_NAME;
             break;
         case 'MY_CP':
             $r = $g_parameter->MY_CP;
             break;
         case 'MY_COMMUNE':
             $r = $g_parameter->MY_COMMUNE;
             break;
         case 'MY_TVA':
             $r = $g_parameter->MY_TVA;
             break;
         case 'MY_STREET':
             $r = $g_parameter->MY_STREET;
             break;
         case 'MY_NUMBER':
             $r = $g_parameter->MY_NUMBER;
             break;
         case 'MY_TEL':
             $r = $g_parameter->MY_TEL;
             break;
         case 'MY_FAX':
             $r = $g_parameter->MY_FAX;
             break;
         case 'MY_PAYS':
             $r = $g_parameter->MY_PAYS;
             break;
             // customer
             /*\note The CUST_* are retrieved thx the $p_array['tiers']
              * which contains the quick_code
              */
         // customer
         /*\note The CUST_* are retrieved thx the $p_array['tiers']
          * which contains the quick_code
          */
         case 'SOLDE':
             $tiers = new Fiche($this->db);
             $qcode = isset($p_array['qcode_dest']) ? $p_array['qcode_dest'] : $p_array['e_client'];
             $tiers->get_by_qcode($qcode, false);
             $p = $tiers->strAttribut(ATTR_DEF_ACCOUNT);
             $poste = new Acc_Account_Ledger($this->db, $p);
             $r = $poste->get_solde(' true');
             break;
         case 'CUST_NAME':
             $tiers = new Fiche($this->db);
             $qcode = isset($p_array['qcode_dest']) ? $p_array['qcode_dest'] : $p_array['e_client'];
             $tiers->get_by_qcode($qcode, false);
             $r = $tiers->strAttribut(ATTR_DEF_NAME);
             break;
         case 'CUST_ADDR_1':
             $tiers = new Fiche($this->db);
             $qcode = isset($p_array['qcode_dest']) ? $p_array['qcode_dest'] : $p_array['e_client'];
             $tiers->get_by_qcode($qcode, false);
             $r = $tiers->strAttribut(ATTR_DEF_ADRESS);
             break;
         case 'CUST_CP':
             $tiers = new Fiche($this->db);
             $qcode = isset($p_array['qcode_dest']) ? $p_array['qcode_dest'] : $p_array['e_client'];
             $tiers->get_by_qcode($qcode, false);
             $r = $tiers->strAttribut(ATTR_DEF_CP);
             break;
         case 'CUST_CITY':
             $tiers = new Fiche($this->db);
             $qcode = isset($p_array['qcode_dest']) ? $p_array['qcode_dest'] : $p_array['e_client'];
             $tiers->get_by_qcode($qcode, false);
             $r = $tiers->strAttribut(ATTR_DEF_CITY);
             break;
         case 'CUST_CO':
             $tiers = new Fiche($this->db);
             $qcode = isset($p_array['qcode_dest']) ? $p_array['qcode_dest'] : $p_array['e_client'];
             $tiers->get_by_qcode($qcode, false);
             $r = $tiers->strAttribut(ATTR_DEF_PAYS);
             break;
             // Marchandise in $p_array['e_march*']
             // \see user_form_achat.php or user_form_ven.php
         // Marchandise in $p_array['e_march*']
         // \see user_form_achat.php or user_form_ven.php
         case 'CUST_VAT':
             $tiers = new Fiche($this->db);
             $qcode = isset($p_array['qcode_dest']) ? $p_array['qcode_dest'] : $p_array['e_client'];
             $tiers->get_by_qcode($qcode, false);
             $r = $tiers->strAttribut(ATTR_DEF_NUMTVA);
             break;
         case 'CUST_NUM':
             $tiers = new Fiche($this->db);
             $qcode = isset($p_array['qcode_dest']) ? $p_array['qcode_dest'] : $p_array['e_client'];
             $tiers->get_by_qcode($qcode, false);
             $r = $tiers->strAttribut(ATTR_DEF_NUMBER_CUSTOMER);
             break;
         case 'CUST_BANQUE_NO':
             $tiers = new Fiche($this->db);
             $qcode = isset($p_array['qcode_dest']) ? $p_array['qcode_dest'] : $p_array['e_client'];
             $tiers->get_by_qcode($qcode, false);
             $r = $tiers->strAttribut(ATTR_DEF_BQ_NO);
             break;
         case 'CUST_BANQUE_NAME':
             $tiers = new Fiche($this->db);
             $qcode = isset($p_array['qcode_dest']) ? $p_array['qcode_dest'] : $p_array['e_client'];
             $tiers->get_by_qcode($qcode, false);
             $r = $tiers->strAttribut(ATTR_DEF_BQ_NAME);
             break;
             /* -------------------------------------------------------------------------------- */
             /* BENEFIT (fee notes */
         /* -------------------------------------------------------------------------------- */
         /* BENEFIT (fee notes */
         case 'BENEF_NAME':
             $tiers = new Fiche($this->db);
             $qcode = isset($p_array['qcode_benef']) ? $p_array['qcode_benef'] : '';
             if ($qcode == '') {
                 $r = '';
                 break;
             }
             $tiers->get_by_qcode($qcode, false);
             $r = $tiers->strAttribut(ATTR_DEF_NAME);
             break;
         case 'BENEF_ADDR_1':
             $tiers = new Fiche($this->db);
             $qcode = isset($p_array['qcode_benef']) ? $p_array['qcode_benef'] : '';
             if ($qcode == '') {
                 $r = '';
                 break;
             }
             $tiers->get_by_qcode($qcode, false);
             $r = $tiers->strAttribut(ATTR_DEF_ADRESS);
             break;
         case 'BENEF_CP':
             $tiers = new Fiche($this->db);
             $qcode = isset($p_array['qcode_benef']) ? $p_array['qcode_benef'] : '';
             if ($qcode == '') {
                 $r = '';
                 break;
             }
             $tiers->get_by_qcode($qcode, false);
             $r = $tiers->strAttribut(ATTR_DEF_CP);
             break;
         case 'BENEF_CITY':
             $tiers = new Fiche($this->db);
             $qcode = isset($p_array['qcode_benef']) ? $p_array['qcode_benef'] : '';
             if ($qcode == '') {
                 $r = '';
                 break;
             }
             $tiers->get_by_qcode($qcode, false);
             $r = $tiers->strAttribut(ATTR_DEF_CITY);
             break;
         case 'BENEF_CO':
             $tiers = new Fiche($this->db);
             $qcode = isset($p_array['qcode_benef']) ? $p_array['qcode_benef'] : '';
             if ($qcode == '') {
                 $r = '';
                 break;
             }
             $tiers->get_by_qcode($qcode, false);
             $r = $tiers->strAttribut(ATTR_DEF_PAYS);
             break;
             // Marchandise in $p_array['e_march*']
             // \see user_form_achat.php or user_form_ven.php
         // Marchandise in $p_array['e_march*']
         // \see user_form_achat.php or user_form_ven.php
         case 'BENEF_VAT':
             $tiers = new Fiche($this->db);
             $qcode = isset($p_array['qcode_benef']) ? $p_array['qcode_benef'] : '';
             if ($qcode == '') {
                 $r = '';
                 break;
             }
             $tiers->get_by_qcode($qcode, false);
             $r = $tiers->strAttribut(ATTR_DEF_NUMTVA);
             break;
         case 'BENEF_NUM':
             $tiers = new Fiche($this->db);
             $qcode = isset($p_array['qcode_benef']) ? $p_array['qcode_benef'] : '';
             if ($qcode == '') {
                 $r = '';
                 break;
             }
             $tiers->get_by_qcode($qcode, false);
             $r = $tiers->strAttribut(ATTR_DEF_NUMBER_CUSTOMER);
             break;
         case 'BENEF_BANQUE_NO':
             $tiers = new Fiche($this->db);
             $qcode = isset($p_array['qcode_benef']) ? $p_array['qcode_benef'] : '';
             if ($qcode == '') {
                 $r = '';
                 break;
             }
             $tiers->get_by_qcode($qcode, false);
             $r = $tiers->strAttribut(ATTR_DEF_BQ_NO);
             break;
         case 'BENEF_BANQUE_NAME':
             $tiers = new Fiche($this->db);
             $qcode = isset($p_array['qcode_benef']) ? $p_array['qcode_benef'] : '';
             if ($qcode == '') {
                 $r = '';
                 break;
             }
             $tiers->get_by_qcode($qcode, false);
             $r = $tiers->strAttribut(ATTR_DEF_BQ_NAME);
             break;
             // Marchandise in $p_array['e_march*']
             // \see user_form_achat.php or user_form_ven.php
         // Marchandise in $p_array['e_march*']
         // \see user_form_achat.php or user_form_ven.php
         case 'NUMBER':
             $r = $this->d_number;
             break;
         case 'USER':
             return $_SESSION['use_name'] . ', ' . $_SESSION['use_first_name'];
             break;
         case 'REFERENCE':
             $act = new Follow_Up($this->db);
             $act->ag_id = $this->ag_id;
             $act->get();
             $r = $act->ag_ref;
             break;
             /*
              *  - [VEN_ART_NAME]
              *  - [VEN_ART_PRICE]
              *  - [VEN_ART_QUANT]
              *  - [VEN_ART_TVA_CODE]
              *  - [VEN_ART_STOCK_CODE]
              *  - [VEN_HTVA]
              *  - [VEN_TVAC]
              *  - [VEN_TVA]
              *  - [TOTAL_VEN_HTVA]
              *  - [DATE_LIMIT]
              */
         /*
          *  - [VEN_ART_NAME]
          *  - [VEN_ART_PRICE]
          *  - [VEN_ART_QUANT]
          *  - [VEN_ART_TVA_CODE]
          *  - [VEN_ART_STOCK_CODE]
          *  - [VEN_HTVA]
          *  - [VEN_TVAC]
          *  - [VEN_TVA]
          *  - [TOTAL_VEN_HTVA]
          *  - [DATE_LIMIT]
          */
         case 'DATE_LIMIT_CALC':
             extract($p_array);
             $id = 'e_ech';
             if (!isset(${$id})) {
                 return "";
             }
             $r = format_date(${$id}, 'DD.MM.YYYY', 'YYYY-MM-DD');
             break;
         case 'DATE_LIMIT':
             extract($p_array);
             $id = 'e_ech';
             if (!isset(${$id})) {
                 return "";
             }
             $r = ${$id};
             break;
         case 'MARCH_NEXT':
             $this->counter++;
             $r = '';
             break;
         case 'VEN_ART_NAME':
             extract($p_array);
             $id = 'e_march' . $this->counter;
             // check if the march exists
             if (!isset(${$id})) {
                 return "";
             }
             // check that something is sold
             if (${'e_march' . $this->counter . '_price'} != 0 && ${'e_quant' . $this->counter} != 0) {
                 $f = new Fiche($this->db);
                 $f->get_by_qcode(${$id}, false);
                 $r = $f->strAttribut(ATTR_DEF_NAME);
             } else {
                 $r = "";
             }
             break;
         case 'VEN_ART_LABEL':
             extract($p_array);
             $id = 'e_march' . $this->counter . "_label";
             // check if the march exists
             if (!isset(${$id}) || isset(${$id}) && strlen(trim(${$id})) == 0) {
                 $id = 'e_march' . $this->counter;
                 // check if the march exists
                 if (!isset(${$id})) {
                     $r = "";
                 } else {
                     // check that something is sold
                     if (${'e_march' . $this->counter . '_price'} != 0 && ${'e_quant' . $this->counter} != 0) {
                         $f = new Fiche($this->db);
                         $f->get_by_qcode(${$id}, false);
                         $r = $f->strAttribut(ATTR_DEF_NAME);
                     } else {
                         $r = "";
                     }
                 }
             } else {
                 $r = ${'e_march' . $this->counter . '_label'};
             }
             break;
         case 'VEN_ART_STOCK_CODE':
             extract($p_array);
             $id = 'e_march' . $this->counter;
             // check if the march exists
             if (!isset(${$id})) {
                 $r = "";
             } else {
                 // check that something is sold
                 if (${'e_march' . $this->counter . '_price'} != 0 && ${'e_quant' . $this->counter} != 0) {
                     $f = new Fiche($this->db);
                     $f->get_by_qcode(${$id}, false);
                     $r = $f->strAttribut(ATTR_DEF_STOCK);
                     $r = $r == NOTFOUND ? '' : $r;
                 }
             }
             break;
         case 'VEN_ART_PRICE':
             extract($p_array);
             $id = 'e_march' . $this->counter . '_price';
             if (!isset(${$id})) {
                 return "";
             }
             if (${$id} == 0) {
                 return "";
             }
             $r = ${$id};
             break;
         case 'TVA_RATE':
         case 'VEN_ART_TVA_RATE':
             extract($p_array);
             $id = 'e_march' . $this->counter . '_tva_id';
             if (!isset(${$id})) {
                 return "";
             }
             if (${$id} == -1 || ${$id} == '') {
                 return "";
             }
             $march_id = 'e_march' . $this->counter . '_price';
             if (!isset(${$march_id})) {
                 return '';
             }
             $tva = new Acc_Tva($this->db);
             $tva->set_parameter("id", ${$id});
             if ($tva->load() == -1) {
                 return '';
             }
             return $tva->get_parameter("rate");
             break;
         case 'TVA_CODE':
         case 'VEN_ART_TVA_CODE':
             extract($p_array);
             $id = 'e_march' . $this->counter . '_tva_id';
             if (!isset(${$id})) {
                 return "";
             }
             if (${$id} == -1) {
                 return "";
             }
             $qt = 'e_quant' . $this->counter;
             $price = 'e_march' . $this->counter . '_price';
             if (${$price} == 0 || ${$qt} == 0 || strlen(trim($price)) == 0 || strlen(trim($qt)) == 0) {
                 return "";
             }
             $r = ${$id};
             break;
         case 'TVA_LABEL':
             extract($p_array);
             $id = 'e_march' . $this->counter . '_tva_id';
             if (!isset(${$id})) {
                 return "";
             }
             $march_id = 'e_march' . $this->counter . '_price';
             if (!isset(${$march_id})) {
                 return '';
             }
             if (${$march_id} == 0) {
                 return '';
             }
             $tva = new Acc_Tva($this->db, ${$id});
             if ($tva->load() == -1) {
                 return "";
             }
             $r = $tva->get_parameter('label');
             break;
             /* total VAT for one sold */
         /* total VAT for one sold */
         case 'TVA_AMOUNT':
         case 'VEN_TVA':
             extract($p_array);
             $qt = 'e_quant' . $this->counter;
             $price = 'e_march' . $this->counter . '_price';
             $tva = 'e_march' . $this->counter . '_tva_id';
             /* if we do not use vat this var. is not set */
             if (!isset(${$tva})) {
                 return '';
             }
             if (!isset(${'e_march' . $this->counter})) {
                 return "";
             }
             // check that something is sold
             if (${$price} == 0 || ${$qt} == 0 || strlen(trim($price)) == 0 || strlen(trim($qt)) == 0) {
                 return "";
             }
             $r = ${'e_march' . $this->counter . '_tva_amount'};
             break;
             /* TVA automatically computed */
         /* TVA automatically computed */
         case 'VEN_ART_TVA':
             extract($p_array);
             $qt = 'e_quant' . $this->counter;
             $price = 'e_march' . $this->counter . '_price';
             $tva = 'e_march' . $this->counter . '_tva_id';
             if (!isset(${'e_march' . $this->counter})) {
                 return "";
             }
             // check that something is sold
             if (${$price} == 0 || ${$qt} == 0 || strlen(trim($price)) == 0 || strlen(trim($qt)) == 0) {
                 return "";
             }
             $oTva = new Acc_Tva($this->db, ${$tva});
             if ($oTva->load() == -1) {
                 return "";
             }
             $r = round(${$price}, 2) * $oTva->get_parameter('rate');
             $r = round($r, 2);
             break;
         case 'VEN_ART_TVAC':
             extract($p_array);
             $qt = 'e_quant' . $this->counter;
             $price = 'e_march' . $this->counter . '_price';
             $tva = 'e_march' . $this->counter . '_tva_id';
             if (!isset(${'e_march' . $this->counter})) {
                 return "";
             }
             // check that something is sold
             if (${$price} == 0 || ${$qt} == 0 || strlen(trim($price)) == 0 || strlen(trim($qt)) == 0) {
                 return "";
             }
             if (!isset(${$tva})) {
                 return '';
             }
             $tva = new Acc_Tva($this->db, ${$tva});
             if ($tva->load() == -1) {
                 $r = round(${$price}, 2);
             } else {
                 $r = round(${$price} * $tva->get_parameter('rate') + ${$price}, 2);
             }
             break;
         case 'VEN_ART_QUANT':
             extract($p_array);
             $id = 'e_quant' . $this->counter;
             if (!isset(${$id})) {
                 return "";
             }
             // check that something is sold
             if (${'e_march' . $this->counter . '_price'} == 0 || ${'e_quant' . $this->counter} == 0 || strlen(trim(${'e_march' . $this->counter . '_price'})) == 0 || strlen(trim(${'e_quant' . $this->counter})) == 0) {
                 return "";
             }
             $r = ${$id};
             break;
         case 'VEN_HTVA':
             extract($p_array);
             $id = 'e_march' . $this->counter . '_price';
             $quant = 'e_quant' . $this->counter;
             if (!isset(${$id})) {
                 return "";
             }
             // check that something is sold
             if (${'e_march' . $this->counter . '_price'} == 0 || ${'e_quant' . $this->counter} == 0 || strlen(trim(${'e_march' . $this->counter . '_price'})) == 0 || strlen(trim(${'e_quant' . $this->counter})) == 0) {
                 return "";
             }
             bcscale(4);
             $r = bcmul(${$id}, ${$quant});
             $r = round($r, 2);
             break;
         case 'VEN_TVAC':
             extract($p_array);
             $id = 'e_march' . $this->counter . '_tva_amount';
             $price = 'e_march' . $this->counter . '_price';
             $quant = 'e_quant' . $this->counter;
             if (!isset(${'e_march' . $this->counter . '_price'}) || !isset(${'e_quant' . $this->counter})) {
                 return "";
             }
             // check that something is sold
             if (${'e_march' . $this->counter . '_price'} == 0 || ${'e_quant' . $this->counter} == 0) {
                 return "";
             }
             bcscale(4);
             // if TVA not exist
             if (!isset(${$id})) {
                 $r = bcmul(${$price}, ${$quant});
             } else {
                 $r = bcmul(${$price}, ${$quant});
                 $r = bcadd($r, ${$id});
             }
             $r = round($r, 2);
             return $r;
             break;
         case 'TOTAL_VEN_HTVA':
             extract($p_array);
             bcscale(4);
             $sum = 0.0;
             for ($i = 0; $i < $nb_item; $i++) {
                 $sell = 'e_march' . $i . '_price';
                 $qt = 'e_quant' . $i;
                 if (!isset(${$sell})) {
                     break;
                 }
                 if (strlen(trim(${$sell})) == 0 || strlen(trim(${$qt})) == 0 || ${$qt} == 0 || ${$sell} == 0) {
                     continue;
                 }
                 $tmp1 = bcmul(${$sell}, ${$qt});
                 $sum = bcadd($sum, $tmp1);
             }
             $r = round($sum, 2);
             break;
         case 'TOTAL_VEN_TVAC':
             extract($p_array);
             $sum = 0.0;
             bcscale(4);
             for ($i = 0; $i < $nb_item; $i++) {
                 $tva = 'e_march' . $i . '_tva_amount';
                 $tva_amount = 0;
                 /* if we do not use vat this var. is not set */
                 if (isset(${$tva})) {
                     $tva_amount = ${$tva};
                 }
                 $sell = ${'e_march' . $i . '_price'};
                 $qt = ${'e_quant' . $i};
                 $tot = bcmul($sell, $qt);
                 $tot = bcadd($tot, $tva_amount);
                 $sum = bcadd($sum, $tot);
             }
             $r = round($sum, 2);
             break;
         case 'TOTAL_TVA':
             extract($p_array);
             $sum = 0.0;
             for ($i = 0; $i < $nb_item; $i++) {
                 $tva = 'e_march' . $i . '_tva_amount';
                 if (!isset(${$tva})) {
                     $tva_amount = 0.0;
                 } else {
                     $tva_amount = ${$tva};
                 }
                 $sum += $tva_amount;
                 $sum = round($sum, 2);
             }
             $r = $sum;
             break;
         case 'BON_COMMANDE':
             if (isset($p_array['bon_comm'])) {
                 return $p_array['bon_comm'];
             } else {
                 return "";
             }
             break;
         case 'PJ':
             if (isset($p_array['e_pj'])) {
                 return $p_array['e_pj'];
             } else {
                 return "";
             }
         case 'OTHER_INFO':
             if (isset($p_array['other_info'])) {
                 return $p_array['other_info'];
             } else {
                 return "";
             }
             break;
         case 'COMMENT':
             if (isset($p_array['e_comm'])) {
                 return $p_array['e_comm'];
             }
             break;
         case 'ACOMPTE':
             if (isset($p_array['acompte'])) {
                 return $p_array['acompte'];
             }
             return "0";
             break;
         case 'STOCK_NAME':
             if (!isset($p_array['repo'])) {
                 return "";
             }
             $ret = $this->db->get_value('select r_name from public.stock_repository where r_id=$1', array($p_array['repo']));
             return $ret;
         case 'STOCK_ADRESS':
             if (!isset($p_array['repo'])) {
                 return "";
             }
             $ret = $this->db->get_value('select r_adress from public.stock_repository where r_id=$1', array($p_array['repo']));
             return $ret;
         case 'STOCK_COUNTRY':
             if (!isset($p_array['repo'])) {
                 return "";
             }
             $ret = $this->db->get_value('select r_country from public.stock_repository where r_id=$1', array($p_array['repo']));
             return $ret;
         case 'STOCK_CITY':
             if (!isset($p_array['repo'])) {
                 return "";
             }
             $ret = $this->db->get_value('select r_city from public.stock_repository where r_id=$1', array($p_array['repo']));
             return $ret;
         case 'STOCK_PHONE':
             if (!isset($p_array['repo'])) {
                 return "";
             }
             $ret = $this->db->get_value('select r_phone from public.stock_repository where r_id=$1', array($p_array['repo']));
             return $ret;
         case 'TITLE':
             $title = HtmlInput::default_value_request("ag_title", "");
             return $title;
     }
     /*
      * retrieve the value of ATTR for e_march
      */
     if (preg_match('/^ATTR/', $p_tag) == 1) {
         // Retrieve f_id
         if (isset($p_array['e_march' . $this->counter])) {
             $id = $p_array['e_march' . $this->counter];
             $r = $this->replace_special_tag($id, $p_tag);
         }
     }
     /*
      * retrieve the value of ATTR for e_march
      */
     if (preg_match('/^BENEFATTR/', $p_tag) == 1) {
         $qcode = isset($p_array['qcode_benef']) ? $p_array['qcode_benef'] : '';
         // Retrieve f_id
         $r = $this->replace_special_tag($qcode, $p_tag);
     }
     if (preg_match('/^CUSTATTR/', $p_tag) == 1) {
         if (isset($p_array['qcode_dest']) || isset($p_array['e_client'])) {
             $qcode = isset($p_array['qcode_dest']) ? $p_array['qcode_dest'] : $p_array['e_client'];
             $r = $this->replace_special_tag($qcode, $p_tag);
         }
     }
     return $r;
 }
Example #4
0
</td>

</tr>
<?php 
}
?>
</table>
    
</div>
<div id="last_operation_management_div" class="box">
    <?php 
echo HtmlInput::title_box(_('Suivi'), "last_operation_management_div", 'zoom', 'onclick="action_show(' . dossier::id() . ')"');
?>
    <?php 
require_once NOALYSS_INCLUDE . '/class_follow_up.php';
$gestion = new Follow_Up($cn);
$array = $gestion->get_last(MAX_ACTION_SHOW);
$len_array = count($array);
?>
    <table style="width: 100%">
    <?php 
for ($i = 0; $i < $len_array; $i++) {
    ?>
        <tr class=" <?php 
    echo $i % 2 == 0 ? 'even' : 'odd';
    ?>
">
            <td class="box">
                <?php 
    echo smaller_date($array[$i]['ag_timestamp_fmt']);
    ?>
 *   (at your option) any later version.
 *
 *   NOALYSS is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with NOALYSS; if not, write to the Free Software
 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
// Copyright Author Dany De Bontridder danydb@aevalys.eu
if (!defined('ALLOWED')) {
    die('Appel direct ne sont pas permis');
}
$fl = new Follow_Up($cn);
$fl->ag_id = $_REQUEST['ag_id'];
if ($g_user->can_write_action($fl->ag_id) == TRUE) {
    $fl->tag_remove($_REQUEST['t_id']);
}
ob_start();
$fl->tag_cell();
$response = ob_get_clean();
$html = escape_xml($response);
header('Content-type: text/xml; charset=UTF-8');
echo <<<EOF
<?xml version="1.0" encoding="UTF-8"?>
<data>
<ctl></ctl>
<code>{$html}</code>
</data>
Example #6
0
 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
// Copyright Author Dany De Bontridder danydb@aevalys.eu
/**
 * @file
 * @brief show the detail of an action
 *
 */
if (!defined('ALLOWED')) {
    die('Appel direct ne sont pas permis');
}
ob_start();
require_once NOALYSS_INCLUDE . '/class_follow_up.php';
require_once NOALYSS_INCLUDE . '/class_default_menu.php';
echo HtmlInput::title_box(_("Détail action"), $div);
$act = new Follow_Up($cn);
$act->ag_id = $ag_id;
$act->get();
$code = 'nok';
if ($g_user->can_write_action($ag_id) == true || $g_user->can_read_action($ag_id) == true || $act->ag_dest == -1) {
    $menu = new Default_Menu();
    echo $act->Display('READ', false, "ajax", "");
    //$action=HtmlInput::array_to_string(array("gDossier","ag_id"), $_GET)."&ac=FOLLOW&sa=detail";
    $action = "do.php?" . http_build_query(array("gDossier" => Dossier::id(), "ag_id" => $ag_id, "ac" => $menu->get('code_follow'), "sa" => "detail"));
    $code = 'ok';
    if ($_GET['mod'] == 1) {
        $forbidden = _("Accès interdit : vous n'avez pas accès à cette information, contactez votre responsable");
        ?>
<a href="<?php 
        echo $action;
        ?>
 *   This file is part of NOALYSS.
 *
 *   NOALYSS is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 *
 *   NOALYSS is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with NOALYSS; if not, write to the Free Software
 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/
// Copyright Author Dany De Bontridder danydb@aevalys.eu
/*! \file
 * \brief Search module
 */
if (!defined('ALLOWED')) {
    die('Appel direct ne sont pas permis');
}
require_once NOALYSS_INCLUDE . '/class_dossier.php';
include_once NOALYSS_INCLUDE . '/ac_common.php';
require_once NOALYSS_INCLUDE . '/class_follow_up.php';
$_REQUEST['ac'] = 'FOLLOW';
echo Follow_Up::display_search($cn, true);
$sql = "true " . Follow_Up::create_query($cn);
echo Follow_Up::short_list($cn, $sql);
Example #8
0
require_once NOALYSS_INCLUDE . '/class_acc_report.php';
require_once NOALYSS_INCLUDE . '/class_periode.php';
require_once NOALYSS_INCLUDE . '/user_menu.php';
require_once NOALYSS_INCLUDE . '/class_dossier.php';
require_once NOALYSS_INCLUDE . '/class_todo_list.php';
require_once NOALYSS_INCLUDE . '/class_itextarea.php';
require_once NOALYSS_INCLUDE . '/class_calendar.php';
require_once NOALYSS_INCLUDE . '/class_acc_ledger.php';
require_once NOALYSS_INCLUDE . '/class_follow_up.php';
echo '<div class="content">';
global $g_user;
/* others report */
$cal = new Calendar();
$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_INCLUDE . '/template/dashboard.php';
$ret = ob_get_contents();
ob_end_clean();
 *   (at your option) any later version.
 *
 *   NOALYSS is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with NOALYSS; if not, write to the Free Software
 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
// Copyright Author Dany De Bontridder danydb@aevalys.eu
if (!defined('ALLOWED')) {
    die('Appel direct ne sont pas permis');
}
$fl = new Follow_Up($cn);
$fl->ag_id = $_REQUEST['ag_id'];
if ($g_user->can_write_action($fl->ag_id) == TRUE) {
    $fl->tag_add($_REQUEST['t_id']);
}
ob_start();
$fl->tag_cell();
$response = ob_get_clean();
$html = escape_xml($response);
header('Content-type: text/xml; charset=UTF-8');
echo <<<EOF
<?xml version="1.0" encoding="UTF-8"?>
<data>
<ctl></ctl>
<code>{$html}</code>
</data>
 function insert_related_action($p_string)
 {
     if ($p_string == "") {
         return;
     }
     $a_action = explode(',', $p_string);
     for ($i = 0; $i < count($a_action); $i++) {
         $action = new Follow_Up($this->db, $a_action[$i]);
         $action->operation = $this->jr_id;
         $action->insert_operation();
     }
 }
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with NOALYSS; if not, write to the Free Software
 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/
// Copyright 2014 Author Dany De Bontridder danydb@aevalys.eu
// require_once '.php';
if (!defined('ALLOWED')) {
    die('Appel direct ne sont pas permis');
}
/**
 * Insert into follow-up the card (f_id) for the action_gestion (ag_id)
 */
require_once 'class_follow_up.php';
$follow = new Follow_Up($cn, $ag_id);
$follow->insert_linked_card($f_id);
/**
 * Display all the linked card
 */
ob_start();
$follow->display_linked();
echo HtmlInput::button_action_add_concerned_card($ag_id);
$response = ob_get_clean();
$html = escape_xml($response);
header('Content-type: text/xml; charset=UTF-8');
echo <<<EOF
<?xml version="1.0" encoding="UTF-8"?>
<data>
<ctl>unused</ctl>
<code>{$html}</code>
 *   (at your option) any later version.
 *
 *   NOALYSS is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with NOALYSS; if not, write to the Free Software
 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
// Copyright Author Dany De Bontridder danydb@aevalys.eu
/**
 * @file
 * @brief export Action Gestion to csv, taking in account the search
 *
 */
if (!defined('ALLOWED')) {
    die('Appel direct ne sont pas permis');
}
require_once NOALYSS_INCLUDE . '/class_follow_up.php';
header('Pragma: public');
header('Content-type: application/csv');
header('Content-Disposition: attachment;filename="action-gestion.csv"', FALSE);
$follow = new Follow_Up($cn);
$array = $_GET;
if (isset($_POST['query'])) {
    $p_array['query'] = $_POST['query'];
}
echo $follow->export_csv($_GET);
exit;
Example #13
0
 static function action_print($cn, $p_array)
 {
     global $g_user;
     $mag_id = $p_array['mag_id'];
     for ($i = 0; $i < count($mag_id); $i++) {
         if ($g_user->can_read_action($mag_id[$i]) == false) {
             continue;
         }
         $a = new Follow_Up($cn, $mag_id[$i]);
         $a->get();
         echo '<div class="content">';
         echo $a->Display("READ", false, "");
         echo '</div>';
         echo '<P id="breakhere"> - - </p>';
     }
 }
Example #14
0
 } catch (Exception $ex) {
     header('Content-type: text/xml; charset=UTF-8');
     $dom = new DOMDocument('1.0', 'UTF-8');
     $xml_content = $dom->createElement('content', $ex->getMessage());
     $xml_status = $dom->createElement('status', "NOK");
     $root = $dom->createElement("root");
     $root->appendChild($xml_content);
     $root->appendChild($xml_status);
     $dom->appendChild($root);
     echo $dom->saveXML();
     return;
 }
 /*
  * Save data
  */
 $gestion = new Follow_Up($cn);
 $gestion->ag_priority = $event_priority;
 $gestion->ag_title = $title;
 $gestion->ag_dest = $event_group;
 $gestion->ag_type = $type_event;
 $gestion->f_id_dest = $dest_id;
 $gestion->ag_state = 3;
 $gestion->dt_id = $type_event;
 $gestion->ag_comment = h($summary);
 $gestion->ag_timestamp = $date_event;
 $gestion->ag_remind_date = $date_event;
 $content = _('Sauvé');
 $status = 'OK';
 try {
     $gestion->save_short();
 } catch (Exception $ex) {
 *
 *   You should have received a copy of the GNU General Public License
 *   along with NOALYSS; if not, write to the Free Software
 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/
// Copyright 2014 Author Dany De Bontridder danydb@aevalys.eu
if (!defined('ALLOWED')) {
    die('Appel direct ne sont pas permis');
}
$ag_id = HtmlInput::default_value_get("ag_id", "0");
$f_id = HtmlInput::default_value_get("f_id", "0");
if ($ag_id == 0 || $f_id == 0) {
    throw new Exception("Invalid values", 0);
}
require_once 'class_follow_up.php';
$follow = new Follow_Up($cn, $ag_id);
ob_start();
$follow->remove_linked_card($f_id);
echo $follow->display_linked();
HtmlInput::button_action_add_concerned_card($follow->ag_id);
$response = ob_get_clean();
$html = escape_xml($response);
header('Content-type: text/xml; charset=UTF-8');
echo <<<EOF
<?xml version="1.0" encoding="UTF-8"?>
<data>
<ctl>unused</ctl>
<code>{$html}</code>
</data>
EOF;
?>