diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index ba3c37f1997d5d22f585c2302365cd13853c81a0..12ce56fc0a6bb86581ab07b912e4980960cf0aa7 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -166,28 +166,39 @@ else if ($action == "confirm_delete") { } 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'); - $book->code_journal = GETPOST('code_journal'); - $book->fk_doc = 0; - $book->fk_docdet = 0; - - $book->montant = 0; - - $result = $book->createStd($user); - if ($result < 0) { - setEventMessages($book->error, $book->errors, 'errors'); - } else { - setEventMessages($langs->trans('Saved'), null, 'mesgs'); - $action = ''; - $piece_num = $book->piece_num; + $error = 0; + + $book = new BookKeeping($db); + + if (empty(GETPOST('next_num_mvt'))) + { + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("NumPiece")), null, 'errors'); + $error++; + } + + if (! $error) + { + $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'); + $book->code_journal = GETPOST('code_journal'); + $book->fk_doc = 0; + $book->fk_docdet = 0; + + $book->montant = 0; + + $result = $book->createStd($user); + if ($result < 0) { + setEventMessages($book->error, $book->errors, 'errors'); + } else { + setEventMessages($langs->trans('Saved'), null, 'mesgs'); + $action = ''; + $piece_num = $book->piece_num; + } } } @@ -232,6 +243,10 @@ if ($action == 'create') { $book = new BookKeeping($db); $next_num_mvt = $book->getNextNumMvt(); + if (empty($next_num_mvt)) + { + dol_print_error('', 'Failed to get next piece number'); + } print '<form action="' . $_SERVER["PHP_SELF"] . '" name="create_mvt" method="POST">'; print '<input type="hidden" name="action" value="confirm_create">' . "\n"; @@ -241,19 +256,19 @@ if ($action == 'create') { print '<table class="border" width="100%">'; print '<tr>'; - print '<td width="25%">' . $langs->trans("NumMvts") . '</td>'; + print '<td class="titlefieldcreate fieldrequired">' . $langs->trans("NumPiece") . '</td>'; print '<td>' . $next_num_mvt . '</td>'; print '</tr>'; print '<tr>'; - print '<td>' . $langs->trans("Docdate") . '</td>'; + print '<td class="fieldrequired">' . $langs->trans("Docdate") . '</td>'; print '<td>'; print $html->select_date('', 'doc_date', '', '', '', "create_mvt", 1, 1); print '</td>'; print '</tr>'; print '<tr>'; - print '<td>' . $langs->trans("Codejournal") . '</td>'; + print '<td class="fieldrequired">' . $langs->trans("Codejournal") . '</td>'; print '<td>' . $html->selectarray('code_journal', $code_journal_array) . '</td>'; print '</tr>'; @@ -390,10 +405,9 @@ if ($action == 'create') { print "</tr>\n"; } - if ($total_debit != $total_credit) { - setEventMessages(null, array ( - $langs->trans('MvtNotCorrectlyBalanced', $total_credit, $total_debit) - ), 'errors'); + if ($total_debit != $total_credit) + { + setEventMessages(null, array($langs->trans('MvtNotCorrectlyBalanced', $total_credit, $total_debit)), 'warnings'); } if ($action == "" || $action == 'add') { diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index 53ff4cbee24e30e70dc234a877bad4c922586a0e..4b638ea697b1ad55cdb2bd130d8e3d171cfe3c70 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -167,7 +167,7 @@ if (! empty($search_mvt_num)) { * Action */ -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers { $search_mvt_num = ''; $search_doc_type = ''; @@ -272,7 +272,7 @@ if ($action == 'export_csv') { */ $title_page = $langs->trans("Bookkeeping"); -if ($search_date_start || $search_date_end) $title_page .= ' ' . dol_print_date($search_date_start) . '-' . dol_print_date($search_date_end); +if ($search_date_start || $search_date_end) $title_page .= ' ' . dol_print_date($search_date_start, 'day') . ' - ' . dol_print_date($search_date_end, 'day'); llxHeader('', $title_page); // List @@ -339,7 +339,7 @@ print '</div>'; print '<table class="noborder" width="100%">'; print '<tr class="liste_titre">'; print_liste_field_titre($langs->trans("NumPiece"), $_SERVER['PHP_SELF'], "t.piece_num", "", $options, "", $sortfield, $sortorder); -print_liste_field_titre($langs->trans("Docdate"), $_SERVER['PHP_SELF'], "t.doc_date", "", $options, "", $sortfield, $sortorder); +print_liste_field_titre($langs->trans("Docdate"), $_SERVER['PHP_SELF'], "t.doc_date", "", $options, 'align="center"', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Docref"), $_SERVER['PHP_SELF'], "t.doc_ref", "", $options, "", $sortfield, $sortorder); print_liste_field_titre($langs->trans("AccountAccountingShort"), $_SERVER['PHP_SELF'], "t.numero_compte", "", $options, "", $sortfield, $sortorder); print_liste_field_titre($langs->trans("Code_tiers"), $_SERVER['PHP_SELF'], "t.code_tiers", "", $options, "", $sortfield, $sortorder); @@ -353,7 +353,7 @@ print "</tr>\n"; print '<tr class="liste_titre">'; print '<form action="' . $_SERVER["PHP_SELF"] . '" method="GET">'; print '<td><input type="text" name="search_mvt_num" size="6" value="' . $search_mvt_num . '"></td>'; -print '<td class="liste_titre">'; +print '<td class="liste_titre center">'; print $langs->trans('From') . ': '; print $form->select_date($search_date_start, 'date_start', 0, 0, 1); print '<br>'; diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index fb8934f39a27be4fbb94bc53bf64dbbc3d77a644..0e458edf2027e4618b36b3955800a138148dae71 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -409,7 +409,7 @@ class BookKeeping extends CommonObject $sql .= ' ' . (empty($this->fk_doc) ? '0' : $this->fk_doc) . ','; $sql .= ' ' . (empty($this->fk_docdet) ? '0' : $this->fk_docdet) . ','; $sql .= ' ' . (! isset($this->code_tiers) ? 'NULL' : "'" . $this->db->escape($this->code_tiers) . "'") . ','; - $sql .= ' ' . (! isset($this->numero_compte) ? 'NULL' : "'" . $this->db->escape($this->numero_compte) . "'") . ','; + $sql .= ' ' . (! isset($this->numero_compte) ? "'NotDefined'" : "'" . $this->db->escape($this->numero_compte) . "'") . ','; $sql .= ' ' . (! isset($this->label_compte) ? 'NULL' : "'" . $this->db->escape($this->label_compte) . "'") . ','; $sql .= ' ' . (! isset($this->debit) ? 'NULL' : "'" . $this->debit . "'") . ','; $sql .= ' ' . (! isset($this->credit) ? 'NULL' : "'" . $this->credit . "'") . ','; @@ -417,8 +417,8 @@ class BookKeeping extends CommonObject $sql .= ' ' . (! isset($this->sens) ? 'NULL' : "'" . $this->db->escape($this->sens) . "'") . ','; $sql .= ' ' . $user->id . ','; $sql .= ' ' . (! isset($this->import_key) ? 'NULL' : "'" . $this->db->escape($this->import_key) . "'") . ','; - $sql .= ' ' . (! isset($this->code_journal) ? 'NULL' : "'" . $this->db->escape($this->code_journal) . "'") . ','; - $sql .= ' ' . (! isset($this->piece_num) ? 'NULL' : $this->piece_num).','; + $sql .= ' ' . (empty($this->code_journal) ? 'NULL' : "'" . $this->db->escape($this->code_journal) . "'") . ','; + $sql .= ' ' . (empty($this->piece_num) ? 'NULL' : $this->piece_num).','; $sql .= ' ' . (! isset($this->entity) ? '1' : $this->entity); $sql .= ')'; @@ -1215,18 +1215,20 @@ class BookKeeping extends CommonObject /** * Return next number movement * - * @return string Last number + * @return string Next numero to use */ - public function getNextNumMvt() { + public function getNextNumMvt() + { $sql = "SELECT MAX(piece_num)+1 as max FROM " . MAIN_DB_PREFIX . $this->table_element; - + dol_syslog(get_class($this) . "getNextNumMvt sql=" . $sql, LOG_DEBUG); $result = $this->db->query($sql); - + if ($result) { $obj = $this->db->fetch_object($result); - - return $obj->max; + if ($obj) $result = $obj->max; + if (empty($result)) $result = 1; + return $result; } else { $this->error = "Error " . $this->db->lasterror(); dol_syslog(get_class($this) . "::getNextNumMvt " . $this->error, LOG_ERR); diff --git a/htdocs/accountancy/customer/index.php b/htdocs/accountancy/customer/index.php index 10181ba4ac22260d56280e6ae9293418c52c32df..de03bc18814fe1e8a4572445fa50944f39618027 100644 --- a/htdocs/accountancy/customer/index.php +++ b/htdocs/accountancy/customer/index.php @@ -165,7 +165,7 @@ $textnextyear = ' <a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_cur print load_fiche_titre($langs->trans("CustomersVentilation") . " " . $textprevyear . " " . $langs->trans("Year") . " " . $year_start . " " . $textnextyear); print $langs->trans("DescVentilCustomer") . '<br>'; -print $langs->trans("DescVentilMore", $langs->transnoentitiesnoconv("ValidateHistory"), $langs->transnoentitiesnoconv("ToDispatch")) . '<br>'; +print $langs->trans("DescVentilMore", $langs->transnoentitiesnoconv("ValidateHistory"), $langs->transnoentitiesnoconv("ToBind")) . '<br>'; print '<br>'; print '<div class="inline-block divButAction">'; print '<a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?year=' . $year_current . '&action=validatehistory">' . $langs->trans("ValidateHistory") . '</a>'; diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php index 03a620c6d9d09a96a066cb5a97e35e0adf5b07c6..3a5c3f2b1ca4f18352b2fd1983ee81b03970c5b3 100644 --- a/htdocs/accountancy/customer/lines.php +++ b/htdocs/accountancy/customer/lines.php @@ -264,7 +264,7 @@ if ($result) { print_liste_field_titre($langs->trans("Account"), $_SERVER["PHP_SELF"], "aa.account_number", "", $param, 'align="center"', $sortfield, $sortorder); print_liste_field_titre($langs->trans("Country"), $_SERVER["PHP_SELF"], "co.label", "", $param, 'align="center"', $sortfield, $sortorder); print_liste_field_titre($langs->trans("VATIntra"), $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, 'align="center"', $sortfield, $sortorder); - print_liste_field_titre($langs->trans("Ventilate") . '<br><label id="select-all">' . $langs->trans('All') . '</label> / <label id="unselect-all">' . $langs->trans('None') . '</label>', '', '', '', '', 'align="center"'); + print_liste_field_titre('', '', '', '', '', 'align="center"'); print "</tr>\n"; print '<tr class="liste_titre">'; @@ -277,8 +277,8 @@ if ($result) { print '<td class="liste_titre" align="center"><input type="text" class="flat" size="10" name="search_account" value="' . $search_account . '"></td>'; print '<td class="liste_titre" align="center"><input type="text" class="flat" name="search_country" value="' . $search_country . '"></td>'; print '<td class="liste_titre" align="center"><input type="text" class="flat" name="search_tavintra" value="' . $search_tavintra . '"></td>'; - print '<td class="liste_titre" align="center"><input type="image" class="liste_titre" name="button_search" src="' . img_picto($langs->trans("Search"), 'search.png', '', '', 1) . '" value="' . dol_escape_htmltag($langs->trans("Search")) . '" title="' . dol_escape_htmltag($langs->trans("Search")) . '">'; - $searchpitco=$form->showFilterAndCheckAddButtons(0); + print '<td class="liste_titre" align="center">'; + $searchpitco=$form->showFilterAndCheckAddButtons(1); print $searchpitco; print "</td></tr>\n"; @@ -317,7 +317,7 @@ if ($result) { print '</a></td>'; print '<td align="right">' . $objp->country .'</td>'; print '<td align="center">' . $objp->tva_intra . '</td>'; - print '<td align="center"><input type="checkbox" class="toselect" name="changeaccount[]" value="' . $objp->fdid . '"/></td>'; + print '<td align="right"><input type="checkbox" class="checkforaction" name="changeaccount[]" value="' . $objp->fdid . '"/></td>'; print "</tr>"; $i ++; diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index 358c2268e6009295ab4766baaa2e4effad776456..33cf251cd5e8ba0a954ae83d5989bf964ff7c2ae 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -92,8 +92,13 @@ $accounting = new AccountingAccount($db); $aarowid_s = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT, 1); $aarowid_p = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT, 1); + +/* + * Action + */ + // Purge search criteria -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) { +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) { $search_ref = ''; $search_invoice = ''; $search_label = ''; @@ -103,6 +108,42 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) { $search_vat = ''; } +if ($action == 'ventil' && ! empty($btn_ventil)) { + $msg=''; + //print '<div><font color="red">' . $langs->trans("Processing") . '...</font></div>'; + if (! empty($codeventil) && ! empty($mesCasesCochees)) { + $msg = '<div><font color="red">' . count($mesCasesCochees) . ' ' . $langs->trans("SelectedLines") . '</font></div>'; + $mesCodesVentilChoisis = $codeventil; + $cpt = 0; + + foreach ( $mesCasesCochees as $maLigneCochee ) { + $maLigneCourante = explode("_", $maLigneCochee); + $monId = $maLigneCourante[0]; + $monNumLigne = $maLigneCourante[1]; + $monCompte = $mesCodesVentilChoisis[$monNumLigne]; + + $sql = " UPDATE " . MAIN_DB_PREFIX . "facturedet"; + $sql .= " SET fk_code_ventilation = " . $monCompte; + $sql .= " WHERE rowid = " . $monId; + + $accountventilated = new AccountingAccount($db); + $accountventilated->fetch($monCompte, ''); + + dol_syslog("/accountancy/customer/list.php sql=" . $sql, LOG_DEBUG); + if ($db->query($sql)) { + $msg.= '<div><font color="green">' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' - ' . $langs->trans("VentilatedinAccount") . ' : ' . length_accountg($accountventilated->account_number) . '</font></div>'; + } else { + $msg.= '<div><font color="red">' . $langs->trans("ErrorDB") . ' : ' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' - ' . $langs->trans("NotVentilatedinAccount") . ' : ' . length_accountg($accountventilated->account_number) . '<br/> <pre>' . $sql . '</pre></font></div>'; + } + + $cpt ++; + } + } else { + $msg. '<div><font color="red">' . $langs->trans("AnyLineVentilate") . '</font></div>'; + } + $msg.= '<div><font color="red">' . $langs->trans("EndProcessing") . '</font></div>'; +} + /* @@ -128,45 +169,6 @@ print '<script type="text/javascript"> }); </script>'; -/* - * Action - */ -if ($action == 'ventil' && ! empty($btn_ventil)) { - $msg=''; - //print '<div><font color="red">' . $langs->trans("Processing") . '...</font></div>'; - if (! empty($codeventil) && ! empty($mesCasesCochees)) { - $msg = '<div><font color="red">' . count($mesCasesCochees) . ' ' . $langs->trans("SelectedLines") . '</font></div>'; - $mesCodesVentilChoisis = $codeventil; - $cpt = 0; - - foreach ( $mesCasesCochees as $maLigneCochee ) { - $maLigneCourante = explode("_", $maLigneCochee); - $monId = $maLigneCourante[0]; - $monNumLigne = $maLigneCourante[1]; - $monCompte = $mesCodesVentilChoisis[$monNumLigne]; - - $sql = " UPDATE " . MAIN_DB_PREFIX . "facturedet"; - $sql .= " SET fk_code_ventilation = " . $monCompte; - $sql .= " WHERE rowid = " . $monId; - - $accountventilated = new AccountingAccount($db); - $accountventilated->fetch($monCompte, ''); - - dol_syslog("/accountancy/customer/list.php sql=" . $sql, LOG_DEBUG); - if ($db->query($sql)) { - $msg.= '<div><font color="green">' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' - ' . $langs->trans("VentilatedinAccount") . ' : ' . length_accountg($accountventilated->account_number) . '</font></div>'; - } else { - $msg.= '<div><font color="red">' . $langs->trans("ErrorDB") . ' : ' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' - ' . $langs->trans("NotVentilatedinAccount") . ' : ' . length_accountg($accountventilated->account_number) . '<br/> <pre>' . $sql . '</pre></font></div>'; - } - - $cpt ++; - } - } else { - $msg. '<div><font color="red">' . $langs->trans("AnyLineVentilate") . '</font></div>'; - } - $msg.= '<div><font color="red">' . $langs->trans("EndProcessing") . '</font></div>'; -} - /* * Customer Invoice lines */ @@ -232,7 +234,7 @@ if ($result) { print_barre_liste($langs->trans("InvoiceLines"), $page, $_SERVER["PHP_SELF"], "", $sortfield, $sortorder, '', $num_lines); - print '<br><b>' . $langs->trans("DescVentilTodoCustomer") . '</b></br>'; + print $langs->trans("DescVentilTodoCustomer") . '</br><br>'; if ($msg) print $msg.'<br>'; @@ -250,7 +252,7 @@ if ($result) { print_liste_field_titre($langs->trans("AccountAccountingSuggest"), '', '', '', '', 'align="center"'); print_liste_field_titre($langs->trans("IntoAccount"), '', '', '', '', 'align="center"'); print_liste_field_titre(''); - print_liste_field_titre($langs->trans("Ventilate") . '<br><label id="select-all">' . $langs->trans('All') . '</label>/<label id="unselect-all">' . $langs->trans('None') . '</label>', '', '', '', '', 'align="center"'); + print_liste_field_titre('', '', '', '', '', 'align="center"'); print '</tr>'; // We add search filter @@ -261,10 +263,12 @@ if ($result) { print '<td class="liste_titre"><input type="text" class="flat" size="20" name="search_desc" value="' . $search_desc . '"></td>'; print '<td class="liste_titre" align="right"><input type="text" class="flat" size="10" name="search_amount" value="' . $search_amount . '"></td>'; print '<td class="liste_titre" align="center"><input type="text" class="flat" size="3" name="search_vat" value="' . $search_vat . '">%</td>'; - print '<td align="right" class="liste_titre" colspan="4">'; - print '<input type="image" class="liste_titre" src="' . img_picto($langs->trans("Search"), 'search.png', '', '', 1) . '" name="button_search" value="' . dol_escape_htmltag($langs->trans("Search")) . '" title="' . dol_escape_htmltag($langs->trans("Search")) . '">'; - print ' '; - print '<input type="image" class="liste_titre" src="' . img_picto($langs->trans("Search"), 'searchclear.png', '', '', 1) . '" name="button_removefilter" value="' . dol_escape_htmltag($langs->trans("RemoveFilter")) . '" title="' . dol_escape_htmltag($langs->trans("RemoveFilter")) . '">'; + print '<td class="liste_titre"></td>'; + print '<td class="liste_titre"></td>'; + print '<td class="liste_titre"></td>'; + print '<td align="right" class="liste_titre">'; + $searchpitco=$form->showFilterAndCheckAddButtons(1); + print $searchpitco; print '</td>'; print '</tr>'; @@ -352,8 +356,8 @@ if ($result) { print $formventilation->select_account($objp->aarowid_suggest, 'codeventil[]', 1); print '</td>'; print '<td align="center">' . $objp->rowid . '</td>'; - print '<td align="center">'; - print '<input type="checkbox" name="mesCasesCochees[]" value="' . $objp->rowid . "_" . $i . '"' . ($objp->aarowid ? "checked" : "") . '/>'; + print '<td align="right">'; + print '<input type="checkbox" class="checkforaction" name="mesCasesCochees[]" value="' . $objp->rowid . "_" . $i . '"' . ($objp->aarowid ? "checked" : "") . '/>'; print '</td>'; print '</tr>'; $i ++; diff --git a/htdocs/accountancy/supplier/index.php b/htdocs/accountancy/supplier/index.php index a02ae9aa1843db43c46b6999d90c11cf978fc0e3..be33090ca1c5de488823dfe98fa07834552e83f6 100644 --- a/htdocs/accountancy/supplier/index.php +++ b/htdocs/accountancy/supplier/index.php @@ -158,7 +158,7 @@ $textnextyear = ' <a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_cur print load_fiche_titre($langs->trans("SuppliersVentilation") . " " . $textprevyear . " " . $langs->trans("Year") . " " . $year_start . " " . $textnextyear); print $langs->trans("DescVentilSupplier") . '<br>'; -print $langs->trans("DescVentilMore", $langs->transnoentitiesnoconv("ValidateHistory"), $langs->transnoentitiesnoconv("ToDispatch")) . '<br>'; +print $langs->trans("DescVentilMore", $langs->transnoentitiesnoconv("ValidateHistory"), $langs->transnoentitiesnoconv("ToBind")) . '<br>'; print '<br>'; print '<div class="inline-block divButAction">'; diff --git a/htdocs/accountancy/supplier/lines.php b/htdocs/accountancy/supplier/lines.php index 7e1e40b87028d8fa5cb6e8123d9a21c869b0749a..038b3e20b46656919e5daef1c7d54b932d710f5c 100644 --- a/htdocs/accountancy/supplier/lines.php +++ b/htdocs/accountancy/supplier/lines.php @@ -216,7 +216,7 @@ if ($result) { print_liste_field_titre($langs->trans("Account"), $_SERVER["PHP_SELF"], "aa.account_number", "", $param, 'align="center"', $sortfield, $sortorder); print_liste_field_titre(''); print_liste_field_titre(''); - print_liste_field_titre($langs->trans("Ventilate") . '<br><label id="select-all">' . $langs->trans('All') . '</label> / <label id="unselect-all">' . $langs->trans('None') . '</label>', '', '', '', '', 'align="center"'); + print_liste_field_titre('', '', '', '', '', 'align="center"'); print "</tr>\n"; print '<tr class="liste_titre"><td><input type="text" class="flat" name="search_invoice" size="10" value="' . $search_invoice . '"></td>'; @@ -228,7 +228,7 @@ if ($result) { print '<td class="liste_titre" align="center"><input type="text" class="flat" size="10" name="search_account" value="' . $search_account . '"></td>'; print '<td class="liste_titre" colspan="2"> </td>'; print '<td class="liste_titre" align="right">'; - $searchpitco=$form->showFilterAndCheckAddButtons(0); + $searchpitco=$form->showFilterAndCheckAddButtons(1); print $searchpitco; print '</td>'; print "</tr>\n"; @@ -270,7 +270,7 @@ if ($result) { print img_edit(); print '</a></td>'; - print '<td align="center"><input type="checkbox" class="toselect" name="changeaccount[]" value="' . $objp->rowid . '"/></td>'; + print '<td align="right"><input type="checkbox" class="checkforaction" name="changeaccount[]" value="' . $objp->rowid . '"/></td>'; print "</tr>"; $i ++; diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php index e48f01413184b08d62b360ab7f9656a14df83207..8ae8dd17996bff45d5647ed834d87ad27543ce5a 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -98,17 +98,61 @@ $accounting = new AccountingAccount($db); $aarowid_s = $accounting->fetch('', $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT, 1); $aarowid_p = $accounting->fetch('', $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT, 1); + +/* + * Action + */ + // Purge search criteria if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers { - $search_ref = ''; - $search_label = ''; - $search_desc = ''; - $search_amount = ''; - $search_account = ''; - $search_vat = ''; + $search_ref = ''; + $search_label = ''; + $search_desc = ''; + $search_amount = ''; + $search_account = ''; + $search_vat = ''; } +if ($action == 'ventil' && ! empty($btn_ventil)) { + $msg=''; + //print '<div><font color="red">' . $langs->trans("Processing") . '...</font></div>'; + if ($_POST['codeventil'] && $_POST["mesCasesCochees"]) { + $msg = '<div><font color="red">' . count($_POST["mesCasesCochees"]) . ' ' . $langs->trans("SelectedLines") . '</font></div>'; + $mesCodesVentilChoisis = $codeventil; + $cpt = 0; + + foreach ( $mesCasesCochees as $maLigneCochee ) { + // print '<div><font color="red">id selectionnee : '.$monChoix."</font></div>"; + $maLigneCourante = explode("_", $maLigneCochee); + $monId = $maLigneCourante[0]; + $monNumLigne = $maLigneCourante[1]; + $monCompte = $mesCodesVentilChoisis[$monNumLigne]; + + $sql = " UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det"; + $sql .= " SET fk_code_ventilation = " . $monCompte; + $sql .= " WHERE rowid = " . $monId; + + $accountventilated = new AccountingAccount($db); + $accountventilated->fetch($monCompte, ''); + + dol_syslog('accountancy/supplier/list.php:: sql=' . $sql, LOG_DEBUG); + if ($db->query($sql)) { + $msg.= '<div><font color="green">' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' - ' . $langs->trans("VentilatedinAccount") . ' : ' . length_accountg($accountventilated->account_number) . '</font></div>'; + } else { + $msg.= '<div><font color="red">' . $langs->trans("ErrorDB") . ' : ' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' - ' . $langs->trans("NotVentilatedinAccount") . ' : ' . length_accountg($accountventilated->account_number) . '<br/> <pre>' . $sql . '</pre></font></div>'; + } + + $cpt ++; + } + } else { + $msg.= '<div><font color="red">' . $langs->trans("AnyLineVentilate") . '</font></div>'; + } + $msg.= '<div><font color="red">' . $langs->trans("EndProcessing") . '</font></div>'; +} + + + /* * View */ @@ -131,45 +175,6 @@ print '<script type="text/javascript"> }); </script>'; -/* - * Action - */ -if ($action == 'ventil' && ! empty($btn_ventil)) { - $msg=''; - //print '<div><font color="red">' . $langs->trans("Processing") . '...</font></div>'; - if ($_POST['codeventil'] && $_POST["mesCasesCochees"]) { - $msg = '<div><font color="red">' . count($_POST["mesCasesCochees"]) . ' ' . $langs->trans("SelectedLines") . '</font></div>'; - $mesCodesVentilChoisis = $codeventil; - $cpt = 0; - - foreach ( $mesCasesCochees as $maLigneCochee ) { - // print '<div><font color="red">id selectionnee : '.$monChoix."</font></div>"; - $maLigneCourante = explode("_", $maLigneCochee); - $monId = $maLigneCourante[0]; - $monNumLigne = $maLigneCourante[1]; - $monCompte = $mesCodesVentilChoisis[$monNumLigne]; - - $sql = " UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det"; - $sql .= " SET fk_code_ventilation = " . $monCompte; - $sql .= " WHERE rowid = " . $monId; - - $accountventilated = new AccountingAccount($db); - $accountventilated->fetch($monCompte, ''); - - dol_syslog('accountancy/supplier/list.php:: sql=' . $sql, LOG_DEBUG); - if ($db->query($sql)) { - $msg.= '<div><font color="green">' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' - ' . $langs->trans("VentilatedinAccount") . ' : ' . length_accountg($accountventilated->account_number) . '</font></div>'; - } else { - $msg.= '<div><font color="red">' . $langs->trans("ErrorDB") . ' : ' . $langs->trans("Lineofinvoice") . ' ' . $monId . ' - ' . $langs->trans("NotVentilatedinAccount") . ' : ' . length_accountg($accountventilated->account_number) . '<br/> <pre>' . $sql . '</pre></font></div>'; - } - - $cpt ++; - } - } else { - $msg.= '<div><font color="red">' . $langs->trans("AnyLineVentilate") . '</font></div>'; - } - $msg.= '<div><font color="red">' . $langs->trans("EndProcessing") . '</font></div>'; -} /* * Supplier Invoice Lines @@ -236,7 +241,7 @@ if ($result) { if ($msg) print $msg.'<br>'; - print '<br><b>' . $langs->trans("DescVentilTodoCustomer") . '</b></br>'; + print $langs->trans("DescVentilTodoCustomer") . '</br><br>'; print '<form action="' . $_SERVER["PHP_SELF"] . '" method="post">' . "\n"; print '<input type="hidden" name="action" value="ventil">'; @@ -252,7 +257,7 @@ if ($result) { print_liste_field_titre($langs->trans("AccountAccounting"), '', '', '', '', 'align="center"'); print_liste_field_titre($langs->trans("IntoAccount"), '', '', '', '', 'align="center"'); print_liste_field_titre(''); - print_liste_field_titre($langs->trans("Ventilate") . '<br><label id="select-all">' . $langs->trans('All') . '</label>/<label id="unselect-all">' . $langs->trans('None') . '</label>', '', '', '', '', 'align="center"'); + print_liste_field_titre('', '', '', '', '', 'align="center"'); print "</tr>\n"; print '<tr class="liste_titre">'; @@ -264,10 +269,10 @@ if ($result) { print '<td class="liste_titre" align="center">%<input type="text" class="flat" size="5" name="search_vat" value="' . $search_vat . '"></td>'; print '<td class="liste_titre" align="center"> </td>'; print '<td class="liste_titre"> </td>'; - print '<td align="right" colspan="2" class="liste_titre">'; - print '<input type="image" class="liste_titre" src="' . img_picto($langs->trans("Search"), 'search.png', '', '', 1) . '" name="button_search" value="' . dol_escape_htmltag($langs->trans("Search")) . '" title="' . dol_escape_htmltag($langs->trans("Search")) . '">'; - print ' '; - print '<input type="image" class="liste_titre" src="' . img_picto($langs->trans("Search"), 'searchclear.png', '', '', 1) . '" name="button_removefilter" value="' . dol_escape_htmltag($langs->trans("RemoveFilter")) . '" title="' . dol_escape_htmltag($langs->trans("RemoveFilter")) . '">'; + print '<td class="liste_titre"></td>'; + print '<td align="right" class="liste_titre">'; + $searchpitco=$form->showFilterAndCheckAddButtons(1); + print $searchpitco; print '</td>'; print '</tr>'; @@ -366,8 +371,8 @@ if ($result) { print '</td>'; print '<td align="center">' . $objp->rowid . '</td>'; // Colonne choix ligne a ventiler - print '<td align="center">'; - print '<input type="checkbox" name="mesCasesCochees[]" value="' . $objp->rowid . "_" . $i . '"' . ($objp->aarowid ? "checked" : "") . '/>'; + print '<td align="right">'; + print '<input type="checkbox" class="checkforaction" name="mesCasesCochees[]" value="' . $objp->rowid . "_" . $i . '"' . ($objp->aarowid ? "checked" : "") . '/>'; print '</td>'; print "</tr>"; diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 6c6e4501aa81be012ae0403f16ba6284a4bf718d..39608ed6e28966f3a72cc0b42fb33c34a825fa71 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1008,7 +1008,10 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu // Admin $langs->load("admin"); if (preg_match('/accountancy/',$leftmenu)) $newmenu->add("/accountancy/admin/account.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("Chartofaccounts"),1,$user->rights->accounting->chartofaccount, '', $mainmenu, 'chartofaccount'); - if (preg_match('/accountancy/',$leftmenu)) $newmenu->add("/accountancy/admin/fiscalyear.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("Fiscalyear"),1,$user->rights->accounting->fiscalyear, '', $mainmenu, 'fiscalyear'); + if ($conf->global->MAIN_FEATURES_LEVEL > 0) // Not yet used. In a future will lock some periods. + { + if (preg_match('/accountancy/',$leftmenu)) $newmenu->add("/accountancy/admin/fiscalyear.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("Fiscalyear"),1,$user->rights->accounting->fiscalyear, '', $mainmenu, 'fiscalyear'); + } } // Accountancy (simple) diff --git a/htdocs/install/mysql/migration/4.0.0-5.0.0.sql b/htdocs/install/mysql/migration/4.0.0-5.0.0.sql index 3bd9a80f105978158f84b9bd26013bba1f8f51d2..ab2e6aa669cb0c1a4e1424e2ef66141489fd9ea8 100644 --- a/htdocs/install/mysql/migration/4.0.0-5.0.0.sql +++ b/htdocs/install/mysql/migration/4.0.0-5.0.0.sql @@ -127,9 +127,10 @@ ALTER TABLE llx_accounting_bookkeeping ADD COLUMN entity integer DEFAULT 1 NOT N ALTER TABLE llx_accounting_bookkeeping ADD COLUMN fk_user_modif integer; ALTER TABLE llx_accounting_bookkeeping ADD COLUMN date_creation datetime; ALTER TABLE llx_accounting_bookkeeping ADD COLUMN tms timestamp; -ALTER TABLE llx_accounting_bookkeeping numero_compte varchar(32) DEFAULT NOT NULL -- VMYSQL4.3 ALTER TABLE llx_accounting_bookkeeping MODIFY COLUMN numero_compte varchar(32) NOT NULL; +-- VMYSQL4.3 ALTER TABLE llx_accounting_bookkeeping MODIFY COLUMN code_journal varchar(32) NOT NULL; -- VPGSQL8.2 ALTER TABLE llx_accounting_bookkeeping ALTER COLUMN numero_compte SET NOT NULL; +-- VPGSQL8.2 ALTER TABLE llx_accounting_bookkeeping ALTER COLUMN code_journal SET NOT NULL; ALTER TABLE llx_accounting_account ADD INDEX uk_accounting_account (account_number, entity); diff --git a/htdocs/install/mysql/tables/llx_accounting_bookkeeping.sql b/htdocs/install/mysql/tables/llx_accounting_bookkeeping.sql index 8af28b1132188f56fd3a2037b0b15eac8e8aeffa..c72186c6910d7669de2599ab824da779c2a0a19a 100644 --- a/htdocs/install/mysql/tables/llx_accounting_bookkeeping.sql +++ b/htdocs/install/mysql/tables/llx_accounting_bookkeeping.sql @@ -27,7 +27,7 @@ CREATE TABLE llx_accounting_bookkeeping fk_doc integer NOT NULL, -- facture_client/reglement_client/... rowid fk_docdet integer NOT NULL, -- facture_client/reglement_client/... line rowid code_tiers varchar(24), -- code tiers - numero_compte varchar(32) DEFAULT NOT NULL, + numero_compte varchar(32) NOT NULL, label_compte varchar(128) NOT NULL, debit double NOT NULL, credit double NOT NULL, @@ -38,7 +38,7 @@ CREATE TABLE llx_accounting_bookkeeping date_creation datetime, -- date de creation tms timestamp, -- date last modification import_key varchar(14), - code_journal varchar(10) DEFAULT NULL, + code_journal varchar(10) NOT NULL, piece_num integer NOT NULL, validated tinyint DEFAULT 0 NOT NULL -- 0 line not validated / 1 line validated (No deleting / No modification) ) ENGINE=innodb; diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 512e40e139670f66dcf83f709dabe6e9a20ff8c6..462a547ca758b78b2bc32feb8491dc1307abb644 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -27,8 +27,8 @@ SuppliersVentilation=Supplier invoice binding Reports=Reports NewAccount=New accounting account Create=Create -CreateMvts=Create e transaction entry -UpdateMvts=Modification of a transaction entry +CreateMvts=Create new transaction +UpdateMvts=Modification of a transaction WriteBookKeeping=Record operations in General Ledger Bookkeeping=General ledger AccountBalance=Account balance @@ -38,7 +38,7 @@ InvoiceLines=Lines of invoice to be binded InvoiceLinesDone=Binded lines of invoice IntoAccount=Bind line with the accounting account -Ventilate=Ventilate +Ventilate=Bind Processing=Processing EndProcessing=The end of processing @@ -106,9 +106,9 @@ CustomerInvoicePayment=Payment of invoice customer ThirdPartyAccount=Thirdparty account -NewAccountingMvt=New transaction entry -NumMvts=Number of transactions -ListeMvts=List of transactions +NewAccountingMvt=New transaction +NumMvts=Numero of transaction +ListeMvts=List of movements ErrorDebitCredit=Debit and Credit cannot have a value at the same time ReportThirdParty=List thirdparty account @@ -123,14 +123,14 @@ Accountparent=Root of the account TotalVente=Total turnover before tax TotalMarge=Total sales margin -DescVentilCustomer=Consult here the list of customer invoice lines binded (or not) to a product bookkeeping account -DescVentilMore=In most cases, if you use predefined products or services and you set the account number on the product/service card, the application will be able to make all the binding between your invoice lines and the bookkeeping account of your chart of accounts, just in one click with the button <strong>"%s"</strong>. If account was not set on product/service cards or if you still has some lines not binded to any account, you will have to make a manual binding from the menu "<strong>%s</strong>". -DescVentilDoneCustomer=Consult here the list of the lines of invoices customers and their product bookkeeping account -DescVentilTodoCustomer=Bind your lines of customer invoice with a product bookkeeping account +DescVentilCustomer=Consult here the list of customer invoice lines binded (or not) to a product accounting account +DescVentilMore=In most cases, if you use predefined products or services and you set the account number on the product/service card, the application will be able to make all the binding between your invoice lines and the accounting account of your chart of accounts, just in one click with the button <strong>"%s"</strong>. If account was not set on product/service cards or if you still has some lines not binded to any account, you will have to make a manual binding from the menu "<strong>%s</strong>". +DescVentilDoneCustomer=Consult here the list of the lines of invoices customers and their product accounting account +DescVentilTodoCustomer=Bind invoice lines not already binded with a product accounting account ChangeAccount=Change the accounting account for lines selected by the account: Vide=- -DescVentilSupplier=Consult here the list of supplier invoice lines binded or not yet binded to a product bookkeeping account -DescVentilDoneSupplier=Consult here the list of the lines of invoices supplier and their bookkeeping account +DescVentilSupplier=Consult here the list of supplier invoice lines binded or not yet binded to a product accounting account +DescVentilDoneSupplier=Consult here the list of the lines of invoices supplier and their accounting account ValidateHistory=Bind Automatically AutomaticBindingDone=Automatic binding done diff --git a/htdocs/langs/en_US/banks.lang b/htdocs/langs/en_US/banks.lang index 3cef6fd6c40c150b027453776dce1036c5e4f3e9..778f3ab18284c87d96a77797a67faf993a8146c6 100644 --- a/htdocs/langs/en_US/banks.lang +++ b/htdocs/langs/en_US/banks.lang @@ -145,4 +145,5 @@ RejectCheckDate=Date the check was returned CheckRejected=Check returned CheckRejectedAndInvoicesReopened=Check returned and invoices reopened BankAccountModelModule=Document templates for bank accounts -DocumentModelSepaMandate=Template of SEPA mandate. Usefull for european countries in EEC only. \ No newline at end of file +DocumentModelSepaMandate=Template of SEPA mandate. Usefull for european countries in EEC only. +DocumentModelBan=Template to print a page with BAN information.