Пример #1
0
         if ($result < 0) {
             setEventMessages($book->error, $book->errors, 'errors');
         } else {
             setEventMessages($langs->trans('Saved'), null, 'mesgs');
             $action = '';
         }
     }
 } else {
     if ($action == "confirm_delete") {
         $book = new BookKeeping($db);
         $result = $book->fetch($id);
         $piece_num = $book->piece_num;
         if ($result < 0) {
             setEventMessages($book->error, $book->errors, 'errors');
         } else {
             $result = $book->delete($user);
             if ($result < 0) {
                 setEventMessages($book->error, $book->errors, 'errors');
             }
         }
         $action = '';
     } else {
         if ($action == "confirm_create") {
             $book = new BookKeeping($db);
             $book->label_compte = '';
             $book->debit = 0;
             $book->credit = 0;
             $book->doc_date = $date_start = dol_mktime(0, 0, 0, GETPOST('doc_datemonth'), GETPOST('doc_dateday'), GETPOST('doc_dateyear'));
             $book->doc_type = GETPOST('doc_type');
             $book->piece_num = GETPOST('next_num_mvt');
             $book->doc_ref = GETPOST('doc_ref');