2
0
forked from Wavyzz/dolibarr

clean indent

This commit is contained in:
Frédéric FRANCE
2019-10-20 01:09:11 +02:00
parent 263bd9cbc0
commit 360bf55f5b
51 changed files with 1126 additions and 1163 deletions

View File

@@ -185,16 +185,15 @@
<!-- Check indent are done with spaces and with correct number --> <!-- Check indent are done with spaces and with correct number -->
<!-- Disabled as this does not support tab --> <!-- Disabled as this does not support tab -->
<!-- <rule ref="Generic.WhiteSpace.ScopeIndent.Incorrect" /> -->
<!-- <rule ref="Generic.WhiteSpace.ScopeIndent" /> --> <!-- <rule ref="Generic.WhiteSpace.ScopeIndent" /> -->
<!-- TODO Enable this <!-- <arg name="tab-width" value="4"/> -->
<arg name="tab-width" value="4"/>
<rule ref="Generic.WhiteSpace.ScopeIndent"> <rule ref="Generic.WhiteSpace.ScopeIndent">
<properties> <properties>
<property name="indent" value="4"/> <property name="indent" value="4"/>
<property name="tabIndent" value="true"/> <property name="tabIndent" value="true"/>
</properties> </properties>
</rule> </rule>
-->
<rule ref="Squiz.WhiteSpace.ScopeClosingBrace.Indent" /> <rule ref="Squiz.WhiteSpace.ScopeClosingBrace.Indent" />

View File

@@ -88,11 +88,11 @@ if ($action == 'setlistsorttodo') {
if (! $res > 0) if (! $res > 0)
$error ++; $error ++;
if (! $error) { if (! $error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else { } else {
setEventMessages($langs->trans("Error"), null, 'mesgs'); setEventMessages($langs->trans("Error"), null, 'mesgs');
} }
} }
if ($action == 'setlistsortdone') { if ($action == 'setlistsortdone') {
@@ -100,11 +100,11 @@ if ($action == 'setlistsortdone') {
$res = dolibarr_set_const($db, "ACCOUNTING_LIST_SORT_VENTILATION_DONE", $setlistsortdone, 'yesno', 0, '', $conf->entity); $res = dolibarr_set_const($db, "ACCOUNTING_LIST_SORT_VENTILATION_DONE", $setlistsortdone, 'yesno', 0, '', $conf->entity);
if (! $res > 0) if (! $res > 0)
$error ++; $error ++;
if (! $error) { if (! $error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else { } else {
setEventMessages($langs->trans("Error"), null, 'mesgs'); setEventMessages($langs->trans("Error"), null, 'mesgs');
} }
} }
if ($action == 'setmanagezero') { if ($action == 'setmanagezero') {
@@ -112,11 +112,11 @@ if ($action == 'setmanagezero') {
$res = dolibarr_set_const($db, "ACCOUNTING_MANAGE_ZERO", $setmanagezero, 'yesno', 0, '', $conf->entity); $res = dolibarr_set_const($db, "ACCOUNTING_MANAGE_ZERO", $setmanagezero, 'yesno', 0, '', $conf->entity);
if (! $res > 0) if (! $res > 0)
$error ++; $error ++;
if (! $error) { if (! $error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else { } else {
setEventMessages($langs->trans("Error"), null, 'mesgs'); setEventMessages($langs->trans("Error"), null, 'mesgs');
} }
} }
if ($action == 'setdisabledirectinput') { if ($action == 'setdisabledirectinput') {
@@ -124,11 +124,11 @@ if ($action == 'setdisabledirectinput') {
$res = dolibarr_set_const($db, "BANK_DISABLE_DIRECT_INPUT", $setdisabledirectinput, 'yesno', 0, '', $conf->entity); $res = dolibarr_set_const($db, "BANK_DISABLE_DIRECT_INPUT", $setdisabledirectinput, 'yesno', 0, '', $conf->entity);
if (! $res > 0) if (! $res > 0)
$error ++; $error ++;
if (! $error) { if (! $error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else { } else {
setEventMessages($langs->trans("Error"), null, 'mesgs'); setEventMessages($langs->trans("Error"), null, 'mesgs');
} }
} }
if ($action == 'setenabledraftexport') { if ($action == 'setenabledraftexport') {
@@ -136,11 +136,11 @@ if ($action == 'setenabledraftexport') {
$res = dolibarr_set_const($db, "ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL", $setenabledraftexport, 'yesno', 0, '', $conf->entity); $res = dolibarr_set_const($db, "ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL", $setenabledraftexport, 'yesno', 0, '', $conf->entity);
if (! $res > 0) if (! $res > 0)
$error ++; $error ++;
if (! $error) { if (! $error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else { } else {
setEventMessages($langs->trans("Error"), null, 'mesgs'); setEventMessages($langs->trans("Error"), null, 'mesgs');
} }
} }
if ($action == 'setenablesubsidiarylist') { if ($action == 'setenablesubsidiarylist') {

View File

@@ -180,8 +180,6 @@ if ($massaction == 'ventil') {
} }
$msg.='</div>'; $msg.='</div>';
$msg.= '<div>' . $langs->trans("EndProcessing") . '</div>'; $msg.= '<div>' . $langs->trans("EndProcessing") . '</div>';
//} else {
// setEventMessages($langs->trans("NoRecordSelected"), null, 'warnings');
} }
} }

View File

@@ -161,8 +161,6 @@ if ($massaction == 'ventil') {
} }
$msg.='</div>'; $msg.='</div>';
$msg.= '<div>' . $langs->trans("EndProcessing") . '</div>'; $msg.= '<div>' . $langs->trans("EndProcessing") . '</div>';
//} else {
// setEventMessages($langs->trans("NoRecordSelected"), null, 'warnings');
} }
} }

View File

@@ -996,7 +996,7 @@ if (empty($action) || $action == 'view') {
if (($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == "") || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1' if (($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == "") || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1'
|| ($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == "") || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1') { || ($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == "") || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1') {
print '<input type="button" class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="' . $langs->trans("WriteBookKeeping") . '" />'; print '<input type="button" class="butActionRefused classfortooltip" title="'.dol_escape_htmltag($langs->trans("SomeMandatoryStepsOfSetupWereNotDone")).'" value="' . $langs->trans("WriteBookKeeping") . '" />';
} }
else { else {
if ($in_bookkeeping == 'notyet') print '<input type="button" class="butAction" name="writebookkeeping" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />'; if ($in_bookkeeping == 'notyet') print '<input type="button" class="butAction" name="writebookkeeping" value="' . $langs->trans("WriteBookKeeping") . '" onclick="writebookkeeping();" />';

View File

@@ -306,49 +306,49 @@ if ($action == 'writebookkeeping') {
foreach ($arrayofvat[$key] as $k => $mt) { foreach ($arrayofvat[$key] as $k => $mt) {
if ($mt) { if ($mt) {
// get compte id and label // get compte id and label
$bookkeeping = new BookKeeping($db); $bookkeeping = new BookKeeping($db);
$bookkeeping->doc_date = $val["date"]; $bookkeeping->doc_date = $val["date"];
$bookkeeping->doc_ref = $val["ref"]; $bookkeeping->doc_ref = $val["ref"];
$bookkeeping->date_creation = $now; $bookkeeping->date_creation = $now;
$bookkeeping->doc_type = 'expense_report'; $bookkeeping->doc_type = 'expense_report';
$bookkeeping->fk_doc = $key; $bookkeeping->fk_doc = $key;
$bookkeeping->fk_docdet = $val["fk_expensereportdet"]; $bookkeeping->fk_docdet = $val["fk_expensereportdet"];
$bookkeeping->subledger_account = ''; $bookkeeping->subledger_account = '';
$bookkeeping->subledger_label = ''; $bookkeeping->subledger_label = '';
$bookkeeping->numero_compte = $k; $bookkeeping->numero_compte = $k;
$accountingaccount->fetch($k, null, true); $accountingaccount->fetch($k, null, true);
$bookkeeping->label_compte = $accountingaccount->label; $bookkeeping->label_compte = $accountingaccount->label;
$bookkeeping->label_operation = $langs->trans("VAT"). ' '.join(', ', $def_tva[$key][$k]).' %'; $bookkeeping->label_operation = $langs->trans("VAT"). ' '.join(', ', $def_tva[$key][$k]).' %';
$bookkeeping->montant = $mt; $bookkeeping->montant = $mt;
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D'; $bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
$bookkeeping->debit = ($mt > 0) ? $mt : 0; $bookkeeping->debit = ($mt > 0) ? $mt : 0;
$bookkeeping->credit = ($mt <= 0) ? $mt : 0; $bookkeeping->credit = ($mt <= 0) ? $mt : 0;
$bookkeeping->code_journal = $journal; $bookkeeping->code_journal = $journal;
$bookkeeping->journal_label = $journal_label; $bookkeeping->journal_label = $journal_label;
$bookkeeping->fk_user_author = $user->id; $bookkeeping->fk_user_author = $user->id;
$bookkeeping->entity = $conf->entity; $bookkeeping->entity = $conf->entity;
$totaldebit += $bookkeeping->debit; $totaldebit += $bookkeeping->debit;
$totalcredit += $bookkeeping->credit; $totalcredit += $bookkeeping->credit;
$result = $bookkeeping->create($user); $result = $bookkeeping->create($user);
if ($result < 0) { if ($result < 0) {
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists
{ {
$error++; $error++;
$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
{
$error++;
$errorforline++;
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
}
} }
else
{
$error++;
$errorforline++;
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
}
}
} }
} }
} }
@@ -438,48 +438,48 @@ if ($action == 'exportcsv') { // ISO and not UTF8 !
print "\n"; print "\n";
foreach ($taber as $key => $val) { foreach ($taber as $key => $val) {
$date = dol_print_date($val["date"], 'day'); $date = dol_print_date($val["date"], 'day');
$userstatic->id = $tabuser[$key]['id']; $userstatic->id = $tabuser[$key]['id'];
$userstatic->name = $tabuser[$key]['name']; $userstatic->name = $tabuser[$key]['name'];
// Fees // Fees
foreach ($tabht[$key] as $k => $mt) { foreach ($tabht[$key] as $k => $mt) {
$accountingaccount = new AccountingAccount($db); $accountingaccount = new AccountingAccount($db);
$accountingaccount->fetch(null, $k, true); $accountingaccount->fetch(null, $k, true);
if ($mt) { if ($mt) {
print '"' . $date . '"' . $sep; print '"' . $date . '"' . $sep;
print '"' . $val["ref"] . '"' . $sep; print '"' . $val["ref"] . '"' . $sep;
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep; print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
print '"' . dol_trunc($accountingaccount->label, 32) . '"' . $sep; print '"' . dol_trunc($accountingaccount->label, 32) . '"' . $sep;
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep; print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
print '"' . ($mt < 0 ? price(- $mt) : '') . '"'; print '"' . ($mt < 0 ? price(- $mt) : '') . '"';
print "\n"; print "\n";
}
} }
} // VAT
// VAT foreach ($tabtva[$key] as $k => $mt) {
foreach ($tabtva[$key] as $k => $mt) { if ($mt) {
if ($mt) { print '"' . $date . '"' . $sep;
print '"' . $date . '"' . $sep; print '"' . $val["ref"] . '"' . $sep;
print '"' . $val["ref"] . '"' . $sep; print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep;
print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep; print '"' . dol_trunc($langs->trans("VAT")) . '"' . $sep;
print '"' . dol_trunc($langs->trans("VAT")) . '"' . $sep; print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep;
print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep; print '"' . ($mt < 0 ? price(- $mt) : '') . '"';
print '"' . ($mt < 0 ? price(- $mt) : '') . '"'; print "\n";
print "\n"; }
} }
}
// Third party // Third party
foreach ($tabttc[$key] as $k => $mt) { foreach ($tabttc[$key] as $k => $mt) {
print '"' . $date . '"' . $sep; print '"' . $date . '"' . $sep;
print '"' . $val["ref"] . '"' . $sep; print '"' . $val["ref"] . '"' . $sep;
print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep; print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep;
print '"' . dol_trunc($userstatic->name) . '"' . $sep; print '"' . dol_trunc($userstatic->name) . '"' . $sep;
print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep; print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep;
print '"' . ($mt >= 0 ? price($mt) : '') . '"'; print '"' . ($mt >= 0 ? price($mt) : '') . '"';
} }
print "\n"; print "\n";
} }
} }
@@ -638,29 +638,29 @@ if (empty($action) || $action == 'view') {
if ($numtax == 2) $arrayofvat = $tablocaltax2; if ($numtax == 2) $arrayofvat = $tablocaltax2;
foreach ($arrayofvat[$key] as $k => $mt) { foreach ($arrayofvat[$key] as $k => $mt) {
if ($mt) { if ($mt) {
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print "<!-- VAT -->"; print "<!-- VAT -->";
print "<td>" . $date . "</td>"; print "<td>" . $date . "</td>";
print "<td>" . $expensereportstatic->getNomUrl(1) . "</td>"; print "<td>" . $expensereportstatic->getNomUrl(1) . "</td>";
// Account // Account
print "<td>"; print "<td>";
$accountoshow = length_accountg($k); $accountoshow = length_accountg($k);
if (($accountoshow == "") || $accountoshow == 'NotDefined') if (($accountoshow == "") || $accountoshow == 'NotDefined')
{ {
print '<span class="error">'.$langs->trans("VATAccountNotDefined").'</span>'; print '<span class="error">'.$langs->trans("VATAccountNotDefined").'</span>';
}
else print $accountoshow;
print "</td>";
// Subledger account
print "<td>";
print '</td>';
print "<td>" . $userstatic->getNomUrl(0, 'user', 16) . ' - ' . $langs->trans("VAT"). ' '.join(', ', $def_tva[$key][$k]).' %'.($numtax?' - Localtax '.$numtax:'');
print "</td>";
print '<td class="right nowraponall">' . ($mt >= 0 ? price($mt) : '') . "</td>";
print '<td class="right nowraponall">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
print "</tr>";
} }
else print $accountoshow;
print "</td>";
// Subledger account
print "<td>";
print '</td>';
print "<td>" . $userstatic->getNomUrl(0, 'user', 16) . ' - ' . $langs->trans("VAT"). ' '.join(', ', $def_tva[$key][$k]).' %'.($numtax?' - Localtax '.$numtax:'');
print "</td>";
print '<td class="right nowraponall">' . ($mt >= 0 ? price($mt) : '') . "</td>";
print '<td class="right nowraponall">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
print "</tr>";
}
} }
} }
} }

View File

