2
0
forked from Wavyzz/dolibarr

add new rule

This commit is contained in:
Frédéric FRANCE
2020-05-21 00:02:33 +02:00
parent 954d928467
commit 43dcd9beb5
63 changed files with 315 additions and 534 deletions

View File

@@ -27,7 +27,7 @@
<!-- Rules from Generic Standard --> <!-- Rules from Generic Standard -->
<!-- We want to allow empty statement: It allows to put some code comments into the else for examples --> <!-- We want to allow empty statement: It allows to put some code comments into the else for examples -->
<rule ref="Generic.CodeAnalysis.EmptyStatement"> <rule ref="Generic.CodeAnalysis.EmptyStatement">
<exclude name="Generic.CodeAnalysis.EmptyStatement.DetectedIf"/> <exclude name="Generic.CodeAnalysis.EmptyStatement.DetectedIf"/>
@@ -101,7 +101,7 @@
<property name="error" value="false"/> <property name="error" value="false"/>
</properties> </properties>
</rule> </rule>
--> -->
<!-- We want to allow 'if () { ...small code... }' on same line for better code compacity and readability --> <!-- We want to allow 'if () { ...small code... }' on same line for better code compacity and readability -->
<rule ref="Generic.Formatting.DisallowMultipleStatements"> <rule ref="Generic.Formatting.DisallowMultipleStatements">
<severity>0</severity> <severity>0</severity>
@@ -117,7 +117,7 @@
</properties> </properties>
</rule> </rule>
--> -->
<rule ref="Generic.Formatting.SpaceAfterCast" /> <rule ref="Generic.Formatting.SpaceAfterCast" />
<rule ref="Generic.Functions.CallTimePassByReference" /> <rule ref="Generic.Functions.CallTimePassByReference" />
@@ -188,8 +188,8 @@
</rule> </rule>
<!-- Check for duplicate class names --> <!-- Check for duplicate class names -->
<!-- Disabled: We need this for dependency injection. <!-- Disabled: We need this for dependency injection.
<rule ref="Generic.Classes.DuplicateClassName" /> <rule ref="Generic.Classes.DuplicateClassName" />
--> -->
@@ -213,6 +213,9 @@
<rule ref="Squiz.WhiteSpace.ControlStructureSpacing.SpacingAfterOpen" /> <rule ref="Squiz.WhiteSpace.ControlStructureSpacing.SpacingAfterOpen" />
<rule ref="Squiz.WhiteSpace.ControlStructureSpacing.SpacingBeforeClose" /> <rule ref="Squiz.WhiteSpace.ControlStructureSpacing.SpacingBeforeClose" />
<!-- <rule ref="Squiz.ControlStructures.ControlSignature.SpaceAfterCloseParenthesis" /> -->
<rule ref="Squiz.ControlStructures.ControlSignature.SpaceAfterKeyword" />
<rule ref="Squiz.ControlStructures.ForEachLoopDeclaration.SpaceAfterOpen" /> <rule ref="Squiz.ControlStructures.ForEachLoopDeclaration.SpaceAfterOpen" />
<rule ref="Squiz.ControlStructures.ForEachLoopDeclaration.SpaceBeforeClose" /> <rule ref="Squiz.ControlStructures.ForEachLoopDeclaration.SpaceBeforeClose" />
@@ -309,16 +312,16 @@
<rule ref="PEAR.Files.IncludingFile.UseInclude"> <rule ref="PEAR.Files.IncludingFile.UseInclude">
<severity>0</severity> <severity>0</severity>
</rule> </rule>
<!-- We disable this. We must be allowed to use strict require instead of non strict include anywhere --> <!-- We disable this. We must be allowed to use strict require instead of non strict include anywhere -->
<rule ref="PEAR.Files.IncludingFile.UseIncludeOnce"> <rule ref="PEAR.Files.IncludingFile.UseIncludeOnce">
<severity>0</severity> <severity>0</severity>
</rule> </rule>
<rule ref="PEAR.Files.IncludingFile.UseRequire"> <rule ref="PEAR.Files.IncludingFile.UseRequire">
<severity>0</severity> <severity>0</severity>
</rule> </rule>
<!-- We disable this: We want to allow include_once --> <!-- We disable this: We want to allow include_once -->
<rule ref="PEAR.Files.IncludingFile.UseRequireOnce"> <rule ref="PEAR.Files.IncludingFile.UseRequireOnce">
<severity>0</severity> <severity>0</severity>
@@ -332,7 +335,7 @@
<rule ref="PEAR.Functions.FunctionCallSignature.CloseBracketLine"> <rule ref="PEAR.Functions.FunctionCallSignature.CloseBracketLine">
<severity>0</severity> <severity>0</severity>
</rule> </rule>
<!-- We disable this: We want to allow small function on 1 line --> <!-- We disable this: We want to allow small function on 1 line -->
<rule ref="PEAR.Functions.FunctionCallSignature.ContentAfterOpenBracket"> <rule ref="PEAR.Functions.FunctionCallSignature.ContentAfterOpenBracket">
<severity>0</severity> <severity>0</severity>
@@ -385,7 +388,7 @@
<!--<rule ref="PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps"> <!--<rule ref="PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps">
<severity>0</severity> <severity>0</severity>
</rule>--> </rule>-->
<!-- We disable this: We don't want to have private methods prefixed with an underscore --> <!-- We disable this: We don't want to have private methods prefixed with an underscore -->
<rule ref="PEAR.NamingConventions.ValidFunctionName.PrivateNoUnderscore"> <rule ref="PEAR.NamingConventions.ValidFunctionName.PrivateNoUnderscore">
<severity>0</severity> <severity>0</severity>
@@ -426,5 +429,5 @@
<rule ref="PSR2.Classes.PropertyDeclaration.VarUsed" /> <rule ref="PSR2.Classes.PropertyDeclaration.VarUsed" />
<!-- The closing ?> tag MUST be omitted from files containing only PHP. --> <!-- The closing ?> tag MUST be omitted from files containing only PHP. -->
<rule ref="PSR2.Files.ClosingTag"/> <rule ref="PSR2.Files.ClosingTag"/>
</ruleset> </ruleset>

View File

@@ -144,8 +144,7 @@ if (empty($reshook))
{ {
setEventMessages($langs->trans("ChartLoaded"), null, 'mesgs'); setEventMessages($langs->trans("ChartLoaded"), null, 'mesgs');
} }
else else {
{
setEventMessages($langs->trans("ErrorDuringChartLoad"), null, 'warnings'); setEventMessages($langs->trans("ErrorDuringChartLoad"), null, 'warnings');
} }
} }
@@ -432,8 +431,7 @@ if ($resql)
print "</td>\n"; print "</td>\n";
if (!$i) $totalarray['nbfield']++; if (!$i) $totalarray['nbfield']++;
} }
else else {
{
print '<td>&nbsp;</td>'; print '<td>&nbsp;</td>';
if (!$i) $totalarray['nbfield']++; if (!$i) $totalarray['nbfield']++;
} }

View File

