Exemplo n.º 1
0
    $fiche_def = new Fiche_Def($cn, $_REQUEST['fd_id']);
    $fiche_def = new Fiche_Def($cn, $_REQUEST['fd_id']);
    $fiche_def->RemoveAttribut($_REQUEST['chk_remove']);
    echo $fiche_def->input_detail();
    echo $retour;
    return;
}
/*******************************************************************************************/
// Try to remove a category
/*******************************************************************************************/
if ($action == 'remove_cat') {
    $post_id = HtmlInput::default_value_post('fd_id', 0);
    if ($post_id == 0 || $post_id >= 500000) {
        alert(_('Impossible d\'enlever cette catégorie'));
    } else {
        $fd_id = new Fiche_Def($cn, $post_id);
        $remains = $fd_id->remove();
        if ($remains != 0) {
            /* some card are not removed because it is used */
            alert(_('Impossible d\'enlever cette catégorie, certaines fiches sont encore utilisées' . "\n" . 'Les fiches non utilisées ont cependant été effacées'));
        }
    }
}
/*******************************************************************************************/
// Change some basis info
/*******************************************************************************************/
if (isset($_POST['change_name'])) {
    if (isset($_REQUEST['label'])) {
        $fiche_def = new Fiche_Def($cn, $_REQUEST['fd_id']);
        $fiche_def->SaveLabel($_REQUEST['label']);
        if (isset($_REQUEST['create'])) {
Exemplo n.º 2
0
        echo $export_csv;
    }
    return;
}
/********************************************************************************************************************************
 * Balance
 *
 **********************************************************************************************************************************/
if ($_GET['histo'] == 4 || $_GET['histo'] == 5) {
    if ($allcard == 0) {
        echo $str_add_card;
    }
    echo $export_pdf;
    echo $export_csv;
    echo $export_print;
    $fd = new Fiche_Def($cn, $_REQUEST['cat']);
    if ($allcard == 0 && $fd->hasAttribute(ATTR_DEF_ACCOUNT) == false) {
        echo alert(_("Cette catégorie n'ayant pas de poste comptable n'a pas de balance"));
        return;
    }
    // all card
    if ($allcard == 1) {
        $afiche = $cn->get_array("select fd_id from vw_fiche_def where ad_id=" . ATTR_DEF_ACCOUNT . " order by fd_label asc");
    } else {
        $afiche[0] = array('fd_id' => $_REQUEST['cat']);
    }
    for ($e = 0; $e < count($afiche); $e++) {
        $ret = $cn->exec_sql("select f_id,ad_value from fiche join fiche_detail using(f_id) where fd_id=\$1 and ad_id=1 order by 2 ", array($afiche[$e]['fd_id']));
        if ($cn->count() == 0) {
            if ($allcard == 0) {
                echo _("Aucune fiche trouvée");
Exemplo n.º 3
0
$gDossier = dossier::id();
$cn = new Database($gDossier);
$g_user->Check();
$g_user->check_dossier($gDossier);
$pdf = new PDF($cn);
$pdf->setDossierInfo("  Periode : " . $_GET['start'] . " - " . $_GET['end']);
$pdf->AliasNbPages();
$pdf->AddPage();
$name = $cn->get_value('select fd_label from fiche_def where fd_id=$1', array($_GET['cat']));
$pdf->SetFont('DejaVu', 'BI', 14);
$pdf->Cell(0, 8, $name, 0, 1, 'C');
$pdf->SetTitle($name, 1);
$pdf->SetAuthor('NOALYSS');
/* balance */
if ($_GET['histo'] == 4) {
    $fd = new Fiche_Def($cn, $_REQUEST['cat']);
    if ($fd->hasAttribute(ATTR_DEF_ACCOUNT) == false) {
        $pdf->Cell(0, 10, "Cette catégorie n'ayant pas de poste comptable n'a pas de balance");
        //Save PDF to file
        $fDate = date('dmy-Hi');
        $pdf->Output("category-{$fDate}.pdf", 'D');
        exit;
    }
    $aCard = $cn->get_array("select f_id,ad_value from fiche join fiche_Detail using (f_id)  where ad_id=1 and fd_id=\$1 order by 2 ", array($_REQUEST['cat']));
    if (empty($aCard)) {
        $pdf->Cell(0, 10, "Aucune fiche trouvée");
        //Save PDF to file
        $fDate = date('dmy-Hi');
        $pdf->Output("category-{$fDate}.pdf", 'D');
        exit;
    }
Exemplo n.º 4
0
     break;
 case 'scc':
     /*----------------------------------------------------------------------
      * Save card Category into the database and return a ok message
      *
      *----------------------------------------------------------------------*/
     $html = '';
     if ($g_user->check_action(FICCAT) == 1) {
         $script = create_script("removeDiv('{$ctl}')");
         $html .= $script;
         if (strlen(trim($_GET['nom_mod'])) != 0) {
             $array = array("FICHE_REF" => $cat, "nom_mod" => $_GET['nom_mod'], "class_base" => $_GET['class_base'], "fd_description" => $_GET['fd_description']);
             if (isset($_POST['create'])) {
                 $array['create'] = 1;
             }
             $catcard = new Fiche_Def($cn);
             if ($catcard->Add($array) == -1) {
                 $script = "alert_box('" . _('Catégorie existe déjà') . "')";
             } else {
                 $script = "alert_box('" . _('Catégorie sauvée') . "')";
             }
             $html .= create_script($script);
         } else {
             $script = "alert_box('" . _("Le nom ne peut pas être vide") . "')";
             $html .= create_script($script);
             $invalid = 1;
         }
     } else {
         $html = alert(_('Action interdite'), true);
     }
     break;
Exemplo n.º 5
0
 *   (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 show detail of a fiche_def (category of card) + Attribut
 *
 */
if (!defined('ALLOWED')) {
    die('Appel direct ne sont pas permis');
}
require_once NOALYSS_INCLUDE . '/class_fiche_def.php';
require_once NOALYSS_INCLUDE . '/class_tool_uos.php';
global $g_user;
$g_user->can_request(FICCAT, 0);
$fd = new Fiche_Def($cn, $_GET['id']);
if ($_GET['id'] > 0) {
    echo $fd->input_detail();
    echo HtmlInput::button("retour_b", _("Retour à la liste"), "onclick=\"\$('detail_category_div').hide();\$('list_cat_div').show()\"");
} else {
    $fd->input_new();
}
Exemplo n.º 6
0
 */
if (!defined('ALLOWED')) {
    die('Appel direct ne sont pas permis');
}
header('Pragma: public');
header('Content-type: application/csv');
header('Content-Disposition: attachment;filename="fiche.csv"', FALSE);
include_once "ac_common.php";
include_once 'class_fiche.php';
require_once NOALYSS_INCLUDE . '/class_database.php';
require_once NOALYSS_INCLUDE . '/class_dossier.php';
$gDossier = dossier::id();
$cn = new Database($gDossier);
require_once NOALYSS_INCLUDE . '/class_user.php';
if (isset($_GET['fd_id'])) {
    $fiche_def = new Fiche_Def($cn, $_GET['fd_id']);
    $fiche = new Fiche($cn);
    $e = $fiche_def->get_by_type();
    $o = 0;
    //  Heading
    $fiche_def->GetAttribut();
    foreach ($fiche_def->attribut as $attribut) {
        if ($o == 0) {
            printf("%s", $attribut->ad_text);
            $o = 1;
        } else {
            printf(";%s", $attribut->ad_text);
        }
    }
    printf("\n");
    $o = 0;
Exemplo n.º 7
0
 function remove($silent = false)
 {
     if ($this->id == 0) {
         return;
     }
     // verify if that card has not been used is a ledger
     // if the card has its own account in PCMN
     // Get the fiche_def.fd_id from fiche.f_id
     $this->Get();
     $fiche_def = new Fiche_Def($this->cn, $this->fiche_def);
     $fiche_def->get();
     // if the card is used do not removed it
     $qcode = $this->strAttribut(ATTR_DEF_QUICKCODE);
     if ($this->cn->count_sql("select * from jrnx where j_qcode='" . Database::escape_string($qcode) . "'") != 0) {
         if (!$silent) {
             alert(_('Impossible cette fiche est utilisée dans un journal'));
         }
         return 1;
     }
     $this->delete();
     return 0;
 }