@@ -294,7 +294,61 @@ if ($action == 'writebookkeeping') {
if (! $errorforline) if (! $errorforline)
{ {
foreach ($tabttc[$key] as $k => $mt) { foreach ($tabttc[$key] as $k => $mt) {
//if ($mt) { $bookkeeping = new BookKeeping($db);
$bookkeeping->doc_date = $val["date"];
$bookkeeping->date_lim_reglement = $val["datereg"];
$bookkeeping->doc_ref = $val["refsologest"];
$bookkeeping->date_creation = $now;
$bookkeeping->doc_type = 'supplier_invoice';
$bookkeeping->fk_doc = $key;
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
$bookkeeping->thirdparty_code = $companystatic->code_fournisseur;
$bookkeeping->subledger_account = $tabcompany[$key]['code_compta_fournisseur'];
$bookkeeping->subledger_label = $tabcompany[$key]['name'];
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER;
$accountingaccount->fetch(null, $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER, true);
$bookkeeping->label_compte = $accountingaccount->label;
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref_supplier . ' - ' . $langs->trans("SubledgerAccount");
$bookkeeping->montant = $mt;
$bookkeeping->sens = ($mt >= 0) ? 'C' : 'D';
$bookkeeping->debit = ($mt <= 0) ? -$mt : 0;
$bookkeeping->credit = ($mt > 0) ? $mt : 0;
$bookkeeping->code_journal = $journal;
$bookkeeping->journal_label = $journal_label;
$bookkeeping->fk_user_author = $user->id;
$bookkeeping->entity = $conf->entity;
$totaldebit += $bookkeeping->debit;
$totalcredit += $bookkeeping->credit;
$result = $bookkeeping->create($user);
if ($result < 0) {
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists
{
$error++;
$errorforline++;
$errorforinvoice[$key]='alreadyjournalized';
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
}
else
{
$error++;
$errorforline++;
$errorforinvoice[$key]='other';
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
}
}
}
}
// Product / Service
if (! $errorforline)
{
foreach ($tabht[$key] as $k => $mt) {
// get compte id and label
if ($accountingaccount->fetch(null, $k, true)) {
$bookkeeping = new BookKeeping($db); $bookkeeping = new BookKeeping($db);
$bookkeeping->doc_date = $val["date"]; $bookkeeping->doc_date = $val["date"];
$bookkeeping->date_lim_reglement = $val["datereg"]; $bookkeeping->date_lim_reglement = $val["datereg"];
@@ -302,20 +356,17 @@ if ($action == 'writebookkeeping') {
$bookkeeping->date_creation = $now; $bookkeeping->date_creation = $now;
$bookkeeping->doc_type = 'supplier_invoice'; $bookkeeping->doc_type = 'supplier_invoice';
$bookkeeping->fk_doc = $key; $bookkeeping->fk_doc = $key;
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add $bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
$bookkeeping->thirdparty_code = $companystatic->code_fournisseur; $bookkeeping->thirdparty_code = $companystatic->code_fournisseur;
$bookkeeping->subledger_account = $tabcompany[$key]['code_compta_fournisseur']; $bookkeeping->subledger_account = '';
$bookkeeping->subledger_label = $tabcompany[$key]['name']; $bookkeeping->subledger_label = '';
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER; $bookkeeping->numero_compte = $k;
$accountingaccount->fetch(null, $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER, true);
$bookkeeping->label_compte = $accountingaccount->label; $bookkeeping->label_compte = $accountingaccount->label;
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref_supplier . ' - ' . $accountingaccount->label;
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref_supplier . ' - ' . $langs->trans("SubledgerAccount");
$bookkeeping->montant = $mt; $bookkeeping->montant = $mt;
$bookkeeping->sens = ($mt >= 0) ? 'C' : 'D'; $bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
$bookkeeping->debit = ($mt <= 0) ? -$mt : 0; $bookkeeping->debit = ($mt > 0) ? $mt : 0;
$bookkeeping->credit = ($mt > 0) ? $mt : 0; $bookkeeping->credit = ($mt <= 0) ? -$mt : 0;
$bookkeeping->code_journal = $journal; $bookkeeping->code_journal = $journal;
$bookkeeping->journal_label = $journal_label; $bookkeeping->journal_label = $journal_label;
$bookkeeping->fk_user_author = $user->id; $bookkeeping->fk_user_author = $user->id;
@@ -341,62 +392,7 @@ if ($action == 'writebookkeeping') {
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors'); setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
} }
} }
//} }
}
}
// Product / Service
if (! $errorforline)
{
foreach ($tabht[$key] as $k => $mt) {
//if ($mt) {
// get compte id and label
if ($accountingaccount->fetch(null, $k, true)) {
$bookkeeping = new BookKeeping($db);
$bookkeeping->doc_date = $val["date"];
$bookkeeping->date_lim_reglement = $val["datereg"];
$bookkeeping->doc_ref = $val["refsologest"];
$bookkeeping->date_creation = $now;
$bookkeeping->doc_type = 'supplier_invoice';
$bookkeeping->fk_doc = $key;
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
$bookkeeping->thirdparty_code = $companystatic->code_fournisseur;
$bookkeeping->subledger_account = '';
$bookkeeping->subledger_label = '';
$bookkeeping->numero_compte = $k;
$bookkeeping->label_compte = $accountingaccount->label;
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref_supplier . ' - ' . $accountingaccount->label;
$bookkeeping->montant = $mt;
$bookkeeping->sens = ($mt < 0) ? 'C' : 'D';
$bookkeeping->debit = ($mt > 0) ? $mt : 0;
$bookkeeping->credit = ($mt <= 0) ? -$mt : 0;
$bookkeeping->code_journal = $journal;
$bookkeeping->journal_label = $journal_label;
$bookkeeping->fk_user_author = $user->id;
$bookkeeping->entity = $conf->entity;
$totaldebit += $bookkeeping->debit;
$totalcredit += $bookkeeping->credit;
$result = $bookkeeping->create($user);
if ($result < 0) {
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists
{
$error++;
$errorforline++;
$errorforinvoice[$key]='alreadyjournalized';
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
}
else
{
$error++;
$errorforline++;
$errorforinvoice[$key]='other';
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
}
}
}
//}
} }
} }
@@ -865,34 +861,32 @@ if (empty($action) || $action == 'view') {
// Third party // Third party
foreach ($tabttc[$key] as $k => $mt) { foreach ($tabttc[$key] as $k => $mt) {
//if ($mt) { print '<tr class="oddeven">';
print '<tr class="oddeven">'; print "<!-- Thirdparty -->";
print "<!-- Thirdparty -->"; print "<td>" . $date . "</td>";
print "<td>" . $date . "</td>"; print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>"; // Account
// Account print "<td>";
print "<td>"; $accountoshow = length_accounta($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER);
$accountoshow = length_accounta($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER); if (($accountoshow == "") || $accountoshow == 'NotDefined')
if (($accountoshow == "") || $accountoshow == 'NotDefined') {
{ print '<span class="error">'.$langs->trans("MainAccountForSuppliersNotDefined").'</span>';
print '<span class="error">'.$langs->trans("MainAccountForSuppliersNotDefined").'</span>'; }
} else print $accountoshow;
else print $accountoshow; print '</td>';
print '</td>'; // Subledger account
// Subledger account print "<td>";
print "<td>"; $accountoshow = length_accounta($k);
$accountoshow = length_accounta($k); if (($accountoshow == "") || $accountoshow == 'NotDefined')
if (($accountoshow == "") || $accountoshow == 'NotDefined') {
{ print '<span class="error">'.$langs->trans("ThirdpartyAccountNotDefined").'</span>';
print '<span class="error">'.$langs->trans("ThirdpartyAccountNotDefined").'</span>'; }
} else print $accountoshow;
else print $accountoshow; print '</td>';
print '</td>'; print "<td>" . $companystatic->getNomUrl(0, 'supplier', 16) . ' - ' . $invoicestatic->ref_supplier . ' - ' . $langs->trans("SubledgerAccount") . "</td>";
print "<td>" . $companystatic->getNomUrl(0, 'supplier', 16) . ' - ' . $invoicestatic->ref_supplier . ' - ' . $langs->trans("SubledgerAccount") . "</td>"; print '<td class="right nowraponall">'. ($mt < 0 ? price(- $mt) : '') . "</td>";
print '<td class="right nowraponall">'. ($mt < 0 ? price(- $mt) : '') . "</td>"; print '<td class="right nowraponall">' . ($mt >= 0 ? price($mt) : '') . "</td>";
print '<td class="right nowraponall">' . ($mt >= 0 ? price($mt) : '') . "</td>"; print "</tr>";
print "</tr>";
//}
} }
// Product / Service // Product / Service
@@ -900,30 +894,28 @@ if (empty($action) || $action == 'view') {
$accountingaccount = new AccountingAccount($db); $accountingaccount = new AccountingAccount($db);
$accountingaccount->fetch(null, $k, true); $accountingaccount->fetch(null, $k, true);
//if ($mt) { print '<tr class="oddeven">';
print '<tr class="oddeven">'; print "<!-- Product -->";
print "<!-- Product -->"; print "<td>" . $date . "</td>";
print "<td>" . $date . "</td>"; print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>"; // Account
// Account print "<td>";
print "<td>"; $accountoshow = length_accountg($k);
$accountoshow = length_accountg($k); if (($accountoshow == "") || $accountoshow == 'NotDefined')
if (($accountoshow == "") || $accountoshow == 'NotDefined') {
{ print '<span class="error">'.$langs->trans("ProductAccountNotDefined").'</span>';
print '<span class="error">'.$langs->trans("ProductAccountNotDefined").'</span>'; }
} else print $accountoshow;
else print $accountoshow; print "</td>";
print "</td>"; // Subledger account
// Subledger account print "<td>";
print "<td>"; print '</td>';
print '</td>'; $companystatic->id = $tabcompany[$key]['id'];
$companystatic->id = $tabcompany[$key]['id']; $companystatic->name = $tabcompany[$key]['name'];
$companystatic->name = $tabcompany[$key]['name']; print "<td>" . $companystatic->getNomUrl(0, 'supplier', 16) . ' - ' . $invoicestatic->ref_supplier . ' - ' . $accountingaccount->label . "</td>";
print "<td>" . $companystatic->getNomUrl(0, 'supplier', 16) . ' - ' . $invoicestatic->ref_supplier . ' - ' . $accountingaccount->label . "</td>"; print '<td class="right nowraponall">' . ($mt >= 0 ? price($mt) : '') . "</td>";
print '<td class="right nowraponall">' . ($mt >= 0 ? price($mt) : '') . "</td>"; print '<td class="right nowraponall">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
print '<td class="right nowraponall">' . ($mt < 0 ? price(- $mt) : '') . "</td>"; print "</tr>";
print "</tr>";
//}
} }
// VAT // VAT

View File

@@ -124,7 +124,7 @@ if ($in_bookkeeping == 'already')
if ($in_bookkeeping == 'notyet') if ($in_bookkeeping == 'notyet')
{ {
$sql .= " AND f.rowid NOT IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='customer_invoice')"; $sql .= " AND f.rowid NOT IN (SELECT fk_doc FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='customer_invoice')";
// $sql .= " AND fd.rowid NOT IN (SELECT fk_docdet FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='customer_invoice')"; // Useless, we save one line for all products with same account // $sql .= " AND fd.rowid NOT IN (SELECT fk_docdet FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab WHERE ab.doc_type='customer_invoice')"; // Useless, we save one line for all products with same account
} }
$sql .= " ORDER BY f.datef"; $sql .= " ORDER BY f.datef";
//print $sql; //print $sql;
@@ -305,7 +305,61 @@ if ($action == 'writebookkeeping') {
if (! $errorforline) if (! $errorforline)
{ {
foreach ($tabttc[$key] as $k => $mt) { foreach ($tabttc[$key] as $k => $mt) {
//if ($mt) { $bookkeeping = new BookKeeping($db);
$bookkeeping->doc_date = $val["date"];
$bookkeeping->date_lim_reglement = $val["datereg"];
$bookkeeping->doc_ref = $val["ref"];
$bookkeeping->date_creation = $now;
$bookkeeping->doc_type = 'customer_invoice';
$bookkeeping->fk_doc = $key;
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
$bookkeeping->thirdparty_code = $companystatic->code_client;
$bookkeeping->subledger_account = $tabcompany[$key]['code_compta'];
$bookkeeping->subledger_label = $tabcompany[$key]['name'];
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER;
$accountingaccount->fetch(null, $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER, true);
$bookkeeping->label_compte = $accountingaccount->label;
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("SubledgerAccount");
$bookkeeping->montant = $mt;
$bookkeeping->sens = ($mt >= 0) ? 'D' : 'C';
$bookkeeping->debit = ($mt >= 0) ? $mt : 0;
$bookkeeping->credit = ($mt < 0) ? -$mt : 0;
$bookkeeping->code_journal = $journal;
$bookkeeping->journal_label = $journal_label;
$bookkeeping->fk_user_author = $user->id;
$bookkeeping->entity = $conf->entity;
$totaldebit += $bookkeeping->debit;
$totalcredit += $bookkeeping->credit;
$result = $bookkeeping->create($user);
if ($result < 0) {
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists
{
$error++;
$errorforline++;
$errorforinvoice[$key]='alreadyjournalized';
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
}
else
{
$error++;
$errorforline++;
$errorforinvoice[$key]='other';
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
}
}
}
}
// Product / Service
if (! $errorforline)
{
foreach ($tabht[$key] as $k => $mt) {
// get compte id and label
if ($accountingaccount->fetch(null, $k, true)) {
$bookkeeping = new BookKeeping($db); $bookkeeping = new BookKeeping($db);
$bookkeeping->doc_date = $val["date"]; $bookkeeping->doc_date = $val["date"];
$bookkeeping->date_lim_reglement = $val["datereg"]; $bookkeeping->date_lim_reglement = $val["datereg"];
@@ -315,18 +369,15 @@ if ($action == 'writebookkeeping') {
$bookkeeping->fk_doc = $key; $bookkeeping->fk_doc = $key;
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add $bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
$bookkeeping->thirdparty_code = $companystatic->code_client; $bookkeeping->thirdparty_code = $companystatic->code_client;
$bookkeeping->subledger_account = $tabcompany[$key]['code_compta']; $bookkeeping->subledger_account = '';
$bookkeeping->subledger_label = $tabcompany[$key]['name']; $bookkeeping->subledger_label = '';
$bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER; $bookkeeping->numero_compte = $k;
$accountingaccount->fetch(null, $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER, true);
$bookkeeping->label_compte = $accountingaccount->label; $bookkeeping->label_compte = $accountingaccount->label;
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $accountingaccount->label;
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("SubledgerAccount");
$bookkeeping->montant = $mt; $bookkeeping->montant = $mt;
$bookkeeping->sens = ($mt >= 0) ? 'D' : 'C'; $bookkeeping->sens = ($mt < 0) ? 'D' : 'C';
$bookkeeping->debit = ($mt >= 0) ? $mt : 0; $bookkeeping->debit = ($mt < 0) ? -$mt : 0;
$bookkeeping->credit = ($mt < 0) ? -$mt : 0; $bookkeeping->credit = ($mt >= 0) ? $mt : 0;
$bookkeeping->code_journal = $journal; $bookkeeping->code_journal = $journal;
$bookkeeping->journal_label = $journal_label; $bookkeeping->journal_label = $journal_label;
$bookkeeping->fk_user_author = $user->id; $bookkeeping->fk_user_author = $user->id;
@@ -352,62 +403,7 @@ if ($action == 'writebookkeeping') {
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors'); setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
} }
} }
//} }
}
}
// Product / Service
if (! $errorforline)
{
foreach ($tabht[$key] as $k => $mt) {
//if ($mt) {
// get compte id and label
if ($accountingaccount->fetch(null, $k, true)) {
$bookkeeping = new BookKeeping($db);
$bookkeeping->doc_date = $val["date"];
$bookkeeping->date_lim_reglement = $val["datereg"];
$bookkeeping->doc_ref = $val["ref"];
$bookkeeping->date_creation = $now;
$bookkeeping->doc_type = 'customer_invoice';
$bookkeeping->fk_doc = $key;
$bookkeeping->fk_docdet = 0; // Useless, can be several lines that are source of this record to add
$bookkeeping->thirdparty_code = $companystatic->code_client;
$bookkeeping->subledger_account = '';
$bookkeeping->subledger_label = '';
$bookkeeping->numero_compte = $k;
$bookkeeping->label_compte = $accountingaccount->label;
$bookkeeping->label_operation = dol_trunc($companystatic->name, 16) . ' - ' . $invoicestatic->ref . ' - ' . $accountingaccount->label;
$bookkeeping->montant = $mt;
$bookkeeping->sens = ($mt < 0) ? 'D' : 'C';
$bookkeeping->debit = ($mt < 0) ? -$mt : 0;
$bookkeeping->credit = ($mt >= 0) ? $mt : 0;
$bookkeeping->code_journal = $journal;
$bookkeeping->journal_label = $journal_label;
$bookkeeping->fk_user_author = $user->id;
$bookkeeping->entity = $conf->entity;
$totaldebit += $bookkeeping->debit;
$totalcredit += $bookkeeping->credit;
$result = $bookkeeping->create($user);
if ($result < 0) {
if ($bookkeeping->error == 'BookkeepingRecordAlreadyExists') // Already exists
{
$error++;
$errorforline++;
$errorforinvoice[$key]='alreadyjournalized';
//setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings');
}
else
{
$error++;
$errorforline++;
$errorforinvoice[$key]='other';
setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors');
}
}
}
//}
} }
} }
@@ -801,34 +797,32 @@ if (empty($action) || $action == 'view') {
// Third party // Third party
foreach ($tabttc[$key] as $k => $mt) foreach ($tabttc[$key] as $k => $mt)
{ {
//if ($mt) { print '<tr class="oddeven">';
print '<tr class="oddeven">'; print "<!-- Thirdparty -->";
print "<!-- Thirdparty -->"; print "<td>" . $date . "</td>";
print "<td>" . $date . "</td>"; print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>"; // Account
// Account print "<td>";
print "<td>"; $accountoshow = length_accounta($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER);
$accountoshow = length_accounta($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER); if (($accountoshow == "") || $accountoshow == 'NotDefined')
if (($accountoshow == "") || $accountoshow == 'NotDefined') {
{ print '<span class="error">'.$langs->trans("MainAccountForCustomersNotDefined").'</span>';
print '<span class="error">'.$langs->trans("MainAccountForCustomersNotDefined").'</span>'; }
} else print $accountoshow;
else print $accountoshow; print '</td>';
print '</td>'; // Subledger account
// Subledger account print "<td>";
print "<td>"; $accountoshow = length_accounta($k);
$accountoshow = length_accounta($k); if (($accountoshow == "") || $accountoshow == 'NotDefined')
if (($accountoshow == "") || $accountoshow == 'NotDefined') {
{ print '<span class="error">'.$langs->trans("ThirdpartyAccountNotDefined").'</span>';
print '<span class="error">'.$langs->trans("ThirdpartyAccountNotDefined").'</span>'; }
} else print $accountoshow;
else print $accountoshow; print '</td>';
print '</td>'; print "<td>" . $companystatic->getNomUrl(0, 'customer', 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("SubledgerAccount") . "</td>";
print "<td>" . $companystatic->getNomUrl(0, 'customer', 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("SubledgerAccount") . "</td>"; print '<td class="right nowraponall">' . ($mt >= 0 ? price($mt) : '') . "</td>";
print '<td class="right nowraponall">' . ($mt >= 0 ? price($mt) : '') . "</td>"; print '<td class="right nowraponall">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
print '<td class="right nowraponall">' . ($mt < 0 ? price(- $mt) : '') . "</td>"; print "</tr>";
print "</tr>";
//}
} }
// Product / Service // Product / Service
@@ -837,30 +831,28 @@ if (empty($action) || $action == 'view') {
$accountingaccount = new AccountingAccount($db); $accountingaccount = new AccountingAccount($db);
$accountingaccount->fetch(null, $k, true); $accountingaccount->fetch(null, $k, true);
//if ($mt) { print '<tr class="oddeven">';
print '<tr class="oddeven">'; print "<!-- Product -->";
print "<!-- Product -->"; print "<td>" . $date . "</td>";
print "<td>" . $date . "</td>"; print "<td>" . $invoicestatic->getNomUrl(1) . "</td>";
print "<td>" . $invoicestatic->getNomUrl(1) . "</td>"; // Account
// Account print "<td>";
print "<td>"; $accountoshow = length_accountg($k);
$accountoshow = length_accountg($k); if (($accountoshow == "") || $accountoshow == 'NotDefined')
if (($accountoshow == "") || $accountoshow == 'NotDefined') {
{ print '<span class="error">'.$langs->trans("ProductNotDefined").'</span>';
print '<span class="error">'.$langs->trans("ProductNotDefined").'</span>'; }
} else print $accountoshow;
else print $accountoshow; print "</td>";
print "</td>"; // Subledger account
// Subledger account print "<td>";
print "<td>"; print '</td>';
print '</td>'; $companystatic->id = $tabcompany[$key]['id'];
$companystatic->id = $tabcompany[$key]['id']; $companystatic->name = $tabcompany[$key]['name'];
$companystatic->name = $tabcompany[$key]['name']; print "<td>" . $companystatic->getNomUrl(0, 'customer', 16) . ' - ' . $invoicestatic->ref . ' - ' . $accountingaccount->label . "</td>";
print "<td>" . $companystatic->getNomUrl(0, 'customer', 16) . ' - ' . $invoicestatic->ref . ' - ' . $accountingaccount->label . "</td>"; print '<td class="right nowraponall">' . ($mt < 0 ? price(- $mt) : '') . "</td>";
print '<td class="right nowraponall">' . ($mt < 0 ? price(- $mt) : '') . "</td>"; print '<td class="right nowraponall">' . ($mt >= 0 ? price($mt) : '') . "</td>";
print '<td class="right nowraponall">' . ($mt >= 0 ? price($mt) : '') . "</td>"; print "</tr>";
print "</tr>";
//}
} }
// VAT // VAT

View File

@@ -184,8 +184,6 @@ if ($massaction == 'ventil') {
} }
$msg.='</div>'; $msg.='</div>';
$msg.= '<div>' . $langs->trans("EndProcessing") . '</div>'; $msg.= '<div>' . $langs->trans("EndProcessing") . '</div>';
//} else {
// setEventMessages($langs->trans("NoRecordSelected"), null, 'warnings');
} }
} }