@@ -246,8 +246,7 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha'))
setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs'); setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs');
$_POST = array('id'=>$id); // Clean $_POST array, we keep only $_POST = array('id'=>$id); // Clean $_POST array, we keep only
} }
else else {
{
if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
setEventMessages($langs->transnoentities("ErrorRecordAlreadyExists"), null, 'errors'); setEventMessages($langs->transnoentities("ErrorRecordAlreadyExists"), null, 'errors');
} }
@@ -319,8 +318,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes') // delete
{ {
setEventMessages($langs->transnoentities("ErrorRecordIsUsedByChild"), null, 'errors'); setEventMessages($langs->transnoentities("ErrorRecordIsUsedByChild"), null, 'errors');
} }
else else {
{
dol_print_error($db); dol_print_error($db);
} }
} }
@@ -582,8 +580,7 @@ if ($id)
print $form->select_country($search_country_id, 'search_country_id', '', 28, 'maxwidth200 maxwidthonsmartphone'); print $form->select_country($search_country_id, 'search_country_id', '', 28, 'maxwidth200 maxwidthonsmartphone');
print '</td>'; print '</td>';
} }
else else {
{
print '<td class="liste_titre"></td>'; print '<td class="liste_titre"></td>';
} }
} }
@@ -630,8 +627,7 @@ if ($id)
print '<td colspan="3" class="right"><a name="'.(!empty($obj->rowid) ? $obj->rowid : $obj->code).'">&nbsp;</a><input type="submit" class="button" name="actionmodify" value="'.$langs->trans("Modify").'">'; print '<td colspan="3" class="right"><a name="'.(!empty($obj->rowid) ? $obj->rowid : $obj->code).'">&nbsp;</a><input type="submit" class="button" name="actionmodify" value="'.$langs->trans("Modify").'">';
print '&nbsp;<input type="submit" class="button" name="actioncancel" value="'.$langs->trans("Cancel").'"></td>'; print '&nbsp;<input type="submit" class="button" name="actioncancel" value="'.$langs->trans("Cancel").'"></td>';
} }
else else {
{
$tmpaction = 'view'; $tmpaction = 'view';
$parameters = array('var'=>$var, 'fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]); $parameters = array('var'=>$var, 'fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
$reshook = $hookmanager->executeHooks('viewDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks $reshook = $hookmanager->executeHooks('viewDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
@@ -665,8 +661,7 @@ if ($id)
{ {
$valuetoshow = '-'; $valuetoshow = '-';
} }
else else {
{
$key = $langs->trans("Country".strtoupper($obj->country_code)); $key = $langs->trans("Country".strtoupper($obj->country_code));
$valuetoshow = ($key != "Country".strtoupper($obj->country_code) ? $obj->country_code." - ".$key : $obj->country); $valuetoshow = ($key != "Country".strtoupper($obj->country_code) ? $obj->country_code." - ".$key : $obj->country);
} }
@@ -785,8 +780,7 @@ function fieldListAccountModel($fieldlist, $obj = '', $tabname = '', $context =
elseif ($fieldlist[$field] == 'code' && isset($obj->{$fieldlist[$field]})) { elseif ($fieldlist[$field] == 'code' && isset($obj->{$fieldlist[$field]})) {
print '<td><input type="text" class="flat" value="'.(!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:'').'" size="10" name="'.$fieldlist[$field].'"></td>'; print '<td><input type="text" class="flat" value="'.(!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:'').'" size="10" name="'.$fieldlist[$field].'"></td>';
} }
else else {
{
print '<td>'; print '<td>';
$size = ''; $class = ''; $size = ''; $class = '';
if ($fieldlist[$field] == 'code') $size = 'size="8" '; if ($fieldlist[$field] == 'code') $size = 'size="8" ';

View File

@@ -76,8 +76,7 @@ if ($action == 'add' && $user->rights->accounting->chartofaccount)
{ {
$account_number = GETPOST('account_number', 'string'); $account_number = GETPOST('account_number', 'string');
} }
else else {
{
$account_number = clean_account(GETPOST('account_number', 'string')); $account_number = clean_account(GETPOST('account_number', 'string'));
} }
@@ -85,8 +84,7 @@ if ($action == 'add' && $user->rights->accounting->chartofaccount)
{ {
$account_parent = 0; $account_parent = 0;
} }
else else {
{
$account_parent = GETPOST('account_parent', 'int'); $account_parent = GETPOST('account_parent', 'int');
} }
@@ -141,8 +139,7 @@ if ($action == 'add' && $user->rights->accounting->chartofaccount)
{ {
$account_number = GETPOST('account_number', 'string'); $account_number = GETPOST('account_number', 'string');
} }
else else {
{
$account_number = clean_account(GETPOST('account_number', 'string')); $account_number = clean_account(GETPOST('account_number', 'string'));
} }
@@ -150,8 +147,7 @@ if ($action == 'add' && $user->rights->accounting->chartofaccount)
{ {
$account_parent = 0; $account_parent = 0;
} }
else else {
{
$account_parent = GETPOST('account_parent', 'int'); $account_parent = GETPOST('account_parent', 'int');
} }

View File

@@ -236,8 +236,7 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha'))
setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs'); setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs');
$_POST = array('id'=>$id); // Clean $_POST array, we keep only $_POST = array('id'=>$id); // Clean $_POST array, we keep only
} }
else else {
{
if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
setEventMessages($langs->transnoentities("ErrorRecordAlreadyExists"), null, 'errors'); setEventMessages($langs->transnoentities("ErrorRecordAlreadyExists"), null, 'errors');
} }
@@ -309,8 +308,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes') // delete
{ {
setEventMessages($langs->transnoentities("ErrorRecordIsUsedByChild"), null, 'errors'); setEventMessages($langs->transnoentities("ErrorRecordIsUsedByChild"), null, 'errors');
} }
else else {
{
dol_print_error($db); dol_print_error($db);
} }
} }
@@ -598,8 +596,7 @@ if ($id)
print '</td>'; print '</td>';
$filterfound++; $filterfound++;
} }
else else {
{
print '<td class="liste_titre"></td>'; print '<td class="liste_titre"></td>';
} }
} }
@@ -727,9 +724,8 @@ if ($id)
print '</td>'; print '</td>';
print '<td></td>'; print '<td></td>';
} }
else else {
{ $tmpaction = 'view';
$tmpaction = 'view';
$parameters = array('var'=>$var, 'fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]); $parameters = array('var'=>$var, 'fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
$reshook = $hookmanager->executeHooks('viewDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks $reshook = $hookmanager->executeHooks('viewDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
@@ -754,8 +750,7 @@ if ($id)
{ {
$valuetoshow = '-'; $valuetoshow = '-';
} }
else else {
{
$key = $langs->trans("Country".strtoupper($obj->country_code)); $key = $langs->trans("Country".strtoupper($obj->country_code));
$valuetoshow = ($key != "Country".strtoupper($obj->country_code) ? $obj->country_code." - ".$key : $obj->country); $valuetoshow = ($key != "Country".strtoupper($obj->country_code) ? $obj->country_code." - ".$key : $obj->country);
} }
@@ -799,8 +794,7 @@ if ($id)
// Active // Active
print '<td class="center" class="nowrap">'; print '<td class="center" class="nowrap">';
if ($canbedisabled) print '<a href="'.$url.'action='.$acts[$obj->active].'">'.$actl[$obj->active].'</a>'; if ($canbedisabled) print '<a href="'.$url.'action='.$acts[$obj->active].'">'.$actl[$obj->active].'</a>';
else else {
{
print $langs->trans("AlwaysActive"); print $langs->trans("AlwaysActive");
} }
print "</td>"; print "</td>";
@@ -883,8 +877,7 @@ function fieldListAccountingCategories($fieldlist, $obj = '', $tabname = '', $co
$fieldname = 'country_id'; $fieldname = 'country_id';
print $form->select_country(GETPOST('country_id', 'int'), $fieldname, '', 28, 'maxwidth200 maxwidthonsmartphone'); print $form->select_country(GETPOST('country_id', 'int'), $fieldname, '', 28, 'maxwidth200 maxwidthonsmartphone');
} }
else else {
{
print $form->select_country((!empty($obj->country_code) ? $obj->country_code : (!empty($obj->country) ? $obj->country : $mysoc->country_code)), $fieldname, '', 28, 'maxwidth200 maxwidthonsmartphone'); print $form->select_country((!empty($obj->country_code) ? $obj->country_code : (!empty($obj->country) ? $obj->country : $mysoc->country_code)), $fieldname, '', 28, 'maxwidth200 maxwidthonsmartphone');
} }
print '</td>'; print '</td>';
@@ -907,8 +900,7 @@ function fieldListAccountingCategories($fieldlist, $obj = '', $tabname = '', $co
elseif ($fieldlist[$field] == 'code' && isset($obj->{$fieldlist[$field]})) { elseif ($fieldlist[$field] == 'code' && isset($obj->{$fieldlist[$field]})) {
print '<td><input type="text" class="flat minwidth100" value="'.(!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:'').'" name="'.$fieldlist[$field].'"></td>'; print '<td><input type="text" class="flat minwidth100" value="'.(!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:'').'" name="'.$fieldlist[$field].'"></td>';
} }
else else {
{
print '<td>'; print '<td>';
$size = ''; $class = ''; $size = ''; $class = '';
if ($fieldlist[$field] == 'code') $class = 'maxwidth100'; if ($fieldlist[$field] == 'code') $class = 'maxwidth100';

View File

@@ -239,8 +239,7 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha'))
setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs'); setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs');
$_POST = array('id'=>$id); // Clean $_POST array, we keep only $_POST = array('id'=>$id); // Clean $_POST array, we keep only
} }
else else {
{
if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
setEventMessages($langs->transnoentities("ErrorRecordAlreadyExists"), null, 'errors'); setEventMessages($langs->transnoentities("ErrorRecordAlreadyExists"), null, 'errors');
} }
@@ -314,8 +313,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes') // delete
{ {
setEventMessages($langs->transnoentities("ErrorRecordIsUsedByChild"), null, 'errors'); setEventMessages($langs->transnoentities("ErrorRecordIsUsedByChild"), null, 'errors');
} }
else else {
{
dol_print_error($db); dol_print_error($db);
} }
} }
@@ -596,8 +594,7 @@ if ($id)
print '<div name="'.(!empty($obj->rowid) ? $obj->rowid : $obj->code).'"></div>'; print '<div name="'.(!empty($obj->rowid) ? $obj->rowid : $obj->code).'"></div>';
print '</td>'; print '</td>';
} }
else else {
{
$tmpaction = 'view'; $tmpaction = 'view';
$parameters = array('var'=>$var, 'fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]); $parameters = array('var'=>$var, 'fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
$reshook = $hookmanager->executeHooks('viewDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks $reshook = $hookmanager->executeHooks('viewDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
@@ -728,8 +725,7 @@ function fieldListJournal($fieldlist, $obj = '', $tabname = '', $context = '')
elseif ($fieldlist[$field] == 'code' && isset($obj->{$fieldlist[$field]})) { elseif ($fieldlist[$field] == 'code' && isset($obj->{$fieldlist[$field]})) {
print '<td><input type="text" class="flat minwidth100" value="'.(!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:'').'" name="'.$fieldlist[$field].'"></td>'; print '<td><input type="text" class="flat minwidth100" value="'.(!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:'').'" name="'.$fieldlist[$field].'"></td>';
} }
else else {
{
print '<td>'; print '<td>';
$size = ''; $class = ''; $size = ''; $class = '';
if ($fieldlist[$field] == 'code') $class = 'maxwidth100'; if ($fieldlist[$field] == 'code') $class = 'maxwidth100';

View File

@@ -268,9 +268,7 @@ elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL')
elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA') elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA')
{ {
$sql .= " p.accountancy_code_sell_intra = aa.account_number AND aa.fk_pcg_version = '".$pcgvercode."'"; $sql .= " p.accountancy_code_sell_intra = aa.account_number AND aa.fk_pcg_version = '".$pcgvercode."'";
} } else {
else
{
$sql .= " p.accountancy_code_sell_export = aa.account_number AND aa.fk_pcg_version = '".$pcgvercode."'"; $sql .= " p.accountancy_code_sell_export = aa.account_number AND aa.fk_pcg_version = '".$pcgvercode."'";
} }
$sql .= ' WHERE p.entity IN ('.getEntity('product').')'; $sql .= ' WHERE p.entity IN ('.getEntity('product').')';

View File

@@ -629,8 +629,7 @@ if ($action == 'create')
{ {
print $formaccounting->select_auxaccount((GETPOSTISSET("subledger_account") ? GETPOST("subledger_account", "alpha") : $line->subledger_account), 'subledger_account', 1); print $formaccounting->select_auxaccount((GETPOSTISSET("subledger_account") ? GETPOST("subledger_account", "alpha") : $line->subledger_account), 'subledger_account', 1);
} }
else else {
{
print '<input type="text" class="maxwidth150" name="subledger_account" value="'.(GETPOSTISSET("subledger_account") ? GETPOST("subledger_account", "alpha") : $line->subledger_account).'">'; print '<input type="text" class="maxwidth150" name="subledger_account" value="'.(GETPOSTISSET("subledger_account") ? GETPOST("subledger_account", "alpha") : $line->subledger_account).'">';
} }
print '</td>'; print '</td>';
@@ -686,8 +685,7 @@ if ($action == 'create')
{ {
print $formaccounting->select_auxaccount('', 'subledger_account', 1); print $formaccounting->select_auxaccount('', 'subledger_account', 1);
} }
else else {
{
print '<input type="text" class="maxwidth150" name="subledger_account" value="">'; print '<input type="text" class="maxwidth150" name="subledger_account" value="">';
} }
print '</td>'; print '</td>';
@@ -708,8 +706,7 @@ if ($action == 'create')
{ {
print '<a class="button" href="'.$_SERVER["PHP_SELF"].'?piece_num='.$object->piece_num.'&action=valid">'.$langs->trans("ValidTransaction").'</a>'; print '<a class="button" href="'.$_SERVER["PHP_SELF"].'?piece_num='.$object->piece_num.'&action=valid">'.$langs->trans("ValidTransaction").'</a>';
} }
else else {
{
print '<input type="submit" class="button" disabled="disabled" href="#" title="'.dol_escape_htmltag($langs->trans("MvtNotCorrectlyBalanced", $debit, $credit)).'" value="'.dol_escape_htmltag($langs->trans("ValidTransaction")).'">'; print '<input type="submit" class="button" disabled="disabled" href="#" title="'.dol_escape_htmltag($langs->trans("MvtNotCorrectlyBalanced", $debit, $credit)).'" value="'.dol_escape_htmltag($langs->trans("ValidTransaction")).'">';
} }

View File

@@ -352,8 +352,7 @@ if ($action == 'delbookkeepingyearconfirm' && $user->rights->accounting->mouveme
if ($result < 0) { if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
else else {
{
setEventMessages("RecordDeleted", null, 'mesgs'); setEventMessages("RecordDeleted", null, 'mesgs');
} }
@@ -361,8 +360,7 @@ if ($action == 'delbookkeepingyearconfirm' && $user->rights->accounting->mouveme
header("Location: list.php".($param ? '?'.$param : '')); header("Location: list.php".($param ? '?'.$param : ''));
exit; exit;
} }
else else {
{
setEventMessages("NoRecordDeleted", null, 'warnings'); setEventMessages("NoRecordDeleted", null, 'warnings');
} }
} }
@@ -374,8 +372,7 @@ if ($action == 'delmouvconfirm' && $user->rights->accounting->mouvements->suppri
if ($result < 0) { if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
else else {
{
setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs'); setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs');
} }
@@ -481,8 +478,7 @@ if ($action == 'export_file' && $user->rights->accounting->mouvements->export) {
{ {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
else else {
{
// Export files // Export files
$accountancyexport = new AccountancyExport($db); $accountancyexport = new AccountancyExport($db);
$accountancyexport->export($object->lines, $formatexportset); $accountancyexport->export($object->lines, $formatexportset);
@@ -491,8 +487,7 @@ if ($action == 'export_file' && $user->rights->accounting->mouvements->export) {
{ {
setEventMessages('', $accountancyexport->errors, 'errors'); setEventMessages('', $accountancyexport->errors, 'errors');
} }
else else {
{
// Specify as export : update field date_export // Specify as export : update field date_export
$error = 0; $error = 0;
$db->begin(); $db->begin();
@@ -522,8 +517,7 @@ if ($action == 'export_file' && $user->rights->accounting->mouvements->export) {
$db->commit(); $db->commit();
// setEventMessages($langs->trans("AllExportedMovementsWereRecordedAsExported"), null, 'mesgs'); // setEventMessages($langs->trans("AllExportedMovementsWereRecordedAsExported"), null, 'mesgs');
} }
else else {
{
$error++; $error++;
$db->rollback(); $db->rollback();
setEventMessages($langs->trans("NotAllExportedMovementsCouldBeRecordedAsExported"), null, 'errors'); setEventMessages($langs->trans("NotAllExportedMovementsCouldBeRecordedAsExported"), null, 'errors');
@@ -560,8 +554,7 @@ if (is_numeric($nbtotalofrecords) && $limit > $nbtotalofrecords)
{ {
$num = $nbtotalofrecords; $num = $nbtotalofrecords;
} }
else else {
{
$sql .= $db->plimit($limit + 1, $offset); $sql .= $db->plimit($limit + 1, $offset);
$resql = $db->query($sql); $resql = $db->query($sql);
@@ -722,8 +715,7 @@ if (!empty($arrayfields['t.subledger_account']['checked']))
{ {
print $formaccounting->select_auxaccount($search_accountancy_aux_code_start, 'search_accountancy_aux_code_start', 1); print $formaccounting->select_auxaccount($search_accountancy_aux_code_start, 'search_accountancy_aux_code_start', 1);
} }
else else {
{
print '<input type="text" class="maxwidth100" name="search_accountancy_aux_code_start" value="'.$search_accountancy_aux_code_start.'">'; print '<input type="text" class="maxwidth100" name="search_accountancy_aux_code_start" value="'.$search_accountancy_aux_code_start.'">';
} }
print '</div>'; print '</div>';
@@ -735,8 +727,7 @@ if (!empty($arrayfields['t.subledger_account']['checked']))
{ {
print $formaccounting->select_auxaccount($search_accountancy_aux_code_end, 'search_accountancy_aux_code_end', 1); print $formaccounting->select_auxaccount($search_accountancy_aux_code_end, 'search_accountancy_aux_code_end', 1);
} }
else else {
{
print '<input type="text" class="maxwidth100" name="search_accountancy_aux_code_end" value="'.$search_accountancy_aux_code_end.'">'; print '<input type="text" class="maxwidth100" name="search_accountancy_aux_code_end" value="'.$search_accountancy_aux_code_end.'">';
} }
print '</div>'; print '</div>';
@@ -958,8 +949,7 @@ while ($i < min($num, $limit))
$urlsource = $_SERVER['PHP_SELF'].'?id='.$objectstatic->id; $urlsource = $_SERVER['PHP_SELF'].'?id='.$objectstatic->id;
$documentlink = $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir); $documentlink = $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
} }
else else {
{
// Other type // Other type
} }

View File

@@ -255,8 +255,7 @@ if ($action == 'delbookkeepingyearconfirm' && $user->rights->accounting->mouveme
if ($result < 0) { if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
else else {
{
setEventMessages("RecordDeleted", null, 'mesgs'); setEventMessages("RecordDeleted", null, 'mesgs');
} }
@@ -264,8 +263,7 @@ if ($action == 'delbookkeepingyearconfirm' && $user->rights->accounting->mouveme
header("Location: listbyaccount.php".($param ? '?'.$param : '')); header("Location: listbyaccount.php".($param ? '?'.$param : ''));
exit; exit;
} }
else else {
{
setEventMessages("NoRecordDeleted", null, 'warnings'); setEventMessages("NoRecordDeleted", null, 'warnings');
} }
} }
@@ -277,8 +275,7 @@ if ($action == 'delmouvconfirm' && $user->rights->accounting->mouvements->suppri
if ($result < 0) { if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
else else {
{
setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs'); setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs');
} }
@@ -538,8 +535,7 @@ while ($i < min($num, $limit))
print '</td>'; print '</td>';
print '<td></td>'; print '<td></td>';
} }
else else {
{
print '<td></td>'; print '<td></td>';
print '<td class="nowraponall right">'; print '<td class="nowraponall right">';
print price($sous_total_credit - $sous_total_debit); print price($sous_total_credit - $sous_total_debit);
@@ -640,8 +636,7 @@ while ($i < min($num, $limit))
$urlsource = $_SERVER['PHP_SELF'].'?id='.$objectstatic->id; $urlsource = $_SERVER['PHP_SELF'].'?id='.$objectstatic->id;
$documentlink = $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir); $documentlink = $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
} }
else else {
{
// Other type // Other type
} }
@@ -743,8 +738,7 @@ if ($balance > 0 )
print '</td>'; print '</td>';
print '<td></td>'; print '<td></td>';
} }
else else {
{
print '<td></td>'; print '<td></td>';
print '<td class="nowraponall right">'; print '<td class="nowraponall right">';
print price($sous_total_credit - $sous_total_debit); print price($sous_total_credit - $sous_total_debit);

View File

@@ -210,8 +210,7 @@ class AccountancyCategory // extends CommonObject
$this->db->rollback(); $this->db->rollback();
return -1 * $error; return -1 * $error;
} }
else else {
{
$this->db->commit(); $this->db->commit();
return $this->id; return $this->id;
} }
@@ -241,8 +240,7 @@ class AccountancyCategory // extends CommonObject
$sql .= " t.active"; $sql .= " t.active";
$sql .= " FROM ".MAIN_DB_PREFIX."c_accounting_category as t"; $sql .= " FROM ".MAIN_DB_PREFIX."c_accounting_category as t";
if ($id) $sql .= " WHERE t.rowid = ".$id; if ($id) $sql .= " WHERE t.rowid = ".$id;
else else {
{
$sql .= " WHERE t.entity IN (".getEntity('c_accounting_category').")"; // Dont't use entity if you use rowid $sql .= " WHERE t.entity IN (".getEntity('c_accounting_category').")"; // Dont't use entity if you use rowid
if ($code) $sql .= " AND t.code = '".$this->db->escape($code)."'"; if ($code) $sql .= " AND t.code = '".$this->db->escape($code)."'";
elseif ($label) $sql .= " AND t.label = '".$this->db->escape($label)."'"; elseif ($label) $sql .= " AND t.label = '".$this->db->escape($label)."'";
@@ -271,8 +269,7 @@ class AccountancyCategory // extends CommonObject
return 1; return 1;
} }
else else {
{
$this->error = "Error ".$this->db->lasterror(); $this->error = "Error ".$this->db->lasterror();
return -1; return -1;
} }
@@ -336,8 +333,7 @@ class AccountancyCategory // extends CommonObject
$this->db->rollback(); $this->db->rollback();
return -1 * $error; return -1 * $error;
} }
else else {
{
$this->db->commit(); $this->db->commit();
return 1; return 1;
} }
@@ -376,8 +372,7 @@ class AccountancyCategory // extends CommonObject
$this->db->rollback(); $this->db->rollback();
return -1 * $error; return -1 * $error;
} }
else else {
{
$this->db->commit(); $this->db->commit();
return 1; return 1;
} }
@@ -710,8 +705,7 @@ class AccountancyCategory // extends CommonObject
} }
$sql .= " AND t.numero_compte IN (".$listofaccount.")"; $sql .= " AND t.numero_compte IN (".$listofaccount.")";
} }
else else {
{
$sql .= " AND t.numero_compte = '".$this->db->escape($cpt)."'"; $sql .= " AND t.numero_compte = '".$this->db->escape($cpt)."'";
} }
if (!empty($date_start) && !empty($date_end) && (empty($month) || empty($year))) // If month/year provided, it is stronger than filter date_start/date_end if (!empty($date_start) && !empty($date_end) && (empty($month) || empty($year))) // If month/year provided, it is stronger than filter date_start/date_end
@@ -834,8 +828,7 @@ class AccountancyCategory // extends CommonObject
$sql .= " AND t.entity = ".$conf->entity; $sql .= " AND t.entity = ".$conf->entity;
$sql .= " ORDER BY t.account_number"; $sql .= " ORDER BY t.account_number";
} }
else else {
{
$sql = "SELECT t.rowid, t.account_number, t.label as account_label"; $sql = "SELECT t.rowid, t.account_number, t.label as account_label";
$sql .= " FROM ".MAIN_DB_PREFIX."accounting_account as t"; $sql .= " FROM ".MAIN_DB_PREFIX."accounting_account as t";
$sql .= " WHERE ".$predefinedgroupwhere; $sql .= " WHERE ".$predefinedgroupwhere;

View File

@@ -518,11 +518,12 @@ class AccountancyExport
$Tab['contrepartie'] = str_repeat(' ', 8); $Tab['contrepartie'] = str_repeat(' ', 8);
// elarifr: date format must be fixed format : 6 char ddmmyy = %d%m%yand not defined by user / dolibarr setting // elarifr: date format must be fixed format : 6 char ddmmyy = %d%m%yand not defined by user / dolibarr setting
if (!empty($data->date_echeance)) if (!empty($data->date_echeance)) {
//$Tab['date_echeance'] = dol_print_date($data->date_echeance, $conf->global->ACCOUNTING_EXPORT_DATE); //$Tab['date_echeance'] = dol_print_date($data->date_echeance, $conf->global->ACCOUNTING_EXPORT_DATE);
$Tab['date_echeance'] = dol_print_date($data->date_echeance, '%d%m%y'); // elarifr: format must be ddmmyy $Tab['date_echeance'] = dol_print_date($data->date_echeance, '%d%m%y'); // elarifr: format must be ddmmyy
else } else {
$Tab['date_echeance'] = '000000'; $Tab['date_echeance'] = '000000';
}
//elarifr please keep quadra named field lettrage(2) + codestat(3) instead of fake lettrage(5) //elarifr please keep quadra named field lettrage(2) + codestat(3) instead of fake lettrage(5)
//$Tab['lettrage'] = str_repeat(' ', 5); //$Tab['lettrage'] = str_repeat(' ', 5);
@@ -597,12 +598,12 @@ class AccountancyExport
$Tab['num_compte'] = str_pad(self::trunc($code_compta, 6), 6, '0'); $Tab['num_compte'] = str_pad(self::trunc($code_compta, 6), 6, '0');
if($data->sens == 'D'){ if ($data->sens == 'D') {
$Tab['montant_debit'] = str_pad(number_format(abs($data->montant), 2, ',', ''), 13, ' ', STR_PAD_LEFT); $Tab['montant_debit'] = str_pad(number_format(abs($data->montant), 2, ',', ''), 13, ' ', STR_PAD_LEFT);
$Tab['montant_crebit'] = str_pad(number_format(0, 2, ',', ''), 13, ' ', STR_PAD_LEFT); $Tab['montant_crebit'] = str_pad(number_format(0, 2, ',', ''), 13, ' ', STR_PAD_LEFT);
} }
else{ else {
$Tab['montant_debit'] = str_pad(number_format(0, 2, ',', ''), 13, ' ', STR_PAD_LEFT); $Tab['montant_debit'] = str_pad(number_format(0, 2, ',', ''), 13, ' ', STR_PAD_LEFT);
$Tab['montant_crebit'] = str_pad(number_format(abs($data->montant), 2, ',', ''), 13, ' ', STR_PAD_LEFT); $Tab['montant_crebit'] = str_pad(number_format(abs($data->montant), 2, ',', ''), 13, ' ', STR_PAD_LEFT);
@@ -616,11 +617,12 @@ class AccountancyExport
$Tab['code_stat'] = str_repeat(' ', 4); $Tab['code_stat'] = str_repeat(' ', 4);
if (!empty($data->date_echeance)) if (!empty($data->date_echeance)) {
//$Tab['date_echeance'] = dol_print_date($data->date_echeance, $conf->global->ACCOUNTING_EXPORT_DATE); //$Tab['date_echeance'] = dol_print_date($data->date_echeance, $conf->global->ACCOUNTING_EXPORT_DATE);
$Tab['date_echeance'] = dol_print_date($data->date_echeance, '%d%m%Y'); $Tab['date_echeance'] = dol_print_date($data->date_echeance, '%d%m%Y');
else } else {
$Tab['date_echeance'] = dol_print_date($data->doc_date, '%d%m%Y'); $Tab['date_echeance'] = dol_print_date($data->doc_date, '%d%m%Y');
}
$Tab['monnaie'] = '1'; $Tab['monnaie'] = '1';
@@ -925,8 +927,7 @@ class AccountancyExport
{ {
print 'S'.$this->separator; print 'S'.$this->separator;
} }
else else {
{
print 'H'.$this->separator; print 'H'.$this->separator;
} }
//Grp //Grp
@@ -938,13 +939,11 @@ class AccountancyExport
{ {
print length_accounta($thisPieceAccountNr).$this->separator; print length_accounta($thisPieceAccountNr).$this->separator;
} }
else else {
{
print "div".$this->separator; print "div".$this->separator;
} }
} }
else else {
{
print length_accounta($line->code_tiers).$this->separator; print length_accounta($line->code_tiers).$this->separator;
} }
//SId //SId
@@ -961,8 +960,7 @@ class AccountancyExport
{ {
print "2".$this->separator; print "2".$this->separator;
} }
else else {
{
print "1".$this->separator; print "1".$this->separator;
} }
// Code // Code
@@ -972,8 +970,7 @@ class AccountancyExport
{ {
print $line->montant.$this->separator; print $line->montant.$this->separator;
} }
else else {
{
print ($line->montant * -1).$this->separator; print ($line->montant * -1).$this->separator;
} }
// Steuer // Steuer
@@ -1458,7 +1455,9 @@ class AccountancyExport
print self::trunc($line->code_journal, 6).$separator; //Journal code print self::trunc($line->code_journal, 6).$separator; //Journal code
if (!empty($line->subledger_account)) $account = $line->subledger_account; if (!empty($line->subledger_account)) $account = $line->subledger_account;
else $account = $line->numero_compte; else {
$account = $line->numero_compte;
}
print self::trunc($account, 15).$separator; //Account number print self::trunc($account, 15).$separator; //Account number
print self::trunc($line->label_compte, 60).$separator; //Account label print self::trunc($line->label_compte, 60).$separator; //Account label

View File

@@ -137,8 +137,7 @@ class AccountingJournal extends CommonObject
return 0; return 0;
} }
} }
else else {
{
$this->error = "Error ".$this->db->lasterror(); $this->error = "Error ".$this->db->lasterror();
$this->errors[] = "Error ".$this->db->lasterror(); $this->errors[] = "Error ".$this->db->lasterror();
} }

