diff --git a/htdocs/accountancy/admin/categories.php b/htdocs/accountancy/admin/categories.php index a91c22ffe4c..69d09ae301b 100644 --- a/htdocs/accountancy/admin/categories.php +++ b/htdocs/accountancy/admin/categories.php @@ -71,7 +71,7 @@ if (! empty($selectcpt)) { if ($return<0) { setEventMessages($langs->trans('errors'), $accountingcategory->errors, 'errors'); } else { - setEventMessages($langs->trans('Saved'), null, 'mesgs'); + setEventMessages($langs->trans('SetupSaved'), null, 'mesgs'); } } if ($action == 'delete') { diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index f655d245e86..885b090fe0c 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -1,8 +1,8 @@ - * Copyright (C) 2013-2017 Florian Henry - * Copyright (C) 2013-2017 Alexandre Spangaro - * Copyright (C) 2017 Laurent Destailleur +/* Copyright (C) 2013-2017 Olivier Geffroy + * Copyright (C) 2013-2017 Florian Henry + * Copyright (C) 2013-2018 Alexandre Spangaro + * Copyright (C) 2017 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -32,9 +32,7 @@ require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php'; require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php'; -$langs->load("accountancy"); -$langs->load("bills"); -$langs->load("compta"); +$langs->loadLangs(array("accountancy", "bills", "compta")); $action = GETPOST('action','aZ09'); @@ -89,36 +87,36 @@ if ($action == "confirm_update") { if (! $error) { - $book = new BookKeeping($db); + $object = new BookKeeping($db); - $result = $book->fetch($id, null, $mode); + $result = $object->fetch($id, null, $mode); if ($result < 0) { $error++; - setEventMessages($book->error, $book->errors, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); } else { - $book->numero_compte = $account_number; - $book->subledger_account = $subledger_account; - $book->label_compte = $label_compte; - $book->label_operation= $label_operation; - $book->debit = $debit; - $book->credit = $credit; + $object->numero_compte = $account_number; + $object->subledger_account = $subledger_account; + $object->label_compte = $label_compte; + $object->label_operation= $label_operation; + $object->debit = $debit; + $object->credit = $credit; if (floatval($debit) != 0.0) { - $book->montant = $debit; - $book->sens = 'D'; + $object->montant = $debit; + $object->sens = 'D'; } if (floatval($credit) != 0.0) { - $book->montant = $credit; - $book->sens = 'C'; + $object->montant = $credit; + $object->sens = 'C'; } - $result = $book->update($user, false, $mode); + $result = $object->update($user, false, $mode); if ($result < 0) { - setEventMessages($book->error, $book->errors, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); } else { if ($mode != '_tmp') { - setEventMessages($langs->trans('Saved'), null, 'mesgs'); + setEventMessages($langs->trans('RecordSaved'), null, 'mesgs'); } $debit = 0; @@ -147,39 +145,39 @@ else if ($action == "add") { } if (! $error) { - $book = new BookKeeping($db); + $object = new BookKeeping($db); - $book->numero_compte = $account_number; - $book->subledger_account = $subledger_account; - $book->label_compte = $label_compte; - $book->label_operation= $label_operation; - $book->debit = $debit; - $book->credit = $credit; - $book->doc_date = GETPOST('doc_date','alpha'); - $book->doc_type = GETPOST('doc_type','alpha'); - $book->piece_num = $piece_num; - $book->doc_ref = GETPOST('doc_ref','alpha'); - $book->code_journal = GETPOST('code_journal','alpha'); - $book->fk_doc = GETPOST('fk_doc','alpha'); - $book->fk_docdet = GETPOST('fk_docdet','alpha'); + $object->numero_compte = $account_number; + $object->subledger_account = $subledger_account; + $object->label_compte = $label_compte; + $object->label_operation= $label_operation; + $object->debit = $debit; + $object->credit = $credit; + $object->doc_date = GETPOST('doc_date','alpha'); + $object->doc_type = GETPOST('doc_type','alpha'); + $object->piece_num = $piece_num; + $object->doc_ref = GETPOST('doc_ref','alpha'); + $object->code_journal = GETPOST('code_journal','alpha'); + $object->fk_doc = GETPOST('fk_doc','alpha'); + $object->fk_docdet = GETPOST('fk_docdet','alpha'); if (floatval($debit) != 0.0) { - $book->montant = $debit; - $book->sens = 'D'; + $object->montant = $debit; + $object->sens = 'D'; } if (floatval($credit) != 0.0) { - $book->montant = $credit; - $book->sens = 'C'; + $object->montant = $credit; + $object->sens = 'C'; } - $result = $book->createStd($user, false, $mode); + $result = $object->createStd($user, false, $mode); if ($result < 0) { - setEventMessages($book->error, $book->errors, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); } else { if ($mode != '_tmp') { - setEventMessages($langs->trans('Saved'), null, 'mesgs'); + setEventMessages($langs->trans('RecordSaved'), null, 'mesgs'); } $debit = 0; @@ -191,17 +189,17 @@ else if ($action == "add") { } else if ($action == "confirm_delete") { - $book = new BookKeeping($db); + $object = new BookKeeping($db); - $result = $book->fetch($id, null, $mode); - $piece_num = $book->piece_num; + $result = $object->fetch($id, null, $mode); + $piece_num = $object->piece_num; if ($result < 0) { - setEventMessages($book->error, $book->errors, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); } else { - $result = $book->delete($user, false, $mode); + $result = $object->delete($user, false, $mode); if ($result < 0) { - setEventMessages($book->error, $book->errors, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); } } $action = ''; @@ -210,7 +208,7 @@ else if ($action == "confirm_delete") { else if ($action == "confirm_create") { $error = 0; - $book = new BookKeeping($db); + $object = new BookKeeping($db); if (! GETPOST('code_journal','alpha') || GETPOST('code_journal','alpha') == '-1') { setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Journal")), null, 'errors'); @@ -225,29 +223,29 @@ else if ($action == "confirm_create") { if (! $error) { - $book->label_compte = ''; - $book->debit = 0; - $book->credit = 0; - $book->doc_date = $date_start = dol_mktime(0, 0, 0, GETPOST('doc_datemonth','int'), GETPOST('doc_dateday','int'), GETPOST('doc_dateyear','int')); - $book->doc_type = GETPOST('doc_type','alpha'); - $book->piece_num = GETPOST('next_num_mvt','alpha'); - $book->doc_ref = GETPOST('doc_ref','alpha'); - $book->code_journal = GETPOST('code_journal','alpha'); - $book->fk_doc = 0; - $book->fk_docdet = 0; - $book->montant = 0; + $object->label_compte = ''; + $object->debit = 0; + $object->credit = 0; + $object->doc_date = $date_start = dol_mktime(0, 0, 0, GETPOST('doc_datemonth','int'), GETPOST('doc_dateday','int'), GETPOST('doc_dateyear','int')); + $object->doc_type = GETPOST('doc_type','alpha'); + $object->piece_num = GETPOST('next_num_mvt','alpha'); + $object->doc_ref = GETPOST('doc_ref','alpha'); + $object->code_journal = GETPOST('code_journal','alpha'); + $object->fk_doc = 0; + $object->fk_docdet = 0; + $object->montant = 0; - $result = $book->createStd($user,0, $mode); + $result = $object->createStd($user,0, $mode); if ($result < 0) { - setEventMessages($book->error, $book->errors, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); } else { if ($mode != '_tmp') { - setEventMessages($langs->trans('Saved'), null, 'mesgs'); + setEventMessages($langs->trans('RecordSaved'), null, 'mesgs'); } $action = 'update'; - $id=$book->id; - $piece_num = $book->piece_num; + $id=$object->id; + $piece_num = $object->piece_num; } } } @@ -260,7 +258,7 @@ if ($action == 'setdate') { } else { if ($mode != '_tmp') { - setEventMessages($langs->trans('Saved'), null, 'mesgs'); + setEventMessages($langs->trans('RecordSaved'), null, 'mesgs'); } $action = ''; } @@ -274,7 +272,7 @@ if ($action == 'setjournal') { } else { if ($mode != '_tmp') { - setEventMessages($langs->trans('Saved'), null, 'mesgs'); + setEventMessages($langs->trans('RecordSaved'), null, 'mesgs'); } $action = ''; } @@ -288,7 +286,7 @@ if ($action == 'setdocref') { } else { if ($mode != '_tmp') { - setEventMessages($langs->trans('Saved'), null, 'mesgs'); + setEventMessages($langs->trans('RecordSaved'), null, 'mesgs'); } $action = ''; } @@ -326,8 +324,8 @@ if ($action == 'create') { print load_fiche_titre($langs->trans("CreateMvts")); - $book = new BookKeeping($db); - $next_num_mvt = $book->getNextNumMvt('_tmp'); + $object = new BookKeeping($db); + $next_num_mvt = $object->getNextNumMvt('_tmp'); if (empty($next_num_mvt)) { @@ -361,7 +359,7 @@ if ($action == 'create') print ''; print ''; - print '' . $langs->trans("Docref") . ''; + print '' . $langs->trans("Piece") . ''; print ''; print ''; @@ -384,13 +382,13 @@ if ($action == 'create') print ''; } else { - $book = new BookKeeping($db); - $result = $book->fetchPerMvt($piece_num, $mode); + $object = new BookKeeping($db); + $result = $object->fetchPerMvt($piece_num, $mode); if ($result < 0) { - setEventMessages($book->error, $book->errors, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); } - if (! empty($book->piece_num)) + if (! empty($object->piece_num)) { $backlink = '' . $langs->trans('BackToList') . ''; @@ -398,14 +396,14 @@ if ($action == 'create') $head=array(); $h=0; - $head[$h][0] = $_SERVER['PHP_SELF'].'?piece_num='.$book->piece_num.($mode?'&mode='.$mode:''); + $head[$h][0] = $_SERVER['PHP_SELF'].'?piece_num='.$object->piece_num.($mode?'&mode='.$mode:''); $head[$h][1] = $langs->trans("Transaction"); $head[$h][2] = 'transaction'; $h++; dol_fiche_head($head, 'transaction', '', -1); - //dol_banner_tab($book, '', $backlink); + //dol_banner_tab($object, '', $backlink); print '
'; print '
'; @@ -416,7 +414,7 @@ if ($action == 'create') // Account movement print ''; print '' . $langs->trans("NumMvts") . ''; - print '' . $book->piece_num . ''; + print '' . $object->piece_num . ''; print ''; // Date @@ -425,19 +423,19 @@ if ($action == 'create') print $langs->trans('Docdate'); print ''; if ($action != 'editdate') - print 'piece_num .'&mode='. $mode .'">'.img_edit($langs->transnoentitiesnoconv('SetDate'),1).''; + print 'piece_num .'&mode='. $mode .'">'.img_edit($langs->transnoentitiesnoconv('SetDate'),1).''; print ''; print ''; if ($action == 'editdate') { - print '
'; + print ''; print ''; print ''; print ''; - $form->select_date($book->doc_date ? $book->doc_date : - 1, 'doc_date', '', '', '', "setdate"); + $form->select_date($object->doc_date ? $object->doc_date : - 1, 'doc_date', '', '', '', "setdate"); print ''; print '
'; } else { - print $book->doc_date ? dol_print_date($book->doc_date, 'day') : ' '; + print $object->doc_date ? dol_print_date($object->doc_date, 'day') : ' '; } print ''; print ''; @@ -448,19 +446,19 @@ if ($action == 'create') print $langs->trans('Codejournal'); print ''; if ($action != 'editjournal') - print 'piece_num.'&mode='. $mode .'">'.img_edit($langs->transnoentitiesnoconv('Edit'),1).''; + print 'piece_num.'&mode='. $mode .'">'.img_edit($langs->transnoentitiesnoconv('Edit'),1).''; print ''; print ''; if ($action == 'editjournal') { - print '
'; + print ''; print ''; print ''; print ''; - print $formaccounting->select_journal($book->code_journal,'code_journal',0,0,array(),1,1); + print $formaccounting->select_journal($object->code_journal,'code_journal',0,0,array(),1,1); print ''; print '
'; } else { - print $book->code_journal ; + print $object->code_journal ; } print ''; print ''; @@ -468,22 +466,22 @@ if ($action == 'create') // Ref document print ''; print ''; if ($action != 'editdocref') - print ''; + print ''; print '
'; - print $langs->trans('Docref'); + print $langs->trans('Piece'); print 'piece_num.'&mode='. $mode .'">'.img_edit($langs->transnoentitiesnoconv('Edit'),1).'piece_num.'&mode='. $mode .'">'.img_edit($langs->transnoentitiesnoconv('Edit'),1).'
'; print ''; if ($action == 'editdocref') { - print '
'; + print ''; print ''; print ''; print ''; - print ''; + print ''; print ''; print '
'; } else { - print $book->doc_ref ; + print $object->doc_ref ; } print ''; print ''; @@ -498,11 +496,11 @@ if ($action == 'create') print ''; // Doc type - if(! empty($book->doc_type)) + if(! empty($object->doc_type)) { print ''; print ''; - print ''; + print ''; print ''; } @@ -510,7 +508,7 @@ if ($action == 'create') print ''; print ''; print ''; print ''; @@ -519,7 +517,7 @@ if ($action == 'create') print ''; print ''; print ''; print ''; - if ($book->doc_type == 'customer_invoice') + if ($object->doc_type == 'customer_invoice') { $sqlmid = 'SELECT rowid as ref'; $sqlmid .= " FROM ".MAIN_DB_PREFIX."facture as fac"; - $sqlmid .= " WHERE fac.rowid=" . $book->fk_doc; + $sqlmid .= " WHERE fac.rowid=" . $object->fk_doc; dol_syslog("accountancy/bookkeeping/card.php::sqlmid=" . $sqlmid, LOG_DEBUG); $resultmid = $db->query($sqlmid); if ($resultmid) { @@ -563,24 +561,24 @@ if ($action == 'create') print '
'; - $result = $book->fetchAllPerMvt($piece_num, $mode); + $result = $object->fetchAllPerMvt($piece_num, $mode); if ($result < 0) { - setEventMessages($book->error, $book->errors, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); } else { print load_fiche_titre($langs->trans("ListeMvts"), '', ''); - print ''; - print '' . "\n"; - print '' . "\n"; - print '' . "\n"; - print '' . "\n"; - print '' . "\n"; - print '' . "\n"; + print ''; + print '' . "\n"; + print '' . "\n"; + print '' . "\n"; + print '' . "\n"; + print '' . "\n"; + print '' . "\n"; print '' . "\n"; print "
' . $langs->trans("Doctype") . '' . $book->doc_type . '' . $object->doc_type . '
' . $langs->trans("DateCreation") . ''; - print $book->date_creation ? dol_print_date($book->date_creation, 'day') : ' '; + print $object->date_creation ? dol_print_date($object->date_creation, 'day') : ' '; print '
' . $langs->trans("Status") . ''; - if (empty($book->validated)) { + if (empty($object->validated)) { print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; @@ -536,11 +534,11 @@ if ($action == 'create') /* print '
' . $langs->trans("Control") . '
"; - if (count($book->linesmvt) > 0) { + if (count($object->linesmvt) > 0) { $total_debit = 0; $total_credit = 0; @@ -597,7 +595,7 @@ if ($action == 'create') print "\n"; - foreach ($book->linesmvt as $line) { + foreach ($object->linesmvt as $line) { print ''; $total_debit += $line->debit; $total_credit += $line->credit; @@ -692,7 +690,7 @@ if ($action == 'create') print '
'; if ($total_debit == $total_credit) { - print ''.$langs->trans("ValidTransaction").''; + print ''.$langs->trans("ValidTransaction").''; } else {