View File

@@ -26,17 +26,12 @@ if (empty($conf) || ! is_object($conf))
$contact = $GLOBALS['objcanvas']->control->object; $contact = $GLOBALS['objcanvas']->control->object;
?> echo "<!-- BEGIN PHP TEMPLATE ADHERENTCARD_VIEW.TPL.PHP DEFAULT -->\n";
echo $this->control->tpl['showhead'];
<!-- BEGIN PHP TEMPLATE ADHERENTCARD_VIEW.TPL.PHP DEFAULT -->
<?php echo $this->control->tpl['showhead']; ?>
<?php
dol_htmloutput_errors($this->control->tpl['error'], $this->control->tpl['errors']); dol_htmloutput_errors($this->control->tpl['error'], $this->control->tpl['errors']);
?> if (! empty($this->control->tpl['action_create_user'])) echo $this->control->tpl['action_create_user'];
if (! empty($this->control->tpl['action_delete'])) echo $this->control->tpl['action_delete']; ?>
<?php if (! empty($this->control->tpl['action_create_user'])) echo $this->control->tpl['action_create_user']; ?>
<?php if (! empty($this->control->tpl['action_delete'])) echo $this->control->tpl['action_delete']; ?>
<table class="border allwidth"> <table class="border allwidth">
@@ -121,29 +116,28 @@ dol_htmloutput_errors($this->control->tpl['error'], $this->control->tpl['errors'
</table> </table>
<?php echo $this->control->tpl['showend']; ?> <?php echo $this->control->tpl['showend'];
<?php if (empty($user->societe_id)) { ?> if (empty($user->societe_id)) {
<div class="tabsAction"> echo '<div class="tabsAction">';
<?php if ($user->rights->adherent->creer) { ?> if ($user->rights->adherent->creer) {
<a class="butAction" href="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->control->tpl['id'].'&amp;action=edit&amp;canvas='.$canvas; ?>"><?php echo $langs->trans('Modify'); ?></a> echo '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$this->control->tpl['id'].'&amp;action=edit&amp;canvas='.$canvas.'">'.$langs->trans('Modify').'</a>';
<?php } ?> }
<?php if (! $this->control->tpl['user_id'] && $user->rights->user->user->creer) { ?> if (! $this->control->tpl['user_id'] && $user->rights->user->user->creer) {
<a class="butAction" href="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->control->tpl['id'].'&amp;action=create_user&amp;canvas='.$canvas; ?>"><?php echo $langs->trans("CreateDolibarrLogin"); ?></a> echo '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$this->control->tpl['id'].'&amp;action=create_user&amp;canvas='.$canvas.'">'.$langs->trans("CreateDolibarrLogin").'</a>';
<?php } ?> }
<?php if ($user->rights->adherent->supprimer) { ?> if ($user->rights->adherent->supprimer) {
<a class="butActionDelete" href="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->control->tpl['id'].'&amp;action=delete&amp;canvas='.$canvas; ?>"><?php echo $langs->trans('Delete'); ?></a> echo '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$this->control->tpl['id'].'&amp;action=delete&amp;canvas='.$canvas.'">'.$langs->trans('Delete').'</a>';
<?php } ?> }
</div><br> echo '</div><br>';
<?php } }
echo $this->control->tpl['actionstodo']; echo $this->control->tpl['actionstodo'];
echo $this->control->tpl['actionsdone']; echo $this->control->tpl['actionsdone'];
?>
<!-- END PHP TEMPLATE --> echo "<!-- END PHP TEMPLATE -->\n";

View File

@@ -866,18 +866,18 @@ else
$object->country_code=$tmparray['code']; $object->country_code=$tmparray['code'];
$object->country=$tmparray['label']; $object->country=$tmparray['label'];
} }
if (!empty($socid)) {
$object = new Societe($db);
if ($socid > 0) $object->fetch($socid);
if (! ($object->id > 0)) if (!empty($socid)) {
{ $object = new Societe($db);
$langs->load("errors"); if ($socid > 0) $object->fetch($socid);
print($langs->trans('ErrorRecordNotFound'));
exit; if (! ($object->id > 0))
} {
} $langs->load("errors");
print($langs->trans('ErrorRecordNotFound'));
exit;
}
}
$adht = new AdherentType($db); $adht = new AdherentType($db);
@@ -1679,14 +1679,14 @@ if (! ($object->id > 0))
else else
{ {
if ($object->need_subscription == 0) if ($object->need_subscription == 0)
{ {
print $langs->trans("SubscriptionNotNeeded"); print $langs->trans("SubscriptionNotNeeded");
} }
elseif (! $adht->subscription) elseif (! $adht->subscription)
{ {
print $langs->trans("SubscriptionNotRecorded"); print $langs->trans("SubscriptionNotRecorded");
if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // displays delay Pictogram only if not a draft and not terminated if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // displays delay Pictogram only if not a draft and not terminated
} }
else else
{ {
print $langs->trans("SubscriptionNotReceived"); print $langs->trans("SubscriptionNotReceived");

View File

@@ -2471,7 +2471,7 @@ class Adherent extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
/** /**
* Initialise tableau info (tableau des attributs LDAP) * Initialise tableau info (tableau des attributs LDAP)
* *
* @return array Tableau info des attributs * @return array Tableau info des attributs

View File

@@ -88,8 +88,8 @@ class AdherentType extends CommonObject
/** @var array Array of members */ /** @var array Array of members */
public $members=array(); public $members=array();
public $multilangs=array(); public $multilangs=array();
/** /**
@@ -129,9 +129,9 @@ class AdherentType extends CommonObject
$this->description = $obj->description; $this->description = $obj->description;
$this->email = $obj->email; $this->email = $obj->email;
} }
$this->multilangs["$obj->lang"]["label"] = $obj->label; $this->multilangs["$obj->lang"]["label"] = $obj->label;
$this->multilangs["$obj->lang"]["description"] = $obj->description; $this->multilangs["$obj->lang"]["description"] = $obj->description;
$this->multilangs["$obj->lang"]["email"] = $obj->email; $this->multilangs["$obj->lang"]["email"] = $obj->email;
} }
return 1; return 1;
} }
@@ -141,7 +141,7 @@ class AdherentType extends CommonObject
return -1; return -1;
} }
} }
/** /**
* Update or add a translation for a product * Update or add a translation for a product
* *
@@ -248,7 +248,7 @@ class AdherentType extends CommonObject
return 1; return 1;
} }
/** /**
* Delete a language for this product * Delete a language for this product
* *
@@ -361,7 +361,7 @@ class AdherentType extends CommonObject
*/ */
public function update($user, $notrigger = 0) public function update($user, $notrigger = 0)
{ {
global $langs, $conf, $hookmanager; global $langs, $conf, $hookmanager;
$error=0; $error=0;
@@ -383,16 +383,16 @@ class AdherentType extends CommonObject
$result = $this->db->query($sql); $result = $this->db->query($sql);
if ($result) if ($result)
{ {
$this->description = $this->db->escape($this->note); $this->description = $this->db->escape($this->note);
// Multilangs // Multilangs
if (! empty($conf->global->MAIN_MULTILANGS)) { if (! empty($conf->global->MAIN_MULTILANGS)) {
if ($this->setMultiLangs($user) < 0) { if ($this->setMultiLangs($user) < 0) {
$this->error=$langs->trans("Error")." : ".$this->db->error()." - ".$sql; $this->error=$langs->trans("Error")." : ".$this->db->error()." - ".$sql;
return -2; return -2;
}
} }
}
$action='update'; $action='update';
// Actions on extra fields // Actions on extra fields
@@ -474,8 +474,8 @@ class AdherentType extends CommonObject
*/ */
public function fetch($rowid) public function fetch($rowid)
{ {
global $langs, $conf; global $langs, $conf;
$sql = "SELECT d.rowid, d.libelle as label, d.morphy, d.statut, d.subscription, d.mail_valid, d.note, d.vote"; $sql = "SELECT d.rowid, d.libelle as label, d.morphy, d.statut, d.subscription, d.mail_valid, d.note, d.vote";
$sql .= " FROM ".MAIN_DB_PREFIX."adherent_type as d"; $sql .= " FROM ".MAIN_DB_PREFIX."adherent_type as d";
$sql .= " WHERE d.rowid = ".(int) $rowid; $sql .= " WHERE d.rowid = ".(int) $rowid;
@@ -498,11 +498,11 @@ class AdherentType extends CommonObject
$this->mail_valid = $obj->mail_valid; $this->mail_valid = $obj->mail_valid;
$this->note = $obj->note; $this->note = $obj->note;
$this->vote = $obj->vote; $this->vote = $obj->vote;
// multilangs // multilangs
if (! empty($conf->global->MAIN_MULTILANGS)) { if (! empty($conf->global->MAIN_MULTILANGS)) {
$this->getMultiLangs(); $this->getMultiLangs();
} }
} }
return 1; return 1;

View File

@@ -24,11 +24,7 @@ if (empty($conf) || ! is_object($conf))
exit; exit;
} }
?> echo "<!-- BEGIN PHP TEMPLATE -->\n";
<!-- BEGIN PHP TEMPLATE -->
<?php
global $user; global $user;
@@ -39,22 +35,20 @@ $langs->load("members");
$total=0; $total=0;
foreach($linkedObjectBlock as $key => $objectlink) foreach($linkedObjectBlock as $key => $objectlink)
{ {
?> echo '<tr class="oddeven">';
<tr class="oddeven" > echo '<td>'.$langs->trans("Subscription").'</td>';
<td><?php echo $langs->trans("Subscription"); ?></td> echo '<td>'.$objectlink->getNomUrl(1).'</td>';
<td><?php echo $objectlink->getNomUrl(1); ?></td> echo '<td class="center"></td>';
<td class="center"></td> echo '<td class="center">'.dol_print_date($objectlink->dateh, 'day').'</td>';
<td class="center"><?php echo dol_print_date($objectlink->dateh, 'day'); ?></td> echo '<td class="right">';
<td class="right"><?php
if ($user->rights->adherent->lire) { if ($user->rights->adherent->lire) {
$total = $total + $objectlink->amount; $total = $total + $objectlink->amount;
echo price($objectlink->amount); echo price($objectlink->amount);
} ?></td> }
<td class="right"></td> echo '</td>';
<td class="right"><a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key; ?>"><?php echo img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?></a></td> echo '<td class="right"></td>';
</tr> echo '<td class="right"><a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&dellinkid='.$key.'">'.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').'</a></td>';
<?php echo '</tr>';
} }
?>
<!-- END PHP TEMPLATE --> echo "<!-- END PHP TEMPLATE -->\n";

View File

@@ -523,14 +523,14 @@ if ($rowid > 0)
{ {
$sql.= natural_search("d.email", $search_email); $sql.= natural_search("d.email", $search_email);
} }
if ($filter == 'uptodate') if ($filter == 'uptodate')
{ {
$sql.=" AND (datefin >= '".$db->idate($now)."') OR t.subscription = 0)"; $sql.=" AND (datefin >= '".$db->idate($now)."') OR t.subscription = 0)";
} }
if ($filter == 'outofdate') if ($filter == 'outofdate')
{ {
$sql.=" AND (datefin < '".$db->idate($now)."' AND t.subscription = 1)"; $sql.=" AND (datefin < '".$db->idate($now)."' AND t.subscription = 1)";
} }
$sql.= " ".$db->order($sortfield, $sortorder); $sql.= " ".$db->order($sortfield, $sortorder);

View File

@@ -295,7 +295,7 @@ if ($action == 'add' && $user->rights->adherent->configurer)
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
print '<tr><td class="tdtop titlefieldcreate fieldrequired">'.$langs->trans('Language').'</td><td>'; print '<tr><td class="tdtop titlefieldcreate fieldrequired">'.$langs->trans('Language').'</td><td>';
print $formadmin->select_language('', 'forcelangprod', 0, $object->multilangs, 1); print $formadmin->select_language('', 'forcelangprod', 0, $object->multilangs, 1);
print '</td></tr>'; print '</td></tr>';
print '<tr><td class="tdtop fieldrequired">'.$langs->trans('Label').'</td><td><input name="libelle" size="40"></td></tr>'; print '<tr><td class="tdtop fieldrequired">'.$langs->trans('Label').'</td><td><input name="libelle" size="40"></td></tr>';
print '<tr><td class="tdtop">'.$langs->trans('Description').'</td><td>'; print '<tr><td class="tdtop">'.$langs->trans('Description').'</td><td>';

View File

@@ -268,17 +268,17 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
// Active // Active
if (in_array($name, $def)) if (in_array($name, $def))
{ {
print '<td class="center">'."\n"; print '<td class="center">'."\n";
if ($conf->global->ACTION_EVENT_ADDON_PDF != "$name") if ($conf->global->ACTION_EVENT_ADDON_PDF != "$name")
{ {
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type=action">'; print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&amp;value='.$name.'&amp;scan_dir='.$module->scandir.'&amp;label='.urlencode($module->name).'&amp;type=action">';
print img_picto($langs->trans("Enabled"), 'switch_on'); print img_picto($langs->trans("Enabled"), 'switch_on');
print '</a>'; print '</a>';
} }
else else
{ {
print img_picto($langs->trans("Enabled"), 'switch_on'); print img_picto($langs->trans("Enabled"), 'switch_on');
} }
print "</td>"; print "</td>";
} }
else else

View File

@@ -96,29 +96,29 @@ elseif ($action == 'updateengine')
$resql=$db->query($sql); $resql=$db->query($sql);
if ($resql) if ($resql)
{ {
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
$i = 0; $i = 0;
while ($i < $num) while ($i < $num)
{ {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
if (GETPOST('coder'.$obj->rowid, 'alpha')) if (GETPOST('coder'.$obj->rowid, 'alpha'))
{ {
$coder = GETPOST('coder'.$obj->rowid, 'alpha'); $coder = GETPOST('coder'.$obj->rowid, 'alpha');
$code_id = $obj->rowid; $code_id = $obj->rowid;
$sqlp = "UPDATE ".MAIN_DB_PREFIX."c_barcode_type"; $sqlp = "UPDATE ".MAIN_DB_PREFIX."c_barcode_type";
$sqlp.= " SET coder = '" . $coder."'"; $sqlp.= " SET coder = '" . $coder."'";
$sqlp.= " WHERE rowid = ". $code_id; $sqlp.= " WHERE rowid = ". $code_id;
$sqlp.= " AND entity = ".$conf->entity; $sqlp.= " AND entity = ".$conf->entity;
$upsql=$db->query($sqlp); $upsql=$db->query($sqlp);
if (! $upsql) dol_print_error($db); if (! $upsql) dol_print_error($db);
} }
$i++; $i++;
} }
} }
} }

View File

@@ -430,7 +430,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
} }
print '</td>'; print '</td>';
// Info // Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name; $htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); $htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
if ($module->type == 'pdf') if ($module->type == 'pdf')

View File

@@ -470,7 +470,7 @@ foreach ($dirmodels as $reldir)
} }
print '</td>'; print '</td>';
// Info // Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name; $htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); $htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
if ($module->type == 'pdf') if ($module->type == 'pdf')

View File

@@ -163,7 +163,7 @@ llxHeader('', $langs->trans("Setup"), $wikihelp);
// Add logic to show/hide buttons // Add logic to show/hide buttons
if ($conf->use_javascript_ajax) if ($conf->use_javascript_ajax)
{ {
?> ?>
<script type="text/javascript"> <script type="text/javascript">
jQuery(document).ready(function() { jQuery(document).ready(function() {
jQuery("#updateconst").hide(); jQuery("#updateconst").hide();
@@ -181,7 +181,7 @@ jQuery(document).ready(function() {
}); });
}); });
</script> </script>
<?php <?php
} }
print load_fiche_titre($langs->trans("OtherSetup"), '', 'title_setup'); print load_fiche_titre($langs->trans("OtherSetup"), '', 'title_setup');

View File

@@ -406,7 +406,7 @@ foreach ($dirmodels as $reldir)
} }
print '</td>'; print '</td>';
// Info // Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name; $htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); $htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
if ($module->type == 'pdf') if ($module->type == 'pdf')

View File