View File

@@ -259,8 +259,7 @@ class BookKeeping extends CommonObject
{ {
$this->errors[] = $langs->trans('ErrorFieldAccountNotDefinedForBankLine', $this->fk_docdet, $this->doc_type); $this->errors[] = $langs->trans('ErrorFieldAccountNotDefinedForBankLine', $this->fk_docdet, $this->doc_type);
} }
else else {
{
//$this->errors[]=$langs->trans('ErrorFieldAccountNotDefinedForInvoiceLine', $this->doc_ref, $this->label_compte); //$this->errors[]=$langs->trans('ErrorFieldAccountNotDefinedForInvoiceLine', $this->doc_ref, $this->label_compte);
$mesg = $this->doc_ref.', '.$langs->trans("AccountAccounting").': '.$this->numero_compte; $mesg = $this->doc_ref.', '.$langs->trans("AccountAccounting").': '.$this->numero_compte;
if ($this->subledger_account && $this->subledger_account != $this->numero_compte) if ($this->subledger_account && $this->subledger_account != $this->numero_compte)

View File

@@ -42,8 +42,7 @@ if (!$user->rights->accounting->fiscalyear->write)
$month_start = ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1); $month_start = ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1);
if (GETPOST("year", 'int')) $year_start = GETPOST("year", 'int'); if (GETPOST("year", 'int')) $year_start = GETPOST("year", 'int');
else else {
{
$year_start = dol_print_date(dol_now(), '%Y'); $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 if (dol_print_date(dol_now(), '%m') < $month_start) $year_start--; // If current month is lower that starting fiscal month, we start last year
} }

View File

@@ -42,8 +42,7 @@ if ($user->socid > 0)
$month_start = ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1); $month_start = ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1);
if (GETPOST("year", 'int')) $year_start = GETPOST("year", 'int'); if (GETPOST("year", 'int')) $year_start = GETPOST("year", 'int');
else else {
{
$year_start = dol_print_date(dol_now(), '%Y'); $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 if (dol_print_date(dol_now(), '%m') < $month_start) $year_start--; // If current month is lower that starting fiscal month, we start last year
} }

View File

