Merge remote-tracking branch 'upstream/develop' into socialnetworks
This commit is contained in:
commit
f4540dddb8
@ -28,6 +28,11 @@ Following changes may create regressions for some external modules, but were nec
|
||||
|
||||
|
||||
***** ChangeLog for 10.0.3 compared to 10.0.2 *****
|
||||
IMPORTANT : This version fixes a serious bug in saving the units of weight, size, surface and volume on product card.
|
||||
The unit were not saved correctly in database making calculation on shipments wrong.
|
||||
Update to this version must be done if you use them and have installed version 10.0.0, 10.0.1 or 10.0.2 and set some products after installing or upgrading to this version.
|
||||
Once update is done you must then edit (manually) the product that has bad unit to set the correct unit to have features restored.
|
||||
|
||||
FIX: #11702
|
||||
FIX: #11861 No consistent code to manage measuring units
|
||||
FIX: #11942
|
||||
|
||||
@ -116,7 +116,6 @@ for ($s = 0 ; $s < GEN_NUMBER_SOCIETE ; $s++)
|
||||
$contact->firstname = $listoflastname[mt_rand(0, count($listoflastname)-1)];
|
||||
if ( $contact->create($user) )
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -122,14 +122,14 @@
|
||||
<rule ref="Generic.Functions.CallTimePassByReference" />
|
||||
|
||||
<rule ref="Generic.Functions.FunctionCallArgumentSpacing" />
|
||||
|
||||
|
||||
<rule ref="Generic.Functions.FunctionCallArgumentSpacing.NoSpaceBeforeEquals">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
<rule ref="Generic.Functions.FunctionCallArgumentSpacing.NoSpaceBeforeEquals">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
|
||||
|
||||
<!-- Disallow several spaces after comma -->
|
||||
<!-- We want to allow this because we want to be able to align params on several similare functions on different lines -->
|
||||
<rule ref="Generic.Functions.FunctionCallArgumentSpacing.TooMuchSpaceAfterComma">
|
||||
@ -195,7 +195,7 @@
|
||||
</properties>
|
||||
</rule>
|
||||
-->
|
||||
|
||||
|
||||
<rule ref="Squiz.WhiteSpace.ScopeClosingBrace.Indent" />
|
||||
|
||||
<!-- There MUST NOT be trailing whitespace at the end of non-blank lines. -->
|
||||
@ -213,6 +213,8 @@
|
||||
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.EmptyLines">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
|
||||
<rule ref="Squiz.WhiteSpace.ControlStructureSpacing.SpacingAfterOpen" />
|
||||
<rule ref="Squiz.WhiteSpace.ControlStructureSpacing.SpacingBeforeClose" />
|
||||
|
||||
<rule ref="Squiz.ControlStructures.ForEachLoopDeclaration.SpaceAfterOpen" />
|
||||
@ -337,7 +339,7 @@
|
||||
<rule ref="PEAR.Commenting.InlineComment" />
|
||||
|
||||
<!-- Check position of { after a control structure like if (), while (), etc... -->
|
||||
<!--
|
||||
<!--
|
||||
<rule ref="PEAR.ControlStructures.ControlSignature" />
|
||||
-->
|
||||
|
||||
@ -375,7 +377,7 @@
|
||||
<rule ref="PEAR.Functions.FunctionCallSignature.ContentAfterOpenBracket">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
|
||||
|
||||
<rule ref="PEAR.Functions.FunctionCallSignature.EmptyLine">
|
||||
<severity>0</severity>
|
||||
</rule>
|
||||
|
||||
@ -677,7 +677,6 @@ if ($id)
|
||||
{
|
||||
foreach ($fieldlist as $field => $value)
|
||||
{
|
||||
|
||||
$showfield=1;
|
||||
$class="left";
|
||||
$valuetoshow=$obj->{$fieldlist[$field]};
|
||||
|
||||
@ -273,7 +273,6 @@ if ($action == 'create') {
|
||||
print '</form>';
|
||||
}
|
||||
elseif ($id > 0 || $ref) {
|
||||
|
||||
$result = $object->fetch($id, $ref, 1);
|
||||
|
||||
if ($result > 0) {
|
||||
|
||||
@ -130,7 +130,6 @@ if (! empty($cat_id))
|
||||
}
|
||||
|
||||
if (is_array($accountingcategory->lines_cptbk) && count($accountingcategory->lines_cptbk) > 0) {
|
||||
|
||||
print $form->multiselectarray('cpt_bk', $arraykeyvalue, GETPOST('cpt_bk', 'array'), null, null, null, null, "90%");
|
||||
print '<br>';
|
||||
/*print '<select class="flat minwidth200" size="8" name="cpt_bk[]" multiple>';
|
||||
@ -153,7 +152,6 @@ print '</form>';
|
||||
|
||||
|
||||
if ($action == 'display' || $action == 'delete') {
|
||||
|
||||
print "<table class='noborder' width='100%'>\n";
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre">'.$langs->trans("AccountAccounting")."</td>";
|
||||
|
||||
@ -170,7 +170,7 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha'))
|
||||
}
|
||||
if (isset($_POST["code"]))
|
||||
{
|
||||
if ($_POST["code"]=='0')
|
||||
if ($_POST["code"]=='0')
|
||||
{
|
||||
$ok=0;
|
||||
setEventMessages($langs->transnoentities('ErrorCodeCantContainZero'), null, 'errors');
|
||||
@ -468,7 +468,7 @@ if ($id)
|
||||
$valuetoshow=$langs->trans($valuetoshow); // try to translate
|
||||
$class="left";
|
||||
if ($fieldlist[$field]=='type') {
|
||||
if ($tabname[$id] == MAIN_DB_PREFIX."c_paiement") {
|
||||
if ($tabname[$id] == MAIN_DB_PREFIX."c_paiement") {
|
||||
$valuetoshow=$form->textwithtooltip($langs->trans("Type"), $langs->trans("TypePaymentDesc"), 2, 1, img_help(1, ''));
|
||||
} else {
|
||||
$valuetoshow=$langs->trans("Type");
|
||||
@ -501,7 +501,7 @@ if ($id)
|
||||
if ($fieldlist[$field]=='range_account') {
|
||||
$valuetoshow=$langs->trans("Comment");
|
||||
}
|
||||
if ($fieldlist[$field]=='category_type') {
|
||||
if ($fieldlist[$field]=='category_type') {
|
||||
$valuetoshow=$langs->trans("Calculated");
|
||||
}
|
||||
|
||||
@ -742,7 +742,6 @@ if ($id)
|
||||
{
|
||||
foreach ($fieldlist as $field => $value)
|
||||
{
|
||||
|
||||
$showfield=1;
|
||||
$class="left";
|
||||
$valuetoshow=$obj->{$fieldlist[$field]};
|
||||
|
||||
@ -99,7 +99,6 @@ print '<input type="hidden" name="action" value="update">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
foreach ($list_account_main as $key) {
|
||||
|
||||
print '<tr class="oddeven value">';
|
||||
// Param
|
||||
$label = $langs->trans($key);
|
||||
|
||||
@ -83,7 +83,6 @@ if (GETPOST('change_chart', 'alpha'))
|
||||
$chartofaccounts = GETPOST('chartofaccounts', 'int');
|
||||
|
||||
if (! empty($chartofaccounts)) {
|
||||
|
||||
if (! dolibarr_set_const($db, 'CHARTOFACCOUNTS', $chartofaccounts, 'chaine', 0, '', $conf->entity)) {
|
||||
$error ++;
|
||||
}
|
||||
@ -144,7 +143,6 @@ print '<input type="hidden" name="action" value="update">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
foreach ($list_account_main as $key) {
|
||||
|
||||
print '<tr class="oddeven value">';
|
||||
// Param
|
||||
$label = $langs->trans($key);
|
||||
@ -172,7 +170,6 @@ print '<br>';
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
foreach ($list_account as $key) {
|
||||
|
||||
print '<tr class="oddeven value">';
|
||||
// Param
|
||||
$label = $langs->trans($key);
|
||||
|
||||
@ -114,7 +114,7 @@ if ($action == 'update') {
|
||||
$error ++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error) {
|
||||
// reload
|
||||
@ -203,7 +203,6 @@ print "</tr>\n";
|
||||
$num = count($main_option);
|
||||
if ($num) {
|
||||
foreach ($main_option as $key) {
|
||||
|
||||
print '<tr class="oddeven value">';
|
||||
|
||||
// Param
|
||||
|
||||
@ -45,7 +45,7 @@ $langs->loadLangs(array("admin","compta"));
|
||||
// Security check
|
||||
if ($user->societe_id > 0)
|
||||
accessforbidden();
|
||||
if (! $user->rights->accounting->fiscalyear) // If we can read accounting records, we should be able to see fiscal year.
|
||||
if (! $user->rights->accounting->fiscalyear->write) // If we can read accounting records, we should be able to see fiscal year.
|
||||
accessforbidden();
|
||||
|
||||
$error = 0;
|
||||
@ -112,7 +112,7 @@ if ($result)
|
||||
$i = 0;
|
||||
|
||||
|
||||
$addbutton.= dolGetButtonTitle($langs->trans('NewFiscalYear'), '', 'fa fa-plus-circle', 'fiscalyear_card.php?action=create', '', $user->rights->accounting->fiscalyear);
|
||||
$addbutton.= dolGetButtonTitle($langs->trans('NewFiscalYear'), '', 'fa fa-plus-circle', 'fiscalyear_card.php?action=create', '', $user->rights->accounting->fiscalyear->write);
|
||||
|
||||
|
||||
$title = $langs->trans('AccountingPeriods');
|
||||
|
||||
@ -33,7 +33,7 @@ $langs->loadLangs(array("admin","compta"));
|
||||
// Security check
|
||||
if ($user->societe_id > 0)
|
||||
accessforbidden();
|
||||
if (empty($user->rights->accounting->fiscalyear))
|
||||
if (empty($user->rights->accounting->fiscalyear->write))
|
||||
accessforbidden();
|
||||
|
||||
$error = 0;
|
||||
@ -300,7 +300,7 @@ if ($action == 'create')
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
if (! empty($user->rights->accounting->fiscalyear))
|
||||
if (! empty($user->rights->accounting->fiscalyear->write))
|
||||
{
|
||||
/*
|
||||
* Barre d'actions
|
||||
|
||||
@ -32,7 +32,7 @@ $langs->loadLangs(array("admin","compta"));
|
||||
// Security check
|
||||
if ($user->societe_id > 0)
|
||||
accessforbidden();
|
||||
if (! $user->rights->accounting->fiscalyear)
|
||||
if (! $user->rights->accounting->fiscalyear->write)
|
||||
accessforbidden();
|
||||
|
||||
$id = GETPOST('id', 'int');
|
||||
|
||||
@ -609,7 +609,6 @@ if ($id)
|
||||
$langs->load("accountancy");
|
||||
foreach ($fieldlist as $field => $value)
|
||||
{
|
||||
|
||||
$showfield=1;
|
||||
$class="left";
|
||||
$valuetoshow=$obj->{$fieldlist[$field]};
|
||||
|
||||
@ -117,7 +117,6 @@ if ($action == 'update') {
|
||||
);
|
||||
|
||||
if (in_array($accounting_product_mode, $accounting_product_modes)) {
|
||||
|
||||
if (! dolibarr_set_const($db, 'ACCOUNTING_PRODUCT_MODE', $accounting_product_mode, 'chaine', 0, '', $conf->entity)) {
|
||||
$error ++;
|
||||
}
|
||||
@ -129,7 +128,6 @@ if ($action == 'update') {
|
||||
if (! empty($btn_changeaccount)) {
|
||||
//$msg = '<div><span class="accountingprocessing">' . $langs->trans("Processing") . '...</span></div>';
|
||||
if (! empty($chk_prod)) {
|
||||
|
||||
$accounting = new AccountingAccount($db);
|
||||
|
||||
//$msg .= '<div><span class="accountingprocessing">' . count($chk_prod) . ' ' . $langs->trans("SelectedLines") . '</span></div>';
|
||||
|
||||
@ -105,7 +105,6 @@ if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
while ( $i < $num ) {
|
||||
|
||||
$row = $db->fetch_row($resql);
|
||||
|
||||
print '<tr class="oddeven"><td width="14%">' . length_accountg($row[0]) . '</td>';
|
||||
|
||||
@ -83,7 +83,6 @@ $object = new BookKeeping($db);
|
||||
*/
|
||||
|
||||
if ($action == "confirm_update") {
|
||||
|
||||
$error = 0;
|
||||
|
||||
if ((floatval($debit) != 0.0) && (floatval($credit) != 0.0)) {
|
||||
@ -585,7 +584,6 @@ if ($action == 'create')
|
||||
if ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
} else {
|
||||
|
||||
print load_fiche_titre($langs->trans("ListeMvts"), '', '');
|
||||
|
||||
print '<form action="' . $_SERVER["PHP_SELF"] . '?piece_num=' . $object->piece_num . '" method="post">';
|
||||
@ -601,7 +599,6 @@ if ($action == 'create')
|
||||
|
||||
print "<table class=\"noborder\" width=\"100%\">";
|
||||
if (count($object->linesmvt) > 0) {
|
||||
|
||||
$total_debit = 0;
|
||||
$total_credit = 0;
|
||||
|
||||
|
||||
@ -155,6 +155,12 @@ $arrayfields=array(
|
||||
|
||||
if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING)) unset($arrayfields['t.lettering_code']);
|
||||
|
||||
$listofformat=AccountancyExport::getType();
|
||||
$formatexportset = $conf->global->ACCOUNTING_EXPORT_MODELCSV;
|
||||
if (empty($listofformat[$formatexportset])) $formatexportset = 1;
|
||||
|
||||
$error = 0;
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
@ -310,7 +316,6 @@ if (empty($reshook))
|
||||
}
|
||||
|
||||
if ($action == 'delbookkeeping' && $user->rights->accounting->mouvements->supprimer) {
|
||||
|
||||
$import_key = GETPOST('importkey', 'alpha');
|
||||
|
||||
if (! empty($import_key)) {
|
||||
@ -325,7 +330,6 @@ if ($action == 'delbookkeeping' && $user->rights->accounting->mouvements->suppri
|
||||
}
|
||||
}
|
||||
if ($action == 'delbookkeepingyearconfirm' && $user->rights->accounting->mouvements->supprimer_tous) {
|
||||
|
||||
$delyear = GETPOST('delyear', 'int');
|
||||
if ($delyear==-1) {
|
||||
$delyear=0;
|
||||
@ -356,7 +360,6 @@ if ($action == 'delbookkeepingyearconfirm' && $user->rights->accounting->mouveme
|
||||
}
|
||||
}
|
||||
if ($action == 'delmouvconfirm' && $user->rights->accounting->mouvements->supprimer) {
|
||||
|
||||
$mvt_num = GETPOST('mvt_num', 'int');
|
||||
|
||||
if (! empty($mvt_num)) {
|
||||
@ -373,10 +376,96 @@ if ($action == 'delmouvconfirm' && $user->rights->accounting->mouvements->suppri
|
||||
exit;
|
||||
}
|
||||
}
|
||||
if ($action == 'setreexport') {
|
||||
$setreexport = GETPOST('value', 'int');
|
||||
if (! dolibarr_set_const($db, "ACCOUNTING_REEXPORT", $setreexport, 'yesno', 0, '', $conf->entity)) $error++;
|
||||
|
||||
if (! $error) {
|
||||
if ($conf->global->ACCOUNTING_REEXPORT == 1) {
|
||||
setEventMessages($langs->trans("ExportOfPiecesAlreadyExportedIsEnable"), null, 'mesgs');
|
||||
} else {
|
||||
setEventMessages($langs->trans("ExportOfPiecesAlreadyExportedIsDisable"), null, 'mesgs');
|
||||
}
|
||||
} else {
|
||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
// Build and execute select (used by page and export action)
|
||||
// must de set after the action that set $filter
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
$sql = 'SELECT';
|
||||
$sql .= ' t.rowid,';
|
||||
$sql .= " t.doc_date,";
|
||||
$sql .= " t.doc_type,";
|
||||
$sql .= " t.doc_ref,";
|
||||
$sql .= " t.fk_doc,";
|
||||
$sql .= " t.fk_docdet,";
|
||||
$sql .= " t.thirdparty_code,";
|
||||
$sql .= " t.subledger_account,";
|
||||
$sql .= " t.subledger_label,";
|
||||
$sql .= " t.numero_compte,";
|
||||
$sql .= " t.label_compte,";
|
||||
$sql .= " t.label_operation,";
|
||||
$sql .= " t.debit,";
|
||||
$sql .= " t.credit,";
|
||||
$sql .= " t.lettering_code,";
|
||||
$sql .= " t.montant,";
|
||||
$sql .= " t.sens,";
|
||||
$sql .= " t.fk_user_author,";
|
||||
$sql .= " t.import_key,";
|
||||
$sql .= " t.code_journal,";
|
||||
$sql .= " t.journal_label,";
|
||||
$sql .= " t.piece_num,";
|
||||
$sql .= " t.date_creation,";
|
||||
$sql .= " t.tms as date_modification,";
|
||||
$sql .= " t.date_export";
|
||||
$sql .= ' FROM ' . MAIN_DB_PREFIX . $object->table_element . ' as t';
|
||||
// Manage filter
|
||||
$sqlwhere = array ();
|
||||
if (count($filter) > 0) {
|
||||
foreach ($filter as $key => $value) {
|
||||
if ($key == 't.doc_date') {
|
||||
$sqlwhere[] = $key . '=\'' . $db->idate($value) . '\'';
|
||||
} elseif ($key == 't.doc_date>=' || $key == 't.doc_date<=') {
|
||||
$sqlwhere[] = $key . '\'' . $db->idate($value) . '\'';
|
||||
} elseif ($key == 't.numero_compte>=' || $key == 't.numero_compte<=' || $key == 't.subledger_account>=' || $key == 't.subledger_account<=') {
|
||||
$sqlwhere[] = $key . '\'' . $db->escape($value) . '\'';
|
||||
} elseif ($key == 't.fk_doc' || $key == 't.fk_docdet' || $key == 't.piece_num') {
|
||||
$sqlwhere[] = $key . '=' . $value;
|
||||
} elseif ($key == 't.subledger_account' || $key == 't.numero_compte') {
|
||||
$sqlwhere[] = $key . ' LIKE \'' . $db->escape($value) . '%\'';
|
||||
} elseif ($key == 't.date_creation>=' || $key == 't.date_creation<=') {
|
||||
$sqlwhere[] = $key . '\'' . $db->idate($value) . '\'';
|
||||
} elseif ($key == 't.tms>=' || $key == 't.tms<=') {
|
||||
$sqlwhere[] = $key . '\'' . $db->idate($value) . '\'';
|
||||
} elseif ($key == 't.date_export>=' || $key == 't.date_export<=') {
|
||||
$sqlwhere[] = $key . '\'' . $db->idate($value) . '\'';
|
||||
} elseif ($key == 't.credit' || $key == 't.debit') {
|
||||
$sqlwhere[] = natural_search($key, $value, 1, 1);
|
||||
} else {
|
||||
$sqlwhere[] = natural_search($key, $value, 0, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
$sql.= ' WHERE t.entity IN (' . getEntity('accountancy') . ')';
|
||||
if ($conf->global->ACCOUNTING_REEXPORT == 0) {
|
||||
$sql .= " AND t.date_export IS NULL";
|
||||
}
|
||||
if (count($sqlwhere) > 0) {
|
||||
$sql .= ' AND ' . implode(' AND ', $sqlwhere);
|
||||
}
|
||||
if (! empty($sortfield)) {
|
||||
$sql .= $db->order($sortfield, $sortorder);
|
||||
}
|
||||
//print $sql;
|
||||
|
||||
|
||||
// Export into a file with format defined into setup (FEC, CSV, ...)
|
||||
// Must be after definition of $sql
|
||||
if ($action == 'export_file' && $user->rights->accounting->mouvements->export) {
|
||||
|
||||
// TODO Replace the fetchAll + ->export later that consume too much memory on large export with the query($sql) and loop on each line to export them.
|
||||
$result = $object->fetchAll($sortorder, $sortfield, 0, 0, $filter, 'AND', $conf->global->ACCOUNTING_REEXPORT);
|
||||
|
||||
if ($result < 0)
|
||||
@ -387,55 +476,54 @@ if ($action == 'export_file' && $user->rights->accounting->mouvements->export) {
|
||||
{
|
||||
// Export files
|
||||
$accountancyexport = new AccountancyExport($db);
|
||||
$accountancyexport->export($object->lines);
|
||||
$accountancyexport->export($object->lines, $formatexportset);
|
||||
|
||||
if (! empty($accountancyexport->errors))
|
||||
{
|
||||
setEventMessages('', $accountancyexport->errors, 'errors');
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
// Specify as export : update field date_export
|
||||
// TODO Move in class bookKeeping
|
||||
$error=0;
|
||||
$db->begin();
|
||||
|
||||
if (is_array($object->lines)) {
|
||||
foreach ($object->lines as $movement) {
|
||||
if (is_array($object->lines))
|
||||
{
|
||||
foreach ($object->lines as $movement)
|
||||
{
|
||||
$now = dol_now();
|
||||
|
||||
$sql = " UPDATE " . MAIN_DB_PREFIX . "accounting_bookkeeping";
|
||||
$sql .= " SET date_export = '" . $db->idate($now) . "'";
|
||||
$sql .= " WHERE rowid = " . $movement->id;
|
||||
|
||||
dol_syslog("/accountancy/bookeeping/list.php Function export_file Specify movements as exported sql=" . $sql, LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
$db->commit();
|
||||
// setEventMessages($langs->trans("AllExportedMovementsWereRecordedAsExported"), null, 'mesgs');
|
||||
} else {
|
||||
$db->rollback();
|
||||
// setEventMessages($langs->trans("NotAllExportedMovementsCouldBeRecordedAsExported"), null, 'errors');
|
||||
if (! $result)
|
||||
{
|
||||
$error++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$db->commit();
|
||||
// setEventMessages($langs->trans("AllExportedMovementsWereRecordedAsExported"), null, 'mesgs');
|
||||
}
|
||||
else
|
||||
{
|
||||
$error++;
|
||||
$db->rollback();
|
||||
setEventMessages($langs->trans("NotAllExportedMovementsCouldBeRecordedAsExported"), null, 'errors');
|
||||
}
|
||||
}
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'setreexport') {
|
||||
$export = 0;
|
||||
$setreexport = GETPOST('value', 'int');
|
||||
if (! dolibarr_set_const($db, "ACCOUNTING_REEXPORT", $setreexport, 'yesno', 0, '', $conf->entity)) $error++;
|
||||
|
||||
if (! $error) {
|
||||
if ($conf->global->ACCOUNTING_REEXPORT == 1) {
|
||||
setEventMessages($langs->trans("ExportOfPiecesAlreadyExportedIsEnable"), null, 'mesgs');
|
||||
} else {
|
||||
setEventMessages($langs->trans("ExportOfPiecesAlreadyExportedIsDisable"), null, 'mesgs');
|
||||
}
|
||||
} else {
|
||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* View
|
||||
@ -443,31 +531,49 @@ if ($action == 'setreexport') {
|
||||
|
||||
$title_page = $langs->trans("Bookkeeping");
|
||||
|
||||
llxHeader('', $title_page);
|
||||
|
||||
// List
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
$nbtotalofrecords = $object->fetchAll($sortorder, $sortfield, 0, 0, $filter, 'AND', $conf->global->ACCOUNTING_REEXPORT);
|
||||
if ($nbtotalofrecords < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
{
|
||||
$resql = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($resql);
|
||||
if (($page * $limit) > $nbtotalofrecords) // if total of record found is smaller than page * limit, goto and load page 0
|
||||
{
|
||||
$page = 0;
|
||||
$offset = 0;
|
||||
}
|
||||
}
|
||||
// if total of record found is smaller than limit, no need to do paging and to restart another select with limits set.
|
||||
if (is_numeric($nbtotalofrecords) && $limit > $nbtotalofrecords)
|
||||
{
|
||||
$num = $nbtotalofrecords;
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql.= $db->plimit($limit+1, $offset);
|
||||
|
||||
// TODO Do not use this
|
||||
$result = $object->fetchAll($sortorder, $sortfield, $limit, $offset, $filter, 'AND', $conf->global->ACCOUNTING_REEXPORT);
|
||||
if ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$resql=$db->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
dol_print_error($db);
|
||||
exit;
|
||||
}
|
||||
|
||||
$num = $db->num_rows($resql);
|
||||
}
|
||||
|
||||
$num=count($object->lines);
|
||||
|
||||
// Output page
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
llxHeader('', $title_page);
|
||||
|
||||
|
||||
if ($action == 'delmouv') {
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?mvt_num='.GETPOST('mvt_num').$param, $langs->trans('DeleteMvt'), $langs->trans('ConfirmDeleteMvtPartial'), 'delmouvconfirm', '', 0, 1);
|
||||
print $formconfirm;
|
||||
}
|
||||
if ($action == 'delbookkeepingyear') {
|
||||
|
||||
$form_question = array ();
|
||||
$delyear = GETPOST('delyear');
|
||||
$deljournal = GETPOST('deljournal');
|
||||
@ -510,9 +616,6 @@ print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
||||
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||
|
||||
$button .= '<a class="butAction" title="" name="button_export_file" href="'.$_SERVER["PHP_SELF"].'?action=export_file'.($param?'&'.$param:'').'">';
|
||||
|
||||
$listofformat=AccountancyExport::getType();
|
||||
if (count($filter)) $buttonLabel = $langs->trans("ExportFilteredList");
|
||||
else $buttonLabel = $langs->trans("ExportList");
|
||||
|
||||
@ -524,13 +627,13 @@ if (! empty($conf->global->ACCOUNTING_REEXPORT)) {
|
||||
}
|
||||
$newcardbutton.= '<span class="valignmiddle marginrightonly">'.$langs->trans("IncludeDocsAlreadyExported").'</span>';
|
||||
|
||||
$newcardbutton.= dolGetButtonTitle($buttonLabel, $langs->trans("ExportFilteredList").' ('.$listofformat[$conf->global->ACCOUNTING_EXPORT_MODELCSV].')', 'fa fa-file-export paddingleft', $_SERVER["PHP_SELF"].'?action=export_file'.($param?'&'.$param:''), $user->rights->accounting->mouvements->export);
|
||||
$newcardbutton.= dolGetButtonTitle($buttonLabel, $langs->trans("ExportFilteredList").' ('.$listofformat[$formatexportset].')', 'fa fa-file-export paddingleft', $_SERVER["PHP_SELF"].'?action=export_file'.($param?'&'.$param:''), $user->rights->accounting->mouvements->export);
|
||||
|
||||
$newcardbutton.= dolGetButtonTitle($langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft', DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?'.$param);
|
||||
|
||||
$newcardbutton.= dolGetButtonTitle($langs->trans('NewAccountingMvt'), '', 'fa fa-plus-circle paddingleft', './card.php?action=create', '', $user->rights->accounting->mouvements->creer);
|
||||
|
||||
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $result, $nbtotalofrecords, 'title_accountancy', 0, $newcardbutton, '', $limit);
|
||||
print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy', 0, $newcardbutton, '', $limit);
|
||||
|
||||
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
|
||||
$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
||||
@ -650,7 +753,6 @@ if (! empty($arrayfields['t.code_journal']['checked']))
|
||||
print '<td class="liste_titre center"><input type="text" name="search_ledger_code" size="3" value="' . $search_ledger_code . '"></td>';
|
||||
}
|
||||
|
||||
|
||||
// Fields from hook
|
||||
$parameters=array('arrayfields'=>$arrayfields);
|
||||
$reshook=$hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook
|
||||
@ -727,171 +829,200 @@ print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
if ($num > 0)
|
||||
$line = new BookKeepingLine();
|
||||
|
||||
// Loop on record
|
||||
// --------------------------------------------------------------------
|
||||
$i=0;
|
||||
$totalarray=array();
|
||||
while ($i < min($num, $limit))
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
if (empty($obj)) break; // Should not happen
|
||||
|
||||
$line->id = $obj->rowid;
|
||||
$line->doc_date = $db->jdate($obj->doc_date);
|
||||
$line->doc_type = $obj->doc_type;
|
||||
$line->doc_ref = $obj->doc_ref;
|
||||
$line->fk_doc = $obj->fk_doc;
|
||||
$line->fk_docdet = $obj->fk_docdet;
|
||||
$line->thirdparty_code = $obj->thirdparty_code;
|
||||
$line->subledger_account = $obj->subledger_account;
|
||||
$line->subledger_label = $obj->subledger_label;
|
||||
$line->numero_compte = $obj->numero_compte;
|
||||
$line->label_compte = $obj->label_compte;
|
||||
$line->label_operation = $obj->label_operation;
|
||||
$line->debit = $obj->debit;
|
||||
$line->credit = $obj->credit;
|
||||
$line->montant = $obj->montant;
|
||||
$line->sens = $obj->sens;
|
||||
$line->lettering_code = $obj->lettering_code;
|
||||
$line->fk_user_author = $obj->fk_user_author;
|
||||
$line->import_key = $obj->import_key;
|
||||
$line->code_journal = $obj->code_journal;
|
||||
$line->journal_label = $obj->journal_label;
|
||||
$line->piece_num = $obj->piece_num;
|
||||
$line->date_creation = $db->jdate($obj->date_creation);
|
||||
$line->date_modification = $db->jdate($obj->date_modification);
|
||||
$line->date_export = $db->jdate($obj->date_export);
|
||||
|
||||
$total_debit += $line->debit;
|
||||
$total_credit += $line->credit;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
// Piece number
|
||||
if (! empty($arrayfields['t.piece_num']['checked']))
|
||||
{
|
||||
print '<td>';
|
||||
$object->id = $line->id;
|
||||
$object->piece_num = $line->piece_num;
|
||||
print $object->getNomUrl(1, '', 0, '', 1);
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Document date
|
||||
if (! empty($arrayfields['t.doc_date']['checked']))
|
||||
{
|
||||
print '<td class="center">' . dol_print_date($line->doc_date, 'day') . '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Document ref
|
||||
if (! empty($arrayfields['t.doc_ref']['checked']))
|
||||
{
|
||||
print '<td class="nowrap">' . $line->doc_ref . '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Account number
|
||||
if (! empty($arrayfields['t.numero_compte']['checked']))
|
||||
{
|
||||
print '<td>' . length_accountg($line->numero_compte) . '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Subledger account
|
||||
if (! empty($arrayfields['t.subledger_account']['checked']))
|
||||
{
|
||||
print '<td>' . length_accounta($line->subledger_account) . '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Label operation
|
||||
if (! empty($arrayfields['t.label_operation']['checked']))
|
||||
{
|
||||
print '<td>' . $line->label_operation . '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Amount debit
|
||||
if (! empty($arrayfields['t.debit']['checked']))
|
||||
{
|
||||
print '<td class="nowrap right">' . ($line->debit ? price($line->debit) : ''). '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! $i) $totalarray['totaldebitfield']=$totalarray['nbfield'];
|
||||
$totalarray['totaldebit'] += $line->debit;
|
||||
}
|
||||
|
||||
// Amount credit
|
||||
if (! empty($arrayfields['t.credit']['checked']))
|
||||
{
|
||||
print '<td class="nowrap right">' . ($line->credit ? price($line->credit) : '') . '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! $i) $totalarray['totalcreditfield']=$totalarray['nbfield'];
|
||||
$totalarray['totalcredit'] += $line->credit;
|
||||
}
|
||||
|
||||
// Lettering code
|
||||
if (! empty($arrayfields['t.lettering_code']['checked']))
|
||||
{
|
||||
print '<td class="center">' . $line->lettering_code . '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Journal code
|
||||
if (! empty($arrayfields['t.code_journal']['checked']))
|
||||
{
|
||||
$accountingjournal = new AccountingJournal($db);
|
||||
$result = $accountingjournal->fetch('', $line->code_journal);
|
||||
$journaltoshow = (($result > 0)?$accountingjournal->getNomUrl(0, 0, 0, '', 0) : $line->code_journal);
|
||||
print '<td class="center">' . $journaltoshow . '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Fields from hook
|
||||
$parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj);
|
||||
$reshook=$hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
// Creation operation date
|
||||
if (! empty($arrayfields['t.date_creation']['checked']))
|
||||
{
|
||||
print '<td class="center">' . dol_print_date($line->date_creation, 'dayhour') . '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Modification operation date
|
||||
if (! empty($arrayfields['t.tms']['checked']))
|
||||
{
|
||||
print '<td class="center">' . dol_print_date($line->date_modification, 'dayhour') . '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Exported operation date
|
||||
if (! empty($arrayfields['t.date_export']['checked']))
|
||||
{
|
||||
print '<td align="center">' . dol_print_date($line->date_export, 'dayhour') . '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Action column
|
||||
print '<td class="nowraponall center">';
|
||||
if (empty($line->date_export)) {
|
||||
if ($user->rights->accounting->mouvements->creer) {
|
||||
print '<a href="' . DOL_URL_ROOT . '/accountancy/bookkeeping/card.php?piece_num=' . $line->piece_num . $param . '&page=' . $page . ($sortfield ? '&sortfield=' . $sortfield : '') . ($sortorder ? '&sortorder=' . $sortorder : '') . '">' . img_edit() . '</a>';
|
||||
}
|
||||
if ($user->rights->accounting->mouvements->supprimer) {
|
||||
print ' <a href="' . $_SERVER['PHP_SELF'] . '?action=delmouv&mvt_num=' . $line->piece_num . $param . '&page=' . $page . ($sortfield ? '&sortfield=' . $sortfield : '') . ($sortorder ? '&sortorder=' . $sortorder : '') . '">' . img_delete() . '</a>';
|
||||
}
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
// Show total line
|
||||
if (isset($totalarray['totaldebitfield']) || isset($totalarray['totalcreditfield']))
|
||||
{
|
||||
$i=0;
|
||||
$totalarray=array();
|
||||
while ($i < min($num, $limit))
|
||||
print '<tr class="liste_total">';
|
||||
while ($i < $totalarray['nbfield'])
|
||||
{
|
||||
$line = $object->lines[$i];
|
||||
|
||||
$total_debit += $line->debit;
|
||||
$total_credit += $line->credit;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
// Piece number
|
||||
if (! empty($arrayfields['t.piece_num']['checked']))
|
||||
{
|
||||
print '<td>';
|
||||
$object->id = $line->id;
|
||||
$object->piece_num = $line->piece_num;
|
||||
print $object->getNomUrl(1, '', 0, '', 1);
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Document date
|
||||
if (! empty($arrayfields['t.doc_date']['checked']))
|
||||
{
|
||||
print '<td class="center">' . dol_print_date($line->doc_date, 'day') . '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Document ref
|
||||
if (! empty($arrayfields['t.doc_ref']['checked']))
|
||||
{
|
||||
print '<td class="nowrap">' . $line->doc_ref . '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Account number
|
||||
if (! empty($arrayfields['t.numero_compte']['checked']))
|
||||
{
|
||||
print '<td>' . length_accountg($line->numero_compte) . '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Subledger account
|
||||
if (! empty($arrayfields['t.subledger_account']['checked']))
|
||||
{
|
||||
print '<td>' . length_accounta($line->subledger_account) . '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Label operation
|
||||
if (! empty($arrayfields['t.label_operation']['checked']))
|
||||
{
|
||||
print '<td>' . $line->label_operation . '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Amount debit
|
||||
if (! empty($arrayfields['t.debit']['checked']))
|
||||
{
|
||||
print '<td class="nowrap right">' . ($line->debit ? price($line->debit) : ''). '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! $i) $totalarray['totaldebitfield']=$totalarray['nbfield'];
|
||||
$totalarray['totaldebit'] += $line->debit;
|
||||
}
|
||||
|
||||
// Amount credit
|
||||
if (! empty($arrayfields['t.credit']['checked']))
|
||||
{
|
||||
print '<td class="nowrap right">' . ($line->credit ? price($line->credit) : '') . '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
if (! $i) $totalarray['totalcreditfield']=$totalarray['nbfield'];
|
||||
$totalarray['totalcredit'] += $line->credit;
|
||||
}
|
||||
|
||||
// Lettering code
|
||||
if (! empty($arrayfields['t.lettering_code']['checked']))
|
||||
{
|
||||
print '<td class="center">' . $line->lettering_code . '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Journal code
|
||||
if (! empty($arrayfields['t.code_journal']['checked']))
|
||||
{
|
||||
$accountingjournal = new AccountingJournal($db);
|
||||
$result = $accountingjournal->fetch('', $line->code_journal);
|
||||
$journaltoshow = (($result > 0)?$accountingjournal->getNomUrl(0, 0, 0, '', 0) : $line->code_journal);
|
||||
print '<td class="center">' . $journaltoshow . '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Fields from hook
|
||||
$parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj);
|
||||
$reshook=$hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
// Creation operation date
|
||||
if (! empty($arrayfields['t.date_creation']['checked']))
|
||||
{
|
||||
print '<td class="center">' . dol_print_date($line->date_creation, 'dayhour') . '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Modification operation date
|
||||
if (! empty($arrayfields['t.tms']['checked']))
|
||||
{
|
||||
print '<td class="center">' . dol_print_date($line->date_modification, 'dayhour') . '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Exported operation date
|
||||
if (! empty($arrayfields['t.date_export']['checked']))
|
||||
{
|
||||
print '<td align="center">' . dol_print_date($line->date_export, 'dayhour') . '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Action column
|
||||
print '<td class="nowraponall center">';
|
||||
if (empty($line->date_export)) {
|
||||
if ($user->rights->accounting->mouvements->creer) {
|
||||
print '<a href="' . DOL_URL_ROOT . '/accountancy/bookkeeping/card.php?piece_num=' . $line->piece_num . $param . '&page=' . $page . ($sortfield ? '&sortfield=' . $sortfield : '') . ($sortorder ? '&sortorder=' . $sortorder : '') . '">' . img_edit() . '</a>';
|
||||
}
|
||||
if ($user->rights->accounting->mouvements->supprimer) {
|
||||
print ' <a href="' . $_SERVER['PHP_SELF'] . '?action=delmouv&mvt_num=' . $line->piece_num . $param . '&page=' . $page . ($sortfield ? '&sortfield=' . $sortfield : '') . ($sortorder ? '&sortorder=' . $sortorder : '') . '">' . img_delete() . '</a>';
|
||||
}
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
// Show total line
|
||||
if (isset($totalarray['totaldebitfield']) || isset($totalarray['totalcreditfield']))
|
||||
{
|
||||
$i=0;
|
||||
print '<tr class="liste_total">';
|
||||
while ($i < $totalarray['nbfield'])
|
||||
if ($i == 1)
|
||||
{
|
||||
$i++;
|
||||
if ($i == 1)
|
||||
{
|
||||
if ($num < $limit && empty($offset)) print '<td class="left">'.$langs->trans("Total").'</td>';
|
||||
else print '<td class="left">'.$langs->trans("Totalforthispage").'</td>';
|
||||
}
|
||||
elseif ($totalarray['totaldebitfield'] == $i) print '<td class="nowrap right">'.price($totalarray['totaldebit']).'</td>';
|
||||
elseif ($totalarray['totalcreditfield'] == $i) print '<td class="nowrap right">'.price($totalarray['totalcredit']).'</td>';
|
||||
else print '<td></td>';
|
||||
if ($num < $limit && empty($offset)) print '<td class="left">'.$langs->trans("Total").'</td>';
|
||||
else print '<td class="left">'.$langs->trans("Totalforthispage").'</td>';
|
||||
}
|
||||
$parameters=array('arrayfields'=>$arrayfields, 'sql'=>$sql);
|
||||
$reshook=$hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
print '</tr>';
|
||||
elseif ($totalarray['totaldebitfield'] == $i) print '<td class="nowrap right">'.price($totalarray['totaldebit']).'</td>';
|
||||
elseif ($totalarray['totalcreditfield'] == $i) print '<td class="nowrap right">'.price($totalarray['totalcredit']).'</td>';
|
||||
else print '<td></td>';
|
||||
}
|
||||
$parameters=array('arrayfields'=>$arrayfields, 'sql'=>$sql);
|
||||
$reshook=$hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
|
||||
|
||||
print "</table>";
|
||||
print '</div>';
|
||||
|
||||
|
||||
@ -179,7 +179,6 @@ if (! empty($search_credit)) {
|
||||
|
||||
|
||||
if ($action == 'delmouvconfirm') {
|
||||
|
||||
$mvt_num = GETPOST('mvt_num', 'int');
|
||||
|
||||
if (! empty($mvt_num)) {
|
||||
@ -229,7 +228,6 @@ if ($action == 'delmouv') {
|
||||
print $formconfirm;
|
||||
}
|
||||
if ($action == 'delbookkeepingyear') {
|
||||
|
||||
$form_question = array ();
|
||||
$delyear = GETPOST('delyear');
|
||||
|
||||
@ -338,7 +336,6 @@ while ($i < min($num, $limit))
|
||||
|
||||
// Is it a break ?
|
||||
if ($accountg != $displayed_account_number || ! isset($displayed_account_number)) {
|
||||
|
||||
// Affiche un Sous-Total par compte comptable
|
||||
if (isset($displayed_account_number)) {
|
||||
print '<tr class="liste_total"><td class="right" colspan="5">'.$langs->trans("SubTotal").':</td><td class="nowrap right">'.price($sous_total_debit).'</td><td class="nowrap right">'.price($sous_total_credit).'</td>';
|
||||
|
||||
@ -100,7 +100,6 @@ if ($result < 0)
|
||||
*/
|
||||
|
||||
if ($action == 'lettering') {
|
||||
|
||||
$result = $lettering->updateLettering($toselect);
|
||||
|
||||
if ($result < 0) {
|
||||
@ -251,7 +250,6 @@ if ($resql) {
|
||||
$tmp = '';
|
||||
|
||||
while ( $obj = $db->fetch_object($resql) ) {
|
||||
|
||||
if ($tmp != $obj->lettering_code || empty($tmp)) $tmp = $obj->lettering_code;
|
||||
/*if ($tmp != $obj->lettering_code || empty($obj->lettering_code))*/ $solde += ($obj->credit - $obj->debit);
|
||||
|
||||
|
||||
@ -99,7 +99,6 @@ if ($result<0)
|
||||
* Action
|
||||
*/
|
||||
if ($action == 'lettering') {
|
||||
|
||||
$result = $lettering->updateLettering($toselect);
|
||||
|
||||
if ($result < 0) {
|
||||
@ -248,7 +247,6 @@ if ($resql) {
|
||||
$solde = 0;
|
||||
$tmp = '';
|
||||
while ($obj = $db->fetch_object($resql)) {
|
||||
|
||||
if ($tmp != $obj->lettering_code || empty($tmp)) $tmp = $obj->lettering_code;
|
||||
/*if ($tmp != $obj->lettering_code || empty($obj->lettering_code))*/ $solde += ($obj->credit - $obj->debit);
|
||||
|
||||
|
||||
@ -224,22 +224,23 @@ class AccountancyExport
|
||||
/**
|
||||
* Function who chose which export to use with the default config, and make the export into a file
|
||||
*
|
||||
* @param array $TData data
|
||||
* @return void
|
||||
* @param array $TData Array with data
|
||||
* @param int $formatexportset Id of export format
|
||||
* @return void
|
||||
*/
|
||||
public function export(&$TData)
|
||||
public function export(&$TData, $formatexportset)
|
||||
{
|
||||
global $conf, $langs;
|
||||
global $search_date_end; // Used into /accountancy/tpl/export_journal.tpl.php
|
||||
|
||||
// Define name of file to save
|
||||
$filename = 'general_ledger-'.$this->getFormatCode($conf->global->ACCOUNTING_EXPORT_MODELCSV);
|
||||
$filename = 'general_ledger-'.$this->getFormatCode($formatexportset);
|
||||
$type_export = 'general_ledger';
|
||||
|
||||
include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php';
|
||||
|
||||
|
||||
switch ($conf->global->ACCOUNTING_EXPORT_MODELCSV) {
|
||||
switch ($formatexportset) {
|
||||
case self::$EXPORT_TYPE_CONFIGURABLE :
|
||||
$this->exportConfigurable($TData);
|
||||
break;
|
||||
@ -548,7 +549,6 @@ class AccountancyExport
|
||||
$end_line = "\n";
|
||||
|
||||
foreach ($objectLines as $line) {
|
||||
|
||||
$date = dol_print_date($line->doc_date, '%d%m%Y');
|
||||
|
||||
print $line->id . $separator;
|
||||
@ -584,7 +584,6 @@ class AccountancyExport
|
||||
$end_line = "\n";
|
||||
|
||||
foreach ($objectLines as $line) {
|
||||
|
||||
$date = dol_print_date($line->doc_date, '%d%m%Y');
|
||||
|
||||
print $line->piece_num . $separator;
|
||||
@ -624,7 +623,6 @@ class AccountancyExport
|
||||
$end_line = "\n";
|
||||
|
||||
foreach ($objectLines as $line) {
|
||||
|
||||
$date = dol_print_date($line->doc_date, '%d/%m/%Y');
|
||||
|
||||
print $date . $separator;
|
||||
@ -933,7 +931,6 @@ class AccountancyExport
|
||||
$end_line = "\r\n";
|
||||
|
||||
foreach ($objectLines as $line) {
|
||||
|
||||
$date_document = dol_print_date($line->doc_date, '%Y%m%d');
|
||||
$date_creation = dol_print_date($line->date_creation, '%Y%m%d');
|
||||
|
||||
@ -1086,7 +1083,6 @@ class AccountancyExport
|
||||
print $end_line;
|
||||
|
||||
foreach($objectLines as $line) {
|
||||
|
||||
$date = dol_print_date($line->doc_date, '%Y%m%d');
|
||||
print $date . $separator; //Date
|
||||
|
||||
|
||||
@ -407,7 +407,6 @@ class AccountingAccount extends CommonObject
|
||||
$result = $this->checkUsage();
|
||||
|
||||
if ($result > 0) {
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
// if (! $error) {
|
||||
|
||||
@ -1584,9 +1584,7 @@ class BookKeeping extends CommonObject
|
||||
dol_syslog(get_class($this) . "::" . __METHOD__, LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
|
||||
while ($obj = $this->db->fetch_object($result)) {
|
||||
|
||||
$line = new BookKeepingLine();
|
||||
|
||||
$line->id = $obj->rowid;
|
||||
@ -1966,6 +1964,7 @@ class BookKeepingLine
|
||||
public $credit;
|
||||
public $montant;
|
||||
public $sens;
|
||||
public $lettering_code;
|
||||
|
||||
/**
|
||||
* @var int ID
|
||||
@ -1977,4 +1976,6 @@ class BookKeepingLine
|
||||
public $journal_label;
|
||||
public $piece_num;
|
||||
public $date_creation;
|
||||
public $date_modification;
|
||||
public $date_export;
|
||||
}
|
||||
|
||||
@ -149,7 +149,6 @@ class Lettering extends BookKeeping
|
||||
}
|
||||
}
|
||||
} elseif ($obj->type == 'payment') {
|
||||
|
||||
$sql = 'SELECT DISTINCT bk.rowid, fac.ref, fac.ref, pay.fk_bank, fac.rowid as fact_id';
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "facture fac ";
|
||||
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "paiement_facture as payfac ON payfac.fk_facture=fac.rowid";
|
||||
|
||||
0
htdocs/accountancy/closure/index.html
Normal file
0
htdocs/accountancy/closure/index.html
Normal file
132
htdocs/accountancy/closure/index.php
Normal file
132
htdocs/accountancy/closure/index.php
Normal file
@ -0,0 +1,132 @@
|
||||
<?php
|
||||
/* Copyright (C) 2019 Open-DSI <support@open-dsi.fr>
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/accountancy/closure/index.php
|
||||
* \ingroup Accountancy
|
||||
* \brief Home closure page
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("compta","bills","other","main","accountancy"));
|
||||
|
||||
// Security check
|
||||
if (empty($conf->accounting->enabled)) {
|
||||
accessforbidden();
|
||||
}
|
||||
if ($user->societe_id > 0)
|
||||
accessforbidden();
|
||||
if (! $user->rights->accounting->fiscalyear->write)
|
||||
accessforbidden();
|
||||
|
||||
|
||||
$month_start= ($conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START):1);
|
||||
if (GETPOST("year", 'int')) $year_start = GETPOST("year", 'int');
|
||||
else
|
||||
{
|
||||
$year_start = dol_print_date(dol_now(), '%Y');
|
||||
if (dol_print_date(dol_now(), '%m') < $month_start) $year_start--; // If current month is lower that starting fiscal month, we start last year
|
||||
}
|
||||
$year_end = $year_start + 1;
|
||||
$month_end = $month_start - 1;
|
||||
if ($month_end < 1)
|
||||
{
|
||||
$month_end = 12;
|
||||
$year_end--;
|
||||
}
|
||||
$search_date_start = dol_mktime(0, 0, 0, $month_start, 1, $year_start);
|
||||
$search_date_end = dol_get_last_day($year_end, $month_end);
|
||||
$year_current = $year_start;
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader('', $langs->trans("Closure"));
|
||||
|
||||
$textprevyear = '<a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_current - 1) . '">' . img_previous() . '</a>';
|
||||
$textnextyear = ' <a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_current + 1) . '">' . img_next() . '</a>';
|
||||
|
||||
|
||||
print load_fiche_titre($langs->trans("Closure") . " " . $textprevyear . " " . $langs->trans("Year") . " " . $year_start . " " . $textnextyear, '', 'title_accountancy');
|
||||
|
||||
print $langs->trans("DescClosure") . '<br>';
|
||||
print '<br>';
|
||||
|
||||
|
||||
$y = $year_current;
|
||||
|
||||
$buttonbind = '<a class="butAction" href="./validate.php">' . $langs->trans("ValidateMovements") . '</a>';
|
||||
|
||||
print_barre_liste($langs->trans("OverviewOfMovementsNotValidated"), '', '', '', '', '', '', -1, '', '', 0, $buttonbind, '', 0, 1, 1);
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START?$conf->global->SOCIETE_FISCAL_MONTH_START:1) - 1;
|
||||
if ($j > 12) $j-=12;
|
||||
print '<td width="60" class="right">' . $langs->trans('MonthShort' . str_pad($j, 2, '0', STR_PAD_LEFT)) . '</td>';
|
||||
}
|
||||
print '<td width="60" class="right"><b>' . $langs->trans("Total") . '</b></td></tr>';
|
||||
|
||||
$sql = "SELECT COUNT(b.rowid) as detail,";
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START?$conf->global->SOCIETE_FISCAL_MONTH_START:1) - 1;
|
||||
if ($j > 12) $j-=12;
|
||||
$sql .= " SUM(" . $db->ifsql('MONTH(b.doc_date)=' . $j, '1', '0') . ") AS month" . str_pad($j, 2, '0', STR_PAD_LEFT) . ",";
|
||||
}
|
||||
$sql .= " COUNT(b.rowid) as total";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as b";
|
||||
$sql .= " WHERE b.doc_date >= '" . $db->idate($search_date_start) . "'";
|
||||
$sql .= " AND b.doc_date <= '" . $db->idate($search_date_end) . "'";
|
||||
$sql .= " AND b.entity IN (" . getEntity('bookkeeping', 0) . ")"; // We don't share object for accountancy
|
||||
|
||||
dol_syslog('htdocs/accountancy/closure/index.php sql=' . $sql, LOG_DEBUG);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
while ( $row = $db->fetch_row($resql)) {
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
print '<td class="right">' . $row[$i] . '</td>';
|
||||
}
|
||||
print '<td class="right"><b>' . $row[13] . '</b></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
$db->free($resql);
|
||||
} else {
|
||||
print $db->lasterror(); // Show last sql error
|
||||
}
|
||||
print "</table>\n";
|
||||
print '</div>';
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
$db->close();
|
||||
158
htdocs/accountancy/closure/validate.php
Normal file
158
htdocs/accountancy/closure/validate.php
Normal file
@ -0,0 +1,158 @@
|
||||
<?php
|
||||
/* Copyright (C) 2019 Open-DSI <support@open-dsi.fr>
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/accountancy/closure/validate.php
|
||||
* \ingroup Accountancy
|
||||
* \brief Validate entries page
|
||||
*/
|
||||
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/accountancy/class/bookkeeping.class.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("compta","bills","other","main","accountancy"));
|
||||
|
||||
// Security check
|
||||
if (empty($conf->accounting->enabled)) {
|
||||
accessforbidden();
|
||||
}
|
||||
if ($user->societe_id > 0)
|
||||
accessforbidden();
|
||||
if (! $user->rights->accounting->fiscalyear->write)
|
||||
accessforbidden();
|
||||
|
||||
|
||||
$month_start= ($conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START):1);
|
||||
if (GETPOST("year", 'int')) $year_start = GETPOST("year", 'int');
|
||||
else
|
||||
{
|
||||
$year_start = dol_print_date(dol_now(), '%Y');
|
||||
if (dol_print_date(dol_now(), '%m') < $month_start) $year_start--; // If current month is lower that starting fiscal month, we start last year
|
||||
}
|
||||
$year_end = $year_start + 1;
|
||||
$month_end = $month_start - 1;
|
||||
if ($month_end < 1)
|
||||
{
|
||||
$month_end = 12;
|
||||
$year_end--;
|
||||
}
|
||||
$search_date_start = dol_mktime(0, 0, 0, $month_start, 1, $year_start);
|
||||
$search_date_end = dol_get_last_day($year_end, $month_end);
|
||||
$year_current = $year_start;
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if ($action == 'validate')
|
||||
{
|
||||
$now = dol_now();
|
||||
|
||||
// Update database
|
||||
$db->begin();
|
||||
$sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_bookkeeping as b";
|
||||
$sql .= " SET b.date_validated = '" . $db->idate($now) . "'";
|
||||
$sql .= ' WHERE b.date_validated IS NULL';
|
||||
|
||||
dol_syslog("htdocs/accountancy/closure/validate.php validate", LOG_DEBUG);
|
||||
$resql = $db->query($sql);
|
||||
if (! $resql1) {
|
||||
$error ++;
|
||||
$db->rollback();
|
||||
setEventMessages($db->lasterror(), null, 'errors');
|
||||
} else {
|
||||
$db->commit();
|
||||
}
|
||||
// End clean database
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader('', $langs->trans("ValidateMovements"));
|
||||
|
||||
$textprevyear = '<a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_current - 1) . '">' . img_previous() . '</a>';
|
||||
$textnextyear = ' <a href="' . $_SERVER["PHP_SELF"] . '?year=' . ($year_current + 1) . '">' . img_next() . '</a>';
|
||||
|
||||
|
||||
print load_fiche_titre($langs->trans("ValidateMovements") . " " . $textprevyear . " " . $langs->trans("Year") . " " . $year_start . " " . $textnextyear, '', 'title_accountancy');
|
||||
|
||||
print $langs->trans("DescValidateMovements") . '<br>';
|
||||
print '<br>';
|
||||
|
||||
|
||||
$y = $year_current;
|
||||
|
||||
print_barre_liste($langs->trans("SelectMonthAndValidate"), '', '', '', '', '', '', -1, '', '', 0, '', 'class="right"', 0, 1, 1);
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="oddeven">';
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START?$conf->global->SOCIETE_FISCAL_MONTH_START:1) - 1;
|
||||
if ($j > 12) $j-=12;
|
||||
print '<td class="center">' . $langs->trans('MonthShort' . str_pad($j, 2, '0', STR_PAD_LEFT)) . '</td>';
|
||||
}
|
||||
print '<td><b>' . $langs->trans("Total") . '</b></td></tr>';
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
$sql = "SELECT COUNT(b.rowid) as detail,";
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
$j = $i + ($conf->global->SOCIETE_FISCAL_MONTH_START?$conf->global->SOCIETE_FISCAL_MONTH_START:1) - 1;
|
||||
if ($j > 12) $j-=12;
|
||||
$sql .= " SUM(" . $db->ifsql('MONTH(b.doc_date)=' . $j, '1', '0') . ") AS month" . str_pad($j, 2, '0', STR_PAD_LEFT) . ",";
|
||||
}
|
||||
$sql .= " COUNT(b.rowid) as total";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as b";
|
||||
$sql .= " WHERE b.doc_date >= '" . $db->idate($search_date_start) . "'";
|
||||
$sql .= " AND b.doc_date <= '" . $db->idate($search_date_end) . "'";
|
||||
$sql .= " AND b.entity IN (" . getEntity('bookkeeping', 0) . ")"; // We don't share object for accountancy
|
||||
|
||||
dol_syslog('htdocs/accountancy/closure/index.php sql=' . $sql, LOG_DEBUG);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
while ( $row = $db->fetch_row($resql)) {
|
||||
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
print '<td class="nowrap center">' . $row[$i] . '<br><br>';
|
||||
print '<input id="cb'.$row[$i].'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$row[$i].'"'.($selected?' checked="checked"':'').'>';
|
||||
print '</td>' ;
|
||||
}
|
||||
print '<td class="valigntop"><b>' . $row[13] . '</b></td>';
|
||||
}
|
||||
print
|
||||
$db->free($resql);
|
||||
} else {
|
||||
print $db->lasterror(); // Show last sql error
|
||||
}
|
||||
print '</tr>';
|
||||
print "</table>\n";
|
||||
|
||||
print '<br><div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?month=' . $year_current . '&action=validate"">' . $langs->trans("ValidateMovements") . '</a></div>';
|
||||
print '</div>';
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
$db->close();
|
||||
@ -112,7 +112,6 @@ if (! empty($id)) {
|
||||
$i = 0;
|
||||
|
||||
if ($num_lines) {
|
||||
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
print '<form action="' . $_SERVER["PHP_SELF"] . '?id=' . $id . '" method="post">' . "\n";
|
||||
|
||||
@ -97,7 +97,6 @@ if ($action == 'clean' || $action == 'validatehistory')
|
||||
}
|
||||
|
||||
if ($action == 'validatehistory') {
|
||||
|
||||
$error = 0;
|
||||
$db->begin();
|
||||
|
||||
@ -195,7 +194,6 @@ if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
while ( $row = $db->fetch_row($resql)) {
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
if ($row[0] == 'tobind')
|
||||
{
|
||||
@ -271,7 +269,6 @@ if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
while ( $row = $db->fetch_row($resql)) {
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
if ($row[0] == 'tobind')
|
||||
{
|
||||
@ -398,7 +395,6 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange.
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
while ($row = $db->fetch_row($resql)) {
|
||||
|
||||
print '<tr><td>' . $row[0] . '</td>';
|
||||
for($i = 1; $i <= 12; $i ++) {
|
||||
print '<td class="nowrap right">' . price(price2num($row[$i])) . '</td>';
|
||||
|
||||
@ -94,7 +94,6 @@ if ($action == 'clean' || $action == 'validatehistory')
|
||||
}
|
||||
|
||||
if ($action == 'validatehistory') {
|
||||
|
||||
$error = 0;
|
||||
$db->begin();
|
||||
|
||||
@ -187,7 +186,6 @@ if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
while ( $row = $db->fetch_row($resql)) {
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
if ($row[0] == 'tobind')
|
||||
{
|
||||
@ -259,7 +257,6 @@ if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
while ( $row = $db->fetch_row($resql)) {
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
if ($row[0] == 'tobind')
|
||||
{
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2013-2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2013-2019 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
|
||||
* Copyright (C) 2017-2018 Frédéric France <frederic.france@netlogic.fr>
|
||||
@ -167,7 +167,6 @@ $journal_label = $accountingjournalstatic->label;
|
||||
dol_syslog("accountancy/journal/bankjournal.php", LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
|
||||
$num = $db->num_rows($result);
|
||||
//print $sql;
|
||||
|
||||
@ -268,10 +267,8 @@ if ($result) {
|
||||
|
||||
// get_url may return -1 which is not traversable
|
||||
if (is_array($links) && count($links) > 0) {
|
||||
|
||||
// Now loop on each link of record in bank.
|
||||
foreach ($links as $key => $val) {
|
||||
|
||||
if (in_array($links[$key]['type'], array('sc', 'payment_sc', 'payment', 'payment_supplier', 'payment_vat', 'payment_expensereport', 'banktransfert', 'payment_donation', 'member', 'payment_loan', 'payment_salary', 'payment_various')))
|
||||
{
|
||||
// So we excluded 'company' and 'user' here. We want only payment lines
|
||||
@ -387,7 +384,9 @@ if ($result) {
|
||||
$tabpay[$obj->rowid]["paymentvariousid"] = $paymentvariousstatic->id;
|
||||
$paymentvariousstatic->fetch($paymentvariousstatic->id);
|
||||
$account_various = (! empty($paymentvariousstatic->accountancy_code) ? $paymentvariousstatic->accountancy_code : 'NotDefined'); // NotDefined is a reserved word
|
||||
$tabtp[$obj->rowid][$account_various] += $obj->amount;
|
||||
$account_subledger = (! empty($paymentvariousstatic->subledger_account) ? $paymentvariousstatic->subledger_account : ''); // NotDefined is a reserved word
|
||||
$tabpay[$obj->rowid]["account_various"] = $account_various;
|
||||
$tabtp[$obj->rowid][$account_subledger] += $obj->amount;
|
||||
} elseif ($links[$key]['type'] == 'payment_loan') {
|
||||
$paymentloanstatic->id = $links[$key]['url_id'];
|
||||
$paymentloanstatic->ref = $links[$key]['url_id'];
|
||||
@ -660,11 +659,11 @@ if (! $error && $action == 'writebookkeeping') {
|
||||
$accountingaccount->fetch(null, $k, true);
|
||||
$bookkeeping->label_compte = $accountingaccount->label;
|
||||
} elseif ($tabtype[$key] == 'payment_various') {
|
||||
$bookkeeping->subledger_account = '';
|
||||
$bookkeeping->subledger_label = '';
|
||||
$bookkeeping->numero_compte = $k;
|
||||
$bookkeeping->subledger_account = $k;
|
||||
$bookkeeping->subledger_label = $tabcompany[$key]['name'];
|
||||
$bookkeeping->numero_compte = $tabpay[$obj->rowid]["account_various"];
|
||||
|
||||
$accountingaccount->fetch(null, $k, true);
|
||||
$accountingaccount->fetch(null, $bookkeeping->numero_compte, true);
|
||||
$bookkeeping->label_compte = $accountingaccount->label;
|
||||
} elseif ($tabtype[$key] == 'banktransfert') {
|
||||
$bookkeeping->subledger_account = '';
|
||||
@ -1123,6 +1122,7 @@ if (empty($action) || $action == 'view') {
|
||||
if ($tabtype[$key] == 'payment_salary') $account_ledger = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT;
|
||||
if ($tabtype[$key] == 'payment_vat') $account_ledger = $conf->global->ACCOUNTING_VAT_PAY_ACCOUNT;
|
||||
if ($tabtype[$key] == 'member') $account_ledger = $conf->global->ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT;
|
||||
if ($tabtype[$key] == 'payment_various') $account_ledger = $tabpay[$key]["account_various"];
|
||||
$accounttoshow = length_accounta($account_ledger);
|
||||
if (empty($accounttoshow) || $accounttoshow == 'NotDefined')
|
||||
{
|
||||
@ -1156,7 +1156,7 @@ if (empty($action) || $action == 'view') {
|
||||
// Subledger account
|
||||
print "<td>";
|
||||
|
||||
if (in_array($tabtype[$key], array('payment', 'payment_supplier', 'payment_expensereport', 'payment_salary'))) // Type of payment with subledger
|
||||
if (in_array($tabtype[$key], array('payment', 'payment_supplier', 'payment_expensereport', 'payment_salary', 'payment_various'))) // Type of payment with subledger
|
||||
{
|
||||
$accounttoshowsubledger = length_accounta($k);
|
||||
if ($accounttoshow != $accounttoshowsubledger)
|
||||
|
||||
@ -115,7 +115,6 @@ $sql .= " ORDER BY er.date_debut";
|
||||
dol_syslog('accountancy/journal/expensereportsjournal.php', LOG_DEBUG);
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
|
||||
$taber = array ();
|
||||
$tabht = array ();
|
||||
$tabtva = array ();
|
||||
@ -485,7 +484,6 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
|
||||
}
|
||||
|
||||
if (empty($action) || $action == 'view') {
|
||||
|
||||
llxHeader('', $langs->trans("ExpenseReportsJournal"));
|
||||
|
||||
$nom = $langs->trans("ExpenseReportsJournal") . ' | ' . $accountingjournalstatic->getNomUrl(0, 1, 1, '', 1);
|
||||
|
||||
@ -242,7 +242,6 @@ if ($action == 'writebookkeeping') {
|
||||
$invoicestatic = new FactureFournisseur($db);
|
||||
|
||||
foreach ($tabfac as $key => $val) { // Loop on each invoice
|
||||
|
||||
$errorforline = 0;
|
||||
|
||||
$totalcredit = 0;
|
||||
@ -716,7 +715,6 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
|
||||
}
|
||||
|
||||
if (empty($action) || $action == 'view') {
|
||||
|
||||
llxHeader('', $langs->trans("PurchasesJournal"));
|
||||
|
||||
$nom = $langs->trans("PurchasesJournal") . ' | ' . $accountingjournalstatic->getNomUrl(0, 1, 1, '', 1);
|
||||
|
||||
@ -255,7 +255,6 @@ if ($action == 'writebookkeeping') {
|
||||
$invoicestatic = new Facture($db);
|
||||
|
||||
foreach ($tabfac as $key => $val) { // Loop on each invoice
|
||||
|
||||
$errorforline = 0;
|
||||
|
||||
$totalcredit = 0;
|
||||
@ -654,7 +653,6 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
|
||||
|
||||
|
||||
if (empty($action) || $action == 'view') {
|
||||
|
||||
llxHeader('', $langs->trans("SellsJournal"));
|
||||
|
||||
$nom = $langs->trans("SellsJournal") . ' | ' . $accountingjournalstatic->getNomUrl(0, 1, 1, '', 1);
|
||||
|
||||
@ -95,7 +95,6 @@ if ($action == 'clean' || $action == 'validatehistory')
|
||||
}
|
||||
|
||||
if ($action == 'validatehistory') {
|
||||
|
||||
$error = 0;
|
||||
$db->begin();
|
||||
|
||||
@ -187,7 +186,6 @@ if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
while ( $row = $db->fetch_row($resql)) {
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
if ($row[0] == 'tobind')
|
||||
{
|
||||
@ -258,7 +256,6 @@ if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
while ( $row = $db->fetch_row($resql)) {
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
if ($row[0] == 'tobind')
|
||||
{
|
||||
|
||||
@ -2367,7 +2367,6 @@ class Adherent extends CommonObject
|
||||
$langs->load("orders");
|
||||
|
||||
if (! dol_strlen($modele)) {
|
||||
|
||||
$modele = 'standard';
|
||||
|
||||
if ($this->modelpdf) {
|
||||
|
||||
@ -383,7 +383,6 @@ class AdherentType extends CommonObject
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
|
||||
$this->description = $this->db->escape($this->note);
|
||||
|
||||
// Multilangs
|
||||
|
||||
@ -90,7 +90,6 @@ if ($id > 0)
|
||||
$result=$membert->fetch($object->typeid);
|
||||
if ($result > 0)
|
||||
{
|
||||
|
||||
// Build file list
|
||||
$filearray=dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC), 1);
|
||||
$totalsize=0;
|
||||
|
||||
@ -39,7 +39,6 @@ $langs->load("members");
|
||||
$total=0;
|
||||
foreach($linkedObjectBlock as $key => $objectlink)
|
||||
{
|
||||
|
||||
?>
|
||||
<tr class="oddeven" >
|
||||
<td><?php echo $langs->trans("Subscription"); ?></td>
|
||||
|
||||
@ -94,7 +94,6 @@ $hookmanager->initHooks(array('membertypecard','globalcard'));
|
||||
*/
|
||||
|
||||
if ($cancel) {
|
||||
|
||||
$action='';
|
||||
|
||||
if (! empty($backtopage)) {
|
||||
|
||||
@ -268,7 +268,6 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
|
||||
// Active
|
||||
if (in_array($name, $def))
|
||||
{
|
||||
|
||||
print '<td class="center">'."\n";
|
||||
if ($conf->global->ACTION_EVENT_ADDON_PDF != "$name")
|
||||
{
|
||||
@ -363,7 +362,6 @@ print '</td></tr>'."\n";
|
||||
|
||||
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE))
|
||||
{
|
||||
|
||||
print '<!-- AGENDA_USE_EVENT_TYPE_DEFAULT -->';
|
||||
print '<tr class="oddeven">'."\n";
|
||||
print '<td>'.$langs->trans("AGENDA_USE_EVENT_TYPE_DEFAULT").'</td>'."\n";
|
||||
|
||||
@ -253,7 +253,6 @@ $i = 0;
|
||||
|
||||
$nbofbank = count($bankorder);
|
||||
while ($i < $nbofbank) {
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>' . $bankorder[$i][0] . "</td><td>\n";
|
||||
print $bankorder[$i][1];
|
||||
@ -341,7 +340,6 @@ foreach ($dirmodels as $reldir) {
|
||||
|
||||
foreach ($filelist as $file) {
|
||||
if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) {
|
||||
|
||||
if (file_exists($dir . '/' . $file)) {
|
||||
$name = substr($file, 4, dol_strlen($file) - 16);
|
||||
$classname = substr($file, 0, dol_strlen($file) - 12);
|
||||
|
||||
@ -319,7 +319,6 @@ print '</tr>';
|
||||
// Chemin du binaire genbarcode sous linux
|
||||
if (! isset($_SERVER['WINDIR']))
|
||||
{
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("GenbarcodeLocation").'</td>';
|
||||
print '<td width="60" class="center">';
|
||||
@ -335,7 +334,6 @@ if (! isset($_SERVER['WINDIR']))
|
||||
// Module products
|
||||
if (! empty($conf->product->enabled))
|
||||
{
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("SetDefaultBarcodeTypeProducts").'</td>';
|
||||
print '<td width="60" class="right">';
|
||||
@ -346,7 +344,6 @@ if (! empty($conf->product->enabled))
|
||||
// Module thirdparty
|
||||
if (! empty($conf->societe->enabled))
|
||||
{
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("SetDefaultBarcodeTypeThirdParties").'</td>';
|
||||
print '<td width="60" class="right">';
|
||||
|
||||
@ -255,7 +255,6 @@ foreach ($dirmodels as $reldir)
|
||||
|
||||
if ($module->isEnabled())
|
||||
{
|
||||
|
||||
print '<tr class="oddeven"><td>'.$module->name."</td><td>\n";
|
||||
print $module->info();
|
||||
print '</td>';
|
||||
@ -381,7 +380,6 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
|
||||
{
|
||||
if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file))
|
||||
{
|
||||
|
||||
if (file_exists($dir.'/'.$file))
|
||||
{
|
||||
$name = substr($file, 4, dol_strlen($file) -16);
|
||||
|
||||
@ -474,7 +474,6 @@ print '</tr>';
|
||||
|
||||
// Activate FileCache - Developement
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL == 2 || ! empty($conf->global->MAIN_ACTIVATE_FILECACHE)) {
|
||||
|
||||
print '<tr class="oddeven"><td width="35%">'.$langs->trans("EnableFileCache").'</td><td>';
|
||||
print $form->selectyesno('MAIN_ACTIVATE_FILECACHE', $conf->global->MAIN_ACTIVATE_FILECACHE, 1);
|
||||
print '</td>';
|
||||
|
||||
@ -282,7 +282,6 @@ foreach ($dirmodels as $reldir)
|
||||
$handle = opendir($dir);
|
||||
if (is_resource($handle))
|
||||
{
|
||||
|
||||
while (($file = readdir($handle))!==false)
|
||||
{
|
||||
if (substr($file, 0, 13) == 'mod_commande_' && substr($file, dol_strlen($file)-3, 3) == 'php')
|
||||
@ -299,7 +298,6 @@ foreach ($dirmodels as $reldir)
|
||||
|
||||
if ($module->isEnabled())
|
||||
{
|
||||
|
||||
print '<tr class="oddeven"><td>'.$module->name."</td><td>\n";
|
||||
print $module->info();
|
||||
print '</td>';
|
||||
@ -423,7 +421,6 @@ foreach ($dirmodels as $reldir)
|
||||
{
|
||||
if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file))
|
||||
{
|
||||
|
||||
if (file_exists($dir.'/'.$file))
|
||||
{
|
||||
$name = substr($file, 4, dol_strlen($file) -16);
|
||||
|
||||
@ -470,7 +470,6 @@ print '</td></tr>'."\n";
|
||||
|
||||
// Barcode
|
||||
if (! empty($conf->barcode->enabled)) {
|
||||
|
||||
print '<tr class="oddeven"><td><label for="barcode">'.$langs->trans("Gencod").'</label></td><td>';
|
||||
print '<input name="barcode" id="barcode" class="minwidth150" value="'. dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_GENCOD) . '"></td></tr>';
|
||||
print '</td></tr>';
|
||||
@ -555,7 +554,6 @@ print '</td></tr>';
|
||||
// ProfID1
|
||||
if ($langs->transcountry("ProfId1", $mysoc->country_code) != '-')
|
||||
{
|
||||
|
||||
print '<tr class="oddeven"><td><label for="profid1">'.$langs->transcountry("ProfId1", $mysoc->country_code).'</label></td><td>';
|
||||
if (! empty($mysoc->country_code))
|
||||
{
|
||||
@ -571,7 +569,6 @@ if ($langs->transcountry("ProfId1", $mysoc->country_code) != '-')
|
||||
// ProfId2
|
||||
if ($langs->transcountry("ProfId2", $mysoc->country_code) != '-')
|
||||
{
|
||||
|
||||
print '<tr class="oddeven"><td><label for="profid2">'.$langs->transcountry("ProfId2", $mysoc->country_code).'</label></td><td>';
|
||||
if (! empty($mysoc->country_code))
|
||||
{
|
||||
@ -587,7 +584,6 @@ if ($langs->transcountry("ProfId2", $mysoc->country_code) != '-')
|
||||
// ProfId3
|
||||
if ($langs->transcountry("ProfId3", $mysoc->country_code) != '-')
|
||||
{
|
||||
|
||||
print '<tr class="oddeven"><td><label for="profid3">'.$langs->transcountry("ProfId3", $mysoc->country_code).'</label></td><td>';
|
||||
if (! empty($mysoc->country_code))
|
||||
{
|
||||
@ -603,7 +599,6 @@ if ($langs->transcountry("ProfId3", $mysoc->country_code) != '-')
|
||||
// ProfId4
|
||||
if ($langs->transcountry("ProfId4", $mysoc->country_code) != '-')
|
||||
{
|
||||
|
||||
print '<tr class="oddeven"><td><label for="profid4">'.$langs->transcountry("ProfId4", $mysoc->country_code).'</label></td><td>';
|
||||
if (! empty($mysoc->country_code))
|
||||
{
|
||||
@ -619,7 +614,6 @@ if ($langs->transcountry("ProfId4", $mysoc->country_code) != '-')
|
||||
// ProfId5
|
||||
if ($langs->transcountry("ProfId5", $mysoc->country_code) != '-')
|
||||
{
|
||||
|
||||
print '<tr class="oddeven"><td><label for="profid5">'.$langs->transcountry("ProfId5", $mysoc->country_code).'</label></td><td>';
|
||||
if (! empty($mysoc->country_code))
|
||||
{
|
||||
@ -635,7 +629,6 @@ if ($langs->transcountry("ProfId5", $mysoc->country_code) != '-')
|
||||
// ProfId6
|
||||
if ($langs->transcountry("ProfId6", $mysoc->country_code) != '-')
|
||||
{
|
||||
|
||||
print '<tr class="oddeven"><td><label for="profid6">'.$langs->transcountry("ProfId6", $mysoc->country_code).'</label></td><td>';
|
||||
if (! empty($mysoc->country_code))
|
||||
{
|
||||
|
||||
@ -68,7 +68,6 @@ if ($action == 'update')
|
||||
|
||||
|
||||
if (in_array($accounting_mode, $accounting_modes)) {
|
||||
|
||||
if (!dolibarr_set_const($db, 'ACCOUNTING_MODE', $accounting_mode, 'chaine', 0, '', $conf->entity)) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
@ -118,7 +118,6 @@ if (! empty($consts) && $action == 'update')
|
||||
// Mass delete
|
||||
if (! empty($consts) && $action == 'delete')
|
||||
{
|
||||
|
||||
$nbdeleted=0;
|
||||
foreach($consts as $const)
|
||||
{
|
||||
|
||||
@ -219,7 +219,6 @@ foreach ($dirmodels as $reldir)
|
||||
$handle = opendir($dir);
|
||||
if (is_resource($handle))
|
||||
{
|
||||
|
||||
while (($file = readdir($handle))!==false)
|
||||
{
|
||||
if (substr($file, 0, 13) == 'mod_contract_' && substr($file, dol_strlen($file)-3, 3) == 'php')
|
||||
@ -236,7 +235,6 @@ foreach ($dirmodels as $reldir)
|
||||
|
||||
if ($module->isEnabled())
|
||||
{
|
||||
|
||||
print '<tr class="oddeven"><td>'.$module->nom."</td><td>\n";
|
||||
print $module->info();
|
||||
print '</td>';
|
||||
@ -359,7 +357,6 @@ foreach ($dirmodels as $reldir)
|
||||
{
|
||||
if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file))
|
||||
{
|
||||
|
||||
if (file_exists($dir.'/'.$file))
|
||||
{
|
||||
$name = substr($file, 4, dol_strlen($file) -16);
|
||||
|
||||
@ -265,7 +265,6 @@ print '<br>';
|
||||
print '<span class="opacitymedium">'.$langs->trans("DescWeather").'</span> ';
|
||||
|
||||
if($action == 'edit') {
|
||||
|
||||
$str_mode_std = $langs->trans('MeteoStdModEnabled').' : '.$langs->trans('MeteoUseMod', $langs->transnoentitiesnoconv('MeteoPercentageMod'));
|
||||
$str_mode_percentage = $langs->trans('MeteoPercentageModEnabled').' : '.$langs->trans('MeteoUseMod', $langs->transnoentitiesnoconv('MeteoStdMod'));
|
||||
if(empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) $str_mode_enabled = $str_mode_std;
|
||||
@ -292,8 +291,6 @@ $text=''; $options='class="valignmiddle" height="60px"';
|
||||
|
||||
|
||||
if ($action == 'edit') {
|
||||
|
||||
|
||||
print '<div id="standard" '.(empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE) ? '' : 'style="display:none;"').'>';
|
||||
|
||||
print '<div>';
|
||||
@ -364,9 +361,7 @@ if ($action == 'edit') {
|
||||
|
||||
<?php
|
||||
} else {
|
||||
|
||||
if(!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) {
|
||||
|
||||
print '<div>';
|
||||
print '<div class="inline-block" style="padding-right: 20px">';
|
||||
print img_weather($text, 0, $options);
|
||||
@ -386,7 +381,6 @@ if ($action == 'edit') {
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
} else {
|
||||
|
||||
print '<div>';
|
||||
print '<div class="inline-block" style="padding-right: 20px">';
|
||||
print img_weather($text, 0, $options);
|
||||
@ -411,11 +405,9 @@ if ($action == 'edit') {
|
||||
print '</div>';
|
||||
|
||||
if($action == 'edit') {
|
||||
|
||||
print '<br><div class="center"><input type="submit" class="button" value="'.$langs->trans("Save").'"></div>';
|
||||
print '<br></form>';
|
||||
} else {
|
||||
|
||||
print '<br><div class="tabsAction">';
|
||||
print '<a class="butAction" href="delais.php?action=edit">'.$langs->trans("Modify").'</a></div>';
|
||||
}
|
||||
|
||||
@ -1740,7 +1740,6 @@ else
|
||||
{
|
||||
if ($showemptyline)
|
||||
{
|
||||
|
||||
print '<tr class="oddeven"><td width="50%"> </td><td> </td><td> </td></tr>';
|
||||
$showemptyline=0;
|
||||
}
|
||||
|
||||
@ -226,7 +226,6 @@ class Dolistore
|
||||
$html .= self::get_categories($cat->id);
|
||||
$html .= "</li>\n";
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -366,7 +366,6 @@ foreach ($dirmodels as $reldir)
|
||||
{
|
||||
if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file))
|
||||
{
|
||||
|
||||
if (file_exists($dir.'/'.$file))
|
||||
{
|
||||
$name = substr($file, 4, dol_strlen($file) -16);
|
||||
|
||||
@ -247,7 +247,6 @@ foreach ($dirmodels as $reldir)
|
||||
|
||||
if ($module->isEnabled())
|
||||
{
|
||||
|
||||
print '<tr class="oddeven"><td>'.$module->nom."</td><td>\n";
|
||||
print $module->info();
|
||||
print '</td>';
|
||||
@ -367,10 +366,8 @@ foreach ($dirmodels as $reldir)
|
||||
{
|
||||
if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file))
|
||||
{
|
||||
|
||||
if (file_exists($dir.'/'.$file))
|
||||
{
|
||||
|
||||
$name = substr($file, 4, dol_strlen($file) -16);
|
||||
$classname = substr($file, 0, dol_strlen($file) -12);
|
||||
|
||||
|
||||
@ -300,7 +300,6 @@ if ($resql)
|
||||
// Logo
|
||||
if ($result > 0 && empty($rss->error))
|
||||
{
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print "<td>".$langs->trans("Logo")."</td>";
|
||||
print '<td>';
|
||||
|
||||
@ -720,7 +720,6 @@ if ($resql)
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
|
||||
$row = $db->fetch_row($resql);
|
||||
|
||||
print '<option value="'.$row[0].'"';
|
||||
|
||||
@ -293,7 +293,6 @@ foreach ($dirmodels as $reldir)
|
||||
$handle = opendir($dir);
|
||||
if (is_resource($handle))
|
||||
{
|
||||
|
||||
while (($file = readdir($handle))!==false)
|
||||
{
|
||||
if (preg_match('/^(mod_.*)\.php$/i', $file, $reg))
|
||||
@ -433,8 +432,6 @@ foreach ($dirmodels as $reldir)
|
||||
{
|
||||
if (file_exists($dir.'/'.$file))
|
||||
{
|
||||
|
||||
|
||||
$name = substr($file, 4, dol_strlen($file) -16);
|
||||
$classname = substr($file, 0, dol_strlen($file) -12);
|
||||
|
||||
|
||||
@ -238,7 +238,6 @@ foreach ($dirmodels as $reldir)
|
||||
|
||||
if ($module->isEnabled())
|
||||
{
|
||||
|
||||
print '<tr class="oddeven"><td>'.$module->nom."</td><td>\n";
|
||||
print $module->info();
|
||||
print '</td>';
|
||||
@ -303,7 +302,6 @@ print '<br>';
|
||||
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
|
||||
{
|
||||
|
||||
/*
|
||||
* Documents models for Holidays
|
||||
*/
|
||||
@ -369,7 +367,6 @@ foreach ($dirmodels as $reldir)
|
||||
{
|
||||
if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file))
|
||||
{
|
||||
|
||||
if (file_exists($dir.'/'.$file))
|
||||
{
|
||||
$name = substr($file, 4, dol_strlen($file) -16);
|
||||
|
||||
@ -172,7 +172,6 @@ if (empty($mysoc->country_code))
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
// Show examples
|
||||
print '<b>'.$langs->trans("ExamplesWithCurrentSetup").":</b><br>\n";
|
||||
|
||||
|
||||
@ -356,8 +356,6 @@ foreach ($dirmodels as $reldir)
|
||||
{
|
||||
if (file_exists($dir.'/'.$file))
|
||||
{
|
||||
|
||||
|
||||
$name = substr($file, 4, dol_strlen($file) -16);
|
||||
$classname = substr($file, 0, dol_strlen($file) -12);
|
||||
|
||||
|
||||
@ -364,7 +364,6 @@ if ($action == 'edit')
|
||||
// ID
|
||||
if (! empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer'))))
|
||||
{
|
||||
|
||||
$mainstmpid=(! empty($conf->global->MAIN_MAIL_SMTPS_ID)?$conf->global->MAIN_MAIL_SMTPS_ID:'');
|
||||
print '<tr class="drag drop oddeven"><td>'.$langs->trans("MAIN_MAIL_SMTPS_ID").'</td><td>';
|
||||
// SuperAdministrator access only
|
||||
@ -384,7 +383,6 @@ if ($action == 'edit')
|
||||
// PW
|
||||
if (! empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE) && in_array($conf->global->MAIN_MAIL_SENDMODE, array('smtps', 'swiftmailer'))))
|
||||
{
|
||||
|
||||
$mainsmtppw=(! empty($conf->global->MAIN_MAIL_SMTPS_PW)?$conf->global->MAIN_MAIL_SMTPS_PW:'');
|
||||
print '<tr class="drag drop oddeven"><td>'.$langs->trans("MAIN_MAIL_SMTPS_PW").'</td><td>';
|
||||
// SuperAdministrator access only
|
||||
|
||||
@ -316,7 +316,6 @@ if ($action == 'edit')
|
||||
// ID
|
||||
if (! empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer'))))
|
||||
{
|
||||
|
||||
$mainstmpid=(! empty($conf->global->MAIN_MAIL_SMTPS_ID_EMAILING)?$conf->global->MAIN_MAIL_SMTPS_ID_EMAILING:'');
|
||||
print '<tr class="drag drop oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTPS_ID").'</td><td>';
|
||||
// SuperAdministrator access only
|
||||
|
||||
@ -323,7 +323,6 @@ if ($action == 'create')
|
||||
$res = $db->query($sql);
|
||||
if ($res)
|
||||
{
|
||||
|
||||
while ($menu = $db->fetch_array($res))
|
||||
{
|
||||
$parent_rowid = $menu['rowid'];
|
||||
|
||||
@ -63,8 +63,6 @@ $dolistore = new Dolistore(false);
|
||||
if (! $user->admin)
|
||||
accessforbidden();
|
||||
|
||||
$specialtostring=array(0=>'common', 1=>'interfaces', 2=>'other', 3=>'functional', 4=>'marketplace');
|
||||
|
||||
$familyinfo=array(
|
||||
'hr'=>array('position'=>'001', 'label'=>$langs->trans("ModuleFamilyHr")),
|
||||
'crm'=>array('position'=>'006', 'label'=>$langs->trans("ModuleFamilyCrm")),
|
||||
@ -190,7 +188,7 @@ if ($action=='install')
|
||||
//var_dump($modulenamedir);
|
||||
if (! dol_is_dir($modulenamedir))
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorModuleFileSeemsToHaveAWrongFormat").'<br>Dir not found: '.$conf->admin->dir_temp.'/'.$tmpdir.'/'.$modulename.'<br>'.$conf->admin->dir_temp.'/'.$tmpdir.'/htdocs/'.$modulename, null, 'errors');
|
||||
setEventMessages($langs->trans("ErrorModuleFileSeemsToHaveAWrongFormat").'<br>'.$langs->trans("ErrorModuleFileSeemsToHaveAWrongFormat2", $modulename, 'htdocs/'.$modulename), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
@ -368,11 +366,8 @@ foreach ($modulesdir as $dir)
|
||||
}
|
||||
}
|
||||
ksort($arrayofnatures);
|
||||
}
|
||||
|
||||
// Define array $categ with categ with at least one qualified module
|
||||
if ($modulequalified > 0)
|
||||
{
|
||||
// Define array $categ with categ with at least one qualified module
|
||||
$filename[$i]= $modName;
|
||||
$modules[$modName] = $objMod;
|
||||
|
||||
@ -400,7 +395,15 @@ foreach ($modulesdir as $dir)
|
||||
$arrayofwarningsext[$modName]=$objMod->warnings_activation_ext;
|
||||
}
|
||||
|
||||
$orders[$i] = $familyinfo[$familykey]['position']."_".$familykey."_".$moduleposition."_".$j; // Sort by family, then by module position then number
|
||||
$familyposition = $familyinfo[$familykey]['position'];
|
||||
if ($external)
|
||||
{
|
||||
// TODO Find a solution so modules with their own family are always at end
|
||||
//var_dump($familyposition);
|
||||
//$familyposition += 100;
|
||||
}
|
||||
|
||||
$orders[$i] = $familyposition."_".$familykey."_".$moduleposition."_".$j; // Sort by family, then by module position then number
|
||||
$dirmod[$i] = $dir;
|
||||
//print $i.'-'.$dirmod[$i].'<br>';
|
||||
// Set categ[$i]
|
||||
@ -527,6 +530,7 @@ if ($mode == 'common')
|
||||
|
||||
print '<div class="clearboth"></div><br>';
|
||||
|
||||
$object=new stdClass();
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('insertExtraHeader', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
@ -538,14 +542,13 @@ if ($mode == 'common')
|
||||
foreach ($orders as $key => $value)
|
||||
{
|
||||
$tab=explode('_', $value);
|
||||
$familyposition=$tab[0]; $familykey=$tab[1]; $module_position=$tab[2]; $numero=$tab[3];
|
||||
$familykey=$tab[1];
|
||||
$module_position=$tab[2];
|
||||
|
||||
$modName = $filename[$key];
|
||||
$objMod = $modules[$modName];
|
||||
$dirofmodule = $dirmod[$key];
|
||||
|
||||
//print $objMod->name." - ".$key." - ".$objMod->version."<br>";
|
||||
//if (($mode != (isset($specialtostring[$special])?$specialtostring[$special]:'unknown') && $mode != 'expdev')
|
||||
if ($mode == 'expdev' && $objMod->version != 'development' && $objMod->version != 'experimental') continue; // Discard if not for current tab
|
||||
|
||||
if (! $objMod->getName())
|
||||
@ -729,7 +732,6 @@ if ($mode == 'common')
|
||||
print '</a>';
|
||||
}
|
||||
else {
|
||||
|
||||
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$objMod->numero.'&module_position='.$module_position.'&action=reset&value=' . $modName . '&mode=' . $mode .'&confirm=yes' . $param . '">';
|
||||
print img_picto($langs->trans("Activated"), 'switch_on');
|
||||
print '</a>';
|
||||
|
||||
@ -164,7 +164,6 @@ print '<td>';
|
||||
$i=0;
|
||||
foreach($listofnotifiedevents as $notifiedevent)
|
||||
{
|
||||
|
||||
$label=$langs->trans("Notify_".$notifiedevent['code']); //!=$langs->trans("Notify_".$notifiedevent['code'])?$langs->trans("Notify_".$notifiedevent['code']):$notifiedevent['label'];
|
||||
$elementLabel = $langs->trans(ucfirst($notifiedevent['elementtype']));
|
||||
|
||||
@ -209,7 +208,6 @@ $listofnotifiedevents=$notificationtrigger->getListOfManagedEvents();
|
||||
|
||||
foreach($listofnotifiedevents as $notifiedevent)
|
||||
{
|
||||
|
||||
$label=$langs->trans("Notify_".$notifiedevent['code']); //!=$langs->trans("Notify_".$notifiedevent['code'])?$langs->trans("Notify_".$notifiedevent['code']):$notifiedevent['label'];
|
||||
|
||||
$elementLabel = $langs->trans(ucfirst($notifiedevent['elementtype']));
|
||||
|
||||
@ -122,7 +122,6 @@ dol_fiche_head($head, 'tokengeneration', '', -1, 'technic');
|
||||
|
||||
if ($mode == 'setup' && $user->admin)
|
||||
{
|
||||
|
||||
print $langs->trans("OAuthSetupForLogin")."<br><br>\n";
|
||||
|
||||
foreach($list as $key)
|
||||
@ -381,7 +380,6 @@ if ($mode == 'userconf' && $user->admin)
|
||||
$sql = 'SELECT p.rowid, p.printer_name, p.printer_location, p.printer_id, p.copy, p.module, p.driver, p.userid, u.login FROM '.MAIN_DB_PREFIX.'printing as p, '.MAIN_DB_PREFIX.'user as u WHERE p.userid=u.rowid';
|
||||
$resql = $db->query($sql);
|
||||
while ($row=$db->fetch_array($resql)) {
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$row['login'].'</td>';
|
||||
print '<td>'.$row['module'].'</td>';
|
||||
|
||||
@ -294,7 +294,6 @@ foreach ($dirmodels as $reldir)
|
||||
|
||||
if ($module->isEnabled())
|
||||
{
|
||||
|
||||
print '<tr class="oddeven"><td>'.$module->nom."</td><td>\n";
|
||||
print $module->info();
|
||||
print '</td>';
|
||||
@ -596,7 +595,6 @@ if (empty($conf->facture->enabled))
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
|
||||
$row = $db->fetch_row($resql);
|
||||
|
||||
print '<option value="'.$row[0].'"';
|
||||
|
||||
@ -371,7 +371,6 @@ foreach ($dirmodels as $reldir)
|
||||
{
|
||||
if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file))
|
||||
{
|
||||
|
||||
if (file_exists($dir.'/'.$file))
|
||||
{
|
||||
$name = substr($file, 4, dol_strlen($file) -16);
|
||||
|
||||
@ -289,8 +289,6 @@ print '</form>';
|
||||
//if($conf->global->MAIN_SECURITY_DISABLEFORGETPASSLINK == 1)
|
||||
// Patter for Password Perso
|
||||
if ($conf->global->USER_PASSWORD_GENERATED == "Perso"){
|
||||
|
||||
|
||||
$tabConf = explode(";", $conf->global->USER_PASSWORD_PATTERN);
|
||||
print '<br>';
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
@ -207,7 +207,6 @@ if ($action == 'edit')
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if (! count($listofmethods)) print '<div class="warning">'.$langs->trans("NoSmsEngine", '<a target="_blank" href="http://www.dolistore.com/search.php?orderby=position&orderway=desc&search_query=smsmanager">DoliStore</a>').'</div>';
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
@ -237,7 +237,6 @@ foreach ($dirmodels as $reldir)
|
||||
$handle = opendir($dir);
|
||||
if (is_resource($handle))
|
||||
{
|
||||
|
||||
while (($file = readdir($handle))!==false)
|
||||
{
|
||||
if (substr($file, 0, 24) == 'mod_facture_fournisseur_' && substr($file, dol_strlen($file)-3, 3) == 'php')
|
||||
@ -365,7 +364,6 @@ foreach ($dirmodels as $reldir)
|
||||
|
||||
if (is_dir($dir))
|
||||
{
|
||||
|
||||
$handle=opendir($dir);
|
||||
|
||||
|
||||
|
||||
@ -267,7 +267,6 @@ foreach ($dirmodels as $reldir)
|
||||
$handle = opendir($dir);
|
||||
if (is_resource($handle))
|
||||
{
|
||||
|
||||
while (($file = readdir($handle))!==false)
|
||||
{
|
||||
if (substr($file, 0, 25) == 'mod_commande_fournisseur_' && substr($file, dol_strlen($file)-3, 3) == 'php')
|
||||
|
||||
@ -213,7 +213,6 @@ foreach ($dirmodels as $reldir)
|
||||
$handle = opendir($dir);
|
||||
if (is_resource($handle))
|
||||
{
|
||||
|
||||
while (($file = readdir($handle))!==false)
|
||||
{
|
||||
if (! is_dir($dir.$file) || (substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS'))
|
||||
@ -337,7 +336,6 @@ foreach ($dirmodels as $reldir)
|
||||
|
||||
if (is_dir($dir))
|
||||
{
|
||||
|
||||
$handle=opendir($dir);
|
||||
|
||||
|
||||
|
||||
@ -246,7 +246,6 @@ foreach ($dirmodels as $reldir)
|
||||
$handle = opendir($dir);
|
||||
if (is_resource($handle))
|
||||
{
|
||||
|
||||
while (($file = readdir($handle))!==false)
|
||||
{
|
||||
if (substr($file, 0, 22) == 'mod_supplier_proposal_' && substr($file, dol_strlen($file)-3, 3) == 'php')
|
||||
@ -263,7 +262,6 @@ foreach ($dirmodels as $reldir)
|
||||
|
||||
if ($module->isEnabled())
|
||||
{
|
||||
|
||||
print '<tr class="oddeven"><td>'.$module->nom."</td><td>\n";
|
||||
print $module->info();
|
||||
print '</td>';
|
||||
@ -537,7 +535,6 @@ print '</form>';
|
||||
|
||||
if ($conf->banque->enabled)
|
||||
{
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_PROPOSAL").'</td><td> </td><td class="right">';
|
||||
if (! empty($conf->use_javascript_ajax))
|
||||
@ -559,7 +556,6 @@ if ($conf->banque->enabled)
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_PROPOSAL").'</td><td> </td><td align="center">'.$langs->trans('NotAvailable').'</td></tr>';
|
||||
}
|
||||
|
||||
@ -50,7 +50,6 @@ foreach ($dirsyslogs as $reldir) {
|
||||
$handle = opendir($newdir);
|
||||
|
||||
if (is_resource($handle)) {
|
||||
|
||||
while (($file = readdir($handle)) !== false) {
|
||||
if (substr($file, 0, 11) == 'mod_syslog_' && substr($file, dol_strlen($file) - 3, 3) == 'php') {
|
||||
$file = substr($file, 0, dol_strlen($file) - 4);
|
||||
|
||||
@ -202,7 +202,6 @@ else
|
||||
if ($resql)
|
||||
{
|
||||
while ($row = $db->fetch_row($resql)) {
|
||||
|
||||
$rescount = $db->query("SELECT COUNT(*) FROM " . $row[0]);
|
||||
if ($rescount) {
|
||||
$row_count = $db->fetch_row($rescount);
|
||||
|
||||
@ -214,7 +214,6 @@ foreach ($dirmodels as $reldir) {
|
||||
if (is_dir($dir)) {
|
||||
$handle = opendir($dir);
|
||||
if (is_resource($handle)) {
|
||||
|
||||
while (($file = readdir($handle)) !== false) {
|
||||
if (preg_match('/^(mod_.*)\.php$/i', $file, $reg)) {
|
||||
$file = $reg[1];
|
||||
|
||||
@ -108,7 +108,6 @@ if ($action == 'update')
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
$db->rollback();
|
||||
if ($db->lasterrno() == 'DB_ERROR_RECORD_ALREADY_EXISTS')
|
||||
{
|
||||
@ -158,7 +157,6 @@ if ($action == 'add')
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
$db->rollback();
|
||||
if ($db->lasterrno() == 'DB_ERROR_RECORD_ALREADY_EXISTS')
|
||||
{
|
||||
|
||||
@ -239,7 +239,6 @@ foreach ($dirmodels as $reldir)
|
||||
{
|
||||
if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file))
|
||||
{
|
||||
|
||||
if (file_exists($dir.'/'.$file))
|
||||
{
|
||||
$name = substr($file, 4, dol_strlen($file) -16);
|
||||
|
||||
@ -186,7 +186,6 @@ foreach ($dirmodels as $reldir)
|
||||
{
|
||||
if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file))
|
||||
{
|
||||
|
||||
if (file_exists($dir.'/'.$file))
|
||||
{
|
||||
$name = substr($file, 4, dol_strlen($file) -16);
|
||||
|
||||
@ -572,7 +572,6 @@ if ($id)
|
||||
// Lines with values
|
||||
while ($i < $num)
|
||||
{
|
||||
|
||||
$obj = $db->fetch_object($resql);
|
||||
//print_r($obj);
|
||||
print '<tr class="oddeven" id="rowid-'.$obj->rowid.'">';
|
||||
|
||||
@ -83,7 +83,6 @@ $hookmanager->initHooks(array('assettypecard','globalcard'));
|
||||
*/
|
||||
|
||||
if ($cancel) {
|
||||
|
||||
$action='';
|
||||
|
||||
if (! empty($backtopage))
|
||||
|
||||
@ -197,7 +197,6 @@ if ($action == 'builddoc')
|
||||
// For labels
|
||||
if ($mode == 'label')
|
||||
{
|
||||
|
||||
$txtforsticker="%PHOTO%"; // Photo will be barcode image, %BARCODE% posible when using TCPDF generator
|
||||
$textleft=make_substitutions((empty($conf->global->BARCODE_LABEL_LEFT_TEXT)?$txtforsticker:$conf->global->BARCODE_LABEL_LEFT_TEXT), $substitutionarray);
|
||||
$textheader=make_substitutions((empty($conf->global->BARCODE_LABEL_HEADER_TEXT)?'':$conf->global->BARCODE_LABEL_HEADER_TEXT), $substitutionarray);
|
||||
|
||||
@ -92,7 +92,6 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x'
|
||||
}
|
||||
|
||||
if ($action === 'downloadblockchain') {
|
||||
|
||||
$auth = new BlockedLogAuthority($db);
|
||||
|
||||
$bc = $auth->getLocalBlockChain();
|
||||
|
||||
@ -51,7 +51,6 @@ if($auth->fetch(0, $signature)<=0) {
|
||||
|
||||
|
||||
if(!empty($hash)) {
|
||||
|
||||
echo $auth->checkBlockchain($hash) ? 'hashisok' : 'hashisjunk';
|
||||
}
|
||||
elseif(!empty($newblock)){
|
||||
@ -62,7 +61,6 @@ elseif(!empty($newblock)){
|
||||
echo 'blockadded';
|
||||
}
|
||||
else{
|
||||
|
||||
echo 'blockalreadyadded';
|
||||
}
|
||||
}
|
||||
|
||||
@ -310,17 +310,14 @@ class BlockedLogAuthority
|
||||
$signature=$block_static->getSignature();
|
||||
|
||||
foreach($blocks as &$block) {
|
||||
|
||||
$url = $conf->global->BLOCKEDLOG_AUTHORITY_URL.'/blockedlog/ajax/authority.php?s='.$signature.'&b='.$block->signature;
|
||||
|
||||
$res = file_get_contents($url);
|
||||
echo $block->signature.' '.$url. ' '.$res.'<br>';
|
||||
if($res === 'blockalreadyadded' || $res === 'blockadded') {
|
||||
|
||||
$block->setCertified();
|
||||
}
|
||||
else {
|
||||
|
||||
$this->error = $langs->trans('ImpossibleToContactAuthority ', $url);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -977,7 +977,6 @@ class BlockedLog
|
||||
if (empty($cachedlogs)) $cachedlogs=array();
|
||||
|
||||
if ($element=='all') {
|
||||
|
||||
$sql="SELECT rowid FROM ".MAIN_DB_PREFIX."blockedlog
|
||||
WHERE entity=".$conf->entity;
|
||||
}
|
||||
@ -1006,7 +1005,6 @@ class BlockedLog
|
||||
|
||||
$res = $this->db->query($sql);
|
||||
if($res) {
|
||||
|
||||
$results=array();
|
||||
|
||||
$i = 0;
|
||||
@ -1046,7 +1044,6 @@ class BlockedLog
|
||||
global $db,$conf,$mysoc;
|
||||
|
||||
if (empty($conf->global->BLOCKEDLOG_ENTITY_FINGERPRINT)) { // creation of a unique fingerprint
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/security.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
|
||||
|
||||
@ -42,6 +42,11 @@ $contextpage= GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'bomcard
|
||||
$backtopage = GETPOST('backtopage', 'alpha');
|
||||
$lineid = GETPOST('lineid', 'int');
|
||||
|
||||
// PDF
|
||||
$hidedetails = (GETPOST('hidedetails', 'int') ? GETPOST('hidedetails', 'int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0));
|
||||
$hidedesc = (GETPOST('hidedesc', 'int') ? GETPOST('hidedesc', 'int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0));
|
||||
$hideref = (GETPOST('hideref', 'int') ? GETPOST('hideref', 'int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0));
|
||||
|
||||
// Initialize technical objects
|
||||
$object=new BOM($db);
|
||||
$extrafields = new ExtraFields($db);
|
||||
@ -92,8 +97,8 @@ if (empty($reshook))
|
||||
$permissiontodelete = $user->rights->bom->delete || ($permissiontoadd && $object->status == 0);
|
||||
$backurlforlist = DOL_URL_ROOT.'/bom/bom_list.php';
|
||||
if (empty($backtopage)) {
|
||||
if (empty($id)) $backtopage = $backurlforlist;
|
||||
else $backtopage = DOL_URL_ROOT.'/bom/bom_card.php?id='.$id;
|
||||
if (empty($id) && $action != 'add' && $action != 'create') $backtopage = $backurlforlist;
|
||||
else $backtopage = DOL_URL_ROOT.'/bom/bom_card.php?id='.($id > 0 ? $id : '__ID__');
|
||||
}
|
||||
$triggermodname = 'BOM_MODIFY'; // Name of trigger action code to execute when we modify record
|
||||
|
||||
@ -286,6 +291,112 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
{
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_deleteline', '', 0, 1);
|
||||
}
|
||||
$formconfirm = '';
|
||||
|
||||
// Confirmation to delete
|
||||
if ($action == 'delete') {
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('DeleteOrder'), $langs->trans('ConfirmDeleteOrder'), 'confirm_delete', '', 0, 1);
|
||||
}
|
||||
|
||||
// Confirmation of validation
|
||||
if ($action == 'validate')
|
||||
{
|
||||
// We check that object has a temporary ref
|
||||
$ref = substr($object->ref, 1, 4);
|
||||
if ($ref == 'PROV') {
|
||||
$object->fetch_product();
|
||||
$numref = $object->getNextNumRef($object->product);
|
||||
} else {
|
||||
$numref = $object->ref;
|
||||
}
|
||||
|
||||
$text = $langs->trans('ConfirmValidateBom', $numref);
|
||||
/*if (! empty($conf->notification->enabled))
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/notify.class.php';
|
||||
$notify = new Notify($db);
|
||||
$text .= '<br>';
|
||||
$text .= $notify->confirmMessage('BOM_VALIDATE', $object->socid, $object);
|
||||
}*/
|
||||
|
||||
$formquestion=array();
|
||||
if (! empty($conf->bom->enabled))
|
||||
{
|
||||
$langs->load("mrp");
|
||||
require_once DOL_DOCUMENT_ROOT . '/product/class/html.formproduct.class.php';
|
||||
$formproduct = new FormProduct($db);
|
||||
$forcecombo=0;
|
||||
if ($conf->browser->name == 'ie') $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy
|
||||
$formquestion = array(
|
||||
// 'text' => $langs->trans("ConfirmClone"),
|
||||
// array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
|
||||
// array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1),
|
||||
);
|
||||
}
|
||||
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('Validate'), $text, 'confirm_validate', $formquestion, 0, 1, 220);
|
||||
}
|
||||
|
||||
// Confirmation of closing
|
||||
if ($action == 'close')
|
||||
{
|
||||
$text = $langs->trans('ConfirmCloseBom', $object->ref);
|
||||
/*if (! empty($conf->notification->enabled))
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/notify.class.php';
|
||||
$notify = new Notify($db);
|
||||
$text .= '<br>';
|
||||
$text .= $notify->confirmMessage('BOM_CLOSE', $object->socid, $object);
|
||||
}*/
|
||||
|
||||
$formquestion=array();
|
||||
if (! empty($conf->bom->enabled))
|
||||
{
|
||||
$langs->load("mrp");
|
||||
require_once DOL_DOCUMENT_ROOT . '/product/class/html.formproduct.class.php';
|
||||
$formproduct = new FormProduct($db);
|
||||
$forcecombo=0;
|
||||
if ($conf->browser->name == 'ie') $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy
|
||||
$formquestion = array(
|
||||
// 'text' => $langs->trans("ConfirmClone"),
|
||||
// array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
|
||||
// array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1),
|
||||
);
|
||||
}
|
||||
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('Close'), $text, 'confirm_close', $formquestion, 0, 1, 220);
|
||||
}
|
||||
|
||||
// Confirmation of reopen
|
||||
if ($action == 'reopen')
|
||||
{
|
||||
$text = $langs->trans('ConfirmReopenBom', $object->ref);
|
||||
/*if (! empty($conf->notification->enabled))
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/notify.class.php';
|
||||
$notify = new Notify($db);
|
||||
$text .= '<br>';
|
||||
$text .= $notify->confirmMessage('BOM_CLOSE', $object->socid, $object);
|
||||
}*/
|
||||
|
||||
$formquestion=array();
|
||||
if (! empty($conf->bom->enabled))
|
||||
{
|
||||
$langs->load("mrp");
|
||||
require_once DOL_DOCUMENT_ROOT . '/product/class/html.formproduct.class.php';
|
||||
$formproduct = new FormProduct($db);
|
||||
$forcecombo=0;
|
||||
if ($conf->browser->name == 'ie') $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy
|
||||
$formquestion = array(
|
||||
// 'text' => $langs->trans("ConfirmClone"),
|
||||
// array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
|
||||
// array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1),
|
||||
);
|
||||
}
|
||||
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('ReOpen'), $text, 'confirm_reopen', $formquestion, 0, 1, 220);
|
||||
}
|
||||
|
||||
// Clone confirmation
|
||||
if ($action == 'clone') {
|
||||
// Create an array for form
|
||||
@ -294,20 +405,12 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
}
|
||||
|
||||
// Confirmation of action xxxx
|
||||
if ($action == 'xxx')
|
||||
if ($action == 'setdraft')
|
||||
{
|
||||
$text = $langs->trans('ConfirmSetToDraft', $object->ref);
|
||||
|
||||
$formquestion=array();
|
||||
/*
|
||||
$forcecombo=0;
|
||||
if ($conf->browser->name == 'ie') $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy
|
||||
$formquestion = array(
|
||||
// 'text' => $langs->trans("ConfirmClone"),
|
||||
// array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
|
||||
// array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1),
|
||||
// array('type' => 'other', 'name' => 'idwarehouse', 'label' => $langs->trans("SelectWarehouseForStockDecrease"), 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1, 0, 0, '', 0, $forcecombo))
|
||||
);
|
||||
*/
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('XXX'), $text, 'confirm_xxx', $formquestion, 0, 1, 220);
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('SetToDraft'), $text, 'confirm_setdraft', $formquestion, 0, 1, 220);
|
||||
}
|
||||
|
||||
// Call Hook formConfirm
|
||||
@ -457,6 +560,11 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
// Send
|
||||
//print '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=presend&mode=init#formmailbeforetitle">' . $langs->trans('SendMail') . '</a>'."\n";
|
||||
|
||||
if ($user->rights->bom->write && $object->status == BOM::STATUS_VALIDATED)
|
||||
{
|
||||
print '<a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=setdraft">' . $langs->trans("SetToDraft") . '</a>';
|
||||
}
|
||||
|
||||
// Modify
|
||||
if ($user->rights->bom->write)
|
||||
{
|
||||
@ -467,10 +575,35 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans('Modify').'</a>'."\n";
|
||||
}
|
||||
|
||||
// Validate
|
||||
if ($user->rights->bom->write && $object->status == BOM::STATUS_DRAFT)
|
||||
{
|
||||
if (is_array($object->lines) && count($object->lines) > 0)
|
||||
{
|
||||
print '<a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=validate">' . $langs->trans("Validate") . '</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a class="butActionRefused" href="" title="'.$langs->trans("AddAtLeastOneLineFirst").'">' . $langs->trans("Validate") . '</a>';
|
||||
}
|
||||
}
|
||||
|
||||
// Close / Cancel
|
||||
if ($user->rights->bom->write && $object->status == BOM::STATUS_VALIDATED)
|
||||
{
|
||||
print '<a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=close">' . $langs->trans("Disable") . '</a>';
|
||||
}
|
||||
|
||||
// Re-open
|
||||
if ($user->rights->bom->write && $object->status == BOM::STATUS_CANCELED)
|
||||
{
|
||||
print '<a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=reopen">' . $langs->trans("ReOpen") . '</a>';
|
||||
}
|
||||
|
||||
// Clone
|
||||
if ($user->rights->bom->write)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&socid=' . $object->socid . '&action=clone&object=order">' . $langs->trans("ToClone") . '</a></div>';
|
||||
print '<a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=clone&object=bom">' . $langs->trans("ToClone") . '</a>';
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@ -21,6 +21,7 @@
|
||||
* \ingroup bom
|
||||
* \brief List page for bom
|
||||
*/
|
||||
|
||||
// Load Dolibarr environment
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||
@ -99,7 +100,7 @@ $arrayfields=array();
|
||||
foreach($object->fields as $key => $val)
|
||||
{
|
||||
// If $val['visible']==0, then we never show the field
|
||||
if (! empty($val['visible'])) $arrayfields['t.'.$key]=array('label'=>$val['label'], 'checked'=>(($val['visible']<0)?0:1), 'enabled'=>$val['enabled'], 'position'=>$val['position']);
|
||||
if (! empty($val['visible'])) $arrayfields['t.'.$key]=array('label'=>$val['label'], 'checked'=>(($val['visible']<0)?0:1), 'enabled'=>($val['enabled'] && ($val['visible'] != 3)), 'position'=>$val['position']);
|
||||
}
|
||||
// Extra fields
|
||||
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0)
|
||||
@ -179,8 +180,9 @@ foreach($object->fields as $key => $val)
|
||||
$sql.='t.'.$key.', ';
|
||||
}
|
||||
// Add fields from extrafields
|
||||
if (! empty($extrafields->attributes[$object->table_element]['label']))
|
||||
if (! empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.' as options_'.$key.', ' : '');
|
||||
}
|
||||
// Add fields from hooks
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
@ -213,6 +215,7 @@ foreach($object->fields as $key => $val)
|
||||
// Add fields from extrafields
|
||||
if (! empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.', ' : '');
|
||||
}
|
||||
// Add where from hooks
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListGroupBy',$parameters); // Note that $action and $object may have been modified by hook
|
||||
@ -258,7 +261,7 @@ if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) &&
|
||||
{
|
||||
$obj = $db->fetch_object($resql);
|
||||
$id = $obj->rowid;
|
||||
header("Location: ".dol_buildpath('/bom/bom_card.php', 1).'?id='.$id);
|
||||
header("Location: ".DOL_URL_ROOT.'/bom/bom_card.php?id='.$id);
|
||||
exit;
|
||||
}
|
||||
|
||||
@ -290,7 +293,8 @@ if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&con
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit);
|
||||
foreach($search as $key => $val)
|
||||
{
|
||||
$param.= '&search_'.$key.'='.urlencode($search[$key]);
|
||||
if (is_array($search[$key]) && count($search[$key])) foreach($search[$key] as $skey) $param.='&search_'.$key.'[]='.urlencode($skey);
|
||||
else $param.= '&search_'.$key.'='.urlencode($search[$key]);
|
||||
}
|
||||
if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
|
||||
// Add $param from extra fields
|
||||
@ -315,19 +319,7 @@ print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
||||
print '<input type="hidden" name="page" value="'.$page.'">';
|
||||
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
||||
|
||||
$newcardbutton='';
|
||||
//if ($user->rights->bom->creer)
|
||||
//{
|
||||
$newcardbutton='<a class="butActionNew" href="bom_card.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']).'"><span class="valignmiddle text-plus-circle">'.$langs->trans('New').'</span>';
|
||||
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
|
||||
$newcardbutton.= '</a>';
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// $newcardbutton='<a class="butActionNewRefused" href="#"><span class="valignmiddle text-plus-circle">'.$langs->trans('New').'</span>';
|
||||
// $newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
|
||||
// $newcardbutton.= '</a>';
|
||||
//}
|
||||
$newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/bom/bom_card.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $user->rights->bom->write);
|
||||
|
||||
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'cubes', 0, $newcardbutton, '', $limit);
|
||||
|
||||
@ -338,10 +330,10 @@ $objecttmp=new BOM($db);
|
||||
$trackid='xxxx'.$object->id;
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
|
||||
|
||||
if ($sall)
|
||||
if ($search_all)
|
||||
{
|
||||
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
|
||||
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall) . join(', ', $fieldstosearchall).'</div>';
|
||||
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all) . join(', ', $fieldstosearchall).'</div>';
|
||||
}
|
||||
|
||||
$moreforfilter = '';
|
||||
@ -424,7 +416,7 @@ $parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sort
|
||||
$reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
// Action column
|
||||
print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ')."\n";
|
||||
print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
|
||||
print '</tr>'."\n";
|
||||
|
||||
|
||||
@ -460,12 +452,14 @@ while ($i < min($num, $limit))
|
||||
foreach($object->fields as $key => $val)
|
||||
{
|
||||
$cssforfield=(empty($val['css'])?'':$val['css']);
|
||||
if ($key == 'status') $cssforfield.=($cssforfield?' ':'').'center';
|
||||
elseif ($key == 'ref') $cssforfield.=($cssforfield?' ':'').'nowrap';
|
||||
elseif (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center';
|
||||
elseif (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap';
|
||||
elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real'))) $cssforfield.=($cssforfield?' ':'').'right';
|
||||
|
||||
if (in_array($val['type'], array('date','datetime','timestamp'))) $cssforfield.=($cssforfield?' ':'').'center';
|
||||
elseif ($key == 'status') $cssforfield.=($cssforfield?' ':'').'center';
|
||||
|
||||
if (in_array($val['type'], array('timestamp'))) $cssforfield.=($cssforfield?' ':'').'nowrap';
|
||||
elseif ($key == 'ref') $cssforfield.=($cssforfield?' ':'').'nowrap';
|
||||
|
||||
if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'status') $cssforfield.=($cssforfield?' ':'').'right';
|
||||
|
||||
if (! empty($arrayfields['t.'.$key]['checked']))
|
||||
{
|
||||
print '<td'.($cssforfield ? ' class="'.$cssforfield.'"' : '').'>';
|
||||
@ -488,7 +482,7 @@ while ($i < min($num, $limit))
|
||||
$reshook=$hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
// Action column
|
||||
print '<td class="nowrap" align="center">';
|
||||
print '<td class="nowrap center">';
|
||||
if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
||||
{
|
||||
$selected=0;
|
||||
|
||||
@ -95,8 +95,8 @@ class BOM extends CommonObject
|
||||
'qty' => array('type'=>'real', 'label'=>'Quantity', 'enabled'=>1, 'visible'=>1, 'default'=>1, 'position'=>55, 'notnull'=>1, 'isameasure'=>'1', 'css'=>'maxwidth75imp'),
|
||||
'efficiency' => array('type'=>'real', 'label'=>'ManufacturingEfficiency', 'enabled'=>1, 'visible'=>-1, 'default'=>1, 'position'=>100, 'notnull'=>0, 'css'=>'maxwidth50imp', 'help'=>'ValueOfMeansLoss'),
|
||||
'duration' => array('type'=>'real', 'label'=>'EstimatedDuration', 'enabled'=>1, 'visible'=>-1, 'position'=>101, 'notnull'=>-1, 'css'=>'maxwidth50imp', 'help'=>'EstimatedDurationDesc'),
|
||||
'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>-1, 'position'=>161, 'notnull'=>-1,),
|
||||
'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>-1, 'position'=>162, 'notnull'=>-1,),
|
||||
'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>-2, 'position'=>161, 'notnull'=>-1,),
|
||||
'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>-2, 'position'=>162, 'notnull'=>-1,),
|
||||
'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>300, 'notnull'=>1,),
|
||||
'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'position'=>501, 'notnull'=>1,),
|
||||
'date_valid' => array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-2, 'position'=>502, 'notnull'=>0,),
|
||||
@ -513,7 +513,7 @@ class BOM extends CommonObject
|
||||
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
|
||||
* @return int <=0 if OK, 0=Nothing done, >0 if KO
|
||||
*/
|
||||
public function valid($user, $notrigger = 0)
|
||||
public function validate($user, $notrigger = 0)
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
@ -524,7 +524,7 @@ class BOM extends CommonObject
|
||||
// Protection
|
||||
if ($this->statut == self::STATUS_VALIDATED)
|
||||
{
|
||||
dol_syslog(get_class($this)."::valid action abandonned: already validated", LOG_WARNING);
|
||||
dol_syslog(get_class($this)."::validate action abandonned: already validated", LOG_WARNING);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -553,14 +553,14 @@ class BOM extends CommonObject
|
||||
$this->newref = $num;
|
||||
|
||||
// Validate
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."bom_bom";
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;
|
||||
$sql.= " SET ref = '".$this->db->escape($num)."',";
|
||||
$sql.= " status = ".self::STATUS_VALIDATED.",";
|
||||
$sql.= " date_valid='".$this->db->idate($now)."',";
|
||||
$sql.= " fk_user_valid = ".$user->id;
|
||||
$sql.= " WHERE rowid = ".$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::valid()", LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::validate()", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
@ -597,7 +597,7 @@ class BOM extends CommonObject
|
||||
$dirdest = $conf->bom->dir_output.'/'.$newref;
|
||||
if (! $error && file_exists($dirsource))
|
||||
{
|
||||
dol_syslog(get_class($this)."::valid() rename dir ".$dirsource." into ".$dirdest);
|
||||
dol_syslog(get_class($this)."::validate() rename dir ".$dirsource." into ".$dirdest);
|
||||
|
||||
if (@rename($dirsource, $dirdest))
|
||||
{
|
||||
@ -640,64 +640,78 @@ class BOM extends CommonObject
|
||||
* Set draft status
|
||||
*
|
||||
* @param User $user Object user that modify
|
||||
* @param int $notrigger 1=Does not execute triggers, 0=Execute triggers
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function setDraft($user)
|
||||
public function setDraft($user, $notrigger = 0)
|
||||
{
|
||||
global $conf, $langs;
|
||||
// Protection
|
||||
if ($this->status <= self::STATUS_DRAFT)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
$error=0;
|
||||
/*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->bom->write))
|
||||
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->bom->bom_advance->validate))))
|
||||
{
|
||||
$this->error='Permission denied';
|
||||
return -1;
|
||||
}*/
|
||||
|
||||
// Protection
|
||||
if ($this->status <= self::STATUS_DRAFT)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->bom->write))
|
||||
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->bom->bom_advance->validate))))
|
||||
{
|
||||
$this->error='Permission denied';
|
||||
return -1;
|
||||
}*/
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."bom";
|
||||
$sql.= " SET status = ".self::STATUS_DRAFT;
|
||||
$sql.= " WHERE rowid = ".$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::setDraft", LOG_DEBUG);
|
||||
if ($this->db->query($sql))
|
||||
{
|
||||
if (! $error)
|
||||
{
|
||||
$this->oldcopy= clone $this;
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('BOM_UNVALIDATE', $user);
|
||||
if ($result < 0) $error++;
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
$this->status=self::STATUS_DRAFT;
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
} else {
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
return $this->setStatusCommon($user, self::STATUS_DRAFT, $notrigger, 'BOM_UNVALIDATE');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set cancel status
|
||||
*
|
||||
* @param User $user Object user that modify
|
||||
* @param int $notrigger 1=Does not execute triggers, 0=Execute triggers
|
||||
* @return int <0 if KO, 0=Nothing done, >0 if OK
|
||||
*/
|
||||
public function cancel($user, $notrigger = 0)
|
||||
{
|
||||
// Protection
|
||||
if ($this->status != self::STATUS_VALIDATED)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->bom->write))
|
||||
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->bom->bom_advance->validate))))
|
||||
{
|
||||
$this->error='Permission denied';
|
||||
return -1;
|
||||
}*/
|
||||
|
||||
return $this->setStatusCommon($user, self::STATUS_CANCELED, $notrigger, 'BOM_CLOSE');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set cancel status
|
||||
*
|
||||
* @param User $user Object user that modify
|
||||
* @param int $notrigger 1=Does not execute triggers, 0=Execute triggers
|
||||
* @return int <0 if KO, 0=Nothing done, >0 if OK
|
||||
*/
|
||||
public function reopen($user, $notrigger = 0)
|
||||
{
|
||||
// Protection
|
||||
if ($this->status != self::STATUS_CANCELED)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->bom->write))
|
||||
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->bom->bom_advance->validate))))
|
||||
{
|
||||
$this->error='Permission denied';
|
||||
return -1;
|
||||
}*/
|
||||
|
||||
return $this->setStatusCommon($user, self::STATUS_VALIDATED, $notrigger, 'BOM_REOPEN');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return a link to the object card (with optionaly the picto)
|
||||
*
|
||||
@ -929,7 +943,6 @@ class BOM extends CommonObject
|
||||
$langs->load("mrp");
|
||||
|
||||
if (! dol_strlen($modele)) {
|
||||
|
||||
$modele = 'standard';
|
||||
|
||||
if ($this->modelpdf) {
|
||||
@ -1052,7 +1065,7 @@ class BOMLine extends CommonObject
|
||||
'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-1, 'position'=>60, 'notnull'=>-1,),
|
||||
'qty' => array('type'=>'double(24,8)', 'label'=>'Quantity', 'enabled'=>1, 'visible'=>1, 'position'=>100, 'notnull'=>1, 'isameasure'=>'1',),
|
||||
'efficiency' => array('type'=>'double(8,4)', 'label'=>'ManufacturingEfficiency', 'enabled'=>1, 'visible'=>1, 'default'=>1, 'position'=>110, 'notnull'=>1, 'css'=>'maxwidth50imp', 'help'=>'ValueOfMeansLoss'),
|
||||
'position' => array('type'=>'integer', 'label'=>'Rank', 'enabled'=>1, 'visible'=>0, 'position'=>200, 'notnull'=>1,),
|
||||
'position' => array('type'=>'integer', 'label'=>'Rank', 'enabled'=>1, 'visible'=>0, 'default'=>0, 'position'=>200, 'notnull'=>1,),
|
||||
'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>1000, 'notnull'=>-1,),
|
||||
);
|
||||
public $rowid;
|
||||
|
||||
@ -38,7 +38,6 @@ function printBookmarksList($aDb, $aLangs)
|
||||
$ret = '<div class="menu_top"></div>'."\n";
|
||||
|
||||
if (! empty($conf->use_javascript_ajax)) { // Bookmark autosubmit can't work when javascript is off.
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/bookmarks/class/bookmark.class.php';
|
||||
if (! isset($conf->global->BOOKMARKS_SHOW_IN_MENU)) $conf->global->BOOKMARKS_SHOW_IN_MENU=5;
|
||||
|
||||
|
||||
@ -54,7 +54,6 @@ $object=new Bookmark($db);
|
||||
|
||||
if ($action == 'add' || $action == 'addproduct' || $action == 'update')
|
||||
{
|
||||
|
||||
if ($action == 'update') {
|
||||
$invertedaction = 'edit';
|
||||
} else {
|
||||
|
||||
@ -125,7 +125,6 @@ print $form->select_company($conf->global->CASHDESK_ID_THIRDPARTY, 'socid', '(s.
|
||||
print '</td></tr>';
|
||||
if (! empty($conf->banque->enabled))
|
||||
{
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("CashDeskBankAccountForSell").'</td>';
|
||||
print '<td colspan="2">';
|
||||
$form->select_comptes($conf->global->CASHDESK_ID_BANKACCOUNT_CASH, 'CASHDESK_ID_BANKACCOUNT_CASH', 0, "courant=2", 1);
|
||||
@ -146,7 +145,6 @@ if (! empty($conf->banque->enabled))
|
||||
|
||||
if (! empty($conf->stock->enabled))
|
||||
{
|
||||
|
||||
print '<tr class="oddeven"><td>'.$langs->trans("CashDeskDoNotDecreaseStock").'</td>'; // Force warehouse (this is not a default value)
|
||||
print '<td colspan="2">';
|
||||
if (empty($conf->productbatch->enabled)) {
|
||||
|
||||
@ -296,12 +296,10 @@ class Facturation
|
||||
}
|
||||
elseif ( $aId == 'RESET' )
|
||||
{
|
||||
|
||||
$this->id = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
$this->id = $aId;
|
||||
}
|
||||
}
|
||||
@ -343,7 +341,6 @@ class Facturation
|
||||
}
|
||||
elseif ( $aQte == 'RESET' )
|
||||
{
|
||||
|
||||
$this->qte = null;
|
||||
}
|
||||
else
|
||||
@ -408,13 +405,10 @@ class Facturation
|
||||
{
|
||||
|
||||
if (is_null($aMontantRemise)) {
|
||||
|
||||
return $this->montant_remise;
|
||||
} elseif ( $aMontantRemise == 'RESET' ) {
|
||||
|
||||
$this->montant_remise = null;
|
||||
} else {
|
||||
|
||||
$this->montant_remise = $aMontantRemise;
|
||||
}
|
||||
}
|
||||
@ -429,13 +423,10 @@ class Facturation
|
||||
{
|
||||
|
||||
if (is_null($aPrix)) {
|
||||
|
||||
return $this->prix;
|
||||
} elseif ( $aPrix == 'RESET' ) {
|
||||
|
||||
$this->prix = null;
|
||||
} else {
|
||||
|
||||
$this->prix = $aPrix;
|
||||
}
|
||||
}
|
||||
@ -449,13 +440,10 @@ class Facturation
|
||||
public function tva($aTva = null)
|
||||
{
|
||||
if (is_null($aTva)) {
|
||||
|
||||
return $this->tva;
|
||||
} elseif ( $aTva == 'RESET' ) {
|
||||
|
||||
$this->tva = null;
|
||||
} else {
|
||||
|
||||
$this->tva = $aTva;
|
||||
}
|
||||
}
|
||||
@ -469,13 +457,10 @@ class Facturation
|
||||
public function numInvoice($aNumFacture = null)
|
||||
{
|
||||
if (is_null($aNumFacture)) {
|
||||
|
||||
return $this->num_facture;
|
||||
} elseif ( $aNumFacture == 'RESET' ) {
|
||||
|
||||
$this->num_facture = null;
|
||||
} else {
|
||||
|
||||
$this->num_facture = $aNumFacture;
|
||||
}
|
||||
}
|
||||
@ -490,13 +475,10 @@ class Facturation
|
||||
{
|
||||
|
||||
if (is_null($aModeReglement)) {
|
||||
|
||||
return $this->mode_reglement;
|
||||
} elseif ( $aModeReglement == 'RESET' ) {
|
||||
|
||||
$this->mode_reglement = null;
|
||||
} else {
|
||||
|
||||
$this->mode_reglement = $aModeReglement;
|
||||
}
|
||||
}
|
||||
@ -511,13 +493,10 @@ class Facturation
|
||||
{
|
||||
|
||||
if (is_null($aMontantEncaisse)) {
|
||||
|
||||
return $this->montant_encaisse;
|
||||
} elseif ( $aMontantEncaisse == 'RESET' ) {
|
||||
|
||||
$this->montant_encaisse = null;
|
||||
} else {
|
||||
|
||||
$this->montant_encaisse = $aMontantEncaisse;
|
||||
}
|
||||
}
|
||||
@ -532,13 +511,10 @@ class Facturation
|
||||
{
|
||||
|
||||
if (is_null($aMontantRendu)) {
|
||||
|
||||
return $this->montant_rendu;
|
||||
} elseif ( $aMontantRendu == 'RESET' ) {
|
||||
|
||||
$this->montant_rendu = null;
|
||||
} else {
|
||||
|
||||
$this->montant_rendu = $aMontantRendu;
|
||||
}
|
||||
}
|
||||
@ -552,13 +528,10 @@ class Facturation
|
||||
public function paiementLe($aPaiementLe = null)
|
||||
{
|
||||
if (is_null($aPaiementLe)) {
|
||||
|
||||
return $this->paiement_le;
|
||||
} elseif ( $aPaiementLe == 'RESET' ) {
|
||||
|
||||
$this->paiement_le = null;
|
||||
} else {
|
||||
|
||||
$this->paiement_le = $aPaiementLe;
|
||||
}
|
||||
}
|
||||
@ -572,13 +545,10 @@ class Facturation
|
||||
public function prixTotalHt($aTotalHt = null)
|
||||
{
|
||||
if (is_null($aTotalHt)) {
|
||||
|
||||
return $this->prix_total_ht;
|
||||
} elseif ( $aTotalHt == 'RESET' ) {
|
||||
|
||||
$this->prix_total_ht = null;
|
||||
} else {
|
||||
|
||||
$this->prix_total_ht = $aTotalHt;
|
||||
}
|
||||
}
|
||||
@ -592,13 +562,10 @@ class Facturation
|
||||
public function montantTva($aMontantTva = null)
|
||||
{
|
||||
if (is_null($aMontantTva)) {
|
||||
|
||||
return $this->montant_tva;
|
||||
} elseif ( $aMontantTva == 'RESET' ) {
|
||||
|
||||
$this->montant_tva = null;
|
||||
} else {
|
||||
|
||||
$this->montant_tva = $aMontantTva;
|
||||
}
|
||||
}
|
||||
|
||||
@ -36,7 +36,6 @@ $form=new Form($db);
|
||||
|
||||
// Get list of articles (in warehouse '$conf_fkentrepot' if defined and stock module enabled)
|
||||
if ( GETPOST('filtre', 'alpha') ) {
|
||||
|
||||
// Avec filtre
|
||||
$ret=array(); $i=0;
|
||||
|
||||
@ -88,7 +87,6 @@ if ( GETPOST('filtre', 'alpha') ) {
|
||||
}
|
||||
$tab_designations=$ret;
|
||||
} else {
|
||||
|
||||
// Sans filtre
|
||||
$ret=array();
|
||||
$i=0;
|
||||
|
||||
@ -57,10 +57,8 @@ else
|
||||
echo ('<p><a href="facturation_verif.php?action=suppr_article&suppr_id='.$tab[$i]['id'].'" title="'.$langs->trans("DeleteArticle").'">'.$tab[$i]['ref'].' - '.$tab[$i]['label'].'</a></p>'."\n");
|
||||
|
||||
if ( $tab[$i]['remise_percent'] > 0 ) {
|
||||
|
||||
$remise_percent = ' -'.$tab[$i]['remise_percent'].'%';
|
||||
} else {
|
||||
|
||||
$remise_percent = '';
|
||||
}
|
||||
|
||||
|
||||
@ -39,12 +39,10 @@ $langs->loadLangs(array("main","bills","banks"));
|
||||
<?php
|
||||
// Affichage de la tva par taux
|
||||
if ( $obj_facturation->montantTva() ) {
|
||||
|
||||
echo ('<tr><td class="resume_label">'.$langs->trans("VAT").'</td><td>'.price(price2num($obj_facturation->montantTva(), 'MT'), 0, $langs, 0, 0, -1, $conf->currency).'</td></tr>');
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
echo ('<tr><td class="resume_label">'.$langs->trans("VAT").'</td><td>'.$langs->trans("NoVAT").'</td></tr>');
|
||||
}
|
||||
?>
|
||||
@ -87,16 +85,13 @@ $langs->loadLangs(array("main","bills","banks"));
|
||||
<?php
|
||||
// Affichage des infos en fonction du mode de paiement
|
||||
if ( $obj_facturation->getsetPaymentMode() == 'DIF' ) {
|
||||
|
||||
echo ('<tr><td class="resume_label">'.$langs->trans("DateDue").'</td><td>'.$obj_facturation->paiementLe().'</td></tr>');
|
||||
} else {
|
||||
|
||||
echo ('<tr><td class="resume_label">'.$langs->trans("Received").'</td><td>'.price(price2num($obj_facturation->montantEncaisse(), 'MT'), 0, $langs, 0, 0, -1, $conf->currency).'</td></tr>');
|
||||
}
|
||||
|
||||
// Affichage du montant rendu (reglement en especes)
|
||||
if ( $obj_facturation->montantRendu() ) {
|
||||
|
||||
echo ('<tr><td class="resume_label">'.$langs->trans("Change").'</td><td>'.price(price2num($obj_facturation->montantRendu(), 'MT'), 0, $langs, 0, 0, -1, $conf->currency).'</td></tr>');
|
||||
}
|
||||
|
||||
|
||||
@ -1637,7 +1637,6 @@ class Categorie extends CommonObject
|
||||
{
|
||||
$nbfile = count($file['name']);
|
||||
for ($i = 0; $i <= $nbfile; $i ++) {
|
||||
|
||||
$originImage = $dir . $file['name'][$i];
|
||||
|
||||
// Cree fichier en taille origine
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user