@@ -551,27 +551,27 @@ $elementList = array();
$sourceList=array(); $sourceList=array();
if ($id == 11) if ($id == 11)
{ {
$elementList = array( $elementList = array(
'' => '', '' => '',
'societe' => $langs->trans('ThirdParty'), 'societe' => $langs->trans('ThirdParty'),
// 'proposal' => $langs->trans('Proposal'), // 'proposal' => $langs->trans('Proposal'),
// 'order' => $langs->trans('Order'), // 'order' => $langs->trans('Order'),
// 'invoice' => $langs->trans('Bill'), // 'invoice' => $langs->trans('Bill'),
'supplier_proposal' => $langs->trans('SupplierProposal'), 'supplier_proposal' => $langs->trans('SupplierProposal'),
'order_supplier' => $langs->trans('SupplierOrder'), 'order_supplier' => $langs->trans('SupplierOrder'),
'invoice_supplier' => $langs->trans('SupplierBill'), 'invoice_supplier' => $langs->trans('SupplierBill'),
// 'intervention' => $langs->trans('InterventionCard'), // 'intervention' => $langs->trans('InterventionCard'),
// 'contract' => $langs->trans('Contract'), // 'contract' => $langs->trans('Contract'),
'project' => $langs->trans('Project'), 'project' => $langs->trans('Project'),
'project_task' => $langs->trans('Task'), 'project_task' => $langs->trans('Task'),
'agenda' => $langs->trans('Agenda'), 'agenda' => $langs->trans('Agenda'),
'dolresource' => $langs->trans('Resource'), 'dolresource' => $langs->trans('Resource'),
// old deprecated // old deprecated
'propal' => $langs->trans('Proposal'), 'propal' => $langs->trans('Proposal'),
'commande' => $langs->trans('Order'), 'commande' => $langs->trans('Order'),
'facture' => $langs->trans('Bill'), 'facture' => $langs->trans('Bill'),
'fichinter' => $langs->trans('InterventionCard'), 'fichinter' => $langs->trans('InterventionCard'),
'contrat' => $langs->trans('Contract') 'contrat' => $langs->trans('Contract'),
); );
if (! empty($conf->global->MAIN_SUPPORT_SHARED_CONTACT_BETWEEN_THIRDPARTIES)) $elementList["societe"] = $langs->trans('ThirdParty'); if (! empty($conf->global->MAIN_SUPPORT_SHARED_CONTACT_BETWEEN_THIRDPARTIES)) $elementList["societe"] = $langs->trans('ThirdParty');
@@ -589,13 +589,13 @@ $localtax_typeList = array();
if ($id == 10) if ($id == 10)
{ {
$localtax_typeList = array( $localtax_typeList = array(
"0" => $langs->trans("No"), "0" => $langs->trans("No"),
"1" => $langs->trans("Yes").' ('.$langs->trans("Type")." 1)", //$langs->trans("%ageOnAllWithoutVAT"), "1" => $langs->trans("Yes").' ('.$langs->trans("Type")." 1)", //$langs->trans("%ageOnAllWithoutVAT"),
"2" => $langs->trans("Yes").' ('.$langs->trans("Type")." 2)", //$langs->trans("%ageOnAllBeforeVAT"), "2" => $langs->trans("Yes").' ('.$langs->trans("Type")." 2)", //$langs->trans("%ageOnAllBeforeVAT"),
"3" => $langs->trans("Yes").' ('.$langs->trans("Type")." 3)", //$langs->trans("%ageOnProductsWithoutVAT"), "3" => $langs->trans("Yes").' ('.$langs->trans("Type")." 3)", //$langs->trans("%ageOnProductsWithoutVAT"),
"4" => $langs->trans("Yes").' ('.$langs->trans("Type")." 4)", //$langs->trans("%ageOnProductsBeforeVAT"), "4" => $langs->trans("Yes").' ('.$langs->trans("Type")." 4)", //$langs->trans("%ageOnProductsBeforeVAT"),
"5" => $langs->trans("Yes").' ('.$langs->trans("Type")." 5)", //$langs->trans("%ageOnServiceWithoutVAT"), "5" => $langs->trans("Yes").' ('.$langs->trans("Type")." 5)", //$langs->trans("%ageOnServiceWithoutVAT"),
"6" => $langs->trans("Yes").' ('.$langs->trans("Type")." 6)" //$langs->trans("%ageOnServiceBeforeVAT"), "6" => $langs->trans("Yes").' ('.$langs->trans("Type")." 6)" //$langs->trans("%ageOnServiceBeforeVAT"),
); );
} }
@@ -636,8 +636,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
&& (! in_array($listfield[$f], array('decalage','module','accountancy_code','accountancy_code_sell','accountancy_code_buy','tracking')) // Fields that are not mandatory && (! in_array($listfield[$f], array('decalage','module','accountancy_code','accountancy_code_sell','accountancy_code_buy','tracking')) // Fields that are not mandatory
&& (! ($id == 10 && $listfield[$f] == 'code')) // Code is mandatory fir table 10 && (! ($id == 10 && $listfield[$f] == 'code')) // Code is mandatory fir table 10
) )
) ) {
{
$ok=0; $ok=0;
$fieldnamekey=$listfield[$f]; $fieldnamekey=$listfield[$f];
// We take translate key of field // We take translate key of field
@@ -1562,18 +1561,18 @@ if ($id)
$class="center"; $class="center";
} }
elseif ($fieldlist[$field]=='localtax1_type') { elseif ($fieldlist[$field]=='localtax1_type') {
if ($obj->localtax1 != 0) if ($obj->localtax1 != 0)
$valuetoshow=$localtax_typeList[$valuetoshow]; $valuetoshow=$localtax_typeList[$valuetoshow];
else else
$valuetoshow = ''; $valuetoshow = '';
$align="center"; $align="center";
} }
elseif ($fieldlist[$field]=='localtax2_type') { elseif ($fieldlist[$field]=='localtax2_type') {
if ($obj->localtax2 != 0) if ($obj->localtax2 != 0)
$valuetoshow=$localtax_typeList[$valuetoshow]; $valuetoshow=$localtax_typeList[$valuetoshow];
else else
$valuetoshow = ''; $valuetoshow = '';
$align="center"; $align="center";
} }
elseif ($fieldlist[$field]=='taux') { elseif ($fieldlist[$field]=='taux') {
$valuetoshow = price($valuetoshow, 0, $langs, 0, 0); $valuetoshow = price($valuetoshow, 0, $langs, 0, 0);

View File

@@ -423,17 +423,20 @@ class PrestaShopWebservice
*/ */
public function delete($options) public function delete($options)
{ {
if (isset($options['url'])) if (isset($options['url'])) {
$url = $options['url']; $url = $options['url'];
elseif (isset($options['resource']) && isset($options['id'])) } elseif (isset($options['resource']) && isset($options['id'])) {
if (is_array($options['id'])) if (is_array($options['id']))
$url = $this->url.'/api/'.$options['resource'].'/?id=['.implode(',', $options['id']).']'; $url = $this->url.'/api/'.$options['resource'].'/?id=['.implode(',', $options['id']).']';
else else
$url = $this->url.'/api/'.$options['resource'].'/'.$options['id']; $url = $this->url.'/api/'.$options['resource'].'/'.$options['id'];
if (isset($options['id_shop'])) }
$url .= '&id_shop='.$options['id_shop']; if (isset($options['id_shop'])) {
if (isset($options['id_group_shop'])) $url .= '&id_shop='.$options['id_shop'];
$url .= '&id_group_shop='.$options['id_group_shop']; }
if (isset($options['id_group_shop'])) {
$url .= '&id_group_shop='.$options['id_group_shop'];
}
$request = self::executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'DELETE')); $request = self::executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'DELETE'));
self::checkStatusCode($request['status_code']);// check the response validity self::checkStatusCode($request['status_code']);// check the response validity
return true; return true;

View File

@@ -32,8 +32,8 @@ class Dolistore
* beginning of pagination * beginning of pagination
* @var int * @var int
*/ */
public $start;
public $start;
/** /**
* end of pagination * end of pagination
* @var int * @var int

View File

@@ -513,7 +513,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
$noparam=array(); $noparam=array();
foreach($arrayoftypes as $key => $value) foreach($arrayoftypes as $key => $value)
{ {
if ($value['noparam']) $noparam[]=$key; if ($value['noparam']) $noparam[]=$key;
} }
print '})'; print '})';
print '</script>'."\n"; print '</script>'."\n";

View File

@@ -415,7 +415,7 @@ foreach ($dirmodels as $reldir)
} }
print '</td>'; print '</td>';
// Info // Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name; $htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); $htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
if ($module->type == 'pdf') if ($module->type == 'pdf')

View File

@@ -79,7 +79,7 @@ if ($action == 'add' || GETPOST("modify"))
if ($_POST["modify"]) if ($_POST["modify"])
{ {
// Supprime boite box_external_rss de definition des boites // Supprime boite box_external_rss de definition des boites
/* $sql = "UPDATE ".MAIN_DB_PREFIX."boxes_def"; /* $sql = "UPDATE ".MAIN_DB_PREFIX."boxes_def";
$sql.= " SET name = '".$boxlabel."'"; $sql.= " SET name = '".$boxlabel."'";
$sql.= " WHERE file ='box_external_rss.php' AND note like '".$_POST["norss"]." %'"; $sql.= " WHERE file ='box_external_rss.php' AND note like '".$_POST["norss"]." %'";
@@ -89,7 +89,7 @@ if ($action == 'add' || GETPOST("modify"))
dol_print_error($db,"sql=$sql"); dol_print_error($db,"sql=$sql");
exit; exit;
} }
*/ */
} }
else else
{ {

View File

@@ -207,8 +207,7 @@ elseif ($action == 'set_FICHINTER_PRINT_PRODUCTS')
} }
} elseif ($action == 'set_FICHINTER_USE_SERVICE_DURATION') { } elseif ($action == 'set_FICHINTER_USE_SERVICE_DURATION') {
$val = GETPOST('FICHINTER_USE_SERVICE_DURATION', 'alpha'); $val = GETPOST('FICHINTER_USE_SERVICE_DURATION', 'alpha');
$res = dolibarr_set_const($db, "FICHINTER_USE_SERVICE_DURATION", ($val == 'on' ? 1 : 0), 'bool', 0, '', $res = dolibarr_set_const($db, "FICHINTER_USE_SERVICE_DURATION", ($val == 'on' ? 1 : 0), 'bool', 0, '', $conf->entity);
$conf->entity);
if (!$res > 0) { if (!$res > 0) {
$error++; $error++;
@@ -220,33 +219,31 @@ $res = dolibarr_set_const($db, "FICHINTER_USE_SERVICE_DURATION", ($val == 'on' ?
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} elseif ($action == 'set_FICHINTER_WITHOUT_DURATION') { } elseif ($action == 'set_FICHINTER_WITHOUT_DURATION') {
$val = GETPOST('FICHINTER_WITHOUT_DURATION', 'alpha'); $val = GETPOST('FICHINTER_WITHOUT_DURATION', 'alpha');
$res = dolibarr_set_const($db, "FICHINTER_WITHOUT_DURATION", ($val == 'on' ? 1 : 0), 'bool', 0, '', $res = dolibarr_set_const($db, "FICHINTER_WITHOUT_DURATION", ($val == 'on' ? 1 : 0), 'bool', 0, '', $conf->entity);
$conf->entity);
if (!$res > 0) { if (!$res > 0) {
$error++; $error++;
} }
if (!$error) { if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else { } else {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} elseif ($action == 'set_FICHINTER_DATE_WITHOUT_HOUR') { } elseif ($action == 'set_FICHINTER_DATE_WITHOUT_HOUR') {
$val = GETPOST('FICHINTER_DATE_WITHOUT_HOUR', 'alpha'); $val = GETPOST('FICHINTER_DATE_WITHOUT_HOUR', 'alpha');
$res = dolibarr_set_const($db, "FICHINTER_DATE_WITHOUT_HOUR", ($val == 'on' ? 1 : 0), 'bool', 0, '', $res = dolibarr_set_const($db, "FICHINTER_DATE_WITHOUT_HOUR", ($val == 'on' ? 1 : 0), 'bool', 0, '', $conf->entity);
$conf->entity);
if (!$res > 0) { if (!$res > 0) {
$error++; $error++;
} }
if (!$error) { if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else { } else {
setEventMessages($langs->trans("Error"), null, 'errors'); setEventMessages($langs->trans("Error"), null, 'errors');
} }
} }

View File

@@ -300,8 +300,14 @@ print '</div>';
print '<br>'; print '<br>';
if ($conf->global->MAIN_FEATURES_LEVEL >= 2) if ($conf->global->MAIN_FEATURES_LEVEL < 2) {
{ dol_fiche_end();
// End of page
llxFooter();
$db->close();
exit;
}
/* /*
* Documents models for Holidays * Documents models for Holidays
*/ */
@@ -317,8 +323,8 @@ $sql.= " AND entity = ".$conf->entity;
$resql=$db->query($sql); $resql=$db->query($sql);
if ($resql) if ($resql)
{ {
$i = 0; $i = 0;
$num_rows=$db->num_rows($resql); $num_rows=$db->num_rows($resql);
while ($i < $num_rows) while ($i < $num_rows)
{ {
$array = $db->fetch_array($resql); $array = $db->fetch_array($resql);
@@ -416,7 +422,7 @@ foreach ($dirmodels as $reldir)
} }
print '</td>'; print '</td>';
// Info // Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name; $htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); $htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
if ($module->type == 'pdf') if ($module->type == 'pdf')
@@ -518,7 +524,7 @@ print '<input type="submit" class="button" value="'.$langs->trans("Save").'">';
print '</div>'; print '</div>';
print '</form>'; print '</form>';
}
dol_fiche_end(); dol_fiche_end();

View File

@@ -478,7 +478,7 @@ if (function_exists("ldap_connect"))
} }
} }
else else
{ {
setEventMessages($ldap->error, $ldap->errors, 'errors'); setEventMessages($ldap->error, $ldap->errors, 'errors');
} }

View File

@@ -139,7 +139,7 @@ if ($action == 'set')
if ($action == 'del') if ($action == 'del')
{ {
$ret = delDocumentModel($value, $type); $ret = delDocumentModel($value, $type);
if ($ret > 0) if ($ret > 0)
{ {
if ($conf->global->LIVRAISON_ADDON_PDF == "$value") dolibarr_del_const($db, 'LIVRAISON_ADDON_PDF', $conf->entity); if ($conf->global->LIVRAISON_ADDON_PDF == "$value") dolibarr_del_const($db, 'LIVRAISON_ADDON_PDF', $conf->entity);

View File

@@ -45,11 +45,11 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php';
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("errors","admin","mails","languages")); $langs->loadLangs(array("errors","admin","mails","languages"));
$action = GETPOST('action', 'alpha')?GETPOST('action', 'alpha'):'view'; $action = GETPOST('action', 'alpha')?GETPOST('action', 'alpha'):'view';
$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation $confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation
$id = GETPOST('id', 'int'); $id = GETPOST('id', 'int');
$rowid = GETPOST('rowid', 'alpha'); $rowid = GETPOST('rowid', 'alpha');
$search_label=GETPOST('search_label', 'alphanohtml'); // Must allow value like 'Abc Def' or '(MyTemplateName)' $search_label=GETPOST('search_label', 'alphanohtml'); // Must allow value like 'Abc Def' or '(MyTemplateName)'
$search_type_template=GETPOST('search_type_template', 'alpha'); $search_type_template=GETPOST('search_type_template', 'alpha');
$search_lang=GETPOST('search_lang', 'alpha'); $search_lang=GETPOST('search_lang', 'alpha');
@@ -327,7 +327,7 @@ if (empty($reshook))
$i++; $i++;
} }
$sql.= " WHERE ".$rowidcol." = '".$rowid."'"; $sql.= " WHERE ".$rowidcol." = '".$rowid."'";
//print $sql;exit; //print $sql;exit;
dol_syslog("actionmodify", LOG_DEBUG); dol_syslog("actionmodify", LOG_DEBUG);
//print $sql; //print $sql;
$resql = $db->query($sql); $resql = $db->query($sql);

View File

@@ -923,19 +923,17 @@ if ($mode == 'marketplace')
&nbsp; &nbsp;
</div> </div>
<div class="divsearchfield right"> <div class="divsearchfield right">
<?php <?php
print $previouslink; print $previouslink;
print $nextlink; print $nextlink;
?> print '</div>';
</div> print '</form>';
</form>
<?php
print '</div></div>'; print '</div></div>';
print '<div class="clearboth"></div>'; print '<div class="clearboth"></div>';
?> ?>
<div id="category-tree-left"> <div id="category-tree-left">
<ul class="tree"> <ul class="tree">

View File

@@ -467,7 +467,7 @@ foreach ($dirmodels as $reldir)
} }
print '</td>'; print '</td>';
// Info // Info
$htmltooltip = $langs->trans("Name").': '.$module->name; $htmltooltip = $langs->trans("Name").': '.$module->name;
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); $htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
if ($module->type == 'pdf') if ($module->type == 'pdf')

View File

@@ -420,7 +420,7 @@ foreach ($dirmodels as $reldir)
} }
print '</td>'; print '</td>';
// Info // Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name; $htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); $htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
if ($module->type == 'pdf') if ($module->type == 'pdf')

View File

@@ -262,11 +262,11 @@ else
if (count($listofmethods) && ! empty($conf->global->MAIN_SMS_SENDMODE)) if (count($listofmethods) && ! empty($conf->global->MAIN_SMS_SENDMODE))
{ {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=test&amp;mode=init">'.$langs->trans("DoTestSend").'</a>'; print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=test&amp;mode=init">'.$langs->trans("DoTestSend").'</a>';
} }
else else
{ {
print '<a class="butActionRefused classfortooltip" href="#">'.$langs->trans("DoTestSend").'</a>'; print '<a class="butActionRefused classfortooltip" href="#">'.$langs->trans("DoTestSend").'</a>';
} }
print '</div>'; print '</div>';

View File