@@ -60,8 +60,7 @@ if ($action == 'ventil' && $user->rights->accounting->bind->write)
if (!$resql) { if (!$resql) {
setEventMessages($db->lasterror(), null, 'errors'); setEventMessages($db->lasterror(), null, 'errors');
} }
else else {
{
setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs'); setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs');
if ($backtopage) if ($backtopage)
{ {

View File

@@ -47,8 +47,7 @@ if (!$user->rights->accounting->bind->write)
$month_start = ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1); $month_start = ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1);
if (GETPOST("year", 'int')) $year_start = GETPOST("year", 'int'); if (GETPOST("year", 'int')) $year_start = GETPOST("year", 'int');
else else {
{
$year_start = dol_print_date(dol_now(), '%Y'); $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 if (dol_print_date(dol_now(), '%m') < $month_start) $year_start--; // If current month is lower that starting fiscal month, we start last year
} }

View File

@@ -160,8 +160,7 @@ if ($massaction == 'ventil') {
$msg .= '<div><font color="red">'.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("NoAccountSelected").'</font></div>'; $msg .= '<div><font color="red">'.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("NoAccountSelected").'</font></div>';
$ko++; $ko++;
} }
else else {
{
$sql = " UPDATE ".MAIN_DB_PREFIX."facturedet"; $sql = " UPDATE ".MAIN_DB_PREFIX."facturedet";
$sql .= " SET fk_code_ventilation = ".$monCompte; $sql .= " SET fk_code_ventilation = ".$monCompte;
$sql .= " WHERE rowid = ".$monId; $sql .= " WHERE rowid = ".$monId;

View File

@@ -64,8 +64,7 @@ if ($action == 'ventil' && $user->rights->accounting->bind->write)
if (!$resql) { if (!$resql) {
setEventMessages($db->lasterror(), null, 'errors'); setEventMessages($db->lasterror(), null, 'errors');
} }
else else {
{
setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs'); setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs');
if ($backtopage) if ($backtopage)
{ {

View File

@@ -43,8 +43,7 @@ if (!$user->rights->accounting->bind->write)
$month_start = ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1); $month_start = ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1);
if (GETPOST("year", 'int')) $year_start = GETPOST("year", 'int'); if (GETPOST("year", 'int')) $year_start = GETPOST("year", 'int');
else else {
{
$year_start = dol_print_date(dol_now(), '%Y'); $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 if (dol_print_date(dol_now(), '%m') < $month_start) $year_start--; // If current month is lower that starting fiscal month, we start last year
} }

View File

@@ -139,8 +139,7 @@ if ($massaction == 'ventil') {
$msg .= '<div><font color="red">'.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("NoAccountSelected").'</font></div>'; $msg .= '<div><font color="red">'.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("NoAccountSelected").'</font></div>';
$ko++; $ko++;
} }
else else {
{
$sql = " UPDATE ".MAIN_DB_PREFIX."expensereport_det"; $sql = " UPDATE ".MAIN_DB_PREFIX."expensereport_det";
$sql .= " SET fk_code_ventilation = ".$monCompte; $sql .= " SET fk_code_ventilation = ".$monCompte;
$sql .= " WHERE rowid = ".$monId; $sql .= " WHERE rowid = ".$monId;

View File

@@ -241,8 +241,7 @@ if ($conf->accounting->enabled)
print '</div>'; print '</div>';
} }
else else {
{
print load_fiche_titre($langs->trans("AccountancyArea"), '', 'accountancy'); print load_fiche_titre($langs->trans("AccountancyArea"), '', 'accountancy');
print $langs->trans("Module10Desc")."<br>\n"; print $langs->trans("Module10Desc")."<br>\n";

View File

@@ -550,8 +550,7 @@ if (!$error && $action == 'writebookkeeping') {
$errorforline++; $errorforline++;
setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings'); setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
} }
else else {
{
$error++; $error++;
$errorforline++; $errorforline++;
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors'); setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
@@ -576,8 +575,7 @@ if (!$error && $action == 'writebookkeeping') {
{ {
$reflabel .= dol_string_nohtmltag($langs->transnoentitiesnoconv('TransitionalAccount').' '.$account_transfer); $reflabel .= dol_string_nohtmltag($langs->transnoentitiesnoconv('TransitionalAccount').' '.$account_transfer);
} }
else else {
{
$reflabel .= dol_string_nohtmltag($val['soclib']); $reflabel .= dol_string_nohtmltag($val['soclib']);
} }
@@ -700,8 +698,7 @@ if (!$error && $action == 'writebookkeeping') {
$errorforline++; $errorforline++;
setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings'); setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
} }
else else {
{
$error++; $error++;
$errorforline++; $errorforline++;
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors'); setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
@@ -748,8 +745,7 @@ if (!$error && $action == 'writebookkeeping') {
$errorforline++; $errorforline++;
setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings'); setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
} }
else else {
{
$error++; $error++;
$errorforline++; $errorforline++;
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors'); setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
@@ -771,8 +767,7 @@ if (!$error && $action == 'writebookkeeping') {
{ {
$db->commit(); $db->commit();
} }
else else {
{
//print 'KO for line '.$key.' '.$error.'<br>'; //print 'KO for line '.$key.' '.$error.'<br>';
$db->rollback(); $db->rollback();
@@ -792,8 +787,7 @@ if (!$error && $action == 'writebookkeeping') {
{ {
setEventMessages($langs->trans("NoNewRecordSaved"), null, 'warnings'); setEventMessages($langs->trans("NoNewRecordSaved"), null, 'warnings');
} }
else else {
{
setEventMessages($langs->trans("GeneralLedgerSomeRecordWasNotRecorded"), null, 'warnings'); setEventMessages($langs->trans("GeneralLedgerSomeRecordWasNotRecorded"), null, 'warnings');
} }
@@ -880,8 +874,7 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
{ {
$reflabel .= dol_string_nohtmltag($langs->transnoentitiesnoconv('TransitionalAccount').' '.$account_transfer); $reflabel .= dol_string_nohtmltag($langs->transnoentitiesnoconv('TransitionalAccount').' '.$account_transfer);
} }
else else {
{
$reflabel .= dol_string_nohtmltag($val['soclib']); $reflabel .= dol_string_nohtmltag($val['soclib']);
} }
@@ -1105,8 +1098,7 @@ if (empty($action) || $action == 'view') {
{ {
$reflabel .= $langs->trans('TransitionalAccount').' '.$account_transfer; $reflabel .= $langs->trans('TransitionalAccount').' '.$account_transfer;
} }
else else {
{
$reflabel .= $val['soclib']; $reflabel .= $val['soclib'];
} }
@@ -1135,13 +1127,11 @@ if (empty($action) || $action == 'view') {
{ {
print '<span class="error">'.$langs->trans('UnknownAccountForThirdpartyAndWaitingAccountNotDefinedBlocking').'</span>'; print '<span class="error">'.$langs->trans('UnknownAccountForThirdpartyAndWaitingAccountNotDefinedBlocking').'</span>';
} }
else else {
{
print '<span class="warning">'.$langs->trans('UnknownAccountForThirdparty', length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE)).'</span>'; // We will use a waiting account print '<span class="warning">'.$langs->trans('UnknownAccountForThirdparty', length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE)).'</span>'; // We will use a waiting account
} }
} }
else else {
{
// We will refuse writing // We will refuse writing
$errorstring = 'UnknownAccountForThirdpartyBlocking'; $errorstring = 'UnknownAccountForThirdpartyBlocking';
if ($tabtype[$key] == 'payment') $errorstring = 'MainAccountForCustomersNotDefined'; if ($tabtype[$key] == 'payment') $errorstring = 'MainAccountForCustomersNotDefined';
@@ -1178,8 +1168,7 @@ if (empty($action) || $action == 'view') {
print '<span class="warning">'.$langs->trans("ThirdpartyAccountNotDefinedOrThirdPartyUnknown", $tabcompany[$key]['code_compta']).'</span>'; print '<span class="warning">'.$langs->trans("ThirdpartyAccountNotDefinedOrThirdPartyUnknown", $tabcompany[$key]['code_compta']).'</span>';
} }
} }
else else {
{
print '<span class="error">'.$langs->trans("ThirdpartyAccountNotDefinedOrThirdPartyUnknownBlocking").'</span>'; print '<span class="error">'.$langs->trans("ThirdpartyAccountNotDefinedOrThirdPartyUnknownBlocking").'</span>';
} }
} }

View File

@@ -232,8 +232,7 @@ if ($action == 'writebookkeeping') {
$errorforline++; $errorforline++;
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings'); //setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
} }
else else {
{
$error++; $error++;
$errorforline++; $errorforline++;
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors'); setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
@@ -282,8 +281,7 @@ if ($action == 'writebookkeeping') {
$errorforline++; $errorforline++;
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings'); //setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
} }
else else {
{
$error++; $error++;
$errorforline++; $errorforline++;
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors'); setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
@@ -342,8 +340,7 @@ if ($action == 'writebookkeeping') {
$errorforline++; $errorforline++;
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings'); //setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
} }
else else {
{
$error++; $error++;
$errorforline++; $errorforline++;
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors'); setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
@@ -366,8 +363,7 @@ if ($action == 'writebookkeeping') {
{ {
$db->commit(); $db->commit();
} }
else else {
{
$db->rollback(); $db->rollback();
if ($error >= 10) if ($error >= 10)
@@ -387,8 +383,7 @@ if ($action == 'writebookkeeping') {
{ {
setEventMessages($langs->trans("NoNewRecordSaved"), null, 'warnings'); setEventMessages($langs->trans("NoNewRecordSaved"), null, 'warnings');
} }
else else {
{
setEventMessages($langs->trans("GeneralLedgerSomeRecordWasNotRecorded"), null, 'warnings'); setEventMessages($langs->trans("GeneralLedgerSomeRecordWasNotRecorded"), null, 'warnings');
} }

View File

@@ -152,8 +152,9 @@ if ($result) {
if (empty($compta_prod)) { if (empty($compta_prod)) {
if ($obj->product_type == 0) if ($obj->product_type == 0)
$compta_prod = (!empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : 'NotDefined'; $compta_prod = (!empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : 'NotDefined';
else else {
$compta_prod = (!empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : 'NotDefined'; $compta_prod = (!empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : 'NotDefined';
}
} }
$vatdata = getTaxesFromId($obj->tva_tx.($obj->vat_src_code ? ' ('.$obj->vat_src_code.')' : ''), $mysoc, $mysoc, 0); $vatdata = getTaxesFromId($obj->tva_tx.($obj->vat_src_code ? ' ('.$obj->vat_src_code.')' : ''), $mysoc, $mysoc, 0);
@@ -332,8 +333,7 @@ if ($action == 'writebookkeeping') {
$errorforinvoice[$key] = 'alreadyjournalized'; $errorforinvoice[$key] = 'alreadyjournalized';
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings'); //setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
} }
else else {
{
$error++; $error++;
$errorforline++; $errorforline++;
$errorforinvoice[$key] = 'other'; $errorforinvoice[$key] = 'other';
@@ -384,8 +384,7 @@ if ($action == 'writebookkeeping') {
$errorforinvoice[$key] = 'alreadyjournalized'; $errorforinvoice[$key] = 'alreadyjournalized';
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings'); //setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
} }
else else {
{
$error++; $error++;
$errorforline++; $errorforline++;
$errorforinvoice[$key] = 'other'; $errorforinvoice[$key] = 'other';
@@ -447,8 +446,7 @@ if ($action == 'writebookkeeping') {
$errorforinvoice[$key] = 'alreadyjournalized'; $errorforinvoice[$key] = 'alreadyjournalized';
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings'); //setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
} }
else else {
{
$error++; $error++;
$errorforline++; $errorforline++;
$errorforinvoice[$key] = 'other'; $errorforinvoice[$key] = 'other';
@@ -500,8 +498,7 @@ if ($action == 'writebookkeeping') {
$errorforinvoice[$key] = 'alreadyjournalized'; $errorforinvoice[$key] = 'alreadyjournalized';
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings'); //setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
} }
else else {
{
$error++; $error++;
$errorforline++; $errorforline++;
$errorforinvoice[$key] = 'other'; $errorforinvoice[$key] = 'other';
@@ -525,8 +522,7 @@ if ($action == 'writebookkeeping') {
{ {
$db->commit(); $db->commit();
} }
else else {
{
$db->rollback(); $db->rollback();
if ($error >= 10) if ($error >= 10)
@@ -546,8 +542,7 @@ if ($action == 'writebookkeeping') {
{ {
setEventMessages($langs->trans("NoNewRecordSaved"), null, 'warnings'); setEventMessages($langs->trans("NoNewRecordSaved"), null, 'warnings');
} }
else else {
{
setEventMessages($langs->trans("GeneralLedgerSomeRecordWasNotRecorded"), null, 'warnings'); setEventMessages($langs->trans("GeneralLedgerSomeRecordWasNotRecorded"), null, 'warnings');
} }

View File

@@ -158,8 +158,9 @@ if ($result) {
if (empty($compta_prod)) { if (empty($compta_prod)) {
if ($obj->product_type == 0) if ($obj->product_type == 0)
$compta_prod = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT)) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : 'NotDefined'; $compta_prod = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT)) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : 'NotDefined';
else else {
$compta_prod = (!empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT)) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : 'NotDefined'; $compta_prod = (!empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT)) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : 'NotDefined';
}
} }
$vatdata = getTaxesFromId($obj->tva_tx.($obj->vat_src_code ? ' ('.$obj->vat_src_code.')' : ''), $mysoc, $mysoc, 0); $vatdata = getTaxesFromId($obj->tva_tx.($obj->vat_src_code ? ' ('.$obj->vat_src_code.')' : ''), $mysoc, $mysoc, 0);
@@ -343,8 +344,7 @@ if ($action == 'writebookkeeping') {
$errorforinvoice[$key] = 'alreadyjournalized'; $errorforinvoice[$key] = 'alreadyjournalized';
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings'); //setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
} }
else else {
{
$error++; $error++;
$errorforline++; $errorforline++;
$errorforinvoice[$key] = 'other'; $errorforinvoice[$key] = 'other';
@@ -395,8 +395,7 @@ if ($action == 'writebookkeeping') {
$errorforinvoice[$key] = 'alreadyjournalized'; $errorforinvoice[$key] = 'alreadyjournalized';
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings'); //setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
} }
else else {
{
$error++; $error++;
$errorforline++; $errorforline++;
$errorforinvoice[$key] = 'other'; $errorforinvoice[$key] = 'other';
@@ -457,8 +456,7 @@ if ($action == 'writebookkeeping') {
$errorforinvoice[$key] = 'alreadyjournalized'; $errorforinvoice[$key] = 'alreadyjournalized';
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings'); //setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
} }
else else {
{
$error++; $error++;
$errorforline++; $errorforline++;
$errorforinvoice[$key] = 'other'; $errorforinvoice[$key] = 'other';
@@ -483,8 +481,7 @@ if ($action == 'writebookkeeping') {
{ {
$db->commit(); $db->commit();
} }
else else {
{
$db->rollback(); $db->rollback();
if ($error >= 10) if ($error >= 10)
@@ -500,12 +497,10 @@ if ($action == 'writebookkeeping') {
if (empty($error) && count($tabpay) > 0) { if (empty($error) && count($tabpay) > 0) {
setEventMessages($langs->trans("GeneralLedgerIsWritten"), null, 'mesgs'); setEventMessages($langs->trans("GeneralLedgerIsWritten"), null, 'mesgs');
} }
elseif (count($tabpay) == $error) elseif (count($tabpay) == $error) {
{
setEventMessages($langs->trans("NoNewRecordSaved"), null, 'warnings'); setEventMessages($langs->trans("NoNewRecordSaved"), null, 'warnings');
} }
else else {
{
setEventMessages($langs->trans("GeneralLedgerSomeRecordWasNotRecorded"), null, 'warnings'); setEventMessages($langs->trans("GeneralLedgerSomeRecordWasNotRecorded"), null, 'warnings');
} }
@@ -659,8 +654,9 @@ if (empty($action) || $action == 'view') {
$description .= $langs->trans("DescJournalOnlyBindedVisible").'<br>'; $description .= $langs->trans("DescJournalOnlyBindedVisible").'<br>';
if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS))
$description .= $langs->trans("DepositsAreNotIncluded"); $description .= $langs->trans("DepositsAreNotIncluded");
else else {
$description .= $langs->trans("DepositsAreIncluded"); $description .= $langs->trans("DepositsAreIncluded");
}
$listofchoices = array('notyet'=>$langs->trans("NotYetInGeneralLedger"), 'already'=>$langs->trans("AlreadyInGeneralLedger")); $listofchoices = array('notyet'=>$langs->trans("NotYetInGeneralLedger"), 'already'=>$langs->trans("AlreadyInGeneralLedger"));
$period = $form->selectDate($date_start ? $date_start : -1, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end ? $date_end : -1, 'date_end', 0, 0, 0, '', 1, 0); $period = $form->selectDate($date_start ? $date_start : -1, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end ? $date_end : -1, 'date_end', 0, 0, 0, '', 1, 0);

View File

@@ -64,8 +64,7 @@ if ($action == 'ventil' && $user->rights->accounting->bind->write)
if (!$resql) { if (!$resql) {
setEventMessages($db->lasterror(), null, 'errors'); setEventMessages($db->lasterror(), null, 'errors');
} }
else else {
{
setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs'); setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs');
if ($backtopage) if ($backtopage)
{ {

View File

@@ -45,8 +45,7 @@ if (!$user->rights->accounting->bind->write)
$month_start = ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1); $month_start = ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1);
if (GETPOST("year", 'int')) $year_start = GETPOST("year", 'int'); if (GETPOST("year", 'int')) $year_start = GETPOST("year", 'int');
else else {
{
$year_start = dol_print_date(dol_now(), '%Y'); $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 if (dol_print_date(dol_now(), '%m') < $month_start) $year_start--; // If current month is lower that starting fiscal month, we start last year
} }

View File

@@ -164,8 +164,7 @@ if ($massaction == 'ventil') {
$msg .= '<div><font color="red">'.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("NoAccountSelected").'</font></div>'; $msg .= '<div><font color="red">'.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("NoAccountSelected").'</font></div>';
$ko++; $ko++;
} }
else else {
{
$sql = " UPDATE ".MAIN_DB_PREFIX."facture_fourn_det"; $sql = " UPDATE ".MAIN_DB_PREFIX."facture_fourn_det";
$sql .= " SET fk_code_ventilation = ".$monCompte; $sql .= " SET fk_code_ventilation = ".$monCompte;
$sql .= " WHERE rowid = ".$monId; $sql .= " WHERE rowid = ".$monId;

View File

@@ -59,8 +59,7 @@ if ($accountancyexport->getFormatCode($formatexportset) == $accountancyexport::$
$completefilename = $siren."FEC".$endaccountingperiod.".txt"; $completefilename = $siren."FEC".$endaccountingperiod.".txt";
} }
else else {
{
$completefilename = ($code ? $code."_" : "").($prefix ? $prefix."_" : "").$filename.($nodateexport ? "" : $date_export).".".$format; $completefilename = ($code ? $code."_" : "").($prefix ? $prefix."_" : "").$filename.($nodateexport ? "" : $date_export).".".$format;
} }

View File

@@ -146,14 +146,12 @@ if ($action == 'add' && $user->rights->adherent->configurer) {
header("Location: ".$_SERVER["PHP_SELF"]); header("Location: ".$_SERVER["PHP_SELF"]);
exit; exit;
} }
else else {
{
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
$action = 'create'; $action = 'create';
} }
} }
else else {
{
$action = 'create'; $action = 'create';
} }
} }
@@ -184,8 +182,7 @@ if ($action == 'update' && $user->rights->adherent->configurer)
{ {
setEventMessages($langs->trans("MemberTypeModified"), null, 'mesgs'); setEventMessages($langs->trans("MemberTypeModified"), null, 'mesgs');
} }
else else {
{
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
@@ -204,8 +201,7 @@ if ($action == 'confirm_delete' && $user->rights->adherent->configurer)
header("Location: ".$_SERVER["PHP_SELF"]); header("Location: ".$_SERVER["PHP_SELF"]);
exit; exit;
} }
else else {
{
setEventMessages($langs->trans("MemberTypeCanNotBeDeleted"), null, 'errors'); setEventMessages($langs->trans("MemberTypeCanNotBeDeleted"), null, 'errors');
$action = ''; $action = '';
} }
@@ -244,8 +240,7 @@ if (!$rowid && $action != 'create' && $action != 'edit')
if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.$limit; if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.$limit;
$newcardbutton = ''; $newcardbutton = '';
if ($user->rights->adherent->configurer) if ($user->rights->adherent->configurer) {
{
$newcardbutton .= dolGetButtonTitle($langs->trans('NewMemberType'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/adherents/type.php?action=create'); $newcardbutton .= dolGetButtonTitle($langs->trans('NewMemberType'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/adherents/type.php?action=create');
} }
@@ -300,8 +295,9 @@ if (!$rowid && $action != 'create' && $action != 'edit')
print '<td class="center">'.$membertype->getLibStatut(5).'</td>'; print '<td class="center">'.$membertype->getLibStatut(5).'</td>';
if ($user->rights->adherent->configurer) if ($user->rights->adherent->configurer)
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=edit&rowid='.$objp->rowid.'">'.img_edit().'</a></td>'; print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=edit&rowid='.$objp->rowid.'">'.img_edit().'</a></td>';
else else {
print '<td class="right">&nbsp;</td>'; print '<td class="right">&nbsp;</td>';
}
print "</tr>"; print "</tr>";
$i++; $i++;
} }
@@ -310,8 +306,7 @@ if (!$rowid && $action != 'create' && $action != 'edit')
print '</form>'; print '</form>';
} }
else else {
{
dol_print_error($db); dol_print_error($db);
} }
} }
@@ -665,8 +660,7 @@ if ($rowid > 0)
{ {
print '<td><a href="card.php?rowid='.$objp->rowid.'">'.img_object($langs->trans("ShowMember"), "user").' '.$adh->getFullName($langs, 0, -1, 20).' / '.dol_trunc($objp->societe, 12).'</a></td>'."\n"; print '<td><a href="card.php?rowid='.$objp->rowid.'">'.img_object($langs->trans("ShowMember"), "user").' '.$adh->getFullName($langs, 0, -1, 20).' / '.dol_trunc($objp->societe, 12).'</a></td>'."\n";
} }
else else {
{
print '<td><a href="card.php?rowid='.$objp->rowid.'">'.img_object($langs->trans("ShowMember"), "user").' '.$adh->getFullName($langs, 0, -1, 32).'</a></td>'."\n"; print '<td><a href="card.php?rowid='.$objp->rowid.'">'.img_object($langs->trans("ShowMember"), "user").' '.$adh->getFullName($langs, 0, -1, 32).'</a></td>'."\n";
} }
@@ -700,22 +694,19 @@ if ($rowid > 0)
{ {
print dol_print_date($datefin, 'day')." ".img_warning($langs->trans("SubscriptionLate")); print dol_print_date($datefin, 'day')." ".img_warning($langs->trans("SubscriptionLate"));
} }
else else {
{
print dol_print_date($datefin, 'day'); print dol_print_date($datefin, 'day');
} }
print '</td>'; print '</td>';
} }
else else {
{
print '<td class="nowrap left">'; print '<td class="nowrap left">';
if ($objp->subscription == 'yes') if ($objp->subscription == 'yes')
{ {
print $langs->trans("SubscriptionNotReceived"); print $langs->trans("SubscriptionNotReceived");
if ($objp->statut > 0) print " ".img_warning(); if ($objp->statut > 0) print " ".img_warning();
} }
else else {
{
print '&nbsp;'; print '&nbsp;';
} }
print '</td>'; print '</td>';
@@ -747,8 +738,7 @@ if ($rowid > 0)
print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, ''); print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, '');
} }
} }
else else {
{
dol_print_error($db); dol_print_error($db);
} }
} }

View File

@@ -167,21 +167,18 @@ if ($result > 0)
{ {
print '<tr class="oddeven"><td colspan="2"><font class="error">'.$langs->trans("ErrorFailedToReadLDAP").'</font></td></tr>'; print '<tr class="oddeven"><td colspan="2"><font class="error">'.$langs->trans("ErrorFailedToReadLDAP").'</font></td></tr>';
} }
else else {
{
$result = show_ldap_content($records, 0, $records['count'], true); $result = show_ldap_content($records, 0, $records['count'], true);
} }
} }
else else {
{
print '<tr class="oddeven"><td colspan="2">'.$langs->trans("LDAPRecordNotFound").' (dn='.$dn.' - search='.$search.')</td></tr>'; print '<tr class="oddeven"><td colspan="2">'.$langs->trans("LDAPRecordNotFound").' (dn='.$dn.' - search='.$search.')</td></tr>';
} }
$ldap->unbind(); $ldap->unbind();
$ldap->close(); $ldap->close();
} }
else else {
{
setEventMessages($ldap->error, $ldap->errors, 'errors'); setEventMessages($ldap->error, $ldap->errors, 'errors');
} }

View File

@@ -77,8 +77,7 @@ if ($action == 'vadd' && $cancel != $langs->trans("Cancel") && $user->rights->ad
$object->description = dol_htmlcleanlastbr($_POST["desc"]); $object->description = dol_htmlcleanlastbr($_POST["desc"]);
$object->other = dol_htmlcleanlastbr($_POST["other"]); $object->other = dol_htmlcleanlastbr($_POST["other"]);
} }
else else {
{
$object->multilangs[$_POST["forcelangprod"]]["label"] = $_POST["libelle"]; $object->multilangs[$_POST["forcelangprod"]]["label"] = $_POST["libelle"];
$object->multilangs[$_POST["forcelangprod"]]["description"] = dol_htmlcleanlastbr($_POST["desc"]); $object->multilangs[$_POST["forcelangprod"]]["description"] = dol_htmlcleanlastbr($_POST["desc"]);
$object->multilangs[$_POST["forcelangprod"]]["other"] = dol_htmlcleanlastbr($_POST["other"]); $object->multilangs[$_POST["forcelangprod"]]["other"] = dol_htmlcleanlastbr($_POST["other"]);
@@ -89,8 +88,7 @@ if ($action == 'vadd' && $cancel != $langs->trans("Cancel") && $user->rights->ad
{ {
$action = ''; $action = '';
} }
else else {
{
$action = 'add'; $action = 'add';
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
@@ -111,8 +109,7 @@ if ($action == 'vedit' && $cancel != $langs->trans("Cancel") && $user->rights->a
$object->description = dol_htmlcleanlastbr($_POST["desc-".$key]); $object->description = dol_htmlcleanlastbr($_POST["desc-".$key]);
$object->other = dol_htmlcleanlastbr($_POST["other-".$key]); $object->other = dol_htmlcleanlastbr($_POST["other-".$key]);
} }
else else {
{
$object->multilangs[$key]["label"] = $_POST["libelle-".$key]; $object->multilangs[$key]["label"] = $_POST["libelle-".$key];
$object->multilangs[$key]["description"] = dol_htmlcleanlastbr($_POST["desc-".$key]); $object->multilangs[$key]["description"] = dol_htmlcleanlastbr($_POST["desc-".$key]);
$object->multilangs[$key]["other"] = dol_htmlcleanlastbr($_POST["other-".$key]); $object->multilangs[$key]["other"] = dol_htmlcleanlastbr($_POST["other-".$key]);
@@ -123,8 +120,7 @@ if ($action == 'vedit' && $cancel != $langs->trans("Cancel") && $user->rights->a
{ {
$action = ''; $action = '';
} }
else else {
{
$action = 'edit'; $action = 'edit';
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }
@@ -142,8 +138,7 @@ if ($action == 'vdelete' && $cancel != $langs->trans("Cancel") && $user->rights-
{ {
$action = ''; $action = '';
} }
else else {
{
$action = 'edit'; $action = 'edit';
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }

View File

@@ -506,8 +506,7 @@ class DataPolicyCron
} }
} }
} }
else else {
{
$errormsg = $object->error; $errormsg = $object->error;
$error++; $error++;
} }
@@ -539,8 +538,7 @@ class DataPolicyCron
{ {
$this->output = $nbupdated.' record updated, '.$nbdeleted.' record deleted'; $this->output = $nbupdated.' record updated, '.$nbdeleted.' record deleted';
} }
else else {
{
$this->error = $errormsg; $this->error = $errormsg;
} }

View File

@@ -48,9 +48,7 @@ if ($action == "update")
if ($res1 < 0 || $res2 < 0 || $res3 < 0 || $res4 < 0 || $res5 < 0 || $res6 < 0 || $res7 < 0 || $res8 < 0) { if ($res1 < 0 || $res2 < 0 || $res3 < 0 || $res4 < 0 || $res5 < 0 || $res6 < 0 || $res7 < 0 || $res8 < 0) {
setEventMessages('ErrorFailedToSaveDate', null, 'errors'); setEventMessages('ErrorFailedToSaveDate', null, 'errors');
$db->rollback(); $db->rollback();
} } else {
else
{
setEventMessages('RecordModifiedSuccessfully', null, 'mesgs'); setEventMessages('RecordModifiedSuccessfully', null, 'mesgs');
$db->commit(); $db->commit();
} }

View File

@@ -129,8 +129,8 @@ if ($dirins && $action == 'initmodule' && $modulename)
$langs->load("errors"); $langs->load("errors");
setEventMessages($langs->trans("ErrorFailToCopyDir", $srcdir, $destdir), null, 'errors'); setEventMessages($langs->trans("ErrorFailToCopyDir", $srcdir, $destdir), null, 'errors');
} }
else // $result == 0 else {
{ // $result == 0
setEventMessages($langs->trans("AllFilesDidAlreadyExist", $srcdir, $destdir), null, 'warnings'); setEventMessages($langs->trans("AllFilesDidAlreadyExist", $srcdir, $destdir), null, 'warnings');
} }
} }
@@ -271,8 +271,7 @@ if ($dirins && $action == 'initapi' && !empty($module))
dolReplaceInFile($destfile, $arrayreplacement); dolReplaceInFile($destfile, $arrayreplacement);
} }
else else {
{
$langs->load("errors"); $langs->load("errors");
setEventMessages($langs->trans('ErrorFailToCreateFile', $destfile), null, 'errors'); setEventMessages($langs->trans('ErrorFailToCreateFile', $destfile), null, 'errors');
} }
@@ -308,14 +307,12 @@ if ($dirins && $action == 'initphpunit' && !empty($module))
dolReplaceInFile($destfile, $arrayreplacement); dolReplaceInFile($destfile, $arrayreplacement);
} }
else else {
{
$langs->load("errors"); $langs->load("errors");
setEventMessages($langs->trans('ErrorFailToCreateFile', $destfile), null, 'errors'); setEventMessages($langs->trans('ErrorFailToCreateFile', $destfile), null, 'errors');
} }
} }
if ($dirins && $action == 'initsqlextrafields' && !empty($module)) if ($dirins && $action == 'initsqlextrafields' && !empty($module)) {
{
$modulename = ucfirst($module); // Force first letter in uppercase $modulename = ucfirst($module); // Force first letter in uppercase
$objectname = $tabobj; $objectname = $tabobj;
@@ -354,8 +351,7 @@ if ($dirins && $action == 'initsqlextrafields' && !empty($module))
dolReplaceInFile($destfile1, $arrayreplacement); dolReplaceInFile($destfile1, $arrayreplacement);
dolReplaceInFile($destfile2, $arrayreplacement); dolReplaceInFile($destfile2, $arrayreplacement);
} }
else else {
{
$langs->load("errors"); $langs->load("errors");
setEventMessages($langs->trans('ErrorFailToCreateFile', ''), null, 'errors'); setEventMessages($langs->trans('ErrorFailToCreateFile', ''), null, 'errors');
} }
@@ -389,8 +385,7 @@ if ($dirins && $action == 'inithook' && !empty($module))
dolReplaceInFile($destfile, $arrayreplacement); dolReplaceInFile($destfile, $arrayreplacement);
} }
else else {
{
$langs->load("errors"); $langs->load("errors");
setEventMessages($langs->trans('ErrorFailToCreateFile', $destfile), null, 'errors'); setEventMessages($langs->trans('ErrorFailToCreateFile', $destfile), null, 'errors');
} }
@@ -423,8 +418,7 @@ if ($dirins && $action == 'inittrigger' && !empty($module))
dolReplaceInFile($destfile, $arrayreplacement); dolReplaceInFile($destfile, $arrayreplacement);
} }
else else {
{
$langs->load("errors"); $langs->load("errors");
setEventMessages($langs->trans('ErrorFailToCreateFile', $destfile), null, 'errors'); setEventMessages($langs->trans('ErrorFailToCreateFile', $destfile), null, 'errors');
} }
@@ -438,8 +432,7 @@ if ($dirins && $action == 'initwidget' && !empty($module))
//var_dump($srcfile);var_dump($destfile); //var_dump($srcfile);var_dump($destfile);
$result = dol_copy($srcfile, $destfile, 0, 0); $result = dol_copy($srcfile, $destfile, 0, 0);
if ($result > 0) if ($result > 0) {
{
$modulename = ucfirst($module); // Force first letter in uppercase $modulename = ucfirst($module); // Force first letter in uppercase
//var_dump($phpfileval['fullname']); //var_dump($phpfileval['fullname']);
@@ -456,9 +449,7 @@ if ($dirins && $action == 'initwidget' && !empty($module))
); );
dolReplaceInFile($destfile, $arrayreplacement); dolReplaceInFile($destfile, $arrayreplacement);
} } else {
else
{
$langs->load("errors"); $langs->load("errors");
setEventMessages($langs->trans('ErrorFailToCreateFile', $destfile), null, 'errors'); setEventMessages($langs->trans('ErrorFailToCreateFile', $destfile), null, 'errors');
} }
@@ -496,8 +487,7 @@ if ($dirins && $action == 'initcss' && !empty($module))
$arrayreplacement = array('/\/\/\s*\''.preg_quote('/'.strtolower($module).'/css/'.strtolower($module).'.css.php', '/').'\'/' => '\'/'.strtolower($module).'/css/'.strtolower($module).'.css.php\''); $arrayreplacement = array('/\/\/\s*\''.preg_quote('/'.strtolower($module).'/css/'.strtolower($module).'.css.php', '/').'\'/' => '\'/'.strtolower($module).'/css/'.strtolower($module).'.css.php\'');
dolReplaceInFile($srcfile, $arrayreplacement, '', 0, 0, 1); dolReplaceInFile($srcfile, $arrayreplacement, '', 0, 0, 1);
} }
else else {
{
$langs->load("errors"); $langs->load("errors");
setEventMessages($langs->trans('ErrorFailToCreateFile', $destfile), null, 'errors'); setEventMessages($langs->trans('ErrorFailToCreateFile', $destfile), null, 'errors');
} }
@@ -535,8 +525,7 @@ if ($dirins && $action == 'initjs' && !empty($module))
$arrayreplacement = array('/\/\/\s*\''.preg_quote('/'.strtolower($module).'/js/'.strtolower($module).'.js.php', '/').'\'/' => '\'/'.strtolower($module).'/js/'.strtolower($module).'.js.php\''); $arrayreplacement = array('/\/\/\s*\''.preg_quote('/'.strtolower($module).'/js/'.strtolower($module).'.js.php', '/').'\'/' => '\'/'.strtolower($module).'/js/'.strtolower($module).'.js.php\'');
dolReplaceInFile($srcfile, $arrayreplacement, '', 0, 0, 1); dolReplaceInFile($srcfile, $arrayreplacement, '', 0, 0, 1);
} }
else else {
{
$langs->load("errors"); $langs->load("errors");
setEventMessages($langs->trans('ErrorFailToCreateFile', $destfile), null, 'errors'); setEventMessages($langs->trans('ErrorFailToCreateFile', $destfile), null, 'errors');
} }
@@ -574,14 +563,12 @@ if ($dirins && $action == 'initcli' && !empty($module))
dolReplaceInFile($destfile, $arrayreplacement); dolReplaceInFile($destfile, $arrayreplacement);
} }
else else {
{
$langs->load("errors"); $langs->load("errors");
setEventMessages($langs->trans('ErrorFailToCreateFile', $destfile), null, 'errors'); setEventMessages($langs->trans('ErrorFailToCreateFile', $destfile), null, 'errors');
} }
} }
if ($dirins && $action == 'initdoc' && !empty($module)) if ($dirins && $action == 'initdoc' && !empty($module)) {
{
dol_mkdir($dirins.'/'.strtolower($module).'/doc'); dol_mkdir($dirins.'/'.strtolower($module).'/doc');
$srcdir = DOL_DOCUMENT_ROOT.'/modulebuilder/template'; $srcdir = DOL_DOCUMENT_ROOT.'/modulebuilder/template';
$srcfile = $srcdir.'/doc/Documentation.asciidoc'; $srcfile = $srcdir.'/doc/Documentation.asciidoc';
@@ -589,8 +576,7 @@ if ($dirins && $action == 'initdoc' && !empty($module))
//var_dump($srcfile);var_dump($destfile); //var_dump($srcfile);var_dump($destfile);
$result = dol_copy($srcfile, $destfile, 0, 0); $result = dol_copy($srcfile, $destfile, 0, 0);
if ($result > 0) if ($result > 0) {
{
$modulename = ucfirst($module); // Force first letter in uppercase $modulename = ucfirst($module); // Force first letter in uppercase
$modulelowercase = strtolower($module); $modulelowercase = strtolower($module);
@@ -625,8 +611,7 @@ if ($dirins && $action == 'initdoc' && !empty($module))
dol_delete_file($outputfiledoc, 0, 0, 0, null, false, 0); dol_delete_file($outputfiledoc, 0, 0, 0, null, false, 0);
dol_delete_file($outputfiledocpdf, 0, 0, 0, null, false, 0); dol_delete_file($outputfiledocpdf, 0, 0, 0, null, false, 0);
} }
else else {
{
$langs->load("errors"); $langs->load("errors");
setEventMessages($langs->trans('ErrorFailToCreateFile', $destfile), null, 'errors'); setEventMessages($langs->trans('ErrorFailToCreateFile', $destfile), null, 'errors');
} }
@@ -671,8 +656,7 @@ if ($dirins && $action == 'initobject' && $module && GETPOST('createtablearray',
{ {
setEventMessages($langs->trans("ErrorTableNotFound", $tablename), null, 'errors'); setEventMessages($langs->trans("ErrorTableNotFound", $tablename), null, 'errors');
} }
else else {
{
/** /**
* 'type' if the field format ('integer', 'integer:Class:pathtoclass', 'varchar(x)', 'double(24,8)', 'text', 'html', 'datetime', 'timestamp', 'float') * 'type' if the field format ('integer', 'integer:Class:pathtoclass', 'varchar(x)', 'double(24,8)', 'text', 'html', 'datetime', 'timestamp', 'float')
* 'label' the translation key. * 'label' the translation key.
@@ -882,8 +866,8 @@ if ($dirins && $action == 'initobject' && $module && $objectname)
$langs->load("errors"); $langs->load("errors");
setEventMessages($langs->trans("ErrorFailToCopyFile", $srcdir.'/'.$srcfile, $destdir.'/'.$destfile), null, 'errors'); setEventMessages($langs->trans("ErrorFailToCopyFile", $srcdir.'/'.$srcfile, $destdir.'/'.$destfile), null, 'errors');
} }
else // $result == 0 else {
{ // $result == 0
setEventMessages($langs->trans("FileAlreadyExists", $destfile), null, 'warnings'); setEventMessages($langs->trans("FileAlreadyExists", $destfile), null, 'warnings');
} }
} }
@@ -1066,14 +1050,12 @@ if ($dirins && ($action == 'droptable' || $action == 'droptableextrafields') &&
$nb = $obj->nb; $nb = $obj->nb;
} }
} }
else else {
{
if ($db->lasterrno() == 'DB_ERROR_NOSUCHTABLE') if ($db->lasterrno() == 'DB_ERROR_NOSUCHTABLE')
{ {
setEventMessages($langs->trans("TableDoesNotExists", $tabletodrop), null, 'warnings'); setEventMessages($langs->trans("TableDoesNotExists", $tabletodrop), null, 'warnings');
} }
else else {
{
dol_print_error($db); dol_print_error($db);
} }
} }
@@ -1231,8 +1213,7 @@ if ($dirins && $action == 'confirm_deletemodule')
{ {
setEventMessages($langs->trans("DirWasRemoved", $modulelowercase), null); setEventMessages($langs->trans("DirWasRemoved", $modulelowercase), null);
} }
else else {
{
setEventMessages($langs->trans("PurgeNothingToDelete"), null, 'warnings'); setEventMessages($langs->trans("PurgeNothingToDelete"), null, 'warnings');
} }
} }
@@ -1291,8 +1272,7 @@ if ($dirins && $action == 'confirm_deleteobject' && $objectname)
{ {
setEventMessages($langs->trans("FilesDeleted"), null); setEventMessages($langs->trans("FilesDeleted"), null);
} }
else else {
{
setEventMessages($langs->trans("ErrorSomeFilesCouldNotBeDeleted"), null, 'warnings'); setEventMessages($langs->trans("ErrorSomeFilesCouldNotBeDeleted"), null, 'warnings');
} }
} }
@@ -1326,8 +1306,7 @@ if ($dirins && $action == 'generatepackage')
dol_print_error($e->getMessage()); dol_print_error($e->getMessage());
} }
} }
else else {
{
$error++; $error++;
$langs->load("errors"); $langs->load("errors");
dol_print_error($langs->trans("ErrorFailedToLoadModuleDescriptorForXXX", $module)); dol_print_error($langs->trans("ErrorFailedToLoadModuleDescriptorForXXX", $module));
@@ -1346,8 +1325,7 @@ if ($dirins && $action == 'generatepackage')
if (!dol_is_dir($dirofmodule)) dol_mkdir($dirofmodule); if (!dol_is_dir($dirofmodule)) dol_mkdir($dirofmodule);
$result = dol_compress_dir($dir, $outputfilezip, 'zip', '', $modulelowercase); $result = dol_compress_dir($dir, $outputfilezip, 'zip', '', $modulelowercase);
} }
else else {
{
$result = -1; $result = -1;
} }
@@ -1355,15 +1333,13 @@ if ($dirins && $action == 'generatepackage')
{ {
setEventMessages($langs->trans("ZipFileGeneratedInto", $outputfilezip), null); setEventMessages($langs->trans("ZipFileGeneratedInto", $outputfilezip), null);
} }
else else {
{
$error++; $error++;
$langs->load("errors"); $langs->load("errors");
setEventMessages($langs->trans("ErrorFailToGenerateFile", $outputfilezip), null, 'errors'); setEventMessages($langs->trans("ErrorFailToGenerateFile", $outputfilezip), null, 'errors');
} }
} }
else else {
{
$error++; $error++;
$langs->load("errors"); $langs->load("errors");
setEventMessages($langs->trans("ErrorCheckVersionIsDefined"), null, 'errors'); setEventMessages($langs->trans("ErrorCheckVersionIsDefined"), null, 'errors');
@@ -1382,8 +1358,7 @@ if ($dirins && $action == 'generatedoc')
{ {
setEventMessages($langs->trans("DocFileGeneratedInto", $dirofmodule), null); setEventMessages($langs->trans("DocFileGeneratedInto", $dirofmodule), null);
} }
else else {
{
setEventMessages($util->error, $util->errors, 'errors'); setEventMessages($util->error, $util->errors, 'errors');
} }
} }
@@ -1421,13 +1396,11 @@ if ($action == 'savefile' && empty($cancel))
setEventMessages($langs->trans("FileSaved"), null); setEventMessages($langs->trans("FileSaved"), null);
} }
else else {
{
setEventMessages($langs->trans("ErrorFailedToSaveFile"), null, 'errors'); setEventMessages($langs->trans("ErrorFailedToSaveFile"), null, 'errors');
} }
} }
else else {
{
setEventMessages($langs->trans("ContentCantBeEmpty"), null, 'errors'); setEventMessages($langs->trans("ContentCantBeEmpty"), null, 'errors');
//$action='editfile'; //$action='editfile';
$error++; $error++;
@@ -1446,8 +1419,7 @@ if ($action == 'set' && $user->admin)
$value = GETPOST('value', 'alpha'); $value = GETPOST('value', 'alpha');
$resarray = activateModule($value); $resarray = activateModule($value);
if (!empty($resarray['errors'])) setEventMessages('', $resarray['errors'], 'errors'); if (!empty($resarray['errors'])) setEventMessages('', $resarray['errors'], 'errors');
else else {
{
//var_dump($resarray);exit; //var_dump($resarray);exit;
if ($resarray['nbperms'] > 0) if ($resarray['nbperms'] > 0)
{ {
@@ -1595,8 +1567,7 @@ if (!$dirins)
$message = info_admin($langs->trans("ConfFileMustContainCustom", DOL_DOCUMENT_ROOT.'/custom', DOL_DOCUMENT_ROOT)); $message = info_admin($langs->trans("ConfFileMustContainCustom", DOL_DOCUMENT_ROOT.'/custom', DOL_DOCUMENT_ROOT));
$allowfromweb = -1; $allowfromweb = -1;
} }
else else {
{
if ($dirins_ok) if ($dirins_ok)
{ {
if (!is_writable(dol_osencode($dirins))) if (!is_writable(dol_osencode($dirins)))
@@ -1606,8 +1577,7 @@ else
$allowfromweb = 0; $allowfromweb = 0;
} }
} }
else else {
{
$message = info_admin($langs->trans("NotExistsDirect", $dirins).$langs->trans("InfDirAlt").$langs->trans("InfDirExample")); $message = info_admin($langs->trans("NotExistsDirect", $dirins).$langs->trans("InfDirAlt").$langs->trans("InfDirExample"));
$allowfromweb = 0; $allowfromweb = 0;
} }
@@ -1645,8 +1615,7 @@ if (!empty($module) && $module != 'initmodule' && $module != 'deletemodule')
print $e->getMessage(); print $e->getMessage();
} }
} }
else else {
{
if (empty($forceddirread)) $error++; if (empty($forceddirread)) $error++;
$langs->load("errors"); $langs->load("errors");
print img_warning('').' '.$langs->trans("ErrorFailedToLoadModuleDescriptorForXXX", $module).'<br>'; print img_warning('').' '.$langs->trans("ErrorFailedToLoadModuleDescriptorForXXX", $module).'<br>';
@@ -1703,28 +1672,24 @@ if (is_array($listofmodules) && count($listofmodules) > 0) {
$linktoenabledisable .= ' <a href="'.$urlpage.'" title="'.$langs->trans($page).'">'.img_picto(ucfirst($page), "setup").'</a>'; $linktoenabledisable .= ' <a href="'.$urlpage.'" title="'.$langs->trans($page).'">'.img_picto(ucfirst($page), "setup").'</a>';
// print '<a href="'.$page.'">'.ucfirst($page).'</a>&nbsp;'; // print '<a href="'.$page.'">'.ucfirst($page).'</a>&nbsp;';
} }
else else {
{
if (preg_match('/^([^@]+)@([^@]+)$/i', $urlpage, $regs)) if (preg_match('/^([^@]+)@([^@]+)$/i', $urlpage, $regs))
{ {
$urltouse = dol_buildpath('/'.$regs[2].'/admin/'.$regs[1], 1); $urltouse = dol_buildpath('/'.$regs[2].'/admin/'.$regs[1], 1);
$linktoenabledisable .= ' &nbsp; <a href="'.$urltouse.(preg_match('/\?/', $urltouse) ? '&' : '?').'save_lastsearch_values=1&backtopage='.urlencode($backtourl).'" title="'.$langs->trans("Setup").'">'.img_picto($langs->trans("Setup"), "setup", 'style="padding-right: 6px"').'</a>'; $linktoenabledisable .= ' &nbsp; <a href="'.$urltouse.(preg_match('/\?/', $urltouse) ? '&' : '?').'save_lastsearch_values=1&backtopage='.urlencode($backtourl).'" title="'.$langs->trans("Setup").'">'.img_picto($langs->trans("Setup"), "setup", 'style="padding-right: 6px"').'</a>';
} }
else else {
{
$urltouse = $urlpage; $urltouse = $urlpage;
$linktoenabledisable .= ' &nbsp; <a href="'.$urltouse.(preg_match('/\?/', $urltouse) ? '&' : '?').'save_lastsearch_values=1&backtopage='.urlencode($backtourl).'" title="'.$langs->trans("Setup").'">'.img_picto($langs->trans("Setup"), "setup", 'style="padding-right: 6px"').'</a>'; $linktoenabledisable .= ' &nbsp; <a href="'.$urltouse.(preg_match('/\?/', $urltouse) ? '&' : '?').'save_lastsearch_values=1&backtopage='.urlencode($backtourl).'" title="'.$langs->trans("Setup").'">'.img_picto($langs->trans("Setup"), "setup", 'style="padding-right: 6px"').'</a>';
} }
} }
} }
} }
elseif (preg_match('/^([^@]+)@([^@]+)$/i', $objMod->config_page_url, $regs)) elseif (preg_match('/^([^@]+)@([^@]+)$/i', $objMod->config_page_url, $regs)) {
{
$linktoenabledisable .= ' &nbsp; <a href="'.dol_buildpath('/'.$regs[2].'/admin/'.$regs[1], 1).'?save_lastsearch_values=1&backtopage='.urlencode($backtourl).'" title="'.$langs->trans("Setup").'">'.img_picto($langs->trans("Setup"), "setup", 'style="padding-right: 6px"').'</a>'; $linktoenabledisable .= ' &nbsp; <a href="'.dol_buildpath('/'.$regs[2].'/admin/'.$regs[1], 1).'?save_lastsearch_values=1&backtopage='.urlencode($backtourl).'" title="'.$langs->trans("Setup").'">'.img_picto($langs->trans("Setup"), "setup", 'style="padding-right: 6px"').'</a>';
} }
} }
else else {
{
$linktoenabledisable .= '<a class="reposition asetresetmodule" href="'.$_SERVER["PHP_SELF"].'?id='.$moduleobj->numero.'&action=set&value=mod'.$module.$param.'">'; $linktoenabledisable .= '<a class="reposition asetresetmodule" href="'.$_SERVER["PHP_SELF"].'?id='.$moduleobj->numero.'&action=set&value=mod'.$module.$param.'">';
$linktoenabledisable .= img_picto($langs->trans("ModuleIsNotActive", $urltomodulesetup), 'switch_off', '', false, 0, 0, '', 'classfortooltip', 1); $linktoenabledisable .= img_picto($langs->trans("ModuleIsNotActive", $urltomodulesetup), 'switch_off', '', false, 0, 0, '', 'classfortooltip', 1);
$linktoenabledisable .= "</a>\n"; $linktoenabledisable .= "</a>\n";
@@ -1775,8 +1740,7 @@ if ($module == 'initmodule')
print '<br><input type="submit" class="button" name="create" value="'.dol_escape_htmltag($langs->trans("Create")).'"'.($dirins ? '' : ' disabled="disabled"').'>'; print '<br><input type="submit" class="button" name="create" value="'.dol_escape_htmltag($langs->trans("Create")).'"'.($dirins ? '' : ' disabled="disabled"').'>';
print '</form>'; print '</form>';
} }
elseif ($module == 'deletemodule') elseif ($module == 'deletemodule') {
{
print '<!-- Form to init a module -->'."\n"; print '<!-- Form to init a module -->'."\n";
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="delete">'; print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="delete">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
@@ -1789,8 +1753,7 @@ elseif ($module == 'deletemodule')
print '<input type="submit" class="buttonDelete" value="'.$langs->trans("Delete").'"'.($dirins ? '' : ' disabled="disabled"').'>'; print '<input type="submit" class="buttonDelete" value="'.$langs->trans("Delete").'"'.($dirins ? '' : ' disabled="disabled"').'>';
print '</form>'; print '</form>';
} }
elseif (!empty($module)) elseif (!empty($module)) {
{
// Tabs for module // Tabs for module
if (!$error) if (!$error)
{ {
@@ -1978,8 +1941,7 @@ elseif (!empty($module))
print '</table>'; print '</table>';
} }
else else {
{
print $langs->trans("ErrorFailedToLoadModuleDescriptorForXXX", $module).'<br>'; print $langs->trans("ErrorFailedToLoadModuleDescriptorForXXX", $module).'<br>';
} }
@@ -2006,8 +1968,7 @@ elseif (!empty($module))
dol_fiche_end(); dol_fiche_end();
} }
else else {
{
$fullpathoffile = dol_buildpath($file, 0, 1); // Description - level 2 $fullpathoffile = dol_buildpath($file, 0, 1); // Description - level 2
if ($fullpathoffile) if ($fullpathoffile)
@@ -2039,8 +2000,7 @@ elseif (!empty($module))
print '</form>'; print '</form>';
} }
} }
else else {
{
dol_fiche_head($head2, $tab, '', -1, ''); // Level 2 dol_fiche_head($head2, $tab, '', -1, ''); // Level 2
} }
@@ -2078,8 +2038,7 @@ elseif (!empty($module))
} }
print '</table>'; print '</table>';
} }
else else {
{
// Edit text language file // Edit text language file
//print $langs->trans("UseAsciiDocFormat").'<br>'; //print $langs->trans("UseAsciiDocFormat").'<br>';
@@ -2208,8 +2167,7 @@ elseif (!empty($module))
$i++; $i++;
} }
} }
else else {
{
print '<tr><td class="opacitymedium" colspan="5">'.$langs->trans("None").'</td></tr>'; print '<tr><td class="opacitymedium" colspan="5">'.$langs->trans("None").'</td></tr>';
} }
@@ -2218,8 +2176,7 @@ elseif (!empty($module))
print '</form>'; print '</form>';
} }
else else {
{
$fullpathoffile = dol_buildpath($file, 0); $fullpathoffile = dol_buildpath($file, 0);
$content = file_get_contents($fullpathoffile); $content = file_get_contents($fullpathoffile);
@@ -2324,8 +2281,7 @@ elseif (!empty($module))
print '</form>'; print '</form>';
} }
elseif ($tabobj == 'deleteobject') elseif ($tabobj == 'deleteobject') {
{
// Delete object tab // Delete object tab
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
@@ -2339,8 +2295,8 @@ elseif (!empty($module))
print '<input type="submit" class="buttonDelete" name="delete" value="'.dol_escape_htmltag($langs->trans("Delete")).'"'.($dirins ? '' : ' disabled="disabled"').'>'; print '<input type="submit" class="buttonDelete" name="delete" value="'.dol_escape_htmltag($langs->trans("Delete")).'"'.($dirins ? '' : ' disabled="disabled"').'>';
print '</form>'; print '</form>';
} }
else else {
{ // tabobj = module // tabobj = module
if ($action == 'deleteproperty') if ($action == 'deleteproperty')
{ {
$formconfirm = $form->formconfirm( $formconfirm = $form->formconfirm(
@@ -2413,13 +2369,11 @@ elseif (!empty($module))
{ {
print '<a href="#" target="apiexplorer" title="'.$langs->trans("ModuleMustBeEnabled").'"><strike>'.$langs->trans("GoToApiExplorer").'</strike></a>'; print '<a href="#" target="apiexplorer" title="'.$langs->trans("ModuleMustBeEnabled").'"><strike>'.$langs->trans("GoToApiExplorer").'</strike></a>';
} }
else else {
{
print '<a href="'.DOL_URL_ROOT.'/api/index.php/explorer/" target="apiexplorer">'.$langs->trans("GoToApiExplorer").'</a>'; print '<a href="'.DOL_URL_ROOT.'/api/index.php/explorer/" target="apiexplorer">'.$langs->trans("GoToApiExplorer").'</a>';
} }
} }
else else {
{
//print '<span class="opacitymedium">'.$langs->trans("FileNotYetGenerated").'</span> '; //print '<span class="opacitymedium">'.$langs->trans("FileNotYetGenerated").'</span> ';
print '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=initapi&format=php&file='.urlencode($pathtoapi).'"><input type="button" class="button" value="'.$langs->trans("Generate").'"></a>'; print '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=initapi&format=php&file='.urlencode($pathtoapi).'"><input type="button" class="button" value="'.$langs->trans("Generate").'"></a>';
} }
@@ -2433,8 +2387,7 @@ elseif (!empty($module))
print ' '; print ' ';
print '<a class="reposition editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=confirm_removefile&file='.urlencode($pathtophpunit).'">'.img_picto($langs->trans("Delete"), 'delete').'</a>'; print '<a class="reposition editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=confirm_removefile&file='.urlencode($pathtophpunit).'">'.img_picto($langs->trans("Delete"), 'delete').'</a>';
} }
else else {
{
//print '<span class="opacitymedium">'.$langs->trans("FileNotYetGenerated").'</span> '; //print '<span class="opacitymedium">'.$langs->trans("FileNotYetGenerated").'</span> ';
print '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=initphpunit&format=php&file='.urlencode($pathtophpunit).'"><input type="button" class="button" value="'.$langs->trans("Generate").'"></a>'; print '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&tabobj='.$tabobj.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=initphpunit&format=php&file='.urlencode($pathtophpunit).'"><input type="button" class="button" value="'.$langs->trans("Generate").'"></a>';
} }
@@ -2542,8 +2495,7 @@ elseif (!empty($module))
{ {
$result = dol_include_once($pathtoclass); $result = dol_include_once($pathtoclass);
} }
else else {
{
$result = @include_once $dirread.'/'.$pathtoclass; $result = @include_once $dirread.'/'.$pathtoclass;
} }
if (class_exists($tabobj)) if (class_exists($tabobj))
@@ -2748,8 +2700,7 @@ elseif (!empty($module))
print '</tr>'; print '</tr>';
} }
} }
else else {
{
if ($tab == 'specifications') if ($tab == 'specifications')
{ {
if ($action != 'editfile' || empty($file)) if ($action != 'editfile' || empty($file))
@@ -2769,8 +2720,7 @@ elseif (!empty($module))
print '<br>'; print '<br>';
} }
} }
else else {
{
// Use MD or asciidoc // Use MD or asciidoc
//print $langs->trans("UseAsciiDocFormat").'<br>'; //print $langs->trans("UseAsciiDocFormat").'<br>';
@@ -2806,8 +2756,7 @@ elseif (!empty($module))
print '</form>'; print '</form>';
} }
else else {
{
print '<tr><td><span class="warning">'.$langs->trans('Failed to init the object with the new.').'</warning></td></tr>'; print '<tr><td><span class="warning">'.$langs->trans('Failed to init the object with the new.').'</warning></td></tr>';
} }
} }
@@ -2816,14 +2765,12 @@ elseif (!empty($module))
print $e->getMessage(); print $e->getMessage();
} }
} }
else else {
{
if (empty($forceddirread)) if (empty($forceddirread))
{ {
$fullpathoffile = dol_buildpath($file, 0); $fullpathoffile = dol_buildpath($file, 0);
} }
else else {
{
$fullpathoffile = $dirread.'/'.$file; $fullpathoffile = $dirread.'/'.$file;
} }
@@ -2957,9 +2904,8 @@ elseif (!empty($module))
print '</tr>'; print '</tr>';
} }
} }
else else {
{ print '<tr><td class="opacitymedium" colspan="5">'.$langs->trans("None").'</td></tr>';
print '<tr><td class="opacitymedium" colspan="5">'.$langs->trans("None").'</td></tr>';
} }
print '</table>'; print '</table>';
@@ -2967,8 +2913,7 @@ elseif (!empty($module))
print '</form>'; print '</form>';
} }
else else {
{
$fullpathoffile = dol_buildpath($file, 0); $fullpathoffile = dol_buildpath($file, 0);
$content = file_get_contents($fullpathoffile); $content = file_get_contents($fullpathoffile);
@@ -3057,9 +3002,8 @@ elseif (!empty($module))
print '</tr>'; print '</tr>';
} }
} }
else else {
{ print '<tr><td class="opacitymedium" colspan="4">'.$langs->trans("None").'</td></tr>';
print '<tr><td class="opacitymedium" colspan="4">'.$langs->trans("None").'</td></tr>';
} }
print '</table>'; print '</table>';
@@ -3067,8 +3011,7 @@ elseif (!empty($module))
print '</form>'; print '</form>';
} }
else else {
{
$fullpathoffile = dol_buildpath($file, 0); $fullpathoffile = dol_buildpath($file, 0);
$content = file_get_contents($fullpathoffile); $content = file_get_contents($fullpathoffile);
@@ -3120,16 +3063,14 @@ elseif (!empty($module))
print '<td><a class="editfielda paddingleft paddingright" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=editfile&format=php&file='.urlencode($pathtohook).'">'.img_picto($langs->trans("Edit"), 'edit').'</a> '; print '<td><a class="editfielda paddingleft paddingright" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=editfile&format=php&file='.urlencode($pathtohook).'">'.img_picto($langs->trans("Edit"), 'edit').'</a> ';
print '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=confirm_removefile&format='.$format.'&file='.urlencode($pathtohook).'">'.img_picto($langs->trans("Delete"), 'delete').'</a></td>'; print '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=confirm_removefile&format='.$format.'&file='.urlencode($pathtohook).'">'.img_picto($langs->trans("Delete"), 'delete').'</a></td>';
} }
else else {
{
print '<span class="opacitymedium">'.$langs->trans("FileNotYetGenerated").'</span>'; print '<span class="opacitymedium">'.$langs->trans("FileNotYetGenerated").'</span>';
print '<a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=inithook&format=php&file='.urlencode($pathtohook).'"><input type="button" class="button" value="'.$langs->trans("Generate").'"></a></td>'; print '<a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=inithook&format=php&file='.urlencode($pathtohook).'"><input type="button" class="button" value="'.$langs->trans("Generate").'"></a></td>';
print '<td></td>'; print '<td></td>';
} }
print '</tr>'; print '</tr>';
} }
else else {
{
$fullpathoffile = dol_buildpath($file, 0); $fullpathoffile = dol_buildpath($file, 0);
$content = file_get_contents($fullpathoffile); $content = file_get_contents($fullpathoffile);
@@ -3189,8 +3130,7 @@ elseif (!empty($module))
print '</tr>'; print '</tr>';
} }
} }
else else {
{
print '<tr><td>'; print '<tr><td>';
print '<span class="fa fa-file-o"></span> '.$langs->trans("NoTrigger"); print '<span class="fa fa-file-o"></span> '.$langs->trans("NoTrigger");
print '<a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=inittrigger&format=php"><input type="button" class="button" value="'.$langs->trans("Generate").'"></a></td>'; print '<a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=inittrigger&format=php"><input type="button" class="button" value="'.$langs->trans("Generate").'"></a></td>';
@@ -3200,8 +3140,7 @@ elseif (!empty($module))
print '</table>'; print '</table>';
} }
else else {
{
$fullpathoffile = dol_buildpath($file, 0); $fullpathoffile = dol_buildpath($file, 0);
$content = file_get_contents($fullpathoffile); $content = file_get_contents($fullpathoffile);
@@ -3245,15 +3184,13 @@ elseif (!empty($module))
print '</td><td><a class="editfielda paddingleft paddingright" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=editfile&format=php&file='.urlencode($pathtohook).'">'.img_picto($langs->trans("Edit"), 'edit').'</a></td>'; print '</td><td><a class="editfielda paddingleft paddingright" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=editfile&format=php&file='.urlencode($pathtohook).'">'.img_picto($langs->trans("Edit"), 'edit').'</a></td>';
print '</td><td><a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=confirm_removefile&format='.$format.'&file='.urlencode($pathtohook).'">'.img_picto($langs->trans("Delete"), 'delete').'</a></td>'; print '</td><td><a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=confirm_removefile&format='.$format.'&file='.urlencode($pathtohook).'">'.img_picto($langs->trans("Delete"), 'delete').'</a></td>';
} }
else else {
{
print '<span class="opacitymedium">'.$langs->trans("FileNotYetGenerated").'</span>'; print '<span class="opacitymedium">'.$langs->trans("FileNotYetGenerated").'</span>';
print '</td><td><a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=initcss&format=php&file='.urlencode($pathtohook).'"><input type="button" class="button" value="'.$langs->trans("Generate").'"></a></td>'; print '</td><td><a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=initcss&format=php&file='.urlencode($pathtohook).'"><input type="button" class="button" value="'.$langs->trans("Generate").'"></a></td>';
} }
print '</tr>'; print '</tr>';
} }
else else {
{
$fullpathoffile = dol_buildpath($file, 0); $fullpathoffile = dol_buildpath($file, 0);
$content = file_get_contents($fullpathoffile); $content = file_get_contents($fullpathoffile);
@@ -3297,15 +3234,13 @@ elseif (!empty($module))
print '</td><td><a class="editfielda paddingleft paddingright" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=editfile&format=php&file='.urlencode($pathtohook).'">'.img_picto($langs->trans("Edit"), 'edit').'</a></td>'; print '</td><td><a class="editfielda paddingleft paddingright" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=editfile&format=php&file='.urlencode($pathtohook).'">'.img_picto($langs->trans("Edit"), 'edit').'</a></td>';
print '</td><td><a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=confirm_removefile&format='.$format.'&file='.urlencode($pathtohook).'">'.img_picto($langs->trans("Delete"), 'delete').'</a></td>'; print '</td><td><a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=confirm_removefile&format='.$format.'&file='.urlencode($pathtohook).'">'.img_picto($langs->trans("Delete"), 'delete').'</a></td>';
} }
else else {
{
print '<span class="opacitymedium">'.$langs->trans("FileNotYetGenerated").'</span>'; print '<span class="opacitymedium">'.$langs->trans("FileNotYetGenerated").'</span>';
print '</td><td><a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=initjs&format=php&file='.urlencode($pathtohook).'"><input type="button" class="button" value="'.$langs->trans("Generate").'"></a></td>'; print '</td><td><a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=initjs&format=php&file='.urlencode($pathtohook).'"><input type="button" class="button" value="'.$langs->trans("Generate").'"></a></td>';
} }
print '</tr>'; print '</tr>';
} }
else else {
{
$fullpathoffile = dol_buildpath($file, 0); $fullpathoffile = dol_buildpath($file, 0);
$content = file_get_contents($fullpathoffile); $content = file_get_contents($fullpathoffile);
@@ -3355,16 +3290,14 @@ elseif (!empty($module))
print '</tr>'; print '</tr>';
} }
} }
else else {
{
print '<tr><td><span class="fa fa-file-o"></span> '.$langs->trans("NoWidget"); print '<tr><td><span class="fa fa-file-o"></span> '.$langs->trans("NoWidget");
print '</td><td><a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=initwidget&format=php"><input type="button" class="button" value="'.$langs->trans("Generate").'"></a>'; print '</td><td><a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=initwidget&format=php"><input type="button" class="button" value="'.$langs->trans("Generate").'"></a>';
print '</td></tr>'; print '</td></tr>';
} }
print '</table>'; print '</table>';
} }
else else {
{
$fullpathoffile = dol_buildpath($file, 0); $fullpathoffile = dol_buildpath($file, 0);
$content = file_get_contents($fullpathoffile); $content = file_get_contents($fullpathoffile);
@@ -3441,16 +3374,14 @@ elseif (!empty($module))
print '</tr>'; print '</tr>';
} }
} }
else else {
{
print '<tr><td><span class="fa fa-file-o"></span> '.$langs->trans("NoCLIFile"); print '<tr><td><span class="fa fa-file-o"></span> '.$langs->trans("NoCLIFile");
print '</td><td><a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=initcli&format=php"><input type="button" class="button" value="'.$langs->trans("Generate").'"></a>'; print '</td><td><a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=initcli&format=php"><input type="button" class="button" value="'.$langs->trans("Generate").'"></a>';
print '</td></tr>'; print '</td></tr>';
} }
print '</table>'; print '</table>';
} }
else else {
{
$fullpathoffile = dol_buildpath($file, 0); $fullpathoffile = dol_buildpath($file, 0);
$content = file_get_contents($fullpathoffile); $content = file_get_contents($fullpathoffile);
@@ -3561,8 +3492,7 @@ elseif (!empty($module))
print '</tr>'; print '</tr>';
} }
} }
else else {
{
print '<tr><td class="opacitymedium" colspan="5">'.$langs->trans("None").'</td></tr>'; print '<tr><td class="opacitymedium" colspan="5">'.$langs->trans("None").'</td></tr>';
} }
@@ -3571,8 +3501,7 @@ elseif (!empty($module))
print '</form>'; print '</form>';
} }
else else {
{
$fullpathoffile = dol_buildpath($file, 0); $fullpathoffile = dol_buildpath($file, 0);
$content = file_get_contents($fullpathoffile); $content = file_get_contents($fullpathoffile);
@@ -3622,8 +3551,7 @@ elseif (!empty($module))
print '</tr>'; print '</tr>';
} }
} }
else else {
{
print '<tr><td>'; print '<tr><td>';
print '<span class="fa fa-file-o"></span> '.$langs->trans("FileNotYetGenerated"); print '<span class="fa fa-file-o"></span> '.$langs->trans("FileNotYetGenerated");
print '</td><td><a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=initdoc&format=php"><input type="button" class="button" value="'.$langs->trans("Generate").'"></a></td>'; print '</td><td><a href="'.$_SERVER['PHP_SELF'].'?tab='.$tab.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=initdoc&format=php"><input type="button" class="button" value="'.$langs->trans("Generate").'"></a></td>';
@@ -3631,8 +3559,7 @@ elseif (!empty($module))
} }
print '</table>'; print '</table>';
} }
else else {
{
// Use MD or asciidoc // Use MD or asciidoc
//print $langs->trans("UseAsciiDocFormat").'<br>'; //print $langs->trans("UseAsciiDocFormat").'<br>';
@@ -3735,14 +3662,12 @@ elseif (!empty($module))
try { try {
$moduleobj = new $class($db); $moduleobj = new $class($db);
} }
catch (Exception $e) catch (Exception $e) {
{
$error++; $error++;
dol_print_error($e->getMessage()); dol_print_error($e->getMessage());
} }
} }
else else {
{
$error++; $error++;
$langs->load("errors"); $langs->load("errors");
dol_print_error($langs->trans("ErrorFailedToLoadModuleDescriptorForXXX", $module)); dol_print_error($langs->trans("ErrorFailedToLoadModuleDescriptorForXXX", $module));

View File

@@ -116,8 +116,7 @@ if ($action == 'edit')
print '</form>'; print '</form>';
print '<br>'; print '<br>';
} }
else else {
{
if (!empty($arrayofparameters)) if (!empty($arrayofparameters))
{ {
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
@@ -137,8 +136,7 @@ else
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit">'.$langs->trans("Modify").'</a>'; print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit">'.$langs->trans("Modify").'</a>';
print '</div>'; print '</div>';
} }
else else {
{
print '<br>'.$langs->trans("NothingToSetup"); print '<br>'.$langs->trans("NothingToSetup");
} }
} }

View File

@@ -165,6 +165,7 @@ class ActionsMyModule
global $conf, $user, $langs; global $conf, $user, $langs;
$error = 0; // Error counter $error = 0; // Error counter
$disabled = 1;
/* print_r($parameters); print_r($object); echo "action: " . $action; */ /* print_r($parameters); print_r($object); echo "action: " . $action; */
if (in_array($parameters['currentcontext'], array('somecontext1', 'somecontext2'))) // do something only for the context 'somecontext1' or 'somecontext2' if (in_array($parameters['currentcontext'], array('somecontext1', 'somecontext2'))) // do something only for the context 'somecontext1' or 'somecontext2'
@@ -231,8 +232,8 @@ class ActionsMyModule
dol_syslog(get_class($this).'::executeHooks action='.$action); dol_syslog(get_class($this).'::executeHooks action='.$action);
/* print_r($parameters); print_r($object); echo "action: " . $action; */ /* print_r($parameters); print_r($object); echo "action: " . $action; */
if (in_array($parameters['currentcontext'], array('somecontext1', 'somecontext2'))) // do something only for the context 'somecontext1' or 'somecontext2' if (in_array($parameters['currentcontext'], array('somecontext1', 'somecontext2'))) {
{ // do something only for the context 'somecontext1' or 'somecontext2'
} }
return $ret; return $ret;

View File

@@ -159,6 +159,7 @@ class MyModuleApi extends DolibarrApi
} }
$result = $db->query($sql); $result = $db->query($sql);
$i = 0;
if ($result) if ($result)
{ {
$num = $db->num_rows($result); $num = $db->num_rows($result);
@@ -239,12 +240,11 @@ class MyModuleApi extends DolibarrApi
$this->myobject->$field = $value; $this->myobject->$field = $value;
} }
if ($this->myobject->update($id, DolibarrApiAccess::$user) > 0) if ($this->myobject->update(DolibarrApiAccess::$user, false) > 0)
{ {
return $this->get($id); return $this->get($id);
} }
else else {
{
throw new RestException(500, $this->myobject->error); throw new RestException(500, $this->myobject->error);
} }
} }

View File

@@ -546,8 +546,7 @@ class MyObject extends CommonObject
{ {
$num = $this->getNextNumRef(); $num = $this->getNextNumRef();
} }
else else {
{
$num = $this->ref; $num = $this->ref;
} }
$this->newref = $num; $this->newref = $num;
@@ -631,8 +630,7 @@ class MyObject extends CommonObject
$this->db->commit(); $this->db->commit();
return 1; return 1;
} }
else else {
{
$this->db->rollback(); $this->db->rollback();
return -1; return -1;
} }
@@ -900,8 +898,7 @@ class MyObject extends CommonObject
$this->db->free($result); $this->db->free($result);
} }
else else {
{
dol_print_error($this->db); dol_print_error($this->db);
} }
} }
@@ -935,8 +932,7 @@ class MyObject extends CommonObject
$this->errors = $this->errors; $this->errors = $this->errors;
return $result; return $result;
} }
else else {
{
$this->lines = $result; $this->lines = $result;
return $this->lines; return $this->lines;
} }
@@ -987,8 +983,7 @@ class MyObject extends CommonObject
{ {
return $numref; return $numref;
} }
else else {
{
$this->error = $obj->error; $this->error = $obj->error;
//dol_print_error($this->db,get_class($this)."::getNextNumRef ".$obj->error); //dol_print_error($this->db,get_class($this)."::getNextNumRef ".$obj->error);
return ""; return "";
@@ -998,8 +993,7 @@ class MyObject extends CommonObject
return ""; return "";
} }
} }
else else {
{
print $langs->trans("ErrorNumberingModuleNotSetup", $this->element); print $langs->trans("ErrorNumberingModuleNotSetup", $this->element);
return ""; return "";
} }