@@ -113,12 +113,12 @@ print '<td>'.$langs->trans("DeStockOnBill").'</td>';
print '<td class="right">'; print '<td class="right">';
if (! empty($conf->facture->enabled)) if (! empty($conf->facture->enabled))
{ {
if ($conf->use_javascript_ajax) { if ($conf->use_javascript_ajax) {
print ajax_constantonoff('STOCK_CALCULATE_ON_BILL'); print ajax_constantonoff('STOCK_CALCULATE_ON_BILL');
} else { } else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("STOCK_CALCULATE_ON_BILL", $arrval, $conf->global->STOCK_CALCULATE_ON_BILL); print $form->selectarray("STOCK_CALCULATE_ON_BILL", $arrval, $conf->global->STOCK_CALCULATE_ON_BILL);
} }
} }
else else
{ {
@@ -133,12 +133,12 @@ print '<td>'.$langs->trans("DeStockOnValidateOrder").'</td>';
print '<td class="right">'; print '<td class="right">';
if (! empty($conf->commande->enabled)) if (! empty($conf->commande->enabled))
{ {
if ($conf->use_javascript_ajax) { if ($conf->use_javascript_ajax) {
print ajax_constantonoff('STOCK_CALCULATE_ON_VALIDATE_ORDER'); print ajax_constantonoff('STOCK_CALCULATE_ON_VALIDATE_ORDER');
} else { } else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("STOCK_CALCULATE_ON_VALIDATE_ORDER", $arrval, $conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER); print $form->selectarray("STOCK_CALCULATE_ON_VALIDATE_ORDER", $arrval, $conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER);
} }
} }
else else
{ {
@@ -155,12 +155,12 @@ print '<td>'.$langs->trans("DeStockOnShipment").'</td>';
print '<td class="right">'; print '<td class="right">';
if (! empty($conf->expedition->enabled)) if (! empty($conf->expedition->enabled))
{ {
if ($conf->use_javascript_ajax) { if ($conf->use_javascript_ajax) {
print ajax_constantonoff('STOCK_CALCULATE_ON_SHIPMENT'); print ajax_constantonoff('STOCK_CALCULATE_ON_SHIPMENT');
} else { } else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("STOCK_CALCULATE_ON_SHIPMENT", $arrval, $conf->global->STOCK_CALCULATE_ON_SHIPMENT); print $form->selectarray("STOCK_CALCULATE_ON_SHIPMENT", $arrval, $conf->global->STOCK_CALCULATE_ON_SHIPMENT);
} }
} }
else else
{ {
@@ -175,12 +175,12 @@ print '<td>'.$langs->trans("DeStockOnShipmentOnClosing").'</td>';
print '<td class="right">'; print '<td class="right">';
if (! empty($conf->expedition->enabled)) if (! empty($conf->expedition->enabled))
{ {
if ($conf->use_javascript_ajax) { if ($conf->use_javascript_ajax) {
print ajax_constantonoff('STOCK_CALCULATE_ON_SHIPMENT_CLOSE'); print ajax_constantonoff('STOCK_CALCULATE_ON_SHIPMENT_CLOSE');
} else { } else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("STOCK_CALCULATE_ON_SHIPMENT_CLOSE", $arrval, $conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE); print $form->selectarray("STOCK_CALCULATE_ON_SHIPMENT_CLOSE", $arrval, $conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE);
} }
} }
else else
{ {
@@ -215,12 +215,12 @@ print '<td>'.$langs->trans("ReStockOnBill").'</td>';
print '<td class="right">'; print '<td class="right">';
if (! empty($conf->fournisseur->enabled)) if (! empty($conf->fournisseur->enabled))
{ {
if ($conf->use_javascript_ajax) { if ($conf->use_javascript_ajax) {
print ajax_constantonoff('STOCK_CALCULATE_ON_SUPPLIER_BILL'); print ajax_constantonoff('STOCK_CALCULATE_ON_SUPPLIER_BILL');
} else { } else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("STOCK_CALCULATE_ON_SUPPLIER_BILL", $arrval, $conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL); print $form->selectarray("STOCK_CALCULATE_ON_SUPPLIER_BILL", $arrval, $conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL);
} }
} }
else else
{ {
@@ -236,12 +236,12 @@ print '<td>'.$langs->trans("ReStockOnValidateOrder").'</td>';
print '<td class="right">'; print '<td class="right">';
if (! empty($conf->fournisseur->enabled)) if (! empty($conf->fournisseur->enabled))
{ {
if ($conf->use_javascript_ajax) { if ($conf->use_javascript_ajax) {
print ajax_constantonoff('STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER'); print ajax_constantonoff('STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER');
} else { } else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER", $arrval, $conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER); print $form->selectarray("STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER", $arrval, $conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER);
} }
} }
else else
{ {
@@ -254,29 +254,29 @@ if (!empty($conf->reception->enabled))
{ {
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'.$langs->trans("StockOnReception").'</td>'; print '<td>'.$langs->trans("StockOnReception").'</td>';
print '<td class="right">'; print '<td class="right">';
if ($conf->use_javascript_ajax) { if ($conf->use_javascript_ajax) {
print ajax_constantonoff('STOCK_CALCULATE_ON_RECEPTION'); print ajax_constantonoff('STOCK_CALCULATE_ON_RECEPTION');
} else { } else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("STOCK_CALCULATE_ON_RECEPTION", $arrval, $conf->global->STOCK_CALCULATE_ON_RECEPTION); print $form->selectarray("STOCK_CALCULATE_ON_RECEPTION", $arrval, $conf->global->STOCK_CALCULATE_ON_RECEPTION);
} }
print "</td>\n</tr>\n"; print "</td>\n</tr>\n";
$found++; $found++;
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'.$langs->trans("StockOnReceptionOnClosing").'</td>'; print '<td>'.$langs->trans("StockOnReceptionOnClosing").'</td>';
print '<td class="right">'; print '<td class="right">';
if ($conf->use_javascript_ajax) { if ($conf->use_javascript_ajax) {
print ajax_constantonoff('STOCK_CALCULATE_ON_RECEPTION_CLOSE'); print ajax_constantonoff('STOCK_CALCULATE_ON_RECEPTION_CLOSE');
} else { } else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("STOCK_CALCULATE_ON_RECEPTION_CLOSE", $arrval, $conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE); print $form->selectarray("STOCK_CALCULATE_ON_RECEPTION_CLOSE", $arrval, $conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE);
} }
print "</td>\n</tr>\n"; print "</td>\n</tr>\n";
$found++; $found++;
} }
@@ -284,15 +284,15 @@ else
{ {
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'.$langs->trans("ReStockOnDispatchOrder").'</td>'; print '<td>'.$langs->trans("ReStockOnDispatchOrder").'</td>';
print '<td class="right">'; print '<td class="right">';
if (! empty($conf->fournisseur->enabled)) if (! empty($conf->fournisseur->enabled))
{ {
if ($conf->use_javascript_ajax) { if ($conf->use_javascript_ajax) {
print ajax_constantonoff('STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER'); print ajax_constantonoff('STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER');
} else { } else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER", $arrval, $conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER); print $form->selectarray("STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER", $arrval, $conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER);
} }
} }
else else
{ {
@@ -338,28 +338,28 @@ if($conf->invoice->enabled)
{ {
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'.$langs->trans("StockMustBeEnoughForInvoice").'</td>'; print '<td>'.$langs->trans("StockMustBeEnoughForInvoice").'</td>';
print '<td class="right">'; print '<td class="right">';
if ($conf->use_javascript_ajax) { if ($conf->use_javascript_ajax) {
print ajax_constantonoff('STOCK_MUST_BE_ENOUGH_FOR_INVOICE'); print ajax_constantonoff('STOCK_MUST_BE_ENOUGH_FOR_INVOICE');
} else { } else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("STOCK_MUST_BE_ENOUGH_FOR_INVOICE", $arrval, $conf->global->STOCK_MUST_BE_ENOUGH_FOR_INVOICE); print $form->selectarray("STOCK_MUST_BE_ENOUGH_FOR_INVOICE", $arrval, $conf->global->STOCK_MUST_BE_ENOUGH_FOR_INVOICE);
} }
print "</td>\n"; print "</td>\n";
print "</tr>\n"; print "</tr>\n";
} }
if($conf->order->enabled) if($conf->order->enabled)
{ {
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'.$langs->trans("StockMustBeEnoughForOrder").'</td>'; print '<td>'.$langs->trans("StockMustBeEnoughForOrder").'</td>';
print '<td class="right">'; print '<td class="right">';
if ($conf->use_javascript_ajax) { if ($conf->use_javascript_ajax) {
print ajax_constantonoff('STOCK_MUST_BE_ENOUGH_FOR_ORDER'); print ajax_constantonoff('STOCK_MUST_BE_ENOUGH_FOR_ORDER');
} else { } else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("STOCK_MUST_BE_ENOUGH_FOR_ORDER", $arrval, $conf->global->STOCK_MUST_BE_ENOUGH_FOR_ORDER); print $form->selectarray("STOCK_MUST_BE_ENOUGH_FOR_ORDER", $arrval, $conf->global->STOCK_MUST_BE_ENOUGH_FOR_ORDER);
} }
print "</td>\n"; print "</td>\n";
print "</tr>\n"; print "</tr>\n";
} }
@@ -368,13 +368,13 @@ if($conf->expedition->enabled)
{ {
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'.$langs->trans("StockMustBeEnoughForShipment").'</td>'; print '<td>'.$langs->trans("StockMustBeEnoughForShipment").'</td>';
print '<td class="right">'; print '<td class="right">';
if ($conf->use_javascript_ajax) { if ($conf->use_javascript_ajax) {
print ajax_constantonoff('STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT'); print ajax_constantonoff('STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT');
} else { } else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT", $arrval, $conf->global->STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT); print $form->selectarray("STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT", $arrval, $conf->global->STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT);
} }
print "</td>\n"; print "</td>\n";
print "</tr>\n"; print "</tr>\n";
} }
@@ -383,27 +383,30 @@ print '</table>';
print '<br>'; print '<br>';
$virtualdiffersfromphysical=0; $virtualdiffersfromphysical=0;
if (! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT) if (
|| ! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER) ! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT)
) $virtualdiffersfromphysical=1; // According to increase/decrease stock options, virtual and physical stock may differs. || ! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER)
) {
$virtualdiffersfromphysical=1; // According to increase/decrease stock options, virtual and physical stock may differs.
}
if ($virtualdiffersfromphysical) if ($virtualdiffersfromphysical)
{ {
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print "<td>".$langs->trans("RuleForStockReplenishment")." ".img_help('help', $langs->trans("VirtualDiffersFromPhysical"))."</td>\n"; print "<td>".$langs->trans("RuleForStockReplenishment")." ".img_help('help', $langs->trans("VirtualDiffersFromPhysical"))."</td>\n";
print '<td class="right">'.$langs->trans("Status").'</td>'."\n"; print '<td class="right">'.$langs->trans("Status").'</td>'."\n";
print '</tr>'."\n"; print '</tr>'."\n";
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'.$langs->trans("UseVirtualStockByDefault").'</td>'; print '<td>'.$langs->trans("UseVirtualStockByDefault").'</td>';
print '<td class="right">'; print '<td class="right">';
if ($conf->use_javascript_ajax) { if ($conf->use_javascript_ajax) {
print ajax_constantonoff('STOCK_USE_VIRTUAL_STOCK'); print ajax_constantonoff('STOCK_USE_VIRTUAL_STOCK');
} else { } else {
$arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes"));
print $form->selectarray("STOCK_USE_VIRTUAL_STOCK", $arrval, $conf->global->STOCK_USE_VIRTUAL_STOCK); print $form->selectarray("STOCK_USE_VIRTUAL_STOCK", $arrval, $conf->global->STOCK_USE_VIRTUAL_STOCK);
} }
print "</td>\n"; print "</td>\n";
print "</tr>\n"; print "</tr>\n";
print '</table>'; print '</table>';
@@ -504,7 +507,6 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
print $form->selectarray("INVENTORY_USE_INVENTORY_DATE_FOR_DATE_OF_MVT", $arrval, $conf->global->INVENTORY_USE_INVENTORY_DATE_FOR_DATE_OF_MVT); print $form->selectarray("INVENTORY_USE_INVENTORY_DATE_FOR_DATE_OF_MVT", $arrval, $conf->global->INVENTORY_USE_INVENTORY_DATE_FOR_DATE_OF_MVT);
} }
print '</td></tr>'; print '</td></tr>';
print '</table>'; print '</table>';
} }
@@ -512,8 +514,6 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
If not used by a module, I still need to understand in which case user may need this now we can set rule on product page. If not used by a module, I still need to understand in which case user may need this now we can set rule on product page.
if ($conf->global->PRODUIT_SOUSPRODUITS) if ($conf->global->PRODUIT_SOUSPRODUITS)
{ {
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'.$langs->trans("IndependantSubProductStock").'</td>'; print '<td>'.$langs->trans("IndependantSubProductStock").'</td>';
print '<td class="right">'; print '<td class="right">';

View File

@@ -413,8 +413,8 @@ foreach ($dirmodels as $reldir)
print "<td>\n"; print "<td>\n";
require_once $dir.$file; require_once $dir.$file;
$module = new $classname($db, $specimenthirdparty); $module = new $classname($db, $specimenthirdparty);
if (method_exists($module, 'info')) print $module->info($langs); if (method_exists($module, 'info')) print $module->info($langs);
else print $module->description; else print $module->description;
print "</td>\n"; print "</td>\n";
// Active // Active

View File

@@ -433,7 +433,7 @@ foreach ($dirmodels as $reldir)
} }
print '</td>'; print '</td>';
// Info // Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name; $htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); $htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
if ($module->type == 'pdf') if ($module->type == 'pdf')

View File