View File

@@ -147,8 +147,7 @@ class mailing_mailinglist_mymodule_myobject extends MailingTargets
$i++; $i++;
} }
} }
else else {
{
dol_syslog($this->db->error()); dol_syslog($this->db->error());
$this->error = $this->db->error(); $this->error = $this->db->error();
return -1; return -1;

View File

@@ -136,9 +136,9 @@ class doc_generic_myobject_odt extends ModelePDFMyObject
if (!$tmpdir) { if (!$tmpdir) {
unset($listofdir[$key]); continue; unset($listofdir[$key]); continue;
} }
if (!is_dir($tmpdir)) $texttitle .= img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0); if (!is_dir($tmpdir)) {
else $texttitle .= img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0);
{ } else {
$tmpfiles = dol_dir_list($tmpdir, 'files', 0, '\.(ods|odt)'); $tmpfiles = dol_dir_list($tmpdir, 'files', 0, '\.(ods|odt)');
if (count($tmpfiles)) $listoffiles = array_merge($listoffiles, $tmpfiles); if (count($tmpfiles)) $listoffiles = array_merge($listoffiles, $tmpfiles);
} }
@@ -275,8 +275,7 @@ class doc_generic_myobject_odt extends ModelePDFMyObject
if ($format == '1') $format = '%Y%m%d%H%M%S'; if ($format == '1') $format = '%Y%m%d%H%M%S';
$filename = $newfiletmp.'-'.dol_print_date(dol_now(), $format).'.'.$newfileformat; $filename = $newfiletmp.'-'.dol_print_date(dol_now(), $format).'.'.$newfileformat;
} }
else else {
{
$filename = $newfiletmp.'.'.$newfileformat; $filename = $newfiletmp.'.'.$newfileformat;
} }
$file = $dir.'/'.$filename; $file = $dir.'/'.$filename;
@@ -309,18 +308,17 @@ class doc_generic_myobject_odt extends ModelePDFMyObject
$contactobject = $object->contact; $contactobject = $object->contact;
} }
} }
else else {
{
$socobject = $object->thirdparty; $socobject = $object->thirdparty;
} }
// Make substitution // Make substitution
$substitutionarray = array( $substitutionarray = array(
'__FROM_NAME__' => $this->emetteur->name, '__FROM_NAME__' => $this->emetteur->name,
'__FROM_EMAIL__' => $this->emetteur->email, '__FROM_EMAIL__' => $this->emetteur->email,
'__TOTAL_TTC__' => $object->total_ttc, '__TOTAL_TTC__' => $object->total_ttc,
'__TOTAL_HT__' => $object->total_ht, '__TOTAL_HT__' => $object->total_ht,
'__TOTAL_VAT__' => $object->total_vat '__TOTAL_VAT__' => $object->total_vat
); );
complete_substitutions_array($substitutionarray, $langs, $object); complete_substitutions_array($substitutionarray, $langs, $object);
// Call the ODTSubstitution hook // Call the ODTSubstitution hook
@@ -392,13 +390,13 @@ class doc_generic_myobject_odt extends ModelePDFMyObject
foreach ($tmparray as $key=>$value) foreach ($tmparray as $key=>$value)
{ {
try { try {
if (preg_match('/logo$/', $key)) // Image if (preg_match('/logo$/', $key)) {
{ // Image
if (file_exists($value)) $odfHandler->setImage($key, $value); if (file_exists($value)) $odfHandler->setImage($key, $value);
else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8'); else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
} }
else // Text else {
{ // Text
$odfHandler->setVars($key, $value, true, 'UTF-8'); $odfHandler->setVars($key, $value, true, 'UTF-8');
} }
} }
@@ -408,8 +406,7 @@ class doc_generic_myobject_odt extends ModelePDFMyObject
} }
} }
// Replace tags of lines // Replace tags of lines
try try {
{
$foundtagforlines = 1; $foundtagforlines = 1;
try { try {
$listlines = $odfHandler->setSegment('lines'); $listlines = $odfHandler->setSegment('lines');
@@ -433,8 +430,7 @@ class doc_generic_myobject_odt extends ModelePDFMyObject
$reshook = $hookmanager->executeHooks('ODTSubstitutionLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks $reshook = $hookmanager->executeHooks('ODTSubstitutionLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
foreach ($tmparray as $key => $val) foreach ($tmparray as $key => $val)
{ {
try try {
{
$listlines->setVars($key, $val, true, 'UTF-8'); $listlines->setVars($key, $val, true, 'UTF-8');
} }
catch (OdfException $e) catch (OdfException $e)
@@ -508,8 +504,7 @@ class doc_generic_myobject_odt extends ModelePDFMyObject
return 1; // Success return 1; // Success
} }
else else {
{
$this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir); $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir);
return -1; return -1;
} }

View File

@@ -141,8 +141,7 @@ class mod_myobject_standard extends ModeleNumRefMyObject
if ($obj) $max = intval($obj->max); if ($obj) $max = intval($obj->max);
else $max = 0; else $max = 0;
} }
else else {
{
dol_syslog("mod_myobject_standard::getNextValue", LOG_DEBUG); dol_syslog("mod_myobject_standard::getNextValue", LOG_DEBUG);
return -1; return -1;
} }

View File

@@ -54,13 +54,10 @@ $action = GETPOST('action', 'alpha');
$cancel = GETPOST('cancel', 'aZ09'); $cancel = GETPOST('cancel', 'aZ09');
$backtopage = GETPOST('backtopage', 'alpha'); $backtopage = GETPOST('backtopage', 'alpha');
if (GETPOST('actioncode', 'array')) if (GETPOST('actioncode', 'array')) {
{
$actioncode = GETPOST('actioncode', 'array', 3); $actioncode = GETPOST('actioncode', 'array', 3);
if (!count($actioncode)) $actioncode = '0'; if (!count($actioncode)) $actioncode = '0';
} } else {
else
{
$actioncode = GETPOST("actioncode", "alpha", 3) ?GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT)); $actioncode = GETPOST("actioncode", "alpha", 3) ?GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT));
} }
$search_agenda_label = GETPOST('search_agenda_label'); $search_agenda_label = GETPOST('search_agenda_label');
@@ -226,9 +223,7 @@ if ($object->id > 0)
if (!empty($user->rights->agenda->myactions->create) || !empty($user->rights->agenda->allactions->create)) if (!empty($user->rights->agenda->myactions->create) || !empty($user->rights->agenda->allactions->create))
{ {
print '<a class="butAction" href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out.'">'.$langs->trans("AddAction").'</a>'; print '<a class="butAction" href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out.'">'.$langs->trans("AddAction").'</a>';
} } else {
else
{
print '<a class="butActionRefused classfortooltip" href="#">'.$langs->trans("AddAction").'</a>'; print '<a class="butActionRefused classfortooltip" href="#">'.$langs->trans("AddAction").'</a>';
} }
} }