@@ -189,8 +189,8 @@ else
if ($base == 4) if ($base == 4)
{ {
// Sqlite by PDO or by Sqlite3 // Sqlite by PDO or by Sqlite3
print '<div class="div-table-responsive-no-min">'; print '<div class="div-table-responsive-no-min">';
print '<table class="noborder">'; print '<table class="noborder">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td>'.$langs->trans("TableName").'</td>'; print '<td>'.$langs->trans("TableName").'</td>';
print '<td>'.$langs->trans("NbOfRecord").'</td>'; print '<td>'.$langs->trans("NbOfRecord").'</td>';

View File

@@ -94,10 +94,10 @@ if ($db->type == 'pgsql')
{ {
// Check option standard_conforming_strings is on // Check option standard_conforming_strings is on
$paramarray=$db->getServerParametersValues('standard_conforming_strings'); $paramarray=$db->getServerParametersValues('standard_conforming_strings');
// if ($paramarray['standard_conforming_strings'] != 'on' && $paramarray['standard_conforming_strings'] != 1) // if ($paramarray['standard_conforming_strings'] != 'on' && $paramarray['standard_conforming_strings'] != 1)
// { // {
// $langs->load("errors"); // $langs->load("errors");
// } // }
} }
print '<br>'; print '<br>';

View File

@@ -111,13 +111,15 @@ jQuery(document).ready(function() {
} }
}); });
<?php
if (in_array($type, array('mysql', 'mysqli'))) print 'jQuery("#radio_dump_mysql").click();';
if (in_array($type, array('pgsql'))) print 'jQuery("#radio_dump_postgresql").click();';
?>
});
</script>
<?php <?php
if (in_array($type, array('mysql', 'mysqli'))) {
print 'jQuery("#radio_dump_mysql").click();';
}
if (in_array($type, array('pgsql'))) {
print 'jQuery("#radio_dump_postgresql").click();';
}
print "});\n";
print "</script>\n";
print load_fiche_titre($langs->trans("Backup"), '', 'title_setup'); print load_fiche_titre($langs->trans("Backup"), '', 'title_setup');
//print_barre_liste($langs->trans("Backup"), '', '', '', '', '', $langs->trans("BackupDesc",DOL_DATA_ROOT), 0, 0, 'title_setup'); //print_barre_liste($langs->trans("Backup"), '', '', '', '', '', $langs->trans("BackupDesc",DOL_DATA_ROOT), 0, 0, 'title_setup');
@@ -127,24 +129,17 @@ print $langs->trans("BackupDesc", DOL_DATA_ROOT);
print '</div>'; print '</div>';
print '<br>'; print '<br>';
?> print "<!-- Dump of a server -->\n";
print '<form method="post" action="export.php" name="dump">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'" />';
print '<input type="hidden" name="export_type" value="server" />';
print '<fieldset id="fieldsetexport"><legend class="legendforfieldsetstep" style="font-size: 3em">1</legend>';
<!-- Dump of a server -->
<form method="post" action="export.php" name="dump"><input type="hidden"
name="token" value="<?php echo $_SESSION['newtoken']; ?>" /> <input
type="hidden" name="export_type" value="server" />
<fieldset id="fieldsetexport"><legend class="legendforfieldsetstep" style="font-size: 3em">1</legend>
<?php
print $langs->trans("BackupDesc3", $dolibarr_main_db_name).'<br>'; print $langs->trans("BackupDesc3", $dolibarr_main_db_name).'<br>';
//print $langs->trans("BackupDescY").'<br>'; //print $langs->trans("BackupDescY").'<br>';
print '<br>'; print '<br>';
?>
<div id="backupdatabaseleft" class="fichehalfleft" > print '<div id="backupdatabaseleft" class="fichehalfleft" >';
<?php
print load_fiche_titre($title?$title:$langs->trans("BackupDumpWizard")); print load_fiche_titre($title?$title:$langs->trans("BackupDumpWizard"));
@@ -155,275 +150,296 @@ print $langs->trans("DatabaseName").' : <b>'.$dolibarr_main_db_name.'</b><br>';
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
print '<tr '.$bc[false].'><td style="padding-left: 8px">'; print '<tr '.$bc[false].'><td style="padding-left: 8px">';
?> print '<table class="centpercent">';
<table class="centpercent"> print '<tr>';
<tr> print '<td class="tdtop">';
<td class="tdtop">
<div id="div_container_exportoptions"> print '<div id="div_container_exportoptions">';
<fieldset id="exportoptions"><legend><?php echo $langs->trans("ExportMethod"); ?></legend> print '<fieldset id="exportoptions"><legend>'.$langs->trans("ExportMethod").'</legend>';
<?php if (in_array($type, array('mysql', 'mysqli'))) {
if (in_array($type, array('mysql', 'mysqli'))) print '<div class="formelementrow"><input type="radio" name="what" value="mysql" id="radio_dump_mysql" />';
{ print '<label for="radio_dump_mysql">MySQL Dump (mysqldump)</label>';
?> print '</div>';
<div class="formelementrow"><input type="radio" name="what" value="mysql" id="radio_dump_mysql" /> print '<br>';
<label for="radio_dump_mysql">MySQL Dump (mysqldump)</label> print '<div class="formelementrow"><input type="radio" name="what" value="mysqlnobin" id="radio_dump_mysql_nobin" />';
</div> print '<label for="radio_dump_mysql">MySQL Dump (php) '.img_warning($langs->trans('BackupPHPWarning')).'</label>';
<br> print '</div>';
<div class="formelementrow"><input type="radio" name="what" value="mysqlnobin" id="radio_dump_mysql_nobin" /> } elseif (in_array($type, array('pgsql'))) {
<label for="radio_dump_mysql">MySQL Dump (php) <?php print img_warning($langs->trans('BackupPHPWarning')) ?></label> print '<div class="formelementrow"><input type="radio" name="what" value="postgresql" id="radio_dump_postgresql" />';
</div> print '<label for="radio_dump_postgresql">PostgreSQL Dump (pg_dump)</label>';
<?php print '</div>';
} } else {
elseif (in_array($type, array('pgsql'))) print 'No method available with database '.$label;
{ }
?> print '</fieldset>';
<div class="formelementrow"><input type="radio" name="what" value="postgresql" id="radio_dump_postgresql" /> print '</div>';
<label for="radio_dump_postgresql">PostgreSQL Dump (pg_dump)</label>
</div>
<?php
}
else
{
print 'No method available with database '.$label;
}
?>
</fieldset>
</div>
</td> print '</td>';
<td class="tdtop"> print '<td class="tdtop">';
<div id="div_container_sub_exportoptions"> print '<div id="div_container_sub_exportoptions">';
<?php if (in_array($type, array('mysql', 'mysqli'))) {
if (in_array($type, array('mysql', 'mysqli'))) print "<!-- Fieldset mysqldump -->\n";
{ print '<fieldset id="mysql_options"><legend>'.$langs->trans("MySqlExportParameters").'</legend>';
?> <!-- Fieldset mysqldump -->
<fieldset id="mysql_options"><legend><?php echo $langs->trans("MySqlExportParameters"); ?></legend>
<div class="formelementrow"><?php echo $langs->trans("FullPathToMysqldumpCommand"); print '<div class="formelementrow">'.$langs->trans("FullPathToMysqldumpCommand");
if (empty($conf->global->SYSTEMTOOLS_MYSQLDUMP)) if (empty($conf->global->SYSTEMTOOLS_MYSQLDUMP))
{ {
$fullpathofmysqldump=$db->getPathOfDump(); $fullpathofmysqldump=$db->getPathOfDump();
} }
else else
{ {
$fullpathofmysqldump=$conf->global->SYSTEMTOOLS_MYSQLDUMP; $fullpathofmysqldump=$conf->global->SYSTEMTOOLS_MYSQLDUMP;
} }
?><br> print '<br>';
<input type="text" name="mysqldump" style="width: 80%" print '<input type="text" name="mysqldump" style="width: 80%" value="'.$fullpathofmysqldump.'" /></div>';
value="<?php echo $fullpathofmysqldump; ?>" /></div>
<br> print '<br>';
<fieldset><legend><?php echo $langs->trans("ExportOptions"); ?></legend> print '<fieldset><legend>'.$langs->trans("ExportOptions").'</legend>';
<div class="formelementrow"><input type="checkbox" print '<div class="formelementrow">';
name="use_transaction" value="yes" id="checkbox_use_transaction" /> <label print '<input type="checkbox" name="use_transaction" value="yes" id="checkbox_use_transaction" />';
for="checkbox_use_transaction"> <?php echo $langs->trans("UseTransactionnalMode"); ?></label> print '<label for="checkbox_use_transaction">'.$langs->trans("UseTransactionnalMode").'</label>';
</div> print '</div>';
<?php if (! empty($conf->global->MYSQL_OLD_OPTION_DISABLE_FK)) { ?> if (! empty($conf->global->MYSQL_OLD_OPTION_DISABLE_FK)) {
<div class="formelementrow"><input type="checkbox" name="disable_fk" print '<div class="formelementrow">';
value="yes" id="checkbox_disable_fk" checked /> <label print '<input type="checkbox" name="disable_fk" value="yes" id="checkbox_disable_fk" checked />';
for="checkbox_disable_fk"> <?php echo $langs->trans("CommandsToDisableForeignKeysForImport"); ?> <?php print img_info($langs->trans('CommandsToDisableForeignKeysForImportWarning')); ?></label> print '<label for="checkbox_disable_fk">'.$langs->trans("CommandsToDisableForeignKeysForImport").' '.img_info($langs->trans('CommandsToDisableForeignKeysForImportWarning')).'</label>';
</div> print '</div>';
<?php } ?> }
<label for="select_sql_compat"> <?php echo $langs->trans("ExportCompatibility"); ?></label> print '<label for="select_sql_compat">'.$langs->trans("ExportCompatibility").'</label>';
<select name="sql_compat" id="select_sql_compat" class="flat"> print '<select name="sql_compat" id="select_sql_compat" class="flat">';
<option value="NONE" selected>NONE</option> print '<option value="NONE" selected>NONE</option>';
<option value="ANSI">ANSI</option> print '<option value="ANSI">ANSI</option>';
<option value="DB2">DB2</option> print '<option value="DB2">DB2</option>';
<option value="MAXDB">MAXDB</option> print '<option value="MAXDB">MAXDB</option>';
<option value="MYSQL323">MYSQL323</option> print '<option value="MYSQL323">MYSQL323</option>';
<option value="MYSQL40">MYSQL40</option> print '<option value="MYSQL40">MYSQL40</option>';
<option value="MSSQL">MSSQL</option> print '<option value="MSSQL">MSSQL</option>';
<option value="ORACLE">ORACLE</option> print '<option value="ORACLE">ORACLE</option>';
<option value="POSTGRESQL">POSTGRESQL</option> print '<option value="POSTGRESQL">POSTGRESQL</option>';
</select> <br> print '</select>';
<!-- <input type="checkbox" name="drop_database" value="yes" print '<br>';
id="checkbox_drop_database" /> <label for="checkbox_drop_database"><?php echo $langs->trans("AddDropDatabase"); ?></label> print '<!-- <input type="checkbox" name="drop_database" value="yes" id="checkbox_drop_database" />';
--> print '<label for="checkbox_drop_database">'.$langs->trans("AddDropDatabase").'</label>';
</fieldset> print '-->';
print '</fieldset>';
<br> print '<br>';
<fieldset><legend> <input type="checkbox" name="sql_structure" print '<fieldset>';
value="structure" id="checkbox_sql_structure" checked /> <label print '<legend>';
for="checkbox_sql_structure"> <?php echo $langs->trans('ExportStructure') ?></label> </legend> <input print '<input type="checkbox" name="sql_structure" value="structure" id="checkbox_sql_structure" checked />';
type="checkbox" name="drop"<?php echo ((! isset($_GET["drop"]) && ! isset($_POST["drop"])) || GETPOST('drop'))?' checked':''; ?> id="checkbox_dump_drop" /> <label print '<label for="checkbox_sql_structure">'.$langs->trans('ExportStructure').'</label>';
for="checkbox_dump_drop"><?php echo $langs->trans("AddDropTable"); ?></label><br> print '</legend>';
</fieldset> print '<input type="checkbox" name="drop"'.((! isset($_GET["drop"]) && ! isset($_POST["drop"])) || GETPOST('drop'))?' checked':''.' id="checkbox_dump_drop" />';
print '<label for="checkbox_dump_drop">'.$langs->trans("AddDropTable").'</label>';
print '<br>';
print '</fieldset>';
<br> print '<br>';
<fieldset><legend> <input type="checkbox" name="sql_data" value="data" print '<fieldset>';
id="checkbox_sql_data" checked /> <label for="checkbox_sql_data"> print '<legend>';
<?php echo $langs->trans("Datas"); ?></label> </legend> <input print '<input type="checkbox" name="sql_data" value="data" id="checkbox_sql_data" checked />';
type="checkbox" name="showcolumns" value="yes" print '<label for="checkbox_sql_data">'.$langs->trans("Datas").'</label>';
id="checkbox_dump_showcolumns" checked /> <label print '</legend>';
for="checkbox_dump_showcolumns"> <?php echo $langs->trans("NameColumn"); ?></label><br> print '<input type="checkbox" name="showcolumns" value="yes" id="checkbox_dump_showcolumns" checked />';
print '<label for="checkbox_dump_showcolumns">'.$langs->trans("NameColumn").'</label>';
print '<br>';
<input type="checkbox" name="extended_ins" value="yes" print '<input type="checkbox" name="extended_ins" value="yes" id="checkbox_dump_extended_ins" checked />';
id="checkbox_dump_extended_ins" checked /> <label print '<label for="checkbox_dump_extended_ins">'.$langs->trans("ExtendedInsert").'</label>';
for="checkbox_dump_extended_ins"> <?php echo $langs->trans("ExtendedInsert"); ?></label><br> print '<br>';
<input type="checkbox" name="disable-add-locks" value="no" print '<input type="checkbox" name="disable-add-locks" value="no" id="checkbox_dump_disable-add-locks" />';
id="checkbox_dump_disable-add-locks" /> <label print '<label for="checkbox_dump_disable-add-locks">'.$langs->trans("NoLockBeforeInsert").'</label>';
for="checkbox_dump_disable-add-locks"> <?php echo $langs->trans("NoLockBeforeInsert"); ?></label><br> print '<br>';
<input type="checkbox" name="delayed" value="yes" print '<input type="checkbox" name="delayed" value="yes" id="checkbox_dump_delayed" />';
id="checkbox_dump_delayed" /> <label for="checkbox_dump_delayed"> <?php echo $langs->trans("DelayedInsert"); ?></label><br> print '<label for="checkbox_dump_delayed">'.$langs->trans("DelayedInsert").'</label>';
print '<br>';
<input type="checkbox" name="sql_ignore" value="yes" print '<input type="checkbox" name="sql_ignore" value="yes" id="checkbox_dump_ignore" />';
id="checkbox_dump_ignore" /> <label for="checkbox_dump_ignore"> <?php echo $langs->trans("IgnoreDuplicateRecords"); ?></label><br> print '<label for="checkbox_dump_ignore">'.$langs->trans("IgnoreDuplicateRecords").'</label>';
print '<br>';
<input type="checkbox" name="hexforbinary" value="yes" print '<input type="checkbox" name="hexforbinary" value="yes" id="checkbox_hexforbinary" checked />';
id="checkbox_hexforbinary" checked /> <label print '<label for="checkbox_hexforbinary">'.$langs->trans("EncodeBinariesInHexa").'</label>';
for="checkbox_hexforbinary"> <?php echo $langs->trans("EncodeBinariesInHexa"); ?></label><br> print '<br>';
<input type="checkbox" name="charset_utf8" value="yes" print '<input type="checkbox" name="charset_utf8" value="yes" id="checkbox_charset_utf8" checked disabled />';
id="checkbox_charset_utf8" checked disabled /> <label print '<label for="checkbox_charset_utf8">'.$langs->trans("UTF8").'</label>';
for="checkbox_charset_utf8"> <?php echo $langs->trans("UTF8"); ?></label><br> print '<br>';
</fieldset> print '</fieldset>';
</fieldset> print '</fieldset>';
print "<!-- Fieldset mysql_nobin -->\n";
print '<fieldset id="mysql_nobin_options">';
print '<legend>'.$langs->trans("MySqlExportParameters").'</legend>';
print '<fieldset>';
print '<legend>'.$langs->trans("ExportOptions").'</legend>';
print '<div class="formelementrow">';
print '<input type="checkbox" name="nobin_use_transaction" value="yes" id="checkbox_use_transaction" />';
print '<label for="checkbox_use_transaction">'.$langs->trans("UseTransactionnalMode").'</label>';
<!-- Fieldset mysql_nobin --> print '</div>';
<fieldset id="mysql_nobin_options"><legend><?php echo $langs->trans("MySqlExportParameters"); ?></legend> if (! empty($conf->global->MYSQL_OLD_OPTION_DISABLE_FK)) {
<fieldset> print '<div class="formelementrow">';
<legend><?php echo $langs->trans("ExportOptions"); ?></legend> print '<input type="checkbox" name="nobin_disable_fk" value="yes" id="checkbox_disable_fk" checked />';
<div class="formelementrow"><input type="checkbox" print '<label for="checkbox_disable_fk">'.$langs->trans("CommandsToDisableForeignKeysForImport").' '.img_info($langs->trans('CommandsToDisableForeignKeysForImportWarning')).'</label>';
name="nobin_use_transaction" value="yes" id="checkbox_use_transaction" /> <label print '</div>';
for="checkbox_use_transaction"> <?php echo $langs->trans("UseTransactionnalMode"); ?></label> }
print '</fieldset>';
</div> print '<br>';
<?php if (! empty($conf->global->MYSQL_OLD_OPTION_DISABLE_FK)) { ?> print '<fieldset><legend>'.$langs->trans('ExportStructure').'</legend>';
<div class="formelementrow"><input type="checkbox" name="nobin_disable_fk" print '<input type="checkbox" name="nobin_drop"'.((! isset($_GET["nobin_drop"]) && ! isset($_POST["nobin_drop"])) || GETPOST('nobin_drop'))?' checked':''.' id="checkbox_dump_drop" />';
value="yes" id="checkbox_disable_fk" checked /> <label print '<label for="checkbox_dump_drop">'.$langs->trans("AddDropTable").'</label>';
for="checkbox_disable_fk"> <?php echo $langs->trans("CommandsToDisableForeignKeysForImport"); ?> <?php print img_info($langs->trans('CommandsToDisableForeignKeysForImportWarning')); ?></label> print '<br>';
</div> print '</fieldset>';
<?php } ?>
</fieldset>
<br> print '<br>';
<fieldset><legend><?php echo $langs->trans('ExportStructure') ?></legend> <input print '<fieldset>';
type="checkbox" name="nobin_drop"<?php echo ((! isset($_GET["nobin_drop"]) && ! isset($_POST["nobin_drop"])) || GETPOST('nobin_drop'))?' checked':''; ?> id="checkbox_dump_drop" /> <label print '<legend>'.$langs->trans("Datas").'</legend>';
for="checkbox_dump_drop"><?php echo $langs->trans("AddDropTable"); ?></label><br>
</fieldset>
<br> print '<input type="checkbox" name="nobin_nolocks" value="no" id="checkbox_dump_disable-add-locks" />';
<fieldset> print '<label for="checkbox_dump_disable-add-locks">'.$langs->trans("NoLockBeforeInsert").'</label>';
<legend><?php echo $langs->trans("Datas"); ?></legend> print '<br>';
<input type="checkbox" name="nobin_nolocks" value="no" print '<input type="checkbox" name="nobin_delayed" value="yes" id="checkbox_dump_delayed" />';
id="checkbox_dump_disable-add-locks" /> <label print '<label for="checkbox_dump_delayed">'.$langs->trans("DelayedInsert").'</label>';
for="checkbox_dump_disable-add-locks"> <?php echo $langs->trans("NoLockBeforeInsert"); ?></label><br> print '<br>';
<input type="checkbox" name="nobin_delayed" value="yes" print '<input type="checkbox" name="nobin_sql_ignore" value="yes" id="checkbox_dump_ignore" />';
id="checkbox_dump_delayed" /> <label for="checkbox_dump_delayed"> <?php echo $langs->trans("DelayedInsert"); ?></label><br> print '<label for="checkbox_dump_ignore">'.$langs->trans("IgnoreDuplicateRecords").'</label>';
print '<br>';
<input type="checkbox" name="nobin_sql_ignore" value="yes" print '<input type="checkbox" name="nobin_charset_utf8" value="yes" id="checkbox_charset_utf8" checked disabled />';
id="checkbox_dump_ignore" /> <label for="checkbox_dump_ignore"> <?php echo $langs->trans("IgnoreDuplicateRecords"); ?></label><br> print '<label for="checkbox_charset_utf8">'.$langs->trans("UTF8").'</label>';
print '<br>';
<input type="checkbox" name="nobin_charset_utf8" value="yes" print '</fieldset>';
id="checkbox_charset_utf8" checked disabled /> <label print '</fieldset>';
for="checkbox_charset_utf8"> <?php echo $langs->trans("UTF8"); ?></label><br> }
</fieldset> if (in_array($type, array('pgsql'))) {
</fieldset> print "<!-- Fieldset pg_dump -->\n";
print '<fieldset id="postgresql_options"><legend>'.$langs->trans("PostgreSqlExportParameters").'</legend>';
<?php print '<div class="formelementrow">'.$langs->trans("FullPathToPostgreSQLdumpCommand");
} if (empty($conf->global->SYSTEMTOOLS_POSTGRESQLDUMP)) {
$fullpathofpgdump=$db->getPathOfDump();
}
else
{
$fullpathofpgdump=$conf->global->SYSTEMTOOLS_POSTGRESQLDUMP;
}
print '<br>';
print '<input type="text" name="postgresqldump" style="width: 80%" value="'.$fullpathofpgdump.'" /></div>';
if (in_array($type, array('pgsql'))) print '<br>';
{ print '<fieldset>';
?> <!-- Fieldset pg_dump --> print '<legend>'.$langs->trans("ExportOptions").'</legend>';
<fieldset id="postgresql_options"><legend><?php echo $langs->trans("PostgreSqlExportParameters"); ?></legend> print '<label for="select_sql_compat">'.$langs->trans("ExportCompatibility").'</label>';
print '<select name="sql_compat" id="select_sql_compat" class="flat">';
print '<option value="POSTGRESQL" selected>POSTGRESQL</option>';
print '<option value="ANSI">ANSI</option>';
print '</select>';
print '<br>';
print '<!-- <input type="checkbox" name="drop_database" value="yes" id="checkbox_drop_database" />';
print '<label for="checkbox_drop_database">'.$langs->trans("AddDropDatabase").'</label>';
print '-->';
print '</fieldset>';
print '<br>';
print '<fieldset>';
print '<legend>';
print '<input type="checkbox" name="sql_structure" value="structure" id="checkbox_sql_structure" checked />';
print '<label for="checkbox_sql_structure">'.$langs->trans('ExportStructure').'</label>';
print '</legend>';
print '</fieldset>';
print '<br>';
print '<fieldset>';
print '<legend>';
print '<input type="checkbox" name="sql_data" value="data" id="checkbox_sql_data" checked />';
print '<label for="checkbox_sql_data">'.$langs->trans("Datas").'</label>';
print '</legend>';
print '<input type="checkbox" name="showcolumns" value="yes" id="checkbox_dump_showcolumns" checked />';
print '<label for="checkbox_dump_showcolumns">'.$langs->trans("NameColumn").'</label>';
print '<br>';
print '</fieldset>';
print '</fieldset>';
}
print '</div>';
<div class="formelementrow"><?php echo $langs->trans("FullPathToPostgreSQLdumpCommand"); print '</td>';
if (empty($conf->global->SYSTEMTOOLS_POSTGRESQLDUMP)) print '</tr>';
{ print '</table>';
$fullpathofpgdump=$db->getPathOfDump();
}
else
{
$fullpathofpgdump=$conf->global->SYSTEMTOOLS_POSTGRESQLDUMP;
}
?><br>
<input type="text" name="postgresqldump" style="width: 80%"
value="<?php echo $fullpathofpgdump; ?>" /></div>
<br> print '<!--<fieldset>';
<fieldset><legend><?php echo $langs->trans("ExportOptions"); ?></legend> print '<legend>'.$langs->trans("Destination").'</legend> -->';
<label for="select_sql_compat"> <?php echo $langs->trans("ExportCompatibility"); ?></label> print '<br>';
<select name="sql_compat" id="select_sql_compat" class="flat"> print '<label for="filename_template">'.$langs->trans("FileNameToGenerate").'</label>';
<option value="POSTGRESQL" selected>POSTGRESQL</option> print '<br>';
<option value="ANSI">ANSI</option>
</select><br>
<!-- <input type="checkbox" name="drop_database" value="yes"
id="checkbox_drop_database" /> <label for="checkbox_drop_database"><?php echo $langs->trans("AddDropDatabase"); ?></label>
-->
</fieldset>
<br>
<fieldset><legend> <input type="checkbox" name="sql_structure"
value="structure" id="checkbox_sql_structure" checked /> <label
for="checkbox_sql_structure"> <?php echo $langs->trans('ExportStructure') ?></label> </legend></fieldset>
<br>
<fieldset><legend> <input type="checkbox" name="sql_data" value="data"
id="checkbox_sql_data" checked /> <label for="checkbox_sql_data">
<?php echo $langs->trans("Datas"); ?></label> </legend> <input
type="checkbox" name="showcolumns" value="yes"
id="checkbox_dump_showcolumns" checked /> <label
for="checkbox_dump_showcolumns"> <?php echo $langs->trans("NameColumn"); ?></label><br>
</fieldset>
</fieldset>
<?php
}
?>
</div>
</td>
</tr>
</table>
<!--<fieldset>
<legend><?php echo $langs->trans("Destination"); ?></legend> -->
<br>
<label for="filename_template"> <?php echo $langs->trans("FileNameToGenerate"); ?></label><br>
<input type="text" name="filename_template" style="width: 90%"
id="filename_template"
value="<?php
$prefix='dump'; $prefix='dump';
$ext='.sql'; $ext='.sql';
if (in_array($type, array('mysql', 'mysqli'))) { $prefix='mysqldump'; $ext='sql'; } if (in_array($type, array('mysql', 'mysqli'))) {
//if ($label == 'PostgreSQL') { $prefix='pg_dump'; $ext='dump'; } $prefix='mysqldump';
if (in_array($type, array('pgsql'))) { $prefix='pg_dump'; $ext='sql'; } $ext='sql';
}
//if ($label == 'PostgreSQL') {
// $prefix='pg_dump';
// $ext='dump';
//}
if (in_array($type, array('pgsql'))) {
$prefix='pg_dump';
$ext='sql';
}
$file=$prefix.'_'.$dolibarr_main_db_name.'_'.dol_sanitizeFileName(DOL_VERSION).'_'.strftime("%Y%m%d%H%M").'.'.$ext; $file=$prefix.'_'.$dolibarr_main_db_name.'_'.dol_sanitizeFileName(DOL_VERSION).'_'.strftime("%Y%m%d%H%M").'.'.$ext;
echo $file; print '<input type="text" name="filename_template" style="width: 90%" id="filename_template" value="'.$file.'" />';
?>" /> <br> print '<br>';
<br> print '<br>';
<?php
// Define compressions array // Define compressions array
$compression=array(); $compression=array();
if (in_array($type, array('mysql', 'mysqli'))) if (in_array($type, array('mysql', 'mysqli'))) {
{ $compression['none'] = array(
$compression['none'] = array('function' => '', 'id' => 'radio_compression_none', 'label' => $langs->trans("None")); 'function' => '',
$compression['gz'] = array('function' => 'gzopen', 'id' => 'radio_compression_gzip', 'label' => $langs->trans("Gzip")); 'id' => 'radio_compression_none',
// $compression['zip']= array('function' => 'dol_compress', 'id' => 'radio_compression_zip', 'label' => $langs->trans("FormatZip")); // Not open source format. Must implement dol_compress function 'label' => $langs->trans("None")
$compression['bz'] = array('function' => 'bzopen', 'id' => 'radio_compression_bzip', 'label' => $langs->trans("Bzip2")); );
$compression['gz'] = array(
'function' => 'gzopen',
'id' => 'radio_compression_gzip',
'label' => $langs->trans("Gzip")
);
// Not open source format. Must implement dol_compress function
// $compression['zip']= array(
// 'function' => 'dol_compress',
// 'id' => 'radio_compression_zip',
// 'label' => $langs->trans("FormatZip")
// );
$compression['bz'] = array(
'function' => 'bzopen',
'id' => 'radio_compression_bzip',
'label' => $langs->trans("Bzip2")
);
} }
else else
{ {
$compression['none'] = array('function' => '', 'id' => 'radio_compression_none', 'label' => $langs->trans("Default")); $compression['none'] = array(
$compression['gz'] = array('function' => 'gzopen', 'id' => 'radio_compression_gzip', 'label' => $langs->trans("Gzip")); 'function' => '',
'id' => 'radio_compression_none',
'label' => $langs->trans("Default")
);
$compression['gz'] = array(
'function' => 'gzopen',
'id' => 'radio_compression_gzip',
'label' => $langs->trans("Gzip")
);
} }
// Show compression choices // Show compression choices
@@ -434,13 +450,14 @@ print $langs->trans("Compression").': &nbsp; ';
foreach($compression as $key => $val) foreach($compression as $key => $val)
{ {
if (! $val['function'] || function_exists($val['function'])) // Enabled export format if (! $val['function'] || function_exists($val['function'])) {
{ // Enabled export format
print '<input type="radio" name="compression" value="'.$key.'" id="'.$val['id'].'" checked>'; print '<input type="radio" name="compression" value="'.$key.'" id="'.$val['id'].'" checked>';
print ' <label for="'.$val['id'].'">'.$val['label'].'</label>'; print ' <label for="'.$val['id'].'">'.$val['label'].'</label>';
} }
else // Disabled export format else
{ {
// Disabled export format
print '<input type="radio" name="compression" value="'.$key.'" id="'.$val['id'].'" disabled>'; print '<input type="radio" name="compression" value="'.$key.'" id="'.$val['id'].'" disabled>';
print ' <label for="'.$val['id'].'">'.$val['label'].'</label>'; print ' <label for="'.$val['id'].'">'.$val['label'].'</label>';
print ' ('.$langs->trans("NotAvailable").')'; print ' ('.$langs->trans("NotAvailable").')';
@@ -451,20 +468,18 @@ foreach($compression as $key => $val)
print '</div>'; print '</div>';
print "\n"; print "\n";
?><!--</fieldset>--> <!-- End destination --> print "<!--</fieldset>--> <!-- End destination -->\n";
print '<br>';
print '<div class="center">';
print '<input type="submit" class="button reposition" value="'.$langs->trans("GenerateBackup").'" id="buttonGo">';
print '<input type="hidden" name="page_y" value="'.GETPOST('page_y', 'int').'">';
print '<br>';
print '<br>';
<br>
<div class="center">
<input type="submit" class="button reposition" value="<?php echo $langs->trans("GenerateBackup") ?>" id="buttonGo">
<input type="hidden" name="page_y" value="<?php echo GETPOST('page_y', 'int'); ?>">
<br>
<br>
<?php
if (! empty($_SESSION["commandbackuplastdone"])) if (! empty($_SESSION["commandbackuplastdone"]))
{ {
print '<br><b>'.$langs->trans("RunCommandSummary").':</b><br>'."\n"; print '<br><b>'.$langs->trans("RunCommandSummary").':</b><br>'."\n";
print '<textarea rows="'.ROWS_2.'" class="centpercent">'.$_SESSION["commandbackuplastdone"].'</textarea><br>'."\n"; print '<textarea rows="'.ROWS_2.'" class="centpercent">'.$_SESSION["commandbackuplastdone"].'</textarea><br>'."\n";
print '<br>'; print '<br>';
@@ -491,71 +506,51 @@ if (! empty($_SESSION["commandbackuptorun"]))
$_SESSION["commandbackuptorun"]=''; $_SESSION["commandbackuptorun"]='';
$_SESSION["commandbackupresult"]=''; $_SESSION["commandbackupresult"]='';
} }
?>
</div> <!-- end div center button --> print "</div> <!-- end div center button -->\n";
<?php
print '</td></tr>'; print '</td></tr>';
print '</table>'; print '</table>';
print "</div> <!-- end div fichehalfleft -->\n";
?>
</div> <!-- end div fichehalfleft -->
<div id="backupdatabaseright" class="fichehalfright" style="height:480px; overflow: auto;"> print '<div id="backupdatabaseright" class="fichehalfright" style="height:480px; overflow: auto;">';
<div class="ficheaddleft"> print '<div class="ficheaddleft">';
<?php
$filearray=dol_dir_list($conf->admin->dir_output.'/backup', 'files', 0, '', '', $sortfield, (strtolower($sortorder)=='asc'?SORT_ASC:SORT_DESC), 1); $filearray=dol_dir_list($conf->admin->dir_output.'/backup', 'files', 0, '', '', $sortfield, (strtolower($sortorder)=='asc'?SORT_ASC:SORT_DESC), 1);
$result=$formfile->list_of_documents($filearray, null, 'systemtools', '', 1, 'backup/', 1, 0, $langs->trans("NoBackupFileAvailable"), 0, $langs->trans("PreviousDumpFiles")); $result=$formfile->list_of_documents($filearray, null, 'systemtools', '', 1, 'backup/', 1, 0, $langs->trans("NoBackupFileAvailable"), 0, $langs->trans("PreviousDumpFiles"));
print '<br>'; print '<br>';
?>
print '</div>';
print '</div>';
print '</form>';
print '</fieldset>';
</div> print "<br>\n";
</div> print "<!-- Dump of a server -->\n";
</form>
</fieldset>
<br> print '<form method="post" action="export_files.php" name="dump">';
<!-- Dump of a server --> print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'" />';
print '<input type="hidden" name="export_type" value="server" />';
<form method="post" action="export_files.php" name="dump"> print '<fieldset><legend class="legendforfieldsetstep" style="font-size: 3em">2</legend>';
<input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>" />
<input type="hidden" name="export_type" value="server" />
<fieldset><legend class="legendforfieldsetstep" style="font-size: 3em">2</legend>
<?php
print $langs->trans("BackupDesc2", DOL_DATA_ROOT).'<br>'; print $langs->trans("BackupDesc2", DOL_DATA_ROOT).'<br>';
print $langs->trans("BackupDescX").'<br><br>'; print $langs->trans("BackupDescX").'<br><br>';
?> print '<div id="backupfilesleft" class="fichehalfleft">';
<div id="backupfilesleft" class="fichehalfleft">
<?php
print load_fiche_titre($title?$title:$langs->trans("BackupDumpWizard")); print load_fiche_titre($title?$title:$langs->trans("BackupDumpWizard"));
?>
<label for="zipfilename_template"> <?php echo $langs->trans("FileNameToGenerate"); ?></label><br> print '<label for="zipfilename_template">'.$langs->trans("FileNameToGenerate").'</label><br>';
<input type="text" name="zipfilename_template" style="width: 90%"
id="zipfilename_template"
value="<?php
$prefix='documents'; $prefix='documents';
$ext='zip'; $ext='zip';
$file=$prefix.'_'.$dolibarr_main_db_name.'_'.dol_sanitizeFileName(DOL_VERSION).'_'.strftime("%Y%m%d%H%M").'.'.$ext; $file=$prefix.'_'.$dolibarr_main_db_name.'_'.dol_sanitizeFileName(DOL_VERSION).'_'.strftime("%Y%m%d%H%M").'.'.$ext;
echo $file; print '<input type="text" name="zipfilename_template" style="width: 90%" id="zipfilename_template" value="'.$file.'" /> <br>';
?>" /> <br> print '<br>';
<br>
<?php
// Show compression choices // Show compression choices
print '<div class="formelementrow">'; print '<div class="formelementrow">';
print "\n"; print "\n";
@@ -584,32 +579,26 @@ foreach($filecompression as $key => $val)
print '</div>'; print '</div>';
print "\n"; print "\n";
?> print '<br>';
<br> print '<div class="center">';
<div class="center"><input type="submit" class="button reposition" print '<input type="submit" class="button reposition" value="'.$langs->trans("GenerateBackup").'" id="buttonGo" /><br>';
value="<?php echo $langs->trans("GenerateBackup") ?>" id="buttonGo" /><br> print '<br>';
<br> print '</div>';
</div>
</div> print '</div>';
<div id="backupdatabaseright" class="fichehalfright" style="height:480px; overflow: auto;"> print '<div id="backupdatabaseright" class="fichehalfright" style="height:480px; overflow: auto;">';
<div class="ficheaddleft"> print '<div class="ficheaddleft">';
<?php
$filearray=dol_dir_list($conf->admin->dir_output.'/documents', 'files', 0, '', '', $sortfield, (strtolower($sortorder)=='asc'?SORT_ASC:SORT_DESC), 1); $filearray=dol_dir_list($conf->admin->dir_output.'/documents', 'files', 0, '', '', $sortfield, (strtolower($sortorder)=='asc'?SORT_ASC:SORT_DESC), 1);
$result=$formfile->list_of_documents($filearray, null, 'systemtools', '', 1, 'documents/', 1, 0, $langs->trans("NoBackupFileAvailable"), 0, $langs->trans("PreviousDumpFiles")); $result=$formfile->list_of_documents($filearray, null, 'systemtools', '', 1, 'documents/', 1, 0, $langs->trans("NoBackupFileAvailable"), 0, $langs->trans("PreviousDumpFiles"));
print '<br>'; print '<br>';
?>
print '</div>';
print '</div>';
</div> print '</fieldset>';
</div> print '</form>';
</fieldset>
</form>
<?php
// End of page // End of page
llxFooter(); llxFooter();

View File

@@ -99,21 +99,21 @@ print $langs->trans("RestoreDesc3", $dolibarr_main_db_name).'<br><br>';
<?php <?php
if (in_array($type, array('mysql', 'mysqli'))) if (in_array($type, array('mysql', 'mysqli')))
{ {
?> ?>
<div class="formelementrow"> <div class="formelementrow">
<input type="radio" name="what" value="mysql" id="radio_dump_mysql"<?php echo ($radio_dump=='mysql_options'?' checked':''); ?> /> <input type="radio" name="what" value="mysql" id="radio_dump_mysql"<?php echo ($radio_dump=='mysql_options'?' checked':''); ?> />
<label for="radio_dump_mysql">MySQL (mysql)</label> <label for="radio_dump_mysql">MySQL (mysql)</label>
</div> </div>
<?php <?php
} }
elseif (in_array($type, array('pgsql'))) elseif (in_array($type, array('pgsql')))
{ {
?> ?>
<div class="formelementrow"> <div class="formelementrow">
<input type="radio" name="what" value="mysql" id="radio_dump_postgresql"<?php echo ($radio_dump=='postgresql_options'?' checked':''); ?> /> <input type="radio" name="what" value="mysql" id="radio_dump_postgresql"<?php echo ($radio_dump=='postgresql_options'?' checked':''); ?> />
<label for="radio_dump_postgresql">PostgreSQL Restore (pg_restore or psql)</label> <label for="radio_dump_postgresql">PostgreSQL Restore (pg_restore or psql)</label>
</div> </div>
<?php <?php
} }
else else
{ {
@@ -131,11 +131,9 @@ print $langs->trans("RestoreDesc3", $dolibarr_main_db_name).'<br><br>';
<?php <?php
if (in_array($type, array('mysql', 'mysqli'))) if (in_array($type, array('mysql', 'mysqli')))
{ {
?> print '<fieldset id="mysql_options">';
<fieldset id="mysql_options"> print '<legend>'.$langs->trans('RestoreMySQL').'</legend>';
<legend><?php echo $langs->trans('RestoreMySQL') ?></legend> print '<div class="formelementrow centpercent">';
<div class="formelementrow centpercent">
<?php
// Parameteres execution // Parameteres execution
$command=$db->getPathOfRestore(); $command=$db->getPathOfRestore();
if (preg_match("/\s/", $command)) $command=$command=escapeshellarg($command); // Use quotes on command if (preg_match("/\s/", $command)) $command=$command=escapeshellarg($command); // Use quotes on command
@@ -157,20 +155,18 @@ if (in_array($type, array('mysql', 'mysqli')))
print '<textarea rows="1" id="restorecommand" class="centpercent">'.$langs->trans("ImportMySqlCommand", $command, ($showpass?$paramclear:$paramcrypted)).'</textarea><br>'; print '<textarea rows="1" id="restorecommand" class="centpercent">'.$langs->trans("ImportMySqlCommand", $command, ($showpass?$paramclear:$paramcrypted)).'</textarea><br>';
print ajax_autoselect('restorecommand'); print ajax_autoselect('restorecommand');
if (empty($_GET["showpass"]) && $dolibarr_main_db_pass) print '<br><a href="'.$_SERVER["PHP_SELF"].'?showpass=1&amp;radio_dump=mysql_options">'.$langs->trans("UnHidePassword").'</a>'; if (empty($_GET["showpass"]) && $dolibarr_main_db_pass) {
//else print '<br><a href="'.$_SERVER["PHP_SELF"].'?showpass=0&amp;radio_dump=mysql_options">'.$langs->trans("HidePassword").'</a>'; print '<br><a href="'.$_SERVER["PHP_SELF"].'?showpass=1&amp;radio_dump=mysql_options">'.$langs->trans("UnHidePassword").'</a>';
?> }
</div> //else print '<br><a href="'.$_SERVER["PHP_SELF"].'?showpass=0&amp;radio_dump=mysql_options">'.$langs->trans("HidePassword").'</a>';
</fieldset> print '</div>';
<?php print '</fieldset>';
} }
elseif (in_array($type, array('pgsql'))) elseif (in_array($type, array('pgsql')))
{ {
?> print '<fieldset id="postgresql_options">';
<fieldset id="postgresql_options"> print '<legend>Restore PostgreSQL</legend>';
<legend>Restore PostgreSQL</legend> print '<div class="formelementrow">';
<div class="formelementrow">
<?php
// Parameteres execution // Parameteres execution
$command=$db->getPathOfRestore(); $command=$db->getPathOfRestore();
if (preg_match("/\s/", $command)) $command=$command=escapeshellarg($command); // Use quotes on command if (preg_match("/\s/", $command)) $command=$command=escapeshellarg($command); // Use quotes on command
@@ -198,20 +194,16 @@ elseif (in_array($type, array('pgsql')))
print ajax_autoselect('restorecommand'); print ajax_autoselect('restorecommand');
//if (empty($_GET["showpass"]) && $dolibarr_main_db_pass) print '<br><a href="'.$_SERVER["PHP_SELF"].'?showpass=1&amp;radio_dump=postgresql_options">'.$langs->trans("UnHidePassword").'</a>'; //if (empty($_GET["showpass"]) && $dolibarr_main_db_pass) print '<br><a href="'.$_SERVER["PHP_SELF"].'?showpass=1&amp;radio_dump=postgresql_options">'.$langs->trans("UnHidePassword").'</a>';
//else print '<br><a href="'.$_SERVER["PHP_SELF"].'?showpass=0&amp;radio_dump=mysql_options">'.$langs->trans("HidePassword").'</a>'; //else print '<br><a href="'.$_SERVER["PHP_SELF"].'?showpass=0&amp;radio_dump=mysql_options">'.$langs->trans("HidePassword").'</a>';
?> print '</div>';
</div> print '</fieldset>';
</fieldset>
<?php
} }
?>
</div> print '</div>';
</td></tr></table> print '</td></tr></table>';
</fieldset> print '</fieldset>';
<?php
// End of page // End of page
llxFooter(); llxFooter();
$db->close(); $db->close();

View File

@@ -37,8 +37,8 @@ $confirm=GETPOST('confirm', 'alpha');
// Security check // Security check
if ($user->societe_id > 0) if ($user->societe_id > 0)
{ {
$action = ''; $action = '';
$socid = $user->societe_id; $socid = $user->societe_id;
} }
$sortfield = GETPOST("sortfield", 'alpha'); $sortfield = GETPOST("sortfield", 'alpha');

View File

@@ -97,9 +97,9 @@ if (! empty($conf->syslog->enabled))
$filelogparam=$filelog; $filelogparam=$filelog;
if ($user->admin && preg_match('/^dolibarr.*\.log$/', basename($filelog))) if ($user->admin && preg_match('/^dolibarr.*\.log$/', basename($filelog)))
{ {
$filelogparam ='<a class="wordbreak" href="'.DOL_URL_ROOT.'/document.php?modulepart=logs&file='; $filelogparam ='<a class="wordbreak" href="'.DOL_URL_ROOT.'/document.php?modulepart=logs&file=';
$filelogparam.=basename($filelog); $filelogparam.=basename($filelog);
$filelogparam.='">'.$filelog.'</a>'; $filelogparam.='">'.$filelog.'</a>';
} }
print '> '.$langs->trans("PurgeDeleteLogFile", $filelogparam); print '> '.$langs->trans("PurgeDeleteLogFile", $filelogparam);
print '<br><br>'; print '<br><br>';

View File

@@ -288,9 +288,9 @@ foreach ($dirmodels as $reldir)
} }
print '</td>'; print '</td>';
// Info // Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name; $htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); $htmltooltip.= '<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
if ($module->type == 'pdf') if ($module->type == 'pdf')
{ {
$htmltooltip.='<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur; $htmltooltip.='<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;

View File

@@ -235,7 +235,7 @@ foreach ($dirmodels as $reldir)
} }
print '</td>'; print '</td>';
// Info // Info
$htmltooltip = ''.$langs->trans("Name").': '.$module->name; $htmltooltip = ''.$langs->trans("Name").': '.$module->name;
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown")); $htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
if ($module->type == 'pdf') if ($module->type == 'pdf')

View File

@@ -77,23 +77,23 @@ class FormCron extends Form
$out.='</SELECT>'; $out.='</SELECT>';
} }
} else { } else {
$out='<SELECT class="flat" name="'.$htmlname.'" id="'.$htmlname.'" />'; $out='<SELECT class="flat" name="'.$htmlname.'" id="'.$htmlname.'" />';
if ($selected=='command') { if ($selected=='command') {
$selected_attr=' selected '; $selected_attr=' selected ';
} else { } else {
$selected_attr=''; $selected_attr='';
} }
$out.= '<OPTION value="command" '.$selected_attr.'>'.$langs->trans('CronType_command').'</OPTION>'; $out.= '<OPTION value="command" '.$selected_attr.'>'.$langs->trans('CronType_command').'</OPTION>';
if ($selected=='method') { if ($selected=='method') {
$selected_attr=' selected '; $selected_attr=' selected ';
} else { } else {
$selected_attr=''; $selected_attr='';
} }
$out.= '<OPTION value="method" '.$selected_attr.'>'.$langs->trans('CronType_method').'</OPTION>'; $out.= '<OPTION value="method" '.$selected_attr.'>'.$langs->trans('CronType_method').'</OPTION>';
$out.='</SELECT>'; $out.='</SELECT>';
} }
return $out; return $out;