View File

@@ -479,8 +479,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
{ {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit">'.$langs->trans("Modify").'</a>'."\n"; print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit">'.$langs->trans("Modify").'</a>'."\n";
} }
else else {
{
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans('Modify').'</a>'."\n"; print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans('Modify').'</a>'."\n";
} }
@@ -493,8 +492,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
{ {
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=confirm_validate&confirm=yes">'.$langs->trans("Validate").'</a>'; print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=confirm_validate&confirm=yes">'.$langs->trans("Validate").'</a>';
} }
else else {
{
$langs->load("errors"); $langs->load("errors");
print '<a class="butActionRefused" href="" title="'.$langs->trans("ErrorAddAtLeastOneLineFirst").'">'.$langs->trans("Validate").'</a>'; print '<a class="butActionRefused" href="" title="'.$langs->trans("ErrorAddAtLeastOneLineFirst").'">'.$langs->trans("Validate").'</a>';
} }
@@ -537,8 +535,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
{ {
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=delete">'.$langs->trans('Delete').'</a>'."\n"; print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=delete">'.$langs->trans('Delete').'</a>'."\n";
} }
else else {
{
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans('Delete').'</a>'."\n"; print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans('Delete').'</a>'."\n";
} }
} }

View File

@@ -199,9 +199,7 @@ if ($object->id)
$relativepathwithnofile = 'myobject/'.dol_sanitizeFileName($object->ref).'/'; $relativepathwithnofile = 'myobject/'.dol_sanitizeFileName($object->ref).'/';
include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';
} } else {
else
{
accessforbidden('', 0, 1); accessforbidden('', 0, 1);
} }