View File

@@ -660,20 +660,20 @@ if ($dirins && $action == 'initobject' && $module && $objectname)
{ {
// Copy some files // Copy some files
$filetogenerate = array( $filetogenerate = array(
'myobject_card.php'=>strtolower($objectname).'_card.php', 'myobject_card.php'=>strtolower($objectname).'_card.php',
'myobject_note.php'=>strtolower($objectname).'_note.php', 'myobject_note.php'=>strtolower($objectname).'_note.php',
'myobject_document.php'=>strtolower($objectname).'_document.php', 'myobject_document.php'=>strtolower($objectname).'_document.php',
'myobject_agenda.php'=>strtolower($objectname).'_agenda.php', 'myobject_agenda.php'=>strtolower($objectname).'_agenda.php',
'myobject_list.php'=>strtolower($objectname).'_list.php', 'myobject_list.php'=>strtolower($objectname).'_list.php',
'lib/mymodule_myobject.lib.php'=>'lib/'.strtolower($module).'_'.strtolower($objectname).'.lib.php', 'lib/mymodule_myobject.lib.php'=>'lib/'.strtolower($module).'_'.strtolower($objectname).'.lib.php',
//'test/phpunit/MyObjectTest.php'=>'test/phpunit/'.strtolower($objectname).'Test.php', //'test/phpunit/MyObjectTest.php'=>'test/phpunit/'.strtolower($objectname).'Test.php',
'sql/llx_mymodule_myobject.sql'=>'sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.sql', 'sql/llx_mymodule_myobject.sql'=>'sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.sql',
'sql/llx_mymodule_myobject_extrafields.sql'=>'sql/llx_'.strtolower($module).'_'.strtolower($objectname).'_extrafields.sql', 'sql/llx_mymodule_myobject_extrafields.sql'=>'sql/llx_'.strtolower($module).'_'.strtolower($objectname).'_extrafields.sql',
'sql/llx_mymodule_myobject.key.sql'=>'sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.key.sql', 'sql/llx_mymodule_myobject.key.sql'=>'sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.key.sql',
//'scripts/mymodule.php'=>'scripts/'.strtolower($objectname).'.php', //'scripts/mymodule.php'=>'scripts/'.strtolower($objectname).'.php',
'img/object_myobject.png'=>'img/object_'.strtolower($objectname).'.png', 'img/object_myobject.png'=>'img/object_'.strtolower($objectname).'.png',
'class/myobject.class.php'=>'class/'.strtolower($objectname).'.class.php', 'class/myobject.class.php'=>'class/'.strtolower($objectname).'.class.php',
//'class/api_mymodule.class.php'=>'class/api_'.strtolower($module).'.class.php' //'class/api_mymodule.class.php'=>'class/api_'.strtolower($module).'.class.php',
); );
foreach($filetogenerate as $srcfile => $destfile) foreach($filetogenerate as $srcfile => $destfile)
@@ -696,68 +696,81 @@ if ($dirins && $action == 'initobject' && $module && $objectname)
//if (! $error) // If there is error copying 1 file, we still have to make the replacement //if (! $error) // If there is error copying 1 file, we still have to make the replacement
//{ //{
// Scan for object class files // Scan for object class files
$listofobject = dol_dir_list($destdir.'/class', 'files', 0, '\.class\.php$'); $listofobject = dol_dir_list($destdir.'/class', 'files', 0, '\.class\.php$');
$firstobjectname=''; $firstobjectname='';
foreach($listofobject as $fileobj) foreach($listofobject as $fileobj)
{
if (preg_match('/^api_/', $fileobj['name'])) continue;
if (preg_match('/^actions_/', $fileobj['name'])) continue;
$tmpcontent=file_get_contents($fileobj['fullname']);
$reg=array();
if (preg_match('/class\s+([^\s]*)\s+extends\s+CommonObject/ims', $tmpcontent, $reg))
{ {
if (preg_match('/^api_/', $fileobj['name'])) continue; $objectnameloop = $reg[1];
if (preg_match('/^actions_/', $fileobj['name'])) continue; if (empty($firstobjectname)) $firstobjectname = $objectnameloop;
$tmpcontent=file_get_contents($fileobj['fullname']);
$reg=array();
if (preg_match('/class\s+([^\s]*)\s+extends\s+CommonObject/ims', $tmpcontent, $reg))
{
$objectnameloop = $reg[1];
if (empty($firstobjectname)) $firstobjectname = $objectnameloop;
}
// Regenerate left menu entry in descriptor for $objectname
$stringtoadd="
\t\t\$this->menu[\$r++]=array(
'fk_menu'=>'fk_mainmenu=mymodule', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
'type'=>'left', // This is a Left menu entry
'titre'=>'List MyObject',
'mainmenu'=>'mymodule',
'leftmenu'=>'mymodule_myobject',
'url'=>'/mymodule/myobject_list.php',
'langs'=>'mymodule@mymodule', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
'position'=>1100+\$r,
'enabled'=>'\$conf->mymodule->enabled', // Define condition to show or hide menu entry. Use '\$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '\$leftmenu==\'system\'' to show if leftmenu system is selected.
'perms'=>'1', // Use 'perms'=>'\$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
'target'=>'',
'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
\t\t\$this->menu[\$r++]=array(
'fk_menu'=>'fk_mainmenu=mymodule,fk_leftmenu=mymodule_myobject', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
'type'=>'left', // This is a Left menu entry
'titre'=>'New MyObject',
'mainmenu'=>'mymodule',
'leftmenu'=>'mymodule_myobject',
'url'=>'/mymodule/myobject_card.php?action=create',
'langs'=>'mymodule@mymodule', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
'position'=>1100+\$r,
'enabled'=>'\$conf->mymodule->enabled', // Define condition to show or hide menu entry. Use '\$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '\$leftmenu==\'system\'' to show if leftmenu system is selected.
'perms'=>'1', // Use 'perms'=>'\$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
'target'=>'',
'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
";
$stringtoadd = preg_replace('/MyObject/', $objectnameloop, $stringtoadd);
$stringtoadd = preg_replace('/mymodule/', strtolower($module), $stringtoadd);
$stringtoadd = preg_replace('/myobject/', strtolower($objectnameloop), $stringtoadd);
$moduledescriptorfile=$destdir.'/core/modules/mod'.$module.'.class.php';
// TODO Allow a replace with regex using dolReplaceInFile with param arryreplacementisregex to 1
// TODO Avoid duplicate addition
dolReplaceInFile($moduledescriptorfile, array('END MODULEBUILDER LEFTMENU MYOBJECT */' => '*/'."\n".$stringtoadd."\n\t\t/* END MODULEBUILDER LEFTMENU MYOBJECT */"));
// Add module descriptor to list of files to replace "MyObject' string with real name of object.
$filetogenerate[]='core/modules/mod'.$module.'.class.php';
// TODO
} }
// Regenerate left menu entry in descriptor for $objectname
$stringtoadd = "
\$this->menu[\$r++]=array(
// '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
'fk_menu'=>'fk_mainmenu=mymodule',
// This is a Left menu entry
'type'=>'left',
'titre'=>'List MyObject',
'mainmenu'=>'mymodule',
'leftmenu'=>'mymodule_myobject',
'url'=>'/mymodule/myobject_list.php',
// Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
'langs'=>'mymodule@mymodule',
'position'=>1100+\$r,
// Define condition to show or hide menu entry. Use '\$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '\$leftmenu==\'system\'' to show if leftmenu system is selected.
'enabled'=>'\$conf->mymodule->enabled',
// Use 'perms'=>'\$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
'perms'=>'1',
'target'=>'',
// 0=Menu for internal users, 1=external users, 2=both
'user'=>2,
);
\$this->menu[\$r++]=array(
// '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
'fk_menu'=>'fk_mainmenu=mymodule,fk_leftmenu=mymodule_myobject',
// This is a Left menu entry
'type'=>'left',
'titre'=>'New MyObject',
'mainmenu'=>'mymodule',
'leftmenu'=>'mymodule_myobject',
'url'=>'/mymodule/myobject_card.php?action=create',
// Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
'langs'=>'mymodule@mymodule',
'position'=>1100+\$r,
// Define condition to show or hide menu entry. Use '\$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '\$leftmenu==\'system\'' to show if leftmenu system is selected.
'enabled'=>'\$conf->mymodule->enabled',
// Use 'perms'=>'\$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
'perms'=>'1',
'target'=>'',
// 0=Menu for internal users, 1=external users, 2=both
'user'=>2
);\n";
$stringtoadd = preg_replace('/MyObject/', $objectnameloop, $stringtoadd);
$stringtoadd = preg_replace('/mymodule/', strtolower($module), $stringtoadd);
$stringtoadd = preg_replace('/myobject/', strtolower($objectnameloop), $stringtoadd);
$moduledescriptorfile=$destdir.'/core/modules/mod'.$module.'.class.php';
// TODO Allow a replace with regex using dolReplaceInFile with param arryreplacementisregex to 1
// TODO Avoid duplicate addition
dolReplaceInFile($moduledescriptorfile, array('END MODULEBUILDER LEFTMENU MYOBJECT */' => '*/'."\n".$stringtoadd."\n\t\t/* END MODULEBUILDER LEFTMENU MYOBJECT */"));
// Add module descriptor to list of files to replace "MyObject' string with real name of object.
$filetogenerate[]='core/modules/mod'.$module.'.class.php';
// TODO
}
//} //}
} }
@@ -888,11 +901,12 @@ if ($dirins && $action == 'addproperty' && !empty($module) && ! empty($tabobj))
if (! $error) if (! $error)
{ {
$addfieldentry = array( $addfieldentry = array(
'name'=>GETPOST('propname', 'aZ09'),'label'=>GETPOST('proplabel', 'alpha'),'type'=>GETPOST('proptype', 'alpha'), 'name'=>GETPOST('propname', 'aZ09'),'label'=>GETPOST('proplabel', 'alpha'),'type'=>GETPOST('proptype', 'alpha'),
'arrayofkeyval'=>GETPOST('proparrayofkeyval', 'none'), // Example json string '{"0":"Draft","1":"Active","-1":"Cancel"}' 'arrayofkeyval'=>GETPOST('proparrayofkeyval', 'none'), // Example json string '{"0":"Draft","1":"Active","-1":"Cancel"}'
'visible'=>GETPOST('propvisible', 'int'),'enabled'=>GETPOST('propenabled', 'int'), 'visible'=>GETPOST('propvisible', 'int'),'enabled'=>GETPOST('propenabled', 'int'),
'position'=>GETPOST('propposition', 'int'),'notnull'=>GETPOST('propnotnull', 'int'),'index'=>GETPOST('propindex', 'int'),'searchall'=>GETPOST('propsearchall', 'int'), 'position'=>GETPOST('propposition', 'int'),'notnull'=>GETPOST('propnotnull', 'int'),'index'=>GETPOST('propindex', 'int'),'searchall'=>GETPOST('propsearchall', 'int'),
'isameasure'=>GETPOST('propisameasure', 'int'), 'comment'=>GETPOST('propcomment', 'alpha'),'help'=>GETPOST('prophelp', 'alpha')); 'isameasure'=>GETPOST('propisameasure', 'int'), 'comment'=>GETPOST('propcomment', 'alpha'),'help'=>GETPOST('prophelp', 'alpha')
);
if (! empty($addfieldentry['arrayofkeyval']) && ! is_array($addfieldentry['arrayofkeyval'])) if (! empty($addfieldentry['arrayofkeyval']) && ! is_array($addfieldentry['arrayofkeyval']))
{ {

View File

@@ -69,14 +69,14 @@ class MyModuleFunctionalTest extends \PHPUnit_Extensions_Selenium2TestCase
), ),
// Geckodriver does not keep the session at the moment?! // Geckodriver does not keep the session at the moment?!
// XPath selectors also don't seem to work // XPath selectors also don't seem to work
// array( //array(
// 'browser' => 'Mozilla Firefox on Linux', // 'browser' => 'Mozilla Firefox on Linux',
// 'browserName' => 'firefox', // 'browserName' => 'firefox',
// 'sessionStrategy' => 'shared', // 'sessionStrategy' => 'shared',
// 'desiredCapabilities' => array( // 'desiredCapabilities' => array(
// 'marionette' => true // 'marionette' => true,
// ) // ),
// ) //)
); );
/** /**
@@ -224,7 +224,7 @@ class MyModuleFunctionalTest extends \PHPUnit_Extensions_Selenium2TestCase
{ {
$this->url('/custom/mymodule/admin/about.php'); $this->url('/custom/mymodule/admin/about.php');
$this->authenticate(); $this->authenticate();
return $this->assertEquals( return $this->assertEquals(
'Dolibarr Module Template (aka My Module)', 'Dolibarr Module Template (aka My Module)',
$this->byTag('h1')->text(), $this->byTag('h1')->text(),
"Readme title" "Readme title"
@@ -254,7 +254,7 @@ return $this->assertEquals(
{ {
$this->url('/admin/triggers.php'); $this->url('/admin/triggers.php');
$this->authenticate(); $this->authenticate();
return $this->assertContains( return $this->assertContains(
'interface_99_modMyModule_MyModuleTriggers.class.php', 'interface_99_modMyModule_MyModuleTriggers.class.php',
$this->byTag('body')->text(), $this->byTag('body')->text(),
"Trigger declared" "Trigger declared"
@@ -271,7 +271,7 @@ return $this->assertContains(
{ {
$this->url('/admin/triggers.php'); $this->url('/admin/triggers.php');
$this->authenticate(); $this->authenticate();
return $this->assertContains( return $this->assertContains(
'tick.png', 'tick.png',
$this->byXPath('//td[text()="interface_99_modMyModule_MyTrigger.class.php"]/following::img')->attribute('src'), $this->byXPath('//td[text()="interface_99_modMyModule_MyTrigger.class.php"]/following::img')->attribute('src'),
"Trigger enabled" "Trigger enabled"