View File

@@ -292,9 +292,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
if (is_numeric($nbtotalofrecords) && ($limit > $nbtotalofrecords || empty($limit))) if (is_numeric($nbtotalofrecords) && ($limit > $nbtotalofrecords || empty($limit)))
{ {
$num = $nbtotalofrecords; $num = $nbtotalofrecords;
} } else {
else
{
if ($limit) $sql .= $db->plimit($limit + 1, $offset); if ($limit) $sql .= $db->plimit($limit + 1, $offset);
$resql = $db->query($sql); $resql = $db->query($sql);

View File

@@ -164,8 +164,7 @@ if (!$error)
$db->commit(); $db->commit();
print '--- end ok'."\n"; print '--- end ok'."\n";
} }
else else {
{
print '--- end error code='.$error."\n"; print '--- end error code='.$error."\n";
$db->rollback(); $db->rollback();
} }

View File

@@ -154,7 +154,7 @@ class CodingPhpTest extends PHPUnit\Framework\TestCase
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$filesarray = dol_dir_list(DOL_DOCUMENT_ROOT, 'files', 1, '\.php', null, 'fullname'); $filesarray = dol_dir_list(DOL_DOCUMENT_ROOT, 'files', 1, '\.php', null, 'fullname');
foreach($filesarray as $key => $file) foreach ($filesarray as $key => $file)
{ {
if (preg_match('/\/htdocs\/includes\//', $file['fullname'])) continue; if (preg_match('/\/htdocs\/includes\//', $file['fullname'])) continue;
if (preg_match('/\/htdocs\/custom\//', $file['fullname'])) continue; if (preg_match('/\/htdocs\/custom\//', $file['fullname'])) continue;
@@ -170,7 +170,7 @@ class CodingPhpTest extends PHPUnit\Framework\TestCase
$matches=array(); $matches=array();
// Check string ='".$this->xxx with xxx that is not 'escape'. It means we forget a db->escape when forging sql request. // Check string ='".$this->xxx with xxx that is not 'escape'. It means we forget a db->escape when forging sql request.
preg_match_all('/'.preg_quote('get_class($this)."::".__METHOD__', '/').'/', $filecontent, $matches, PREG_SET_ORDER); preg_match_all('/'.preg_quote('get_class($this)."::".__METHOD__', '/').'/', $filecontent, $matches, PREG_SET_ORDER);
foreach($matches as $key => $val) foreach ($matches as $key => $val)
{ {
$ok=false; $ok=false;
break; break;
@@ -183,7 +183,7 @@ class CodingPhpTest extends PHPUnit\Framework\TestCase
$matches=array(); $matches=array();
// Check string ='".$this->xxx with xxx that is not 'escape'. It means we forget a db->escape when forging sql request. // Check string ='".$this->xxx with xxx that is not 'escape'. It means we forget a db->escape when forging sql request.
preg_match_all('/(..)\s*\.\s*\$this->db->idate\(/', $filecontent, $matches, PREG_SET_ORDER); preg_match_all('/(..)\s*\.\s*\$this->db->idate\(/', $filecontent, $matches, PREG_SET_ORDER);
foreach($matches as $key => $val) foreach ($matches as $key => $val)
{ {
if ($val[1] != '\'"' && $val[1] != '\'\'') if ($val[1] != '\'"' && $val[1] != '\'\'')
{ {
@@ -201,7 +201,7 @@ class CodingPhpTest extends PHPUnit\Framework\TestCase
$matches=array(); $matches=array();
// Check string ='".$this->xxx with xxx that is not 'escape'. It means we forget a db->escape when forging sql request. // Check string ='".$this->xxx with xxx that is not 'escape'. It means we forget a db->escape when forging sql request.
preg_match_all('/(=|sql.+)\s*\'"\s*\.\s*\$this->(....)/', $filecontent, $matches, PREG_SET_ORDER); preg_match_all('/(=|sql.+)\s*\'"\s*\.\s*\$this->(....)/', $filecontent, $matches, PREG_SET_ORDER);
foreach($matches as $key => $val) foreach ($matches as $key => $val)
{ {
if ($val[2] != 'db->' && $val[2] != 'esca') if ($val[2] != 'db->' && $val[2] != 'esca')
{ {
@@ -220,7 +220,7 @@ class CodingPhpTest extends PHPUnit\Framework\TestCase
$matches=array(); $matches=array();
// Check string ='".$this->xxx with xxx that is not 'escape'. It means we forget a db->escape when forging sql request. // Check string ='".$this->xxx with xxx that is not 'escape'. It means we forget a db->escape when forging sql request.
preg_match_all('/(..............)\$_SERVER\[\'QUERY_STRING\'\]/', $filecontent, $matches, PREG_SET_ORDER); preg_match_all('/(..............)\$_SERVER\[\'QUERY_STRING\'\]/', $filecontent, $matches, PREG_SET_ORDER);
foreach($matches as $key => $val) foreach ($matches as $key => $val)
{ {
if ($val[1] != 'scape_htmltag(' && $val[1] != 'ing_nohtmltag(' && $val[1] != 'dol_escape_js(') if ($val[1] != 'scape_htmltag(' && $val[1] != 'ing_nohtmltag(' && $val[1] != 'dol_escape_js(')
{ {
@@ -236,7 +236,7 @@ class CodingPhpTest extends PHPUnit\Framework\TestCase
$matches=array(); $matches=array();
// Check string ='".$this->xxx with xxx that is not 'escape'. It means we forget a db->escape when forging sql request. // Check string ='".$this->xxx with xxx that is not 'escape'. It means we forget a db->escape when forging sql request.
preg_match_all('/print_liste_field_titre\(\$langs/', $filecontent, $matches, PREG_SET_ORDER); preg_match_all('/print_liste_field_titre\(\$langs/', $filecontent, $matches, PREG_SET_ORDER);
foreach($matches as $key => $val) foreach ($matches as $key => $val)
{ {
$ok=false; $ok=false;
break; break;
@@ -249,7 +249,7 @@ class CodingPhpTest extends PHPUnit\Framework\TestCase
$matches=array(); $matches=array();
// Check string ='".$this->xxx with xxx that is not 'escape'. It means we forget a db->escape when forging sql request. // Check string ='".$this->xxx with xxx that is not 'escape'. It means we forget a db->escape when forging sql request.
preg_match_all('/<br \/>/', $filecontent, $matches, PREG_SET_ORDER); preg_match_all('/<br \/>/', $filecontent, $matches, PREG_SET_ORDER);
foreach($matches as $key => $val) foreach ($matches as $key => $val)
{ {
if ($file['name'] != 'functions.lib.php') if ($file['name'] != 'functions.lib.php')
{ {
@@ -265,7 +265,7 @@ class CodingPhpTest extends PHPUnit\Framework\TestCase
$matches=array(); $matches=array();
// Check string ='".$this->xxx with xxx that is not 'escape'. It means we forget a db->escape when forging sql request. // Check string ='".$this->xxx with xxx that is not 'escape'. It means we forget a db->escape when forging sql request.
preg_match_all('/@var\s+array\(/', $filecontent, $matches, PREG_SET_ORDER); preg_match_all('/@var\s+array\(/', $filecontent, $matches, PREG_SET_ORDER);
foreach($matches as $key => $val) foreach ($matches as $key => $val)
{ {
$ok=false; $ok=false;
break; break;

View File

@@ -158,7 +158,7 @@ class CodingSqlTest extends PHPUnit\Framework\TestCase
print 'Process dir '.$dir."\n"; print 'Process dir '.$dir."\n";
$filesarray = scandir($dir); $filesarray = scandir($dir);
foreach($filesarray as $key => $file) foreach ($filesarray as $key => $file)
{ {
if (! preg_match('/\.sql$/', $file)) if (! preg_match('/\.sql$/', $file))
continue; continue;
@@ -206,14 +206,12 @@ class CodingSqlTest extends PHPUnit\Framework\TestCase
{ {
// Test for data files only // Test for data files only
} }
else else {
{
if (preg_match('/\.key\.sql$/', $file)) if (preg_match('/\.key\.sql$/', $file))
{ {
// Test for key files only // Test for key files only
} }
else else {
{
// Test for non key files only // Test for non key files only
$result=(strpos($filecontent, 'KEY ') && strpos($filecontent, 'PRIMARY KEY') == 0); $result=(strpos($filecontent, 'KEY ') && strpos($filecontent, 'PRIMARY KEY') == 0);
print __METHOD__." Result for checking we don't have ' KEY ' instead of a sql file to create index = ".$result."\n"; print __METHOD__." Result for checking we don't have ' KEY ' instead of a sql file to create index = ".$result."\n";
@@ -244,7 +242,7 @@ class CodingSqlTest extends PHPUnit\Framework\TestCase
$db=$this->savdb; $db=$this->savdb;
$filesarray = scandir(DOL_DOCUMENT_ROOT.'/../dev/initdemo'); $filesarray = scandir(DOL_DOCUMENT_ROOT.'/../dev/initdemo');
foreach($filesarray as $key => $file) { foreach ($filesarray as $key => $file) {
if (! preg_match('/\.sql$/', $file)) if (! preg_match('/\.sql$/', $file))
continue; continue;

View File

@@ -342,7 +342,7 @@ class ExportTest extends PHPUnit\Framework\TestCase
$result=$objexport->load_arrays($user, $filterdatatoexport); // This load ->array_export_xxx properties for datatoexport $result=$objexport->load_arrays($user, $filterdatatoexport); // This load ->array_export_xxx properties for datatoexport
// Loop on each dataset // Loop on each dataset
foreach($objexport->array_export_code as $key => $datatoexport) foreach ($objexport->array_export_code as $key => $datatoexport)
{ {
$exportfile=$conf->export->dir_temp.'/'.$user->id.'/export_'.$datatoexport.'.csv'; $exportfile=$conf->export->dir_temp.'/'.$user->id.'/export_'.$datatoexport.'.csv';
print "Process export for dataset ".$datatoexport." into ".$exportfile."\n"; print "Process export for dataset ".$datatoexport." into ".$exportfile."\n";
@@ -351,7 +351,7 @@ class ExportTest extends PHPUnit\Framework\TestCase
// Generate $array_selected // Generate $array_selected
$i=0; $i=0;
$array_selected=array(); $array_selected=array();
foreach($objexport->array_export_fields[$key] as $key => $val) foreach ($objexport->array_export_fields[$key] as $key => $val)
{ {
$array_selected[$key]=$i++; $array_selected[$key]=$i++;
} }

View File

@@ -187,12 +187,11 @@ class FactureRecTest extends PHPUnit\Framework\TestCase
{ {
$retAr[]="Supplied objects are not of same class."; $retAr[]="Supplied objects are not of same class.";
} }
else else {
{
$oVarsA=get_object_vars($oA); $oVarsA=get_object_vars($oA);
$oVarsB=get_object_vars($oB); $oVarsB=get_object_vars($oB);
$aKeys=array_keys($oVarsA); $aKeys=array_keys($oVarsA);
foreach($aKeys as $sKey) foreach ($aKeys as $sKey)
{ {
if (in_array($sKey, $fieldstoignorearray)) continue; if (in_array($sKey, $fieldstoignorearray)) continue;
if (! $ignoretype && $oVarsA[$sKey] !== $oVarsB[$sKey]) if (! $ignoretype && $oVarsA[$sKey] !== $oVarsB[$sKey])

View File

@@ -366,12 +366,11 @@ class FactureTest extends PHPUnit\Framework\TestCase
{ {
$retAr[]="Supplied objects are not of same class."; $retAr[]="Supplied objects are not of same class.";
} }
else else {
{
$oVarsA=get_object_vars($oA); $oVarsA=get_object_vars($oA);
$oVarsB=get_object_vars($oB); $oVarsB=get_object_vars($oB);
$aKeys=array_keys($oVarsA); $aKeys=array_keys($oVarsA);
foreach($aKeys as $sKey) foreach ($aKeys as $sKey)
{ {
if (in_array($sKey, $fieldstoignorearray)) continue; if (in_array($sKey, $fieldstoignorearray)) continue;
if (! $ignoretype && $oVarsA[$sKey] !== $oVarsB[$sKey]) if (! $ignoretype && $oVarsA[$sKey] !== $oVarsB[$sKey])

View File

@@ -154,7 +154,7 @@ class LangTest extends PHPUnit\Framework\TestCase
include_once DOL_DOCUMENT_ROOT.'/core/class/translate.class.php'; include_once DOL_DOCUMENT_ROOT.'/core/class/translate.class.php';
$filesarray = scandir(DOL_DOCUMENT_ROOT.'/langs'); $filesarray = scandir(DOL_DOCUMENT_ROOT.'/langs');
foreach($filesarray as $key => $code) foreach ($filesarray as $key => $code)
{ {
if (! preg_match('/^[a-z]+_[A-Z]+$/', $code)) continue; if (! preg_match('/^[a-z]+_[A-Z]+$/', $code)) continue;

View File

@@ -144,7 +144,7 @@ class ModulesTest extends PHPUnit\Framework\TestCase
'Mailing','MailmanSpip','Margin','ModuleBuilder','MultiCurrency', 'Mailing','MailmanSpip','Margin','ModuleBuilder','MultiCurrency',
'Notification','Oauth','OpenSurvey','Paybox','Paypal','Prelevement','Printing','Product','ProductBatch','Projet','Propale','ReceiptPrinter','Resource', 'Notification','Oauth','OpenSurvey','Paybox','Paypal','Prelevement','Printing','Product','ProductBatch','Projet','Propale','ReceiptPrinter','Resource',
'Salaries','Service','SocialNetworks','Societe','Stock','Stripe','SupplierProposal','Syslog','TakePos','Tax','Ticket','User','Variants','WebServices','WebServicesClient','Website','Workflow'); 'Salaries','Service','SocialNetworks','Societe','Stock','Stripe','SupplierProposal','Syslog','TakePos','Tax','Ticket','User','Variants','WebServices','WebServicesClient','Website','Workflow');
foreach($modulelist as $modlabel) foreach ($modulelist as $modlabel)
{ {
require_once DOL_DOCUMENT_ROOT.'/core/modules/mod'.$modlabel.'.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/modules/mod'.$modlabel.'.class.php';
$class='mod'.$modlabel; $class='mod'.$modlabel;

View File

@@ -339,7 +339,7 @@ class UserTest extends PHPUnit\Framework\TestCase
$oVarsA=get_object_vars($oA); $oVarsA=get_object_vars($oA);
$oVarsB=get_object_vars($oB); $oVarsB=get_object_vars($oB);
$aKeys=array_keys($oVarsA); $aKeys=array_keys($oVarsA);
foreach($aKeys as $sKey) { foreach ($aKeys as $sKey) {
if (in_array($sKey, $fieldstoignorearray)) if (in_array($sKey, $fieldstoignorearray))
continue; continue;
if (! $ignoretype && $oVarsA[$sKey] !== $oVarsB[$sKey]) { if (! $ignoretype && $oVarsA[$sKey] !== $oVarsB[$sKey]) {

View File

@@ -256,7 +256,7 @@ class WebservicesInvoicesTest extends PHPUnit\Framework\TestCase
try { try {
$result = $this->soapclient->call($WS_METHOD, $parameters, $this->ns, ''); $result = $this->soapclient->call($WS_METHOD, $parameters, $this->ns, '');
} }
catch(SoapFault $exception) catch (SoapFault $exception)
{ {
echo $exception; echo $exception;
$result=0; $result=0;
@@ -314,7 +314,7 @@ class WebservicesInvoicesTest extends PHPUnit\Framework\TestCase
try { try {
$result = $this->soapclient->call($WS_METHOD, $parameters, $this->ns, ''); $result = $this->soapclient->call($WS_METHOD, $parameters, $this->ns, '');
} }
catch(SoapFault $exception) catch (SoapFault $exception)
{ {
echo $exception; echo $exception;
$result=0; $result=0;
@@ -414,7 +414,7 @@ class WebservicesInvoicesTest extends PHPUnit\Framework\TestCase
try { try {
$result = $this->soapclient->call($WS_METHOD, $parameters, $this->ns, ''); $result = $this->soapclient->call($WS_METHOD, $parameters, $this->ns, '');
} }
catch(SoapFault $exception) catch (SoapFault $exception)
{ {
echo $exception; echo $exception;
$result=0; $result=0;
@@ -433,7 +433,6 @@ class WebservicesInvoicesTest extends PHPUnit\Framework\TestCase
$this->assertEquals('OK', $result['result']['result_code']); $this->assertEquals('OK', $result['result']['result_code']);
$this->assertEquals('ref-phpunit-2', $result['ref_ext']); $this->assertEquals('ref-phpunit-2', $result['ref_ext']);
return $result; return $result;
} }
} }

View File

@@ -169,7 +169,7 @@ class WebservicesOrdersTest extends PHPUnit\Framework\TestCase
print __METHOD__." call method ".$WS_METHOD."\n"; print __METHOD__." call method ".$WS_METHOD."\n";
try { try {
$result = $soapclient->call($WS_METHOD, $parameters, $ns, ''); $result = $soapclient->call($WS_METHOD, $parameters, $ns, '');
} catch(SoapFault $exception) { } catch (SoapFault $exception) {
echo $exception; echo $exception;
$result=0; $result=0;
} }

View File

@@ -170,7 +170,7 @@ class WebservicesOtherTest extends PHPUnit\Framework\TestCase
print __METHOD__." call method ".$WS_METHOD."\n"; print __METHOD__." call method ".$WS_METHOD."\n";
try { try {
$result = $soapclient->call($WS_METHOD, $parameters, $ns, ''); $result = $soapclient->call($WS_METHOD, $parameters, $ns, '');
} catch(SoapFault $exception) { } catch (SoapFault $exception) {
echo $exception; echo $exception;
$result=0; $result=0;
} }
@@ -198,7 +198,7 @@ class WebservicesOtherTest extends PHPUnit\Framework\TestCase
print __METHOD__." call method ".$WS_METHOD."\n"; print __METHOD__." call method ".$WS_METHOD."\n";
try { try {
$result = $soapclient->call($WS_METHOD, $parameters, $ns, ''); $result = $soapclient->call($WS_METHOD, $parameters, $ns, '');
} catch(SoapFault $exception) { } catch (SoapFault $exception) {
echo $exception; echo $exception;
$result=0; $result=0;
} }

View File

@@ -188,7 +188,7 @@ class WebservicesProductsTest extends PHPUnit\Framework\TestCase
print __METHOD__." call method ".$WS_METHOD."\n"; print __METHOD__." call method ".$WS_METHOD."\n";
try { try {
$result = $soapclient->call($WS_METHOD, $parameters, $ns, ''); $result = $soapclient->call($WS_METHOD, $parameters, $ns, '');
} catch(SoapFault $exception) { } catch (SoapFault $exception) {
echo $exception; echo $exception;
$result=0; $result=0;
} }
@@ -251,7 +251,7 @@ class WebservicesProductsTest extends PHPUnit\Framework\TestCase
print __METHOD__." call method ".$WS_METHOD."\n"; print __METHOD__." call method ".$WS_METHOD."\n";
try { try {
$result = $soapclient->call($WS_METHOD, $parameters, $ns, ''); $result = $soapclient->call($WS_METHOD, $parameters, $ns, '');
} catch(SoapFault $exception) { } catch (SoapFault $exception) {
echo $exception; echo $exception;
$result=0; $result=0;
} }
@@ -314,7 +314,7 @@ class WebservicesProductsTest extends PHPUnit\Framework\TestCase
print __METHOD__." call method ".$WS_METHOD."\n"; print __METHOD__." call method ".$WS_METHOD."\n";
try { try {
$result = $soapclient->call($WS_METHOD, $parameters, $ns, ''); $result = $soapclient->call($WS_METHOD, $parameters, $ns, '');
} catch(SoapFault $exception) { } catch (SoapFault $exception) {
echo $exception; echo $exception;
$result=0; $result=0;
} }

View File

@@ -214,7 +214,7 @@ class WebservicesThirdpartyTest extends PHPUnit\Framework\TestCase
print __METHOD__." call method ".$WS_METHOD."\n"; print __METHOD__." call method ".$WS_METHOD."\n";
try { try {
$result = $this->soapclient->call($WS_METHOD, $parameters, $this->ns, ''); $result = $this->soapclient->call($WS_METHOD, $parameters, $this->ns, '');
} catch(SoapFault $exception) { } catch (SoapFault $exception) {
echo $exception; echo $exception;
$result=0; $result=0;
} }
@@ -268,7 +268,7 @@ class WebservicesThirdpartyTest extends PHPUnit\Framework\TestCase
print __METHOD__." call method ".$WS_METHOD."\n"; print __METHOD__." call method ".$WS_METHOD."\n";
try { try {
$result = $this->soapclient->call($WS_METHOD, $parameters, $this->_ns, ''); $result = $this->soapclient->call($WS_METHOD, $parameters, $this->_ns, '');
} catch(SoapFault $exception) { } catch (SoapFault $exception) {
echo $exception; echo $exception;
$result=0; $result=0;
} }
@@ -330,7 +330,7 @@ class WebservicesThirdpartyTest extends PHPUnit\Framework\TestCase
print __METHOD__." call method ".$WS_METHOD."\n"; print __METHOD__." call method ".$WS_METHOD."\n";
try { try {
$result = $this->soapclient->call($WS_METHOD, $parameters, $this->_ns, ''); $result = $this->soapclient->call($WS_METHOD, $parameters, $this->_ns, '');
} catch(SoapFault $exception) { } catch (SoapFault $exception) {
echo $exception; echo $exception;
$result=0; $result=0;
} }
@@ -390,7 +390,7 @@ class WebservicesThirdpartyTest extends PHPUnit\Framework\TestCase
print __METHOD__." call method ".$WS_METHOD."\n"; print __METHOD__." call method ".$WS_METHOD."\n";
try { try {
$result = $this->soapclient->call($WS_METHOD, $parameters, $this->_ns, ''); $result = $this->soapclient->call($WS_METHOD, $parameters, $this->_ns, '');
} catch(SoapFault $exception) { } catch (SoapFault $exception) {
echo $exception; echo $exception;
$result=0; $result=0;
} }

View File

@@ -170,7 +170,7 @@ class WebservicesUserTest extends PHPUnit\Framework\TestCase
print __METHOD__."Call method ".$WS_METHOD."\n"; print __METHOD__."Call method ".$WS_METHOD."\n";
try { try {
$result = $soapclient->call($WS_METHOD, $parameters, $ns, ''); $result = $soapclient->call($WS_METHOD, $parameters, $ns, '');
} catch(SoapFault $exception) { } catch (SoapFault $exception) {
echo $exception; echo $exception;
$result=0; $result=0;
} }
@@ -197,7 +197,7 @@ class WebservicesUserTest extends PHPUnit\Framework\TestCase
print __METHOD__."Call method ".$WS_METHOD."\n"; print __METHOD__."Call method ".$WS_METHOD."\n";
try { try {
$result = $soapclient->call($WS_METHOD, $parameters, $ns, ''); $result = $soapclient->call($WS_METHOD, $parameters, $ns, '');
} catch(SoapFault $exception) { } catch (SoapFault $exception) {
echo $exception; echo $exception;
$result=0; $result=0;
} }