Compare commits
158 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
192510316b | ||
|
|
6f83c8c6f3 | ||
|
|
8213756c37 | ||
|
|
a254412c61 | ||
|
|
cc1a3080d0 | ||
|
|
b5f887b3e4 | ||
|
|
694357d48e | ||
|
|
c4f80b4e71 | ||
|
|
ece9f3037a | ||
|
|
8dd44246b0 | ||
|
|
76470c9548 | ||
|
|
19be5f662d | ||
|
|
3eebbc0b14 | ||
|
|
d27c0b31fc | ||
|
|
a1534955a1 | ||
|
|
79371f66b0 | ||
|
|
4569cb82b2 | ||
|
|
04d33f4594 | ||
|
|
af6e95aa79 | ||
|
|
5d942c9d1a | ||
|
|
cc57d3dbc1 | ||
|
|
87b187bded | ||
|
|
df0b20aad3 | ||
|
|
e085c3989a | ||
|
|
e67c208b57 | ||
|
|
e13038dc30 | ||
|
|
744b84cb09 | ||
|
|
5c3b0847c2 | ||
|
|
f1af7ca2f2 | ||
|
|
035bc32323 | ||
|
|
a70d45b3ab | ||
|
|
1574254dcf | ||
|
|
1c129fd3ea | ||
|
|
97575854d0 | ||
|
|
2e744a4517 | ||
|
|
1ad8700810 | ||
|
|
1c8c98ac0f | ||
|
|
92cb95a184 | ||
|
|
96c7a9f77c | ||
|
|
3ebdb89133 | ||
|
|
d819d427c3 | ||
|
|
db81b32a5d | ||
|
|
793e43c7c6 | ||
|
|
d9bac75a63 | ||
|
|
e4c1978e12 | ||
|
|
a0154503f4 | ||
|
|
a9c76f2e44 | ||
|
|
5b6133ad62 | ||
|
|
90c3c90864 | ||
|
|
cacff0c2d4 | ||
|
|
22f6d204a2 | ||
|
|
b110ca6ead | ||
|
|
400f6b244b | ||
|
|
cde290c78a | ||
|
|
b23b82bd6f | ||
|
|
7dfb369a98 | ||
|
|
265aeb76e6 | ||
|
|
5ee74d7c07 | ||
|
|
1541e20870 | ||
|
|
53709cf509 | ||
|
|
10e32c056e | ||
|
|
8728ad2eff | ||
|
|
5de6c193ff | ||
|
|
1f6e9a1a9e | ||
|
|
26c6908f66 | ||
|
|
08685cc6b0 | ||
|
|
7bdfc998bf | ||
|
|
76a0caf116 | ||
|
|
c57dc82eaa | ||
|
|
f16166c47c | ||
|
|
d82c1f34e0 | ||
|
|
0a72aed3d7 | ||
|
|
856b010a45 | ||
|
|
9d6ddced56 | ||
|
|
36ba158a8b | ||
|
|
140cca7596 | ||
|
|
a5b8d0cd4b | ||
|
|
d149596043 | ||
|
|
cf05f38e54 | ||
|
|
57ebcf94c0 | ||
|
|
826bde0656 | ||
|
|
d84d09556c | ||
|
|
7937a798b7 | ||
|
|
ce8312c744 | ||
|
|
cf4beafb68 | ||
|
|
9a72f147d1 | ||
|
|
f5343c55c3 | ||
|
|
1361abffe5 | ||
|
|
9d2fb782fa | ||
|
|
632147ad88 | ||
|
|
1129222064 | ||
|
|
7cb657c991 | ||
|
|
efb9d184e4 | ||
|
|
44d4ab6f9c | ||
|
|
8f96383186 | ||
|
|
db975bbcc2 | ||
|
|
23249751d5 | ||
|
|
7af883abc1 | ||
|
|
e365a14b5a | ||
|
|
e188855dca | ||
|
|
9aa5c94612 | ||
|
|
ba724204a4 | ||
|
|
8518c772fb | ||
|
|
33e40c12c8 | ||
|
|
19b9412c13 | ||
|
|
23749b57ec | ||
|
|
3959d12a39 | ||
|
|
dd8d4e9e98 | ||
|
|
9247bbcc1d | ||
|
|
01c6de1085 | ||
|
|
6d918ad1c7 | ||
|
|
ff696e0dad | ||
|
|
3dcd1aa05d | ||
|
|
8dfe4fe05f | ||
|
|
65d59405da | ||
|
|
0e2e8fe27f | ||
|
|
7232e38dbe | ||
|
|
f2c282305e | ||
|
|
54b81312b5 | ||
|
|
1336d3e791 | ||
|
|
eb8d7f92c3 | ||
|
|
c998abe54e | ||
|
|
181991ee47 | ||
|
|
c8bcd01a10 | ||
|
|
983e28691b | ||
|
|
29950a6afa | ||
|
|
00b617d17f | ||
|
|
fc0c4295bd | ||
|
|
17773f8414 | ||
|
|
e1af439a6d | ||
|
|
bd52613331 | ||
|
|
3875d26a2f | ||
|
|
db3d16f080 | ||
|
|
bc230dbfc2 | ||
|
|
371c75e76a | ||
|
|
3a32787f15 | ||
|
|
57052e2fba | ||
|
|
2da16ade6c | ||
|
|
68ac62d09c | ||
|
|
5910d10021 | ||
|
|
eba377cdf0 | ||
|
|
10f0434116 | ||
|
|
6d00097c89 | ||
|
|
fc4a16b356 | ||
|
|
d0508d557b | ||
|
|
422191def1 | ||
|
|
620d7109b5 | ||
|
|
332fa77d90 | ||
|
|
c3d539abff | ||
|
|
6abe6462e6 | ||
|
|
505517d142 | ||
|
|
1c43a83a8b | ||
|
|
571d130c3c | ||
|
|
88cd8fface | ||
|
|
87bb971d75 | ||
|
|
65c4a21898 | ||
|
|
9d89e48d15 | ||
|
|
9d234a8541 |
@ -175,6 +175,18 @@ In htdocs/includes/tecnickcom/tcpdf/tcpdf.php
|
||||
- protected $default_monospaced_font = 'courier';
|
||||
+ protected $default_monospaced_font = 'freemono';
|
||||
|
||||
* In tecnickcom/tcpdf/include/tcpdf_static, in function intToRoman, right at the beginning
|
||||
of the function, replace:
|
||||
|
||||
$roman = '';
|
||||
|
||||
with:
|
||||
|
||||
$roman = '';
|
||||
if ($number >= 4000) {
|
||||
// do not represent numbers above 4000 in Roman numerals
|
||||
return strval($number);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -121,9 +121,9 @@ if (is_array($changeaccount) && count($changeaccount) > 0) {
|
||||
{
|
||||
$db->begin();
|
||||
|
||||
$sql1 = "UPDATE ".MAIN_DB_PREFIX."facturedet as l";
|
||||
$sql1 .= " SET l.fk_code_ventilation=".(GETPOST('account_parent', 'int') > 0 ? GETPOST('account_parent', 'int') : '0');
|
||||
$sql1 .= ' WHERE l.rowid IN ('.implode(',', $changeaccount).')';
|
||||
$sql1 = "UPDATE ".MAIN_DB_PREFIX."facturedet";
|
||||
$sql1 .= " SET fk_code_ventilation=".(GETPOST('account_parent', 'int') > 0 ? GETPOST('account_parent', 'int') : '0');
|
||||
$sql1 .= ' WHERE rowid IN ('.implode(',', $changeaccount).')';
|
||||
|
||||
dol_syslog('accountancy/customer/lines.php::changeaccount sql= '.$sql1);
|
||||
$resql1 = $db->query($sql1);
|
||||
|
||||
@ -93,87 +93,88 @@ if ($conf->accounting->enabled)
|
||||
print '<div class="'.($helpisexpanded ? '' : 'hideobject').'" id="idfaq">'; // hideobject is to start hidden
|
||||
print "<br>\n";
|
||||
print '<span class="opacitymedium">'.$langs->trans("AccountancyAreaDescIntro")."</span><br>\n";
|
||||
print "<br>\n"; print "<br>\n";
|
||||
if (!empty($user->rights->accounting->chartofaccount)){
|
||||
print "<br>\n"; print "<br>\n";
|
||||
|
||||
print load_fiche_titre('<span class="fa fa-calendar-check-o"></span> '.$langs->trans("AccountancyAreaDescActionOnce"), '', '')."\n";
|
||||
print '<hr>';
|
||||
print "<br>\n";
|
||||
print load_fiche_titre('<span class="fa fa-calendar-check-o"></span> '.$langs->trans("AccountancyAreaDescActionOnce"), '', '')."\n";
|
||||
print '<hr>';
|
||||
print "<br>\n";
|
||||
|
||||
// STEPS
|
||||
$step++;
|
||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescJournalSetup", $step, '<a href="'.DOL_URL_ROOT.'/accountancy/admin/journals_list.php?id=35"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("AccountingJournals").'</strong></a>');
|
||||
print "<br>\n";
|
||||
$step++;
|
||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChartModel", $step, '<a href="'.DOL_URL_ROOT.'/accountancy/admin/accountmodel.php"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Pcg_version").'</strong></a>');
|
||||
print "<br>\n";
|
||||
$step++;
|
||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChart", $step, '<a href="'.DOL_URL_ROOT.'/accountancy/admin/account.php"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Chartofaccounts").'</strong></a>');
|
||||
print "<br>\n";
|
||||
// STEPS
|
||||
$step++;
|
||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescJournalSetup", $step, '<a href="'.DOL_URL_ROOT.'/accountancy/admin/journals_list.php?id=35"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("AccountingJournals").'</strong></a>');
|
||||
print "<br>\n";
|
||||
$step++;
|
||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChartModel", $step, '<a href="'.DOL_URL_ROOT.'/accountancy/admin/accountmodel.php"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Pcg_version").'</strong></a>');
|
||||
print "<br>\n";
|
||||
$step++;
|
||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChart", $step, '<a href="'.DOL_URL_ROOT.'/accountancy/admin/account.php"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Chartofaccounts").'</strong></a>');
|
||||
print "<br>\n";
|
||||
|
||||
print "<br>\n";
|
||||
print $langs->trans("AccountancyAreaDescActionOnceBis");
|
||||
print "<br>\n";
|
||||
print "<br>\n";
|
||||
print "<br>\n";
|
||||
print $langs->trans("AccountancyAreaDescActionOnceBis");
|
||||
print "<br>\n";
|
||||
print "<br>\n";
|
||||
|
||||
$step++;
|
||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescDefault", $step, '<a href="'.DOL_URL_ROOT.'/accountancy/admin/defaultaccounts.php"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong></a>');
|
||||
print "<br>\n";
|
||||
$step++;
|
||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescDefault", $step, '<a href="'.DOL_URL_ROOT.'/accountancy/admin/defaultaccounts.php"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong></a>');
|
||||
print "<br>\n";
|
||||
|
||||
$step++;
|
||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBank", $step, '<a href="'.DOL_URL_ROOT.'/compta/bank/list.php"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuBankAccounts").'</strong></a>')."\n";
|
||||
print "<br>\n";
|
||||
$step++;
|
||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBank", $step, '<a href="'.DOL_URL_ROOT.'/compta/bank/list.php"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuBankAccounts").'</strong></a>')."\n";
|
||||
print "<br>\n";
|
||||
|
||||
$step++;
|
||||
$textlink = '<a href="'.DOL_URL_ROOT.'/admin/dict.php?id=10&from=accountancy"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuVatAccounts").'</strong></a>';
|
||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescVat", $step, $textlink);
|
||||
print "<br>\n";
|
||||
if (!empty($conf->tax->enabled))
|
||||
{
|
||||
$textlink = '<a href="'.DOL_URL_ROOT.'/admin/dict.php?id=7&from=accountancy"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuTaxAccounts").'</strong></a>';
|
||||
$step++;
|
||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescContrib", $step, $textlink);
|
||||
print "<br>\n";
|
||||
$step++;
|
||||
$textlink = '<a href="'.DOL_URL_ROOT.'/admin/dict.php?id=10&from=accountancy"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuVatAccounts").'</strong></a>';
|
||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescVat", $step, $textlink);
|
||||
print "<br>\n";
|
||||
if (!empty($conf->tax->enabled))
|
||||
{
|
||||
$textlink = '<a href="'.DOL_URL_ROOT.'/admin/dict.php?id=7&from=accountancy"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuTaxAccounts").'</strong></a>';
|
||||
$step++;
|
||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescContrib", $step, $textlink);
|
||||
print "<br>\n";
|
||||
}
|
||||
/*if (! empty($conf->salaries->enabled))
|
||||
{
|
||||
$step++;
|
||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescSal", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
|
||||
// htdocs/admin/salaries.php
|
||||
print "<br>\n";
|
||||
print "<br>\n";
|
||||
}*/
|
||||
if (!empty($conf->expensereport->enabled)) // TODO Move this in the default account page because this is only one accounting account per purpose, not several.
|
||||
{
|
||||
$step++;
|
||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescExpenseReport", $step, '<a href="'.DOL_URL_ROOT.'/admin/dict.php?id=17&from=accountancy"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuExpenseReportAccounts").'</strong></a>');
|
||||
print "<br>\n";
|
||||
}
|
||||
/*
|
||||
if (! empty($conf->loan->enabled))
|
||||
{
|
||||
$step++;
|
||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescLoan", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuSpecialExpenses").' - '.$langs->transnoentitiesnoconv("Loans").'</strong> '.$langs->transnoentitiesnoconv("or").' <strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
|
||||
print "<br>\n";
|
||||
}
|
||||
if (! empty($conf->don->enabled))
|
||||
{
|
||||
$step++;
|
||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescDonation", $step, '<strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
|
||||
print "<br>\n";
|
||||
}
|
||||
if (! empty($conf->adherents->enabled))
|
||||
{
|
||||
$step++;
|
||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescSubscription", $step, '<strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
|
||||
print "<br>\n";
|
||||
}*/
|
||||
|
||||
$step++;
|
||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescProd", $step, '<a href="'.DOL_URL_ROOT.'/accountancy/admin/productaccount.php"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("ProductsBinding").'</strong></a>');
|
||||
print "<br>\n";
|
||||
|
||||
print '<br>';
|
||||
}
|
||||
/*if (! empty($conf->salaries->enabled))
|
||||
{
|
||||
$step++;
|
||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescSal", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
|
||||
// htdocs/admin/salaries.php
|
||||
print "<br>\n";
|
||||
print "<br>\n";
|
||||
}*/
|
||||
if (!empty($conf->expensereport->enabled)) // TODO Move this in the default account page because this is only one accounting account per purpose, not several.
|
||||
{
|
||||
$step++;
|
||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescExpenseReport", $step, '<a href="'.DOL_URL_ROOT.'/admin/dict.php?id=17&from=accountancy"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuExpenseReportAccounts").'</strong></a>');
|
||||
print "<br>\n";
|
||||
}
|
||||
/*
|
||||
if (! empty($conf->loan->enabled))
|
||||
{
|
||||
$step++;
|
||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescLoan", $step, '<strong>'.$langs->transnoentitiesnoconv("MenuSpecialExpenses").' - '.$langs->transnoentitiesnoconv("Loans").'</strong> '.$langs->transnoentitiesnoconv("or").' <strong>'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
|
||||
print "<br>\n";
|
||||
}
|
||||
if (! empty($conf->don->enabled))
|
||||
{
|
||||
$step++;
|
||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescDonation", $step, '<strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
|
||||
print "<br>\n";
|
||||
}
|
||||
if (! empty($conf->adherents->enabled))
|
||||
{
|
||||
$step++;
|
||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescSubscription", $step, '<strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").'</strong>');
|
||||
print "<br>\n";
|
||||
}*/
|
||||
|
||||
$step++;
|
||||
print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescProd", $step, '<a href="'.DOL_URL_ROOT.'/accountancy/admin/productaccount.php"><strong>'.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("ProductsBinding").'</strong></a>');
|
||||
print "<br>\n";
|
||||
|
||||
|
||||
print '<br>';
|
||||
|
||||
// Step A - E
|
||||
|
||||
|
||||
@ -123,9 +123,9 @@ if (is_array($changeaccount) && count($changeaccount) > 0) {
|
||||
{
|
||||
$db->begin();
|
||||
|
||||
$sql1 = "UPDATE ".MAIN_DB_PREFIX."facture_fourn_det as l";
|
||||
$sql1 .= " SET l.fk_code_ventilation=".(GETPOST('account_parent', 'int') > 0 ? GETPOST('account_parent', 'int') : '0');
|
||||
$sql1 .= ' WHERE l.rowid IN ('.implode(',', $changeaccount).')';
|
||||
$sql1 = "UPDATE ".MAIN_DB_PREFIX."facture_fourn_det";
|
||||
$sql1 .= " SET fk_code_ventilation=".(GETPOST('account_parent', 'int') > 0 ? GETPOST('account_parent', 'int') : '0');
|
||||
$sql1 .= ' WHERE rowid IN ('.implode(',', $changeaccount).')';
|
||||
|
||||
dol_syslog('accountancy/supplier/lines.php::changeaccount sql= '.$sql1);
|
||||
$resql1 = $db->query($sql1);
|
||||
|
||||
@ -326,7 +326,7 @@ if (empty($reshook))
|
||||
$object->public = GETPOST("public", 'alpha');
|
||||
|
||||
// Fill array 'array_options' with data from add form
|
||||
$ret = $extrafields->setOptionalsFromPost(null, $object);
|
||||
$ret = $extrafields->setOptionalsFromPost(null, $object, '@GETPOSTISSET');
|
||||
if ($ret < 0) $error++;
|
||||
|
||||
// Check if we need to also synchronize user information
|
||||
|
||||
@ -175,7 +175,7 @@ if ($action == 'update' && $user->rights->adherent->configurer)
|
||||
$object->vote = (boolean) trim($vote);
|
||||
|
||||
// Fill array 'array_options' with data from add form
|
||||
$ret = $extrafields->setOptionalsFromPost(null, $object);
|
||||
$ret = $extrafields->setOptionalsFromPost(null, $object, '@GETPOSTISSET');
|
||||
if ($ret < 0) $error++;
|
||||
|
||||
$ret = $object->update($user);
|
||||
|
||||
@ -1048,6 +1048,7 @@ if ($id)
|
||||
elseif ($search_code != '' && $id == 28) $sql .= natural_search("h.code", $search_code);
|
||||
elseif ($search_code != '' && $id == 32) $sql .= natural_search("a.code", $search_code);
|
||||
elseif ($search_code != '' && $id == 3) $sql .= natural_search("r.code_region", $search_code);
|
||||
elseif ($search_code != '' && $id == 10) $sql .= natural_search("t.code", $search_code);
|
||||
elseif ($search_code != '' && $id != 9) $sql .= natural_search("code", $search_code);
|
||||
|
||||
if ($sortfield)
|
||||
|
||||
@ -154,7 +154,7 @@ if ($action == 'update' && $user->rights->asset->write)
|
||||
$object->note = trim($comment);
|
||||
|
||||
// Fill array 'array_options' with data from add form
|
||||
$ret = $extrafields->setOptionalsFromPost(null, $object);
|
||||
$ret = $extrafields->setOptionalsFromPost(null, $object, '@GETPOSTISSET');
|
||||
if ($ret < 0) $error++;
|
||||
|
||||
$ret = $object->update($user);
|
||||
|
||||
@ -102,7 +102,7 @@ if ($action == 'update' && $user->rights->categorie->creer)
|
||||
}
|
||||
if (!$error && empty($object->error))
|
||||
{
|
||||
$ret = $extrafields->setOptionalsFromPost(null, $object);
|
||||
$ret = $extrafields->setOptionalsFromPost(null, $object, '@GETPOSTISSET');
|
||||
if ($ret < 0) $error++;
|
||||
|
||||
if (!$error && $object->update($user) > 0)
|
||||
|
||||
@ -529,7 +529,7 @@ if (empty($reshook) && $action == 'update')
|
||||
}
|
||||
|
||||
// Fill array 'array_options' with data from add form
|
||||
$ret = $extrafields->setOptionalsFromPost(null, $object);
|
||||
$ret = $extrafields->setOptionalsFromPost(null, $object, '@GETPOSTISSET');
|
||||
if ($ret < 0) $error++;
|
||||
|
||||
if (!$error) {
|
||||
|
||||
@ -763,6 +763,7 @@ class ActionComm extends CommonObject
|
||||
$this->elementid = $obj->elementid;
|
||||
$this->elementtype = $obj->elementtype;
|
||||
|
||||
$this->fetch_optionals();
|
||||
$this->fetchResources();
|
||||
}
|
||||
$this->db->free($resql);
|
||||
|
||||
@ -216,6 +216,8 @@ if (empty($reshook))
|
||||
$result = $object->deleteline($user, $lineid);
|
||||
if ($result > 0)
|
||||
{
|
||||
// reorder lines
|
||||
$object->line_order(true);
|
||||
// Define output language
|
||||
$outputlangs = $langs;
|
||||
$newlang = '';
|
||||
|
||||
@ -246,7 +246,7 @@ if ($action == 'update')
|
||||
if (!$error)
|
||||
{
|
||||
// Fill array 'array_options' with data from add form
|
||||
$ret = $extrafields->setOptionalsFromPost(null, $object);
|
||||
$ret = $extrafields->setOptionalsFromPost(null, $object, '@GETPOSTISSET');
|
||||
}
|
||||
|
||||
if (!$error)
|
||||
|
||||
@ -243,6 +243,8 @@ if (empty($reshook))
|
||||
|
||||
$result = $object->deleteline(GETPOST('lineid'));
|
||||
if ($result > 0) {
|
||||
// reorder lines
|
||||
$object->line_order(true);
|
||||
// Define output language
|
||||
$outputlangs = $langs;
|
||||
$newlang = '';
|
||||
@ -1668,6 +1670,11 @@ if (empty($reshook))
|
||||
$discount->tva_tx = $lines[$i]->tva_tx;
|
||||
$discount->fk_user = $user->id;
|
||||
$discount->description = $desc;
|
||||
$discount->multicurrency_subprice = abs($lines[$i]->multicurrency_subprice);
|
||||
$discount->multicurrency_amount_ht = abs($lines[$i]->multicurrency_total_ht);
|
||||
$discount->multicurrency_amount_tva = abs($lines[$i]->multicurrency_total_tva);
|
||||
$discount->multicurrency_amount_ttc = abs($lines[$i]->multicurrency_total_ttc);
|
||||
|
||||
$discountid = $discount->create($user);
|
||||
if ($discountid > 0) {
|
||||
$result = $object->insert_discount($discountid); // This include link_to_invoice
|
||||
@ -2822,6 +2829,7 @@ if (empty($reshook))
|
||||
* View
|
||||
*/
|
||||
|
||||
|
||||
$form = new Form($db);
|
||||
$formother = new FormOther($db);
|
||||
$formfile = new FormFile($db);
|
||||
@ -3749,6 +3757,15 @@ if ($action == 'create')
|
||||
}
|
||||
elseif ($id > 0 || !empty($ref))
|
||||
{
|
||||
if (empty($object->id)) {
|
||||
llxHeader();
|
||||
$langs->load('errors');
|
||||
echo '<div class="error">'.$langs->trans("ErrorRecordNotFound");
|
||||
echo ' <a href="javascript:history.go(-1)">'.$langs->trans('GoBack').'</div>';
|
||||
llxFooter();
|
||||
exit;
|
||||
}
|
||||
|
||||
/*
|
||||
* Show object in view mode
|
||||
*/
|
||||
|
||||
@ -86,6 +86,14 @@ require_once DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
|
||||
* View
|
||||
*/
|
||||
|
||||
if (empty($object->id)) {
|
||||
llxHeader();
|
||||
$langs->load('errors');
|
||||
echo '<div class="error">'.$langs->trans("ErrorRecordNotFound").'</div>';
|
||||
llxFooter();
|
||||
exit;
|
||||
}
|
||||
|
||||
$title = $langs->trans('InvoiceCustomer')." - ".$langs->trans('Documents');
|
||||
$helpurl = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes";
|
||||
llxHeader('', $title, $helpurl);
|
||||
|
||||
@ -43,6 +43,14 @@ $ref = GETPOST("ref", 'alpha');
|
||||
* View
|
||||
*/
|
||||
|
||||
if (empty($object->id)) {
|
||||
llxHeader();
|
||||
$langs->load('errors');
|
||||
echo '<div class="error">'.$langs->trans("ErrorRecordNotFound").'</div>';
|
||||
llxFooter();
|
||||
exit;
|
||||
}
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
$title = $langs->trans('InvoiceCustomer')." - ".$langs->trans('Info');
|
||||
|
||||
@ -64,6 +64,14 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include,
|
||||
* View
|
||||
*/
|
||||
|
||||
if (empty($object->id)) {
|
||||
llxHeader();
|
||||
$langs->load('errors');
|
||||
echo '<div class="error">'.$langs->trans("ErrorRecordNotFound").'</div>';
|
||||
llxFooter();
|
||||
exit;
|
||||
}
|
||||
|
||||
$title = $langs->trans('InvoiceCustomer')." - ".$langs->trans('Notes');
|
||||
$helpurl = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes";
|
||||
llxHeader('', $title, $helpurl);
|
||||
|
||||
@ -92,17 +92,23 @@ print load_fiche_titre($title, '', $picto);
|
||||
dol_mkdir($dir);
|
||||
|
||||
$stats = new FactureStats($db, $socid, $mode, ($userid > 0 ? $userid : 0), ($typent_id > 0 ? $typent_id : 0), ($categ_id > 0 ? $categ_id : 0));
|
||||
if ($mode == 'customer')
|
||||
{
|
||||
if ($object_status != '' && $object_status >= 0) $stats->where .= ' AND f.fk_statut IN ('.$db->escape($object_status).')';
|
||||
if ($mode == 'customer') {
|
||||
if ($object_status != '' && $object_status >= 0) {
|
||||
$stats->where .= ' AND f.fk_statut IN ('.$db->escape($object_status).')';
|
||||
}
|
||||
if (is_array($custcats) && !empty($custcats)) {
|
||||
$stats->from .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_societe as cat ON (f.fk_soc = cat.fk_soc)';
|
||||
$stats->where .= ' AND cat.fk_categorie IN ('.implode(',', $custcats).')';
|
||||
}
|
||||
}
|
||||
if ($mode == 'supplier')
|
||||
{
|
||||
if ($object_status != '' && $object_status >= 0) $stats->where .= ' AND f.fk_statut IN ('.$db->escape($object_status).')';
|
||||
if ($mode == 'supplier') {
|
||||
if ($object_status != '' && $object_status >= 0) {
|
||||
$stats->where .= ' AND f.fk_statut IN ('.$db->escape($object_status).')';
|
||||
}
|
||||
if (is_array($custcats) && !empty($custcats)) {
|
||||
$stats->from .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_fournisseur as cat ON (f.fk_soc = cat.fk_soc)';
|
||||
$stats->where .= ' AND cat.fk_categorie IN ('.implode(',', $custcats).')';
|
||||
}
|
||||
}
|
||||
|
||||
// Build graphic number of object
|
||||
@ -283,7 +289,7 @@ if (! empty($conf->category->enabled)) {
|
||||
$cat_label = $langs->trans("Category").' '.lcfirst($langs->trans("Supplier"));
|
||||
}
|
||||
print '<tr><td>'.$cat_label.'</td><td>';
|
||||
$cate_arbo = $form->select_all_categories(Categorie::TYPE_CUSTOMER, null, 'parent', null, null, 1);
|
||||
$cate_arbo = $form->select_all_categories($cat_type, null, 'parent', null, null, 1);
|
||||
print $form->multiselectarray('custcats', $cate_arbo, GETPOST('custcats', 'array'), null, null, null, null, "90%");
|
||||
//print $formother->select_categories($cat_type, $categ_id, 'categ_id', true);
|
||||
print '</td></tr>';
|
||||
|
||||
@ -443,11 +443,13 @@ if ($resql)
|
||||
print '<td class="right">'.$invoice->getLibStatut(5, $alreadypayed).'</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
if ($objp->paye == 1) // If at least one invoice is paid, disable delete
|
||||
{
|
||||
|
||||
// If at least one invoice is paid, disable delete. INVOICE_CAN_DELETE_PAYMENT_EVEN_IF_INVOICE_CLOSED Can be use for maintenance purpose. Never use this in production
|
||||
if ($objp->paye == 1 && empty($conf->global->INVOICE_CAN_DELETE_PAYMENT_EVEN_IF_INVOICE_CLOSED)) {
|
||||
$disable_delete = 1;
|
||||
$title_button = dol_escape_htmltag($langs->transnoentitiesnoconv("CantRemovePaymentWithOneInvoicePaid"));
|
||||
}
|
||||
|
||||
$total = $total + $objp->amount;
|
||||
$i++;
|
||||
}
|
||||
|
||||
@ -375,7 +375,7 @@ if ($modecompta == 'CREANCES-DETTES')
|
||||
$_SERVER["PHP_SELF"],
|
||||
"amount",
|
||||
"",
|
||||
$classslink,
|
||||
$paramslink,
|
||||
'class="right"',
|
||||
$sortfield,
|
||||
$sortorder
|
||||
|
||||
@ -421,7 +421,7 @@ if (empty($reshook))
|
||||
$object->roles = GETPOST("roles", 'array');
|
||||
|
||||
// Fill array 'array_options' with data from add form
|
||||
$ret = $extrafields->setOptionalsFromPost(null, $object);
|
||||
$ret = $extrafields->setOptionalsFromPost(null, $object, '@GETPOSTISSET');
|
||||
if ($ret < 0) $error++;
|
||||
|
||||
if (!$error)
|
||||
|
||||
@ -175,7 +175,7 @@ $arrayfields = array(
|
||||
'p.phone_mobile'=>array('label'=>"PhoneMobile", 'position'=>32, 'checked'=>1),
|
||||
'p.fax'=>array('label'=>"Fax", 'position'=>33, 'checked'=>0),
|
||||
'p.email'=>array('label'=>"EMail", 'position'=>40, 'checked'=>1),
|
||||
'p.no_email'=>array('label'=>"No_Email", 'position'=>41, 'checked'=>0, 'enabled'=>(!empty($conf->mailing->enabled))),
|
||||
'unsubscribed'=>array('label'=>"No_Email", 'position'=>41, 'checked'=>0, 'enabled'=>(!empty($conf->mailing->enabled))),
|
||||
'p.thirdparty'=>array('label'=>"ThirdParty", 'position'=>50, 'checked'=>1, 'enabled'=>empty($conf->global->SOCIETE_DISABLE_CONTACTS)),
|
||||
'p.priv'=>array('label'=>"ContactVisibility", 'checked'=>1, 'position'=>200),
|
||||
'p.datec'=>array('label'=>"DateCreationShort", 'checked'=>0, 'position'=>500),
|
||||
@ -298,7 +298,7 @@ $contactstatic = new Contact($db);
|
||||
$title = (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses"));
|
||||
|
||||
$sql = "SELECT s.rowid as socid, s.nom as name,";
|
||||
$sql .= " p.rowid, p.lastname as lastname, p.statut, p.firstname, p.zip, p.town, p.poste, p.email, p.no_email,";
|
||||
$sql .= " p.rowid, p.lastname as lastname, p.statut, p.firstname, p.zip, p.town, p.poste, p.email,";
|
||||
$sql .= " p.socialnetworks, p.photo,";
|
||||
$sql .= " p.phone as phone_pro, p.phone_mobile, p.phone_perso, p.fax, p.fk_pays, p.priv, p.datec as date_creation, p.tms as date_update,";
|
||||
$sql .= " co.label as country, co.code as country_code";
|
||||
@ -306,6 +306,9 @@ $sql .= " co.label as country, co.code as country_code";
|
||||
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
|
||||
}
|
||||
if(!empty($conf->mailing->enabled)) {
|
||||
$sql .= ", (SELECT count(*) FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE email = p.email) as unsubscribed";
|
||||
}
|
||||
// Add fields from hooks
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
|
||||
@ -374,8 +377,8 @@ if (strlen($search_town)) $sql .= natural_search("p.town", $search_town);
|
||||
if (count($search_roles) > 0) {
|
||||
$sql .= " AND p.rowid IN (SELECT sc.fk_socpeople FROM ".MAIN_DB_PREFIX."societe_contacts as sc WHERE sc.fk_c_type_contact IN (".implode(',', $search_roles)."))";
|
||||
}
|
||||
|
||||
if ($search_no_email != '' && $search_no_email >= 0) $sql .= " AND p.no_email = ".$db->escape($search_no_email);
|
||||
if ($search_no_email != -1 && $search_no_email > 0) $sql .= " AND (SELECT count(*) FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE email = p.email) > 0";
|
||||
if ($search_no_email != -1 && $search_no_email == 0) $sql .= " AND (SELECT count(*) FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE email = p.email) = 0";
|
||||
if ($search_status != '' && $search_status >= 0) $sql .= " AND p.statut = ".$db->escape($search_status);
|
||||
if ($search_import_key) $sql .= natural_search("p.import_key", $search_import_key);
|
||||
if ($type == "o") // filtre sur type
|
||||
@ -662,7 +665,7 @@ if (!empty($arrayfields['p.email']['checked']))
|
||||
print '<input class="flat" type="text" name="search_email" size="6" value="'.dol_escape_htmltag($search_email).'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (!empty($arrayfields['p.no_email']['checked']))
|
||||
if (!empty($arrayfields['unsubscribed']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre center">';
|
||||
print $form->selectarray('search_no_email', array('-1'=>'', '0'=>$langs->trans('No'), '1'=>$langs->trans('Yes')), $search_no_email);
|
||||
@ -751,7 +754,7 @@ if (!empty($arrayfields['p.phone_perso']['checked'])) print_liste_field_
|
||||
if (!empty($arrayfields['p.phone_mobile']['checked'])) print_liste_field_titre($arrayfields['p.phone_mobile']['label'], $_SERVER["PHP_SELF"], "p.phone_mobile", $begin, $param, '', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['p.fax']['checked'])) print_liste_field_titre($arrayfields['p.fax']['label'], $_SERVER["PHP_SELF"], "p.fax", $begin, $param, '', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['p.email']['checked'])) print_liste_field_titre($arrayfields['p.email']['label'], $_SERVER["PHP_SELF"], "p.email", $begin, $param, '', $sortfield, $sortorder);
|
||||
if (!empty($arrayfields['p.no_email']['checked'])) print_liste_field_titre($arrayfields['p.no_email']['label'], $_SERVER["PHP_SELF"], "p.no_email", $begin, $param, '', $sortfield, $sortorder, 'center ');
|
||||
if (!empty($arrayfields['unsubscribed']['checked'])) print_liste_field_titre($arrayfields['unsubscribed']['label'], $_SERVER["PHP_SELF"], "unsubscribed", $begin, $param, '', $sortfield, $sortorder, 'center ');
|
||||
if (!empty($conf->socialnetworks->enabled)) {
|
||||
foreach ($socialnetworks as $key => $value) {
|
||||
if ($value['active'] && !empty($arrayfields['p.'.$key]['checked'])) {
|
||||
@ -905,9 +908,9 @@ while ($i < min($num, $limit))
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
// No EMail
|
||||
if (!empty($arrayfields['p.no_email']['checked']))
|
||||
if (!empty($arrayfields['unsubscribed']['checked']))
|
||||
{
|
||||
print '<td class="center">'.yn($obj->no_email).'</td>';
|
||||
print '<td class="center">'.yn(($obj->unsubscribed > 0) ? 1 : 0).'</td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
if (!empty($conf->socialnetworks->enabled)) {
|
||||
|
||||
@ -1280,6 +1280,12 @@ if (!$error && ($massaction == 'delete' || ($action == 'delete' && $confirm == '
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($objectclass == 'Holiday' && ! in_array($objecttmp->statut, array(Holiday::STATUS_DRAFT, Holiday::STATUS_CANCELED, Holiday::STATUS_REFUSED))) {
|
||||
$nbignored++;
|
||||
setEventMessage($langs->trans('ErrorLeaveRequestMustBeDraftCanceledOrRefusedToBeDeleted', $objecttmp->ref));
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($objectclass == "Task" && $objecttmp->hasChildren() > 0)
|
||||
{
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."projet_task SET fk_task_parent = 0 WHERE fk_task_parent = ".$objecttmp->id;
|
||||
@ -1314,7 +1320,8 @@ if (!$error && ($massaction == 'delete' || ($action == 'delete' && $confirm == '
|
||||
if (!$error)
|
||||
{
|
||||
if ($nbok > 1) setEventMessages($langs->trans("RecordsDeleted", $nbok), null, 'mesgs');
|
||||
else setEventMessages($langs->trans("RecordDeleted", $nbok), null, 'mesgs');
|
||||
elseif ($nbok > 0) setEventMessages($langs->trans("RecordDeleted", $nbok), null, 'mesgs');
|
||||
else setEventMessages($langs->trans("NoRecordDeleted"), null, 'mesgs');
|
||||
$db->commit();
|
||||
}
|
||||
else
|
||||
|
||||
@ -80,5 +80,9 @@ if (($action == 'set') && !empty($id)) {
|
||||
|
||||
$format = 'int';
|
||||
|
||||
$object->table_element = $tablename;
|
||||
$object->id = $id;
|
||||
$object->fields[$field] = array('type' => $format, 'enabled' => 1);
|
||||
|
||||
$object->setValueFrom($field, $value, $tablename, $id, $format, '', $user, $triggerkey);
|
||||
}
|
||||
|
||||
@ -2055,7 +2055,8 @@ class ExtraFields
|
||||
foreach ($extralabels as $key => $value)
|
||||
{
|
||||
if (!empty($onlykey) && $onlykey != '@GETPOSTISSET' && $key != $onlykey) continue;
|
||||
if (!empty($onlykey) && $onlykey == '@GETPOSTISSET' && ! GETPOSTISSET('options_'.$key)) continue;
|
||||
//when unticking boolean field, it's not set in POST
|
||||
if (!empty($onlykey) && $onlykey == '@GETPOSTISSET' && ! GETPOSTISSET('options_'.$key) && $this->attributes[$object->table_element]['type'][$key] != 'boolean') continue;
|
||||
|
||||
$key_type = $this->attributes[$object->table_element]['type'][$key];
|
||||
if ($key_type == 'separate') continue;
|
||||
|
||||
@ -1,16 +1,17 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013-2015 Jean-François FERRY <hello@librethic.io>
|
||||
* Copyright (C) 2016 Christophe Battarel <christophe@altairis.fr>
|
||||
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
|
||||
/* Copyright (C) 2013-2015 Jean-François FERRY <hello@librethic.io>
|
||||
* Copyright (C) 2016 Christophe Battarel <christophe@altairis.fr>
|
||||
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
@ -351,12 +352,13 @@ class FormTicket
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($conf->projet->enabled) && !$this->ispublic)
|
||||
{
|
||||
$formproject = new FormProjets($this->db);
|
||||
print '<tr><td><label for="project"><span class="">'.$langs->trans("Project").'</span></label></td><td>';
|
||||
print $formproject->select_projects(-1, GETPOST('projectid', 'int'), 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 0, 0, 'maxwidth500');
|
||||
print '</td></tr>';
|
||||
if($subelement != 'project') {
|
||||
if (!empty($conf->projet->enabled) && !$this->ispublic) {
|
||||
$formproject = new FormProjets($this->db);
|
||||
print '<tr><td><label for="project"><span class="">' . $langs->trans("Project") . '</span></label></td><td>';
|
||||
print $formproject->select_projects(-1, GETPOST('projectid', 'int'), 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 0, 0, 'maxwidth500');
|
||||
print '</td></tr>';
|
||||
}
|
||||
}
|
||||
|
||||
// Attached files
|
||||
|
||||
@ -346,17 +346,19 @@ class Utils
|
||||
{
|
||||
$handlein = popen($fullcommandclear, 'r');
|
||||
$i = 0;
|
||||
while (!feof($handlein))
|
||||
{
|
||||
$i++; // output line number
|
||||
$read = fgets($handlein);
|
||||
// Exclude warning line we don't want
|
||||
if ($i == 1 && preg_match('/Warning.*Using a password/i', $read)) continue;
|
||||
fwrite($handle, $read);
|
||||
if (preg_match('/'.preg_quote('-- Dump completed').'/i', $read)) $ok = 1;
|
||||
elseif (preg_match('/'.preg_quote('SET SQL_NOTES=@OLD_SQL_NOTES').'/i', $read)) $ok = 1;
|
||||
if ($handlein) {
|
||||
while (!feof($handlein))
|
||||
{
|
||||
$i++; // output line number
|
||||
$read = fgets($handlein);
|
||||
// Exclude warning line we don't want
|
||||
if ($i == 1 && preg_match('/Warning.*Using a password/i', $read)) continue;
|
||||
fwrite($handle, $read);
|
||||
if (preg_match('/'.preg_quote('-- Dump completed').'/i', $read)) $ok = 1;
|
||||
elseif (preg_match('/'.preg_quote('SET SQL_NOTES=@OLD_SQL_NOTES').'/i', $read)) $ok = 1;
|
||||
}
|
||||
pclose($handlein);
|
||||
}
|
||||
pclose($handlein);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -308,16 +308,20 @@ abstract class DoliDB implements Database
|
||||
* Note : This method executes a given SQL query and retrieves the first row of results as an object. It should only be used with SELECT queries
|
||||
* Dont add LIMIT to your query, it will be added by this method
|
||||
* @param string $sql the sql query string
|
||||
* @return bool| object
|
||||
* @return bool|int|object false on failure, 0 on empty, object on success
|
||||
*/
|
||||
public function getRow($sql)
|
||||
{
|
||||
$sql .= ' LIMIT 1;';
|
||||
$sql .= ' LIMIT 1';
|
||||
|
||||
$res = $this->query($sql);
|
||||
if ($res)
|
||||
{
|
||||
return $this->fetch_object($res);
|
||||
if ($res) {
|
||||
$obj = $this->fetch_object($res);
|
||||
if ($obj) {
|
||||
return $obj;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
@ -40,6 +40,30 @@
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/json.lib.php';
|
||||
|
||||
|
||||
/**
|
||||
* Return dolibarr global constant string value
|
||||
* @param string $key key to return value, return '' if not set
|
||||
* @return string
|
||||
*/
|
||||
function getDolGlobalString($key)
|
||||
{
|
||||
global $conf;
|
||||
// return $conf->global->$key ?? '';
|
||||
return (string) (empty($conf->global->$key) ? '' : $conf->global->$key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return dolibarr global constant int value
|
||||
* @param string $key key to return value, return 0 if not set
|
||||
* @return int
|
||||
*/
|
||||
function getDolGlobalInt($key)
|
||||
{
|
||||
global $conf;
|
||||
// return $conf->global->$key ?? 0;
|
||||
return (int) (empty($conf->global->$key) ? 0 : $conf->global->$key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a DoliDB instance (database handler).
|
||||
*
|
||||
@ -4760,7 +4784,7 @@ function price2num($amount, $rounding = '', $option = 0)
|
||||
$nbofdectoround = '';
|
||||
if ($rounding == 'MU') $nbofdectoround = $conf->global->MAIN_MAX_DECIMALS_UNIT;
|
||||
elseif ($rounding == 'MT') $nbofdectoround = $conf->global->MAIN_MAX_DECIMALS_TOT;
|
||||
elseif ($rounding == 'MS') $nbofdectoround = empty($conf->global->MAIN_MAX_DECIMALS_STOCK) ? 5 : $conf->global->MAIN_MAX_DECIMALS_STOCK;
|
||||
elseif ($rounding == 'MS') $nbofdectoround = !isset($conf->global->MAIN_MAX_DECIMALS_STOCK) ? 5 : $conf->global->MAIN_MAX_DECIMALS_STOCK;
|
||||
elseif ($rounding == 'CR') $nbofdectoround = 8;
|
||||
elseif (is_numeric($rounding)) $nbofdectoround = $rounding;
|
||||
//print "RR".$amount.' - '.$nbofdectoround.'<br>';
|
||||
|
||||
@ -1937,7 +1937,7 @@ function pdf_getlineprogress($object, $i, $outputlangs, $hidedetails = 0, $hookm
|
||||
if ($conf->global->SITUATION_DISPLAY_DIFF_ON_PDF)
|
||||
{
|
||||
$prev_progress = 0;
|
||||
if (method_exists($object, 'get_prev_progress'))
|
||||
if (method_exists($object->lines[$i], 'get_prev_progress'))
|
||||
{
|
||||
$prev_progress = $object->lines[$i]->get_prev_progress($object->id);
|
||||
}
|
||||
|
||||
@ -79,8 +79,8 @@ class mailing_contacts1 extends MailingTargets
|
||||
$statssql[0] .= " count(distinct(c.email)) as nb";
|
||||
$statssql[0] .= " FROM ".MAIN_DB_PREFIX."socpeople as c";
|
||||
$statssql[0] .= " WHERE c.entity IN (".getEntity('socpeople').")";
|
||||
$statssql[0] .= " AND c.email != ''"; // Note that null != '' is false
|
||||
$statssql[0] .= " AND c.no_email = 0";
|
||||
$statssql[0] .= " AND c.email <> ''"; // Note that null != '' is false
|
||||
$statssql[0] .= " AND (SELECT count(*) FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE email = c.email) = 0";
|
||||
$statssql[0] .= " AND c.statut = 1";
|
||||
|
||||
return $statssql;
|
||||
@ -103,8 +103,7 @@ class mailing_contacts1 extends MailingTargets
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."socpeople as c";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = c.fk_soc";
|
||||
$sql .= " WHERE c.entity IN (".getEntity('socpeople').")";
|
||||
$sql .= " AND c.email != ''"; // Note that null != '' is false
|
||||
$sql .= " AND c.no_email = 0";
|
||||
$sql .= " AND c.email <> ''"; // Note that null != '' is false
|
||||
$sql .= " AND (SELECT count(*) FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE email = c.email) = 0";
|
||||
// exclude unsubscribed users
|
||||
$sql .= " AND c.statut = 1";
|
||||
@ -132,10 +131,9 @@ class mailing_contacts1 extends MailingTargets
|
||||
$sql = "SELECT sp.poste, count(distinct(sp.email)) AS nb";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."socpeople as sp";
|
||||
$sql .= " WHERE sp.entity IN (".getEntity('socpeople').")";
|
||||
/*$sql.= " AND sp.email != ''"; // Note that null != '' is false
|
||||
$sql.= " AND sp.no_email = 0";
|
||||
$sql.= " AND sp.statut = 1";*/
|
||||
$sql .= " AND (sp.poste IS NOT NULL AND sp.poste != '')";
|
||||
$sql .= " AND sp.email <> ''"; // Note that null != '' is false
|
||||
$sql .= " AND sp.statut = 1";
|
||||
$sql .= " AND (sp.poste IS NOT NULL AND sp.poste <> '')";
|
||||
$sql .= " GROUP BY sp.poste";
|
||||
$sql .= " ORDER BY sp.poste";
|
||||
$resql = $this->db->query($sql);
|
||||
@ -166,10 +164,9 @@ class mailing_contacts1 extends MailingTargets
|
||||
$sql .= " ".MAIN_DB_PREFIX."socpeople as sp,";
|
||||
$sql .= " ".MAIN_DB_PREFIX."categorie as c,";
|
||||
$sql .= " ".MAIN_DB_PREFIX."categorie_contact as cs";
|
||||
$sql .= " WHERE sp.statut = 1"; // Note that null != '' is false
|
||||
//$sql.= " AND sp.no_email = 0";
|
||||
//$sql.= " AND sp.email != ''";
|
||||
//$sql.= " AND sp.entity IN (".getEntity('socpeople').")";
|
||||
$sql .= " WHERE sp.entity IN (".getEntity('socpeople').")";
|
||||
$sql .= " AND sp.email <> ''"; // Note that null != '' is false
|
||||
$sql .= " AND sp.statut = 1";
|
||||
$sql .= " AND cs.fk_categorie = c.rowid";
|
||||
$sql .= " AND cs.fk_socpeople = sp.rowid";
|
||||
$sql .= " GROUP BY c.label";
|
||||
@ -241,10 +238,9 @@ class mailing_contacts1 extends MailingTargets
|
||||
$sql .= " ".MAIN_DB_PREFIX."socpeople as sp,";
|
||||
$sql .= " ".MAIN_DB_PREFIX."categorie as c,";
|
||||
$sql .= " ".MAIN_DB_PREFIX."categorie_societe as cs";
|
||||
$sql .= " WHERE sp.statut = 1"; // Note that null != '' is false
|
||||
//$sql.= " AND sp.no_email = 0";
|
||||
//$sql.= " AND sp.email != ''";
|
||||
//$sql.= " AND sp.entity IN (".getEntity('socpeople').")";
|
||||
$sql .= " WHERE sp.entity IN (".getEntity('socpeople').")";
|
||||
$sql .= " AND sp.email <> ''"; // Note that null != '' is false
|
||||
$sql .= " AND sp.statut = 1";
|
||||
$sql .= " AND cs.fk_categorie = c.rowid";
|
||||
$sql .= " AND cs.fk_soc = sp.fk_soc";
|
||||
$sql .= " GROUP BY c.label";
|
||||
@ -283,10 +279,9 @@ class mailing_contacts1 extends MailingTargets
|
||||
$sql .= " ".MAIN_DB_PREFIX."socpeople as sp,";
|
||||
$sql .= " ".MAIN_DB_PREFIX."categorie as c,";
|
||||
$sql .= " ".MAIN_DB_PREFIX."categorie_fournisseur as cs";
|
||||
$sql .= " WHERE sp.statut = 1"; // Note that null != '' is false
|
||||
//$sql.= " AND sp.no_email = 0";
|
||||
//$sql.= " AND sp.email != ''";
|
||||
//$sql.= " AND sp.entity IN (".getEntity('socpeople').")";
|
||||
$sql .= " WHERE sp.entity IN (".getEntity('socpeople').")";
|
||||
$sql .= " AND sp.email <> ''"; // Note that null != '' is false
|
||||
$sql .= " AND sp.statut = 1";
|
||||
$sql .= " AND cs.fk_categorie = c.rowid";
|
||||
$sql .= " AND cs.fk_soc = sp.fk_soc";
|
||||
$sql .= " GROUP BY c.label";
|
||||
@ -385,7 +380,6 @@ class mailing_contacts1 extends MailingTargets
|
||||
if ($filter_category_supplier <> 'all') $sql .= ", ".MAIN_DB_PREFIX."categorie_fournisseur as c3s";
|
||||
$sql .= " WHERE sp.entity IN (".getEntity('socpeople').")";
|
||||
$sql .= " AND sp.email <> ''";
|
||||
$sql .= " AND sp.no_email = 0";
|
||||
$sql .= " AND (SELECT count(*) FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE email = sp.email) = 0";
|
||||
// Exclude unsubscribed email adresses
|
||||
$sql .= " AND sp.statut = 1";
|
||||
|
||||
@ -209,24 +209,6 @@ class MailingTargets // This can't be abstract as it is used for some method
|
||||
|
||||
dol_syslog(__METHOD__.": mailing ".$j." targets added");
|
||||
|
||||
/*
|
||||
//Update the status to show thirdparty mail that don't want to be contacted anymore'
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."mailing_cibles";
|
||||
$sql .= " SET statut=3";
|
||||
$sql .= " WHERE fk_mailing=".$mailing_id." AND email in (SELECT email FROM ".MAIN_DB_PREFIX."societe where fk_stcomm=-1)";
|
||||
$sql .= " AND source_type='thirdparty'";
|
||||
dol_syslog(__METHOD__.": mailing update status to display thirdparty mail that do not want to be contacted");
|
||||
$result=$this->db->query($sql);
|
||||
|
||||
//Update the status to show contact mail that don't want to be contacted anymore'
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."mailing_cibles";
|
||||
$sql .= " SET statut=3";
|
||||
$sql .= " WHERE fk_mailing=".$mailing_id." AND source_type='contact' AND (email in (SELECT sc.email FROM ".MAIN_DB_PREFIX."socpeople AS sc ";
|
||||
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe s ON s.rowid=sc.fk_soc WHERE s.fk_stcomm=-1 OR no_email=1))";
|
||||
dol_syslog(__METHOD__.": mailing update status to display contact mail that do not want to be contacted",LOG_DEBUG);
|
||||
$result=$this->db->query($sql);
|
||||
*/
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."mailing_cibles";
|
||||
$sql .= " SET statut=3";
|
||||
$sql .= " WHERE fk_mailing=".$mailing_id." AND email IN (SELECT mu.email FROM ".MAIN_DB_PREFIX."mailing_unsubscribe AS mu WHERE mu.entity IN ('".getEntity('mailing')."'))";
|
||||
|
||||
@ -329,7 +329,7 @@ class modAdherent extends DolibarrModules
|
||||
'a.datec'=>'DateCreation', 'a.datefin'=>'DateEndSubscription'
|
||||
);
|
||||
// Add extra fields
|
||||
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'adherent' AND entity IN (0,".$conf->entity.")";
|
||||
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE type != 'separate' AND elementtype = 'adherent' AND entity IN (0,".$conf->entity.")";
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) // This can fail when class is used on old database (during migration for example)
|
||||
{
|
||||
|
||||
@ -491,7 +491,7 @@ class modProduct extends DolibarrModules
|
||||
if (!empty($conf->global->PRODUCT_USE_UNITS)) $this->import_fields_array[$r]['p.fk_unit'] = 'Unit';
|
||||
// Add extra fields
|
||||
$import_extrafield_sample = array();
|
||||
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'product' AND entity IN (0, ".$conf->entity.")";
|
||||
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE type != 'separate' AND elementtype = 'product' AND entity IN (0, ".$conf->entity.")";
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) // This can fail when class is used on old database (during migration for example)
|
||||
{
|
||||
|
||||
@ -293,7 +293,7 @@ class modProjet extends DolibarrModules
|
||||
$this->import_tables_array[$r] = array('t'=>MAIN_DB_PREFIX.'projet_task', 'extra'=>MAIN_DB_PREFIX.'projet_task_extrafields'); // List of tables to insert into (insert done in same order)
|
||||
$this->import_fields_array[$r] = array('t.fk_projet'=>'ProjectRef*', 't.ref'=>'RefTask*', 't.label'=>'LabelTask*', 't.dateo'=>"DateStart", 't.datee'=>"DateEnd", 't.planned_workload'=>"PlannedWorkload", 't.progress'=>"Progress", 't.note_private'=>"NotePrivate", 't.note_public'=>"NotePublic", 't.datec'=>"DateCreation");
|
||||
// Add extra fields
|
||||
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'projet_task' AND entity IN (0,".$conf->entity.")";
|
||||
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE type != 'separate' AND elementtype = 'projet_task' AND entity IN (0,".$conf->entity.")";
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) // This can fail when class is used on old database (during migration for example)
|
||||
{
|
||||
|
||||
@ -156,7 +156,8 @@ class modPropale extends DolibarrModules
|
||||
$this->rights[$r][1] = 'Close commercial proposals'; // libelle de la permission
|
||||
$this->rights[$r][2] = 'd'; // type de la permission (deprecie a ce jour)
|
||||
$this->rights[$r][3] = 0; // La permission est-elle une permission par defaut
|
||||
$this->rights[$r][4] = 'cloturer';
|
||||
$this->rights[$r][4] = 'propal_advance';
|
||||
$this->rights[$r][5] = 'close';
|
||||
|
||||
$r++;
|
||||
$this->rights[$r][0] = 27; // id de la permission
|
||||
|
||||
@ -265,7 +265,7 @@ class modResource extends DolibarrModules
|
||||
$this->import_tables_array[$r] = array('r'=>MAIN_DB_PREFIX.'resource', 'extra'=>MAIN_DB_PREFIX.'resource_extrafields'); // List of tables to insert into (insert done in same order)
|
||||
$this->import_fields_array[$r] = array('r.ref'=>"ResourceFormLabel_ref*", 'r.fk_code_type_resource'=>'ResourceTypeCode', 'r.description'=>'ResourceFormLabel_description', 'r.note_private'=>"NotePrivate", 'r.note_public'=>"NotePublic", 'r.asset_number'=>'AssetNumber', 'r.datec'=>'DateCreation');
|
||||
// Add extra fields
|
||||
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'resource' AND entity IN (0,".$conf->entity.")";
|
||||
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE type != 'separate' AND elementtype = 'resource' AND entity IN (0,".$conf->entity.")";
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) // This can fail when class is used on old database (during migration for example)
|
||||
{
|
||||
|
||||
@ -459,7 +459,7 @@ class modService extends DolibarrModules
|
||||
if (!empty($conf->global->PRODUCT_USE_UNITS)) $this->import_fields_array[$r]['p.fk_unit'] = 'Unit';
|
||||
// Add extra fields
|
||||
$import_extrafield_sample = array();
|
||||
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'product' AND entity IN (0,".$conf->entity.")";
|
||||
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE type != 'separate' AND elementtype = 'product' AND entity IN (0,".$conf->entity.")";
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) // This can fail when class is used on old database (during migration for example)
|
||||
{
|
||||
|
||||
@ -453,7 +453,7 @@ class modSociete extends DolibarrModules
|
||||
);
|
||||
if (!empty($conf->global->PRODUIT_MULTIPRICES)) $this->import_fields_array[$r]['s.price_level'] = 'PriceLevel';
|
||||
// Add extra fields
|
||||
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'societe' AND entity IN (0, ".$conf->entity.")";
|
||||
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE type != 'separate' AND elementtype = 'societe' AND entity IN (0, ".$conf->entity.")";
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) // This can fail when class is used on old database (during migration for example)
|
||||
{
|
||||
@ -602,7 +602,7 @@ class modSociete extends DolibarrModules
|
||||
's.note_public' => "NotePublic"
|
||||
);
|
||||
// Add extra fields
|
||||
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'socpeople' AND entity IN (0, ".$conf->entity.")";
|
||||
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE type != 'separate' AND elementtype = 'socpeople' AND entity IN (0, ".$conf->entity.")";
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) // This can fail when class is used on an old database (during a migration for example)
|
||||
{
|
||||
|
||||
@ -291,7 +291,7 @@ class modUser extends DolibarrModules
|
||||
'u.statut'=>'Status'
|
||||
);
|
||||
// Add extra fields
|
||||
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'user' AND entity IN (0,".$conf->entity.")";
|
||||
$sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE type != 'separate' AND elementtype = 'user' AND entity IN (0,".$conf->entity.")";
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) // This can fail when class is used on old database (during migration for example)
|
||||
{
|
||||
|
||||
@ -1235,26 +1235,30 @@ class pdf_cornas extends ModelePDFSuppliersOrders
|
||||
$pdf->SetXY($this->marge_gauche, $posy);
|
||||
|
||||
// Logo
|
||||
$logo = $conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo;
|
||||
if ($this->emetteur->logo)
|
||||
{
|
||||
if (is_readable($logo))
|
||||
{
|
||||
$height = pdf_getHeightForLogo($logo);
|
||||
$pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto)
|
||||
if (empty($conf->global->PDF_DISABLE_MYCOMPANY_LOGO)) {
|
||||
if ($this->emetteur->logo) {
|
||||
$logodir = $conf->mycompany->dir_output;
|
||||
if (!empty($conf->mycompany->multidir_output[$object->entity])) $logodir = $conf->mycompany->multidir_output[$object->entity];
|
||||
if (empty($conf->global->MAIN_PDF_USE_LARGE_LOGO))
|
||||
{
|
||||
$logo = $logodir.'/logos/thumbs/'.$this->emetteur->logo_small;
|
||||
}
|
||||
else {
|
||||
$logo = $logodir.'/logos/'.$this->emetteur->logo;
|
||||
}
|
||||
if (is_readable($logo)) {
|
||||
$height = pdf_getHeightForLogo($logo);
|
||||
$pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto)
|
||||
} else {
|
||||
$pdf->SetTextColor(200, 0, 0);
|
||||
$pdf->SetFont('', 'B', $default_font_size - 2);
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L');
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToModuleSetup"), 0, 'L');
|
||||
}
|
||||
} else {
|
||||
$text = $this->emetteur->name;
|
||||
$pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L');
|
||||
}
|
||||
else
|
||||
{
|
||||
$pdf->SetTextColor(200, 0, 0);
|
||||
$pdf->SetFont('', 'B', $default_font_size - 2);
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L');
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToModuleSetup"), 0, 'L');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$text = $this->emetteur->name;
|
||||
$pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L');
|
||||
}
|
||||
|
||||
$pdf->SetFont('', 'B', $default_font_size + 3);
|
||||
|
||||
@ -1151,26 +1151,28 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
|
||||
$pdf->SetXY($this->marge_gauche, $posy);
|
||||
|
||||
// Logo
|
||||
$logo = $conf->mycompany->dir_output.'/logos/'.$this->emetteur->logo;
|
||||
if ($this->emetteur->logo)
|
||||
{
|
||||
if (is_readable($logo))
|
||||
{
|
||||
$height = pdf_getHeightForLogo($logo);
|
||||
$pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto)
|
||||
if (empty($conf->global->PDF_DISABLE_MYCOMPANY_LOGO)) {
|
||||
if ($this->emetteur->logo) {
|
||||
$logodir = $conf->mycompany->dir_output;
|
||||
if (!empty($conf->mycompany->multidir_output[$object->entity])) $logodir = $conf->mycompany->multidir_output[$object->entity];
|
||||
if (empty($conf->global->MAIN_PDF_USE_LARGE_LOGO)) {
|
||||
$logo = $logodir . '/logos/thumbs/' . $this->emetteur->logo_small;
|
||||
} else {
|
||||
$logo = $logodir . '/logos/' . $this->emetteur->logo;
|
||||
}
|
||||
if (is_readable($logo)) {
|
||||
$height = pdf_getHeightForLogo($logo);
|
||||
$pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto)
|
||||
} else {
|
||||
$pdf->SetTextColor(200, 0, 0);
|
||||
$pdf->SetFont('', 'B', $default_font_size - 2);
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L');
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToModuleSetup"), 0, 'L');
|
||||
}
|
||||
} else {
|
||||
$text = $this->emetteur->name;
|
||||
$pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L');
|
||||
}
|
||||
else
|
||||
{
|
||||
$pdf->SetTextColor(200, 0, 0);
|
||||
$pdf->SetFont('', 'B', $default_font_size - 2);
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L');
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToModuleSetup"), 0, 'L');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$text = $this->emetteur->name;
|
||||
$pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L');
|
||||
}
|
||||
|
||||
$pdf->SetFont('', 'B', $default_font_size + 3);
|
||||
|
||||
@ -79,7 +79,11 @@ class InterfaceContactRoles extends DolibarrTriggers
|
||||
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
|
||||
$contactdefault = new Contact($this->db);
|
||||
$contactdefault->socid = $socid;
|
||||
$TContact = $contactdefault->getContactRoles($object->element);
|
||||
|
||||
$TContact = array();
|
||||
if (method_exists($contactdefault, 'getContactRoles')) { // For backward compatibility
|
||||
$TContact = $contactdefault->getContactRoles($object->element);
|
||||
}
|
||||
|
||||
if (is_array($TContact) && !empty($TContact)) {
|
||||
$TContactAlreadyLinked = array();
|
||||
|
||||
@ -268,11 +268,11 @@ class DataPolicy
|
||||
{
|
||||
if ($sendtocc)
|
||||
{
|
||||
$actionmsg .= dol_concatdesc($actionmsg, $langs->transnoentities('Bcc').": ".$sendtocc);
|
||||
$actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('Bcc').": ".$sendtocc);
|
||||
}
|
||||
$actionmsg .= dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic').": ".$subject);
|
||||
$actionmsg .= dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody').":");
|
||||
$actionmsg .= dol_concatdesc($actionmsg, $message);
|
||||
$actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic').": ".$subject);
|
||||
$actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody') . ":");
|
||||
$actionmsg = dol_concatdesc($actionmsg, $message);
|
||||
}
|
||||
|
||||
// Send mail
|
||||
@ -342,11 +342,11 @@ class DataPolicy
|
||||
$actionmsg = $langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto;
|
||||
if ($message) {
|
||||
if ($sendtocc) {
|
||||
$actionmsg .= dol_concatdesc($actionmsg, $langs->transnoentities('Bcc').": ".$sendtocc);
|
||||
$actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('Bcc').": ".$sendtocc);
|
||||
}
|
||||
$actionmsg .= dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic').": ".$subject);
|
||||
$actionmsg .= dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody').":");
|
||||
$actionmsg .= dol_concatdesc($actionmsg, $message);
|
||||
$actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic').": ".$subject);
|
||||
$actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody') . ":");
|
||||
$actionmsg = dol_concatdesc($actionmsg, $message);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -72,7 +72,7 @@ class DolLogsCollector extends MessagesCollector
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$uselogfile = $conf->global->DEBUGBAR_USE_LOGFILE;
|
||||
$uselogfile = $conf->global->DEBUGBAR_USE_LOG_FILE;
|
||||
|
||||
if ($uselogfile)
|
||||
{
|
||||
|
||||
@ -118,7 +118,7 @@ if ($action == 'update')
|
||||
$object->modepaymentid = GETPOST('modepayment', 'int');
|
||||
|
||||
// Fill array 'array_options' with data from add form
|
||||
$ret = $extrafields->setOptionalsFromPost(null, $object);
|
||||
$ret = $extrafields->setOptionalsFromPost(null, $object, '@GETPOSTISSET');
|
||||
if ($ret < 0) $error++;
|
||||
|
||||
if ($object->update($user) > 0)
|
||||
|
||||
@ -1245,13 +1245,17 @@ if ($action == 'create')
|
||||
{
|
||||
// Quantity to send
|
||||
print '<td class="center">';
|
||||
if ($line->product_type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES))
|
||||
{
|
||||
if (GETPOST('qtyl'.$indiceAsked, 'int')) $deliverableQty = GETPOST('qtyl'.$indiceAsked, 'int');
|
||||
print '<input name="idl'.$indiceAsked.'" type="hidden" value="'.$line->id.'">';
|
||||
print '<input name="idl'.$indiceAsked.'" type="hidden" value="'.$line->id.'">';
|
||||
if ($line->product_type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
|
||||
if (GETPOST('qtyl'.$indiceAsked, 'int')) $deliverableQty = GETPOST('qtyl'.$indiceAsked, 'int');
|
||||
print '<input name="qtyl'.$indiceAsked.'" id="qtyl'.$indiceAsked.'" type="text" size="4" value="'.$deliverableQty.'">';
|
||||
} else {
|
||||
if (! empty($conf->global->SHIPMENT_GETS_ALL_ORDER_PRODUCTS)) {
|
||||
print '<input name="qtyl'.$indiceAsked.'" id="qtyl'.$indiceAsked.'" type="hidden" value="0">';
|
||||
}
|
||||
|
||||
print $langs->trans("NA");
|
||||
}
|
||||
else print $langs->trans("NA");
|
||||
print '</td>';
|
||||
|
||||
// Stock
|
||||
@ -1420,8 +1424,13 @@ if ($action == 'create')
|
||||
{
|
||||
print '<input name="qtyl'.$indiceAsked.'_'.$subj.'" id="qtyl'.$indiceAsked.'" type="text" size="4" value="'.$deliverableQty.'">';
|
||||
print '<input name="ent1'.$indiceAsked.'_'.$subj.'" type="hidden" value="'.$warehouse_id.'">';
|
||||
} else {
|
||||
if (! empty($conf->global->SHIPMENT_GETS_ALL_ORDER_PRODUCTS)) {
|
||||
print '<input name="qtyl'.$indiceAsked.'_'.$subj.'" id="qtyl'.$indiceAsked.'" type="hidden" value="0">';
|
||||
}
|
||||
|
||||
print $langs->trans("NA");
|
||||
}
|
||||
else print $langs->trans("NA");
|
||||
print '</td>';
|
||||
|
||||
// Stock
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2014-2017 Francis Appels <francis.appels@yahoo.com>
|
||||
* Copyright (C) 2015 Claudio Aschieri <c.aschieri@19.coop>
|
||||
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2016-2021 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2020 Lenin Rivas <lenin@leninrivas.com>
|
||||
@ -364,14 +364,14 @@ class Expedition extends CommonObject
|
||||
{
|
||||
if (!isset($this->lines[$i]->detail_batch))
|
||||
{ // no batch management
|
||||
if (!$this->create_line($this->lines[$i]->entrepot_id, $this->lines[$i]->origin_line_id, $this->lines[$i]->qty, $this->lines[$i]->rang, $this->lines[$i]->array_options) > 0)
|
||||
if ($this->create_line($this->lines[$i]->entrepot_id, $this->lines[$i]->origin_line_id, $this->lines[$i]->qty, $this->lines[$i]->rang, $this->lines[$i]->array_options) <= 0)
|
||||
{
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{ // with batch management
|
||||
if (!$this->create_line_batch($this->lines[$i], $this->lines[$i]->array_options) > 0)
|
||||
if ($this->create_line_batch($this->lines[$i], $this->lines[$i]->array_options) <= 0)
|
||||
{
|
||||
$error++;
|
||||
}
|
||||
@ -423,7 +423,6 @@ class Expedition extends CommonObject
|
||||
else
|
||||
{
|
||||
$error++;
|
||||
$this->error = $this->db->lasterror()." - sql=$sql";
|
||||
$this->db->rollback();
|
||||
return -3;
|
||||
}
|
||||
|
||||
@ -2235,7 +2235,7 @@ class ExpenseReport extends CommonObject
|
||||
$sql = "SELECT DISTINCT ur.fk_user";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."user_rights as ur, ".MAIN_DB_PREFIX."rights_def as rd";
|
||||
$sql .= " WHERE ur.fk_id = rd.id and rd.module = 'expensereport' AND rd.perms = 'approve'"; // Permission 'Approve';
|
||||
$sql .= "UNION";
|
||||
$sql .= " UNION";
|
||||
$sql .= " SELECT DISTINCT ugu.fk_user";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."usergroup_user as ugu, ".MAIN_DB_PREFIX."usergroup_rights as ur, ".MAIN_DB_PREFIX."rights_def as rd";
|
||||
$sql .= " WHERE ugu.fk_usergroup = ur.fk_usergroup AND ur.fk_id = rd.id and rd.module = 'expensereport' AND rd.perms = 'approve'"; // Permission 'Approve';
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||
* Copyright (C) 2018-2019 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2018-2021 Ferran Marcet <fmarcet@2byte.es>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -460,13 +460,18 @@ class CommandeFournisseur extends CommonOrder
|
||||
$sql .= " l.date_start, l.date_end,";
|
||||
$sql .= ' l.fk_multicurrency, l.multicurrency_code, l.multicurrency_subprice, l.multicurrency_total_ht, l.multicurrency_total_tva, l.multicurrency_total_ttc';
|
||||
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING))
|
||||
$sql .= ", pfp.rowid as fk_pfp, pfp.packaging";
|
||||
$sql .= ", pfp.rowid as fk_pfp, pfp.packaging, MAX(pfp.quantity) as max_qty";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as l";
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product = p.rowid';
|
||||
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING))
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON l.fk_product = pfp.fk_product and l.ref = pfp.ref_fourn AND pfp.fk_soc = ".$this->socid;
|
||||
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) {
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON pfp.entity IN (".getEntity('product_fournisseur_price').") AND l.fk_product = pfp.fk_product and l.ref = pfp.ref_fourn AND pfp.fk_soc = ".((int) $this->socid);
|
||||
}
|
||||
$sql .= " WHERE l.fk_commande = ".$this->id;
|
||||
if ($only_product) $sql .= ' AND p.fk_product_type = 0';
|
||||
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) {
|
||||
$sql.= " AND l.qty >= pfp.quantity ";
|
||||
$sql.= " GROUP BY l.rowid HAVING max_qty = MAX(pfp.quantity) ";
|
||||
}
|
||||
$sql .= " ORDER BY l.rang, l.rowid";
|
||||
//print $sql;
|
||||
|
||||
@ -2904,11 +2909,11 @@ class CommandeFournisseur extends CommonOrder
|
||||
if ($obj->fk_user_approve) $this->user_approve_id = $obj->fk_user_approve;
|
||||
if ($obj->fk_user_approve2) $this->user_approve_id2 = $obj->fk_user_approve2;
|
||||
|
||||
$this->date_creation = $this->db->idate($obj->datec);
|
||||
$this->date_modification = $this->db->idate($obj->datem);
|
||||
$this->date_approve = $this->db->idate($obj->datea);
|
||||
$this->date_approve2 = $this->db->idate($obj->datea2);
|
||||
$this->date_validation = $this->db->idate($obj->date_validation);
|
||||
$this->date_creation = $this->db->jdate($obj->datec);
|
||||
$this->date_modification = $this->db->jdate($obj->datem);
|
||||
$this->date_approve = $this->db->jdate($obj->datea);
|
||||
$this->date_approve2 = $this->db->jdate($obj->datea2);
|
||||
$this->date_validation = $this->db->jdate($obj->date_validation);
|
||||
}
|
||||
$this->db->free($result);
|
||||
}
|
||||
@ -3488,12 +3493,15 @@ class CommandeFournisseurLigne extends CommonOrderLine
|
||||
$sql .= ' cd.date_start, cd.date_end, cd.fk_unit,';
|
||||
$sql .= ' cd.multicurrency_subprice, cd.multicurrency_total_ht, cd.multicurrency_total_tva, cd.multicurrency_total_ttc';
|
||||
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING))
|
||||
$sql .= ", pfp.rowid as fk_pfp, pfp.packaging";
|
||||
$sql .= ", pfp.rowid as fk_pfp, pfp.packaging, MAX(pfp.quantity) as max_qty";
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'commande_fournisseurdet as cd';
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON cd.fk_product = p.rowid';
|
||||
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING))
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON cd.fk_product = pfp.fk_product and cd.ref = pfp.ref_fourn";
|
||||
$sql .= ' WHERE cd.rowid = '.$rowid;
|
||||
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) {
|
||||
$sql .= " AND cd.qty >= pfp.quantity GROUP BY cd.rowid HAVING max_qty = MAX(pfp.quantity)";
|
||||
}
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2014-2016 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2015 Bahfir Abbes <bafbes@gmail.com>
|
||||
* Copyright (C) 2015-2019 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2015-2021 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2016 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||
* Copyright (C) 2018-2020 Frédéric France <frederic.france@netlogic.fr>
|
||||
@ -2144,8 +2144,8 @@ class FactureFournisseur extends CommonInvoice
|
||||
$muser->fetch($obj->fk_user_modif);
|
||||
$this->user_modification = $muser;
|
||||
}
|
||||
$this->date_creation = $this->db->idate($obj->datec);
|
||||
$this->date_modification = $this->db->idate($obj->datem);
|
||||
$this->date_creation = $this->db->jdate($obj->datec);
|
||||
$this->date_modification = $this->db->jdate($obj->datem);
|
||||
//$this->date_validation = $obj->datev; // This field is not available. Should be store into log table and using this function should be replaced with showing content of log (like for supplier orders)
|
||||
}
|
||||
$this->db->free($result);
|
||||
|
||||
@ -792,8 +792,7 @@ if (empty($reshook))
|
||||
{
|
||||
$db->rollback();
|
||||
|
||||
dol_print_error($db, $object->error);
|
||||
exit;
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
@ -805,6 +804,8 @@ if (empty($reshook))
|
||||
$result = $object->deleteline($lineid);
|
||||
if ($result > 0)
|
||||
{
|
||||
// reorder lines
|
||||
$object->line_order(true);
|
||||
// Define output language
|
||||
$outputlangs = $langs;
|
||||
$newlang = '';
|
||||
|
||||
@ -501,7 +501,7 @@ $help_url = '';
|
||||
// llxHeader('',$title,$help_url);
|
||||
|
||||
$sql = 'SELECT';
|
||||
if ($sall || $search_product_category > 0 || $search_user > 0) $sql = 'SELECT DISTINCT';
|
||||
if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT';
|
||||
$sql .= ' s.rowid as socid, s.nom as name, s.town, s.zip, s.fk_pays, s.client, s.code_client, s.email,';
|
||||
$sql .= " typent.code as typent_code,";
|
||||
$sql .= " state.code_departement as state_code, state.nom as state_name,";
|
||||
@ -531,11 +531,6 @@ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON cf.fk_user_author = u.rowid";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet as p ON p.rowid = cf.fk_projet";
|
||||
// We'll need this table joined to the select in order to filter by sale
|
||||
if ($search_sale > 0 || (!$user->rights->societe->client->voir && !$socid)) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
if ($search_user > 0)
|
||||
{
|
||||
$sql .= ", ".MAIN_DB_PREFIX."element_contact as ec";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."c_type_contact as tc";
|
||||
}
|
||||
$sql .= ' WHERE cf.fk_soc = s.rowid';
|
||||
$sql .= ' AND cf.entity IN ('.getEntity('supplier_order').')';
|
||||
if ($socid > 0) $sql .= " AND s.rowid = ".$socid;
|
||||
@ -561,7 +556,15 @@ if ($search_country) $sql .= " AND s.fk_pays IN (".$db->escape($search_country).
|
||||
if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$db->escape($search_type_thirdparty).')';
|
||||
if ($search_company) $sql .= natural_search('s.nom', $search_company);
|
||||
if ($search_sale > 0) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$db->escape($search_sale);
|
||||
if ($search_user > 0) $sql .= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='supplier_order' AND tc.source='internal' AND ec.element_id = cf.rowid AND ec.fk_socpeople = ".$db->escape($search_user);
|
||||
if ($search_user > 0) {
|
||||
$sql .= " AND EXISTS (";
|
||||
$sql .= " SELECT ec.rowid ";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "element_contact as ec";
|
||||
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "c_type_contact as tc ON tc.rowid = ec.fk_c_type_contact";
|
||||
$sql .= " WHERE ec.element_id = cf.rowid AND ec.fk_socpeople = " . ((int) $search_user);
|
||||
$sql .= " AND tc.element = 'order_supplier' AND tc.source = 'internal'";
|
||||
$sql .= ")";
|
||||
}
|
||||
if ($search_total_ht != '') $sql .= natural_search('cf.total_ht', $search_total_ht, 1);
|
||||
if ($search_total_vat != '') $sql .= natural_search('cf.tva', $search_total_vat, 1);
|
||||
if ($search_total_ttc != '') $sql .= natural_search('cf.total_ttc', $search_total_ttc, 1);
|
||||
|
||||
@ -253,6 +253,8 @@ if (empty($reshook))
|
||||
$result = $object->deleteline($lineid);
|
||||
if ($result > 0)
|
||||
{
|
||||
// reorder lines
|
||||
$object->line_order(true);
|
||||
// Define output language
|
||||
/*$outputlangs = $langs;
|
||||
$newlang = '';
|
||||
@ -668,6 +670,7 @@ if (empty($reshook))
|
||||
elseif ($action == 'add' && $usercancreate)
|
||||
{
|
||||
if ($socid > 0) $object->socid = GETPOST('socid', 'int');
|
||||
$selectedLines = GETPOST('toselect', 'array');
|
||||
|
||||
$db->begin();
|
||||
|
||||
@ -980,6 +983,10 @@ if (empty($reshook))
|
||||
$num = count($lines);
|
||||
for ($i = 0; $i < $num; $i++) // TODO handle subprice < 0
|
||||
{
|
||||
if (!in_array($lines[$i]->id, $selectedLines)) {
|
||||
continue; // Skip unselected lines
|
||||
}
|
||||
|
||||
$desc = ($lines[$i]->desc ? $lines[$i]->desc : $lines[$i]->libelle);
|
||||
$product_type = ($lines[$i]->product_type ? $lines[$i]->product_type : 0);
|
||||
|
||||
@ -2239,9 +2246,6 @@ if ($action == 'create')
|
||||
print '<input type="button" class="button" value="'.$langs->trans("Cancel").'" onClick="javascript:history.go(-1)">';
|
||||
print '</div>';
|
||||
|
||||
print "</form>\n";
|
||||
|
||||
|
||||
// Show origin lines
|
||||
if (is_object($objectsrc))
|
||||
{
|
||||
@ -2252,10 +2256,12 @@ if ($action == 'create')
|
||||
|
||||
print '<table class="noborder centpercent">';
|
||||
|
||||
$objectsrc->printOriginLinesList();
|
||||
$objectsrc->printOriginLinesList('', $selectedLines);
|
||||
|
||||
print '</table>';
|
||||
}
|
||||
|
||||
print "</form>\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -84,7 +84,12 @@ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user u ON cp.fk_user = u.rowid";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_holiday_types ct ON cp.fk_type = ct.rowid";
|
||||
$sql .= " WHERE cp.rowid > 0";
|
||||
$sql .= " AND cp.statut = 3"; // Approved
|
||||
$sql .= " AND (date_format(cp.date_debut, '%Y-%m') = '".$db->escape($year_month)."' OR date_format(cp.date_fin, '%Y-%m') = '".$db->escape($year_month)."')";
|
||||
$sql .= " AND (";
|
||||
$sql .= " (date_format(cp.date_debut, '%Y-%m') = '".$db->escape($year_month)."' OR date_format(cp.date_fin, '%Y-%m') = '".$db->escape($year_month)."')";
|
||||
$sql .= " OR";
|
||||
// For work leave over several months
|
||||
$sql .= " (date_format(cp.date_debut, '%Y-%m') < '".$db->escape($year_month)."' AND date_format(cp.date_fin, '%Y-%m') > '".$db->escape($year_month)."') ";
|
||||
$sql .= " )";
|
||||
$sql .= " ORDER BY u.lastname, cp.date_debut";
|
||||
|
||||
$resql = $db->query($sql);
|
||||
|
||||
@ -1440,6 +1440,10 @@ class TCPDF_STATIC {
|
||||
*/
|
||||
public static function intToRoman($number) {
|
||||
$roman = '';
|
||||
if ($number >= 4000) {
|
||||
// do not represent numbers above 4000 in Roman numerals
|
||||
return strval($number);
|
||||
}
|
||||
while ($number >= 1000) {
|
||||
$roman .= 'M';
|
||||
$number -= 1000;
|
||||
|
||||
@ -158,10 +158,10 @@ insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,no
|
||||
insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (201,'05','',1,'FLANDRE-OCCIDENTALE','Flandre-Occidentale');
|
||||
insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (201,'06','',1,'FLANDRE-ORIENTALE','Flandre-Orientale');
|
||||
insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (202,'07','',2,'HAINAUT','Hainaut');
|
||||
insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (201,'08','',2,'LIEGE','Liège');
|
||||
insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (202,'08','',2,'LIEGE','Liège');
|
||||
insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (202,'09','',1,'LIMBOURG','Limbourg');
|
||||
insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (202,'10','',2,'LUXEMBOURG','Luxembourg');
|
||||
insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (201,'11','',2,'NAMUR','Namur');
|
||||
insert into llx_c_departements (fk_region, code_departement,cheflieu,tncc,ncc,nom) values (202,'11','',2,'NAMUR','Namur');
|
||||
|
||||
-- Provinces Italy (id=3)
|
||||
insert into llx_c_departements (code_departement,fk_region,cheflieu,tncc,ncc,nom) values ('AG',315,NULL,NULL,NULL,'AGRIGENTO');
|
||||
|
||||
@ -43,6 +43,8 @@ create table llx_commande_fournisseur_dispatch_extrafields
|
||||
|
||||
ALTER TABLE llx_commande_fournisseur_dispatch_extrafields ADD INDEX idx_commande_fournisseur_dispatch_extrafields (fk_object);
|
||||
|
||||
ALTER TABLE llx_product_fournisseur_price ADD COLUMN packaging double(24,8) DEFAULT 1;
|
||||
|
||||
UPDATE llx_accounting_system SET fk_country = NULL, active = 0 WHERE pcg_version = 'SYSCOHADA';
|
||||
|
||||
create table llx_c_shipment_package_type
|
||||
|
||||
@ -50,7 +50,7 @@ create table llx_product_fournisseur_price
|
||||
import_key varchar(14), -- Import key
|
||||
delivery_time_days integer,
|
||||
supplier_reputation varchar(10),
|
||||
|
||||
packaging double(24,8) DEFAULT 1,
|
||||
fk_multicurrency integer,
|
||||
multicurrency_code varchar(255),
|
||||
multicurrency_tx double(24,8) DEFAULT 1,
|
||||
|
||||
@ -132,3 +132,4 @@ FreeLegalTextOnHolidays=Free text on PDF
|
||||
WatermarkOnDraftHolidayCards=Watermarks on draft leave requests
|
||||
HolidaysToApprove=Holidays to approve
|
||||
NobodyHasPermissionToValidateHolidays=Nobody has permission to validate holidays
|
||||
ErrorLeaveRequestMustBeDraftCanceledOrRefusedToBeDeleted=Leave request %s must be draft, canceled or refused to be deleted
|
||||
|
||||
@ -75,10 +75,12 @@ if ((float) DOL_VERSION >= 6)
|
||||
|
||||
if ($action == 'updateMask')
|
||||
{
|
||||
$maskconstorder = GETPOST('maskconstorder', 'alpha');
|
||||
$maskorder = GETPOST('maskorder', 'alpha');
|
||||
$maskconst = GETPOST('maskconst', 'alpha');
|
||||
$maskvalue = GETPOST('maskvalue', 'alpha');
|
||||
|
||||
if ($maskconstorder) $res = dolibarr_set_const($db, $maskconstorder, $maskorder, 'chaine', 0, '', $conf->entity);
|
||||
if ($maskconst) {
|
||||
$res = dolibarr_set_const($db, $maskconst, $maskvalue, 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
|
||||
if (!$res > 0) $error++;
|
||||
|
||||
|
||||
@ -68,7 +68,7 @@ class mod_myobject_advanced extends ModeleNumRefMyObject
|
||||
$texte .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
$texte .= '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
$texte .= '<input type="hidden" name="action" value="updateMask">';
|
||||
$texte .= '<input type="hidden" name="maskconstBom" value="MYMODULE_MYOBJECT_ADVANCED_MASK">';
|
||||
$texte .= '<input type="hidden" name="maskconst" value="MYMODULE_MYOBJECT_ADVANCED_MASK">';
|
||||
$texte .= '<table class="nobordernopadding" width="100%">';
|
||||
|
||||
$tooltip = $langs->trans("GenericMaskCodes", $langs->transnoentities("MyObject"), $langs->transnoentities("MyObject"));
|
||||
@ -79,7 +79,7 @@ class mod_myobject_advanced extends ModeleNumRefMyObject
|
||||
|
||||
// Parametrage du prefix
|
||||
$texte .= '<tr><td>'.$langs->trans("Mask").':</td>';
|
||||
$texte .= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat" size="24" name="maskMyObject" value="'.$conf->global->MYMODULE_MYOBJECT_ADVANCED_MASK.'">', $tooltip, 1, 1).'</td>';
|
||||
$texte .= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat" size="24" name="maskvalue" value="'.$conf->global->MYMODULE_MYOBJECT_ADVANCED_MASK.'">', $tooltip, 1, 1).'</td>';
|
||||
|
||||
$texte .= '<td class="left" rowspan="2"> <input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button"></td>';
|
||||
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2019 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2022 Ferran Marcet <fmarcet@2byte.es>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -729,6 +730,23 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
while ($i < ($limit ? min($num, $limit) : $num)) {
|
||||
$objp = $db->fetch_object($resql);
|
||||
|
||||
// Multilangs
|
||||
if (!empty($conf->global->MAIN_MULTILANGS)) // If multilang is enabled
|
||||
{
|
||||
$sql = "SELECT label";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."product_lang";
|
||||
$sql .= " WHERE fk_product=".$objp->rowid;
|
||||
$sql .= " AND lang='".$db->escape($langs->getDefaultLang())."'";
|
||||
$sql .= " LIMIT 1";
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$objtp = $db->fetch_object($result);
|
||||
if (!empty($objtp->label)) $objp->produit = $objtp->label;
|
||||
}
|
||||
}
|
||||
|
||||
$userstatic->id = $objp->fk_user_author;
|
||||
$userstatic->login = $objp->login;
|
||||
$userstatic->lastname = $objp->lastname;
|
||||
|
||||
@ -150,7 +150,7 @@ if ($action == 'other')
|
||||
if ($value) {
|
||||
$sql_test = "SELECT count(desc_fourn) as cpt FROM ".MAIN_DB_PREFIX."product_fournisseur_price WHERE 1";
|
||||
$resql = $db->query($sql_test);
|
||||
if (!$resql && $db->lasterrno == 'DB_ERROR_NOSUCHFIELD') // if the field does not exist, we create it
|
||||
if (!$resql && $db->lasterrno() == 'DB_ERROR_NOSUCHFIELD') // if the field does not exist, we create it
|
||||
{
|
||||
$sql_new = "ALTER TABLE ".MAIN_DB_PREFIX."product_fournisseur_price ADD COLUMN desc_fourn text";
|
||||
$resql_new = $db->query($sql_new);
|
||||
@ -159,15 +159,6 @@ if ($action == 'other')
|
||||
|
||||
$value = GETPOST('activate_useProdSupplierPackaging', 'alpha');
|
||||
$res = dolibarr_set_const($db, "PRODUCT_USE_SUPPLIER_PACKAGING", $value, 'chaine', 0, '', $conf->entity);
|
||||
if ($value) {
|
||||
$sql_test = "SELECT count(packaging) as cpt FROM ".MAIN_DB_PREFIX."product_fournisseur_price WHERE 1";
|
||||
$resql = $db->query($sql_test);
|
||||
if (!$resql && $db->lasterrno == 'DB_ERROR_NOSUCHFIELD') // if the field does not exist, we create it
|
||||
{
|
||||
$sql_new = "ALTER TABLE ".MAIN_DB_PREFIX."product_fournisseur_price ADD COLUMN packaging double(24,8) DEFAULT 1";
|
||||
$resql_new = $db->query($sql_new);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'specimen') // For products
|
||||
|
||||
@ -487,7 +487,7 @@ if (empty($reshook))
|
||||
if ($accountancy_code_buy_export <= 0) { $object->accountancy_code_buy_export = ''; } else { $object->accountancy_code_buy_export = $accountancy_code_buy_export; }
|
||||
|
||||
// Fill array 'array_options' with data from add form
|
||||
$ret = $extrafields->setOptionalsFromPost(null, $object);
|
||||
$ret = $extrafields->setOptionalsFromPost(null, $object, '@GETPOSTISSET');
|
||||
if ($ret < 0) $error++;
|
||||
|
||||
if (!$error && $object->check())
|
||||
|
||||
@ -1803,7 +1803,10 @@ class Product extends CommonObject
|
||||
$sql .= " ,pfp.multicurrency_price, pfp.multicurrency_unitprice, pfp.multicurrency_tx, pfp.fk_multicurrency, pfp.multicurrency_code";
|
||||
if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) $sql .= ", pfp.packaging";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp";
|
||||
$sql .= " WHERE pfp.fk_product = ".$product_id;
|
||||
$sql .= " WHERE 1 = 1";
|
||||
if ($product_id > 0) {
|
||||
$sql .= " AND pfp.fk_product = ".((int) $product_id);
|
||||
}
|
||||
if ($fourn_ref != 'none') { $sql .= " AND pfp.ref_fourn = '".$fourn_ref."'";
|
||||
}
|
||||
if ($fk_soc > 0) { $sql .= " AND pfp.fk_soc = ".$fk_soc;
|
||||
|
||||
@ -531,11 +531,11 @@ class Productbatch extends CommonObject
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."product_lot as pl";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = pl.fk_product";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_batch AS pb ON pl.batch = pb.batch";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock AS ps ON ps.rowid = pb.fk_product_stock";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock AS ps ON ps.rowid = pb.fk_product_stock AND ps.fk_product = ".((int) $fk_product);
|
||||
$sql .= " WHERE p.entity IN (".getEntity('product').")";
|
||||
$sql .= " AND pl.fk_product = ".$fk_product;
|
||||
$sql .= " AND pl.fk_product = ".((int) $fk_product);
|
||||
if ($fk_warehouse > 0) {
|
||||
$sql .= " AND ps.fk_entrepot = ".$fk_warehouse;
|
||||
$sql .= " AND ps.fk_entrepot = ".((int) $fk_warehouse);
|
||||
}
|
||||
if ($qty_min !== null) {
|
||||
$sql .= " AND pb.qty > ".$qty_min;
|
||||
|
||||
@ -616,17 +616,19 @@ if ($id > 0 || $ref)
|
||||
</script>';
|
||||
}
|
||||
|
||||
if ($conf->multicurrency->enabled) {
|
||||
// Currency
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Currency").'</td>';
|
||||
print '<td>';
|
||||
$currencycodetouse = GETPOST('multicurrency_code') ?GETPOST('multicurrency_code') : (isset($object->fourn_multicurrency_code) ? $object->fourn_multicurrency_code : '');
|
||||
if (empty($currencycodetouse) && $object->fourn_multicurrency_tx == 1) $currencycodetouse = $conf->currency;
|
||||
print $form->selectMultiCurrency($currencycodetouse, "multicurrency_code", 1);
|
||||
print ' '.$langs->trans("CurrencyRate").' ';
|
||||
print '<input class="flat" name="multicurrency_tx" size="4" value="'.vatrate(GETPOST('multicurrency_tx') ?GETPOST('multicurrency_tx') : (isset($object->fourn_multicurrency_tx) ? $object->fourn_multicurrency_tx : '')).'">';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
if (!empty($conf->multicurrency->enabled)) {
|
||||
// Currency
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Currency").'</td>';
|
||||
print '<td>';
|
||||
$currencycodetouse = GETPOST('multicurrency_code') ? GETPOST('multicurrency_code') : (isset($object->fourn_multicurrency_code) ? $object->fourn_multicurrency_code : '');
|
||||
if (empty($currencycodetouse) && $object->fourn_multicurrency_tx == 1) {
|
||||
$currencycodetouse = $conf->currency;
|
||||
}
|
||||
print $form->selectMultiCurrency($currencycodetouse, "multicurrency_code", 1);
|
||||
print ' '.$langs->trans("CurrencyRate").' ';
|
||||
print '<input class="flat" name="multicurrency_tx" size="4" value="'.vatrate(GETPOST('multicurrency_tx') ? GETPOST('multicurrency_tx') : (isset($object->fourn_multicurrency_tx) ? $object->fourn_multicurrency_tx : '')).'">';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Currency price qty min
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("PriceQtyMinCurrency").'</td>';
|
||||
@ -646,43 +648,45 @@ if ($id > 0 || $ref)
|
||||
print '</td></tr>';
|
||||
|
||||
$currencies = array();
|
||||
$sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'multicurrency WHERE entity = '.$conf->entity;
|
||||
$sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'multicurrency WHERE entity = '.((int) $conf->entity);
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$currency = new MultiCurrency($db);
|
||||
while ($obj = $db->fetch_object($resql)) {
|
||||
$currency->fetch($obj->rowid);
|
||||
$currencies[$currency->code] = $currency->rate->rate;
|
||||
$currencies[$currency->code] = ((float) $currency->rate->rate);
|
||||
}
|
||||
}
|
||||
$currencies = json_encode($currencies);
|
||||
|
||||
print <<<SCRIPT
|
||||
print <<<END
|
||||
<!-- javascript to autocalculate the minimum price -->
|
||||
<script type="text/javascript">
|
||||
function update_price_from_multicurrency() {
|
||||
var multicurrency_price = $('input[name="multicurrency_price"]').val();
|
||||
var multicurrency_tx = $('input[name="multicurrency_tx"]').val();
|
||||
$('input[name="price"]').val(multicurrency_price / multicurrency_tx);
|
||||
$('input[name="disabled_price"]').val(multicurrency_price / multicurrency_tx);
|
||||
console.log("update_price_from_multicurrency");
|
||||
var multicurrency_price = price2numjs($('input[name="multicurrency_price"]').val());
|
||||
var multicurrency_tx = price2numjs($('input[name="multicurrency_tx"]').val());
|
||||
if (multicurrency_tx != 0) {
|
||||
$('input[name="price"]').val(multicurrency_price / multicurrency_tx);
|
||||
$('input[name="disabled_price"]').val(multicurrency_price / multicurrency_tx);
|
||||
} else {
|
||||
$('input[name="price"]').val('');
|
||||
$('input[name="disabled_price"]').val('');
|
||||
}
|
||||
}
|
||||
|
||||
jQuery(document).ready(function () {
|
||||
$('input[name="disabled_price"]').prop('disabled', true);
|
||||
$('select[name="disabled_price_base_type"]').prop('disabled', true);
|
||||
update_price_from_multicurrency();
|
||||
|
||||
$('input[name="multicurrency_price"]').keyup(function () {
|
||||
update_price_from_multicurrency();
|
||||
}).change(function () {
|
||||
update_price_from_multicurrency();
|
||||
}).on('paste', function () {
|
||||
$('input[name="multicurrency_price"], input[name="multicurrency_tx"]').keyup(function () {
|
||||
update_price_from_multicurrency();
|
||||
});
|
||||
|
||||
$('input[name="multicurrency_tx"]').keyup(function () {
|
||||
$('input[name="multicurrency_price"], input[name="multicurrency_tx"]').change(function () {
|
||||
update_price_from_multicurrency();
|
||||
}).change(function () {
|
||||
update_price_from_multicurrency();
|
||||
}).on('paste', function () {
|
||||
});
|
||||
$('input[name="multicurrency_price"], input[name="multicurrency_tx"]').on('paste', function () {
|
||||
update_price_from_multicurrency();
|
||||
});
|
||||
|
||||
@ -693,11 +697,13 @@ if ($id > 0 || $ref)
|
||||
|
||||
var currencies_array = $currencies;
|
||||
$('select[name="multicurrency_code"]').change(function () {
|
||||
console.log("We change the currency");
|
||||
$('input[name="multicurrency_tx"]').val(currencies_array[$(this).val()]);
|
||||
update_price_from_multicurrency();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
SCRIPT;
|
||||
END;
|
||||
} else {
|
||||
// Price qty min
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("PriceQtyMin").'</td>';
|
||||
|
||||
@ -182,7 +182,7 @@ if (empty($reshook))
|
||||
$object->fax = GETPOST("fax");
|
||||
|
||||
// Fill array 'array_options' with data from add form
|
||||
$ret = $extrafields->setOptionalsFromPost(null, $object);
|
||||
$ret = $extrafields->setOptionalsFromPost(null, $object, '@GETPOSTISSET');
|
||||
if ($ret < 0) $error++;
|
||||
|
||||
if (!$error) {
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2014 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2015 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2018-2022 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -1001,6 +1001,23 @@ if ($resql)
|
||||
{
|
||||
$objp = $db->fetch_object($resql);
|
||||
|
||||
// Multilangs
|
||||
if (!empty($conf->global->MAIN_MULTILANGS)) // If multilang is enabled
|
||||
{
|
||||
$sql = "SELECT label";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."product_lang";
|
||||
$sql .= " WHERE fk_product=".$objp->rowid;
|
||||
$sql .= " AND lang='".$db->escape($langs->getDefaultLang())."'";
|
||||
$sql .= " LIMIT 1";
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$objtp = $db->fetch_object($result);
|
||||
if (!empty($objtp->label)) $objp->produit = $objtp->label;
|
||||
}
|
||||
}
|
||||
|
||||
$userstatic->id = $objp->fk_user_author;
|
||||
$userstatic->login = $objp->login;
|
||||
$userstatic->lastname = $objp->lastname;
|
||||
|
||||
@ -620,6 +620,11 @@ $restrictviewformytask = ((!isset($conf->global->PROJECT_TIME_SHOW_TASK_NOT_ASSI
|
||||
|
||||
// Get if user is available or not for each day
|
||||
$isavailable = array();
|
||||
|
||||
// Assume from Monday to Friday if conf empty or badly formed
|
||||
$numstartworkingday = 1;
|
||||
$numendworkingday = 5;
|
||||
|
||||
if (!empty($conf->global->MAIN_DEFAULT_WORKING_DAYS))
|
||||
{
|
||||
$tmparray = explode('-', $conf->global->MAIN_DEFAULT_WORKING_DAYS);
|
||||
|
||||
@ -521,6 +521,11 @@ $startday = dol_mktime(12, 0, 0, $startdayarray['first_month'], $startdayarray['
|
||||
|
||||
// Get if user is available or not for each day
|
||||
$isavailable = array();
|
||||
|
||||
// Assume from Monday to Friday if conf empty or badly formed
|
||||
$numstartworkingday = 1;
|
||||
$numendworkingday = 5;
|
||||
|
||||
if (!empty($conf->global->MAIN_DEFAULT_WORKING_DAYS))
|
||||
{
|
||||
$tmparray = explode('-', $conf->global->MAIN_DEFAULT_WORKING_DAYS);
|
||||
@ -530,7 +535,6 @@ if (!empty($conf->global->MAIN_DEFAULT_WORKING_DAYS))
|
||||
$numendworkingday = $tmparray[1];
|
||||
}
|
||||
}
|
||||
|
||||
for ($idw = 0; $idw < 7; $idw++)
|
||||
{
|
||||
$dayinloopfromfirstdaytoshow = dol_time_plus_duree($firstdaytoshow, $idw, 'd'); // $firstdaytoshow is a date with hours = 0
|
||||
|
||||
@ -276,7 +276,7 @@ if (empty($reshook))
|
||||
$object->usage_organize_event = (GETPOST('usage_organize_event', 'alpha') == 'on' ? 1 : 0);
|
||||
|
||||
// Fill array 'array_options' with data from add form
|
||||
$ret = $extrafields->setOptionalsFromPost(null, $object);
|
||||
$ret = $extrafields->setOptionalsFromPost(null, $object, '@GETPOSTISSET');
|
||||
if ($ret < 0) $error++;
|
||||
}
|
||||
|
||||
|
||||
@ -102,7 +102,7 @@ if ($action == 'update' && !$_POST["cancel"] && $user->rights->projet->creer)
|
||||
$object->progress = $_POST['progress'];
|
||||
|
||||
// Fill array 'array_options' with data from add form
|
||||
$ret = $extrafields->setOptionalsFromPost(null, $object);
|
||||
$ret = $extrafields->setOptionalsFromPost(null, $object, '@GETPOSTISSET');
|
||||
if ($ret < 0) $error++;
|
||||
|
||||
if (!$error)
|
||||
|
||||
@ -1058,7 +1058,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0)
|
||||
if ($search_note) $sql .= natural_search('t.note', $search_note);
|
||||
if ($search_task_ref) $sql .= natural_search('pt.ref', $search_task_ref);
|
||||
if ($search_task_label) $sql .= natural_search('pt.label', $search_task_label);
|
||||
if ($search_user > 0) $sql .= natural_search('t.fk_user', $search_user);
|
||||
if ($search_user > 0) $sql .= natural_search('t.fk_user', $search_user, 2);
|
||||
if ($search_valuebilled == '1') $sql .= ' AND t.invoice_id > 0';
|
||||
if ($search_valuebilled == '0') $sql .= ' AND (t.invoice_id = 0 OR t.invoice_id IS NULL)';
|
||||
$sql .= dolSqlDateFilter('t.task_datehour', $search_day, $search_month, $search_year);
|
||||
@ -1069,6 +1069,12 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0)
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
{
|
||||
$resql = $db->query($sql);
|
||||
|
||||
if (! $resql) {
|
||||
dol_print_error($db);
|
||||
exit;
|
||||
}
|
||||
|
||||
$nbtotalofrecords = $db->num_rows($resql);
|
||||
if (($page * $limit) > $nbtotalofrecords) // if total of record found is smaller than page * limit, goto and load page 0
|
||||
{
|
||||
|
||||
@ -100,20 +100,6 @@ if (!empty($tag) && ($unsuscrib == '1'))
|
||||
$resql = $db->query($sql);
|
||||
if (!$resql) dol_print_error($db);
|
||||
|
||||
/*
|
||||
// Update status communication of thirdparty prospect (old usage)
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm=-1 WHERE rowid IN (SELECT source_id FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE tag = '".$db->escape($tag)."' AND source_type='thirdparty' AND source_id is not null)";
|
||||
|
||||
$resql=$db->query($sql);
|
||||
if (! $resql) dol_print_error($db);
|
||||
|
||||
// Update status communication of contact prospect (old usage)
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."socpeople SET no_email=1 WHERE rowid IN (SELECT source_id FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE tag = '".$db->escape($tag)."' AND source_type='contact' AND source_id is not null)";
|
||||
|
||||
$resql=$db->query($sql);
|
||||
if (! $resql) dol_print_error($db);
|
||||
*/
|
||||
|
||||
// Update status communication of email (new usage)
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."mailing_unsubscribe (date_creat, entity, email) VALUES ('".$db->idate(dol_now())."', ".$db->escape($obj->entity).", '".$db->escape($obj->email)."')";
|
||||
|
||||
|
||||
@ -211,7 +211,7 @@ if ($action == 'create_ticket' && GETPOST('add', 'alpha')) {
|
||||
$message .= ($conf->global->TICKET_MESSAGE_MAIL_NEW ? $conf->global->TICKET_MESSAGE_MAIL_NEW : $langs->transnoentities('TicketNewEmailBody'))."\n\n";
|
||||
$message .= $langs->transnoentities('TicketNewEmailBodyInfosTicket')."\n";
|
||||
|
||||
$url_public_ticket = ($conf->global->TICKET_URL_PUBLIC_INTERFACE ? $conf->global->TICKET_URL_PUBLIC_INTERFACE.'/' : dol_buildpath('/public/ticket/view.php', 2)).'?track_id='.$object->track_id;
|
||||
$url_public_ticket = ($conf->global->TICKET_URL_PUBLIC_INTERFACE ? $conf->global->TICKET_URL_PUBLIC_INTERFACE.'/view.php' : dol_buildpath('/public/ticket/view.php', 2)).'?track_id='.$object->track_id;
|
||||
$infos_new_ticket = $langs->transnoentities('TicketNewEmailBodyInfosTrackId', '<a href="'.$url_public_ticket.'">'.$object->track_id.'</a>')."\n";
|
||||
$infos_new_ticket .= $langs->transnoentities('TicketNewEmailBodyInfosTrackUrl')."\n\n";
|
||||
|
||||
|
||||
@ -155,7 +155,7 @@ if (empty($reshook))
|
||||
$object->country_id = $country_id;
|
||||
|
||||
// Fill array 'array_options' with data from add form
|
||||
$ret = $extrafields->setOptionalsFromPost(null, $object);
|
||||
$ret = $extrafields->setOptionalsFromPost(null, $object, '@GETPOSTISSET');
|
||||
if ($ret < 0) {
|
||||
$error++;
|
||||
}
|
||||
|
||||
@ -75,22 +75,16 @@ if ($search_type != '') {
|
||||
}
|
||||
|
||||
// Add $param from extra fields
|
||||
foreach ($search_array_options as $key => $val)
|
||||
{
|
||||
$crit = $val;
|
||||
$tmpkey = preg_replace('/search_options_/', '', $key);
|
||||
$typ = $extrafields->attributes[$object->table_element]['type'][$tmpkey];
|
||||
if ($val != '') {
|
||||
$param .= '&search_options_'.$tmpkey.'='.urlencode($val);
|
||||
}
|
||||
$mode_search = 0;
|
||||
if (in_array($typ, array('int', 'double', 'real'))) $mode_search = 1; // Search on a numeric
|
||||
if (in_array($typ, array('sellist', 'link')) && $crit != '0' && $crit != '-1') $mode_search = 2; // Search on a foreign key int
|
||||
if ($crit != '' && (!in_array($typ, array('select', 'sellist')) || $crit != '0') && (!in_array($typ, array('link')) || $crit != '-1'))
|
||||
{
|
||||
$filter['ef.'.$tmpkey] = natural_search('ef.'.$tmpkey, $crit, $mode_search);
|
||||
}
|
||||
}
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
|
||||
$sql= null;
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
|
||||
|
||||
// Including the previous script generate the correct SQL filter for all the extrafields
|
||||
// we are playing with the behaviour of the Dolresource::fetch_all() by generating a fake
|
||||
// extrafields filter key to make it works
|
||||
$filter['ef.resource'] = $sql;
|
||||
|
||||
|
||||
if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
|
||||
|
||||
|
||||
|
||||
@ -294,6 +294,7 @@ if (empty($reshook))
|
||||
$search_town = "";
|
||||
$search_zip = "";
|
||||
$search_state = "";
|
||||
$search_region = "";
|
||||
$search_country = '';
|
||||
$search_email = '';
|
||||
$search_phone = '';
|
||||
@ -421,7 +422,7 @@ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_effectif as staff on (staff.id = s.fk_effectif)";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_regions as region on (region. code_region = state.fk_region)";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_regions as region on (region.code_region = state.fk_region)";
|
||||
// We'll need this table joined to the select in order to filter by categ
|
||||
if (!empty($search_categ_cus)) $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cc ON s.rowid = cc.fk_soc"; // We'll need this table joined to the select in order to filter by categ
|
||||
if (!empty($search_categ_sup)) $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_fournisseur as cs ON s.rowid = cs.fk_soc"; // We'll need this table joined to the select in order to filter by categ
|
||||
@ -554,6 +555,7 @@ if ($search_fax != '') $param .= "&search_fax=".urlencode($search_fax);
|
||||
if ($search_email != '') $param .= "&search_email=".urlencode($search_email);
|
||||
if ($search_url != '') $param .= "&search_url=".urlencode($search_url);
|
||||
if ($search_state != '') $param .= "&search_state=".urlencode($search_state);
|
||||
if ($search_region != '') $param .= "&search_region=".urlencode($search_region);
|
||||
if ($search_country != '') $param .= "&search_country=".urlencode($search_country);
|
||||
if ($search_customer_code != '') $param .= "&search_customer_code=".urlencode($search_customer_code);
|
||||
if ($search_supplier_code != '') $param .= "&search_supplier_code=".urlencode($search_supplier_code);
|
||||
@ -983,7 +985,9 @@ if (!empty($arrayfields['s.idprof4']['checked'])) print_liste_field_titre
|
||||
if (!empty($arrayfields['s.idprof5']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId5Short"), $textprofid[4], 1, 0), $_SERVER["PHP_SELF"], "s.idprof5", "", $param, '', $sortfield, $sortorder, 'nowrap ');
|
||||
if (!empty($arrayfields['s.idprof6']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId6Short"), $textprofid[4], 1, 0), $_SERVER["PHP_SELF"], "s.idprof6", "", $param, '', $sortfield, $sortorder, 'nowrap ');
|
||||
if (!empty($arrayfields['s.tva_intra']['checked'])) print_liste_field_titre($arrayfields['s.tva_intra']['label'], $_SERVER["PHP_SELF"], "s.tva_intra", "", $param, '', $sortfield, $sortorder, 'nowrap ');
|
||||
if (!empty($arrayfields['customerorsupplier']['checked'])) print_liste_field_titre(''); // type of customer
|
||||
if (!empty($arrayfields['customerorsupplier']['checked'])) {
|
||||
print_liste_field_titre($arrayfields['customerorsupplier']['label'], $_SERVER['PHP_SELF'], '', '', $param, '', $sortfield, $sortorder, 'center '); // type of customer
|
||||
}
|
||||
if (!empty($arrayfields['s.fk_prospectlevel']['checked'])) print_liste_field_titre($arrayfields['s.fk_prospectlevel']['label'], $_SERVER["PHP_SELF"], "s.fk_prospectlevel", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
if (!empty($arrayfields['s.fk_stcomm']['checked'])) print_liste_field_titre($arrayfields['s.fk_stcomm']['label'], $_SERVER["PHP_SELF"], "s.fk_stcomm", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
if (!empty($arrayfields['s2.nom']['checked'])) print_liste_field_titre($arrayfields['s2.nom']['label'], $_SERVER["PHP_SELF"], "s2.nom", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
|
||||
@ -732,6 +732,7 @@ $( document ).ready(function() {
|
||||
if ($conf->global->TAKEPOS_CONTROL_CASH_OPENING) {
|
||||
$sql = "SELECT rowid, status FROM ".MAIN_DB_PREFIX."pos_cash_fence WHERE";
|
||||
$sql .= " entity = ".$conf->entity." AND ";
|
||||
$sql .= " posnumber = ".$_SESSION["takeposterminal"]." AND ";
|
||||
$sql .= " date(date_creation) = CURDATE()";
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
@ -918,6 +919,7 @@ if ($conf->global->TAKEPOS_PRINT_METHOD == "receiptprinter") {
|
||||
|
||||
$sql = "SELECT rowid, status, entity FROM ".MAIN_DB_PREFIX."pos_cash_fence WHERE";
|
||||
$sql .= " entity = ".$conf->entity." AND ";
|
||||
$sql .= " posnumber = ".$_SESSION["takeposterminal"]." AND ";
|
||||
$sql .= " date(date_creation) = CURDATE()";
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
|
||||
@ -1,7 +1,8 @@
|
||||
<?php
|
||||
/* Copyright (C) 2013-2016 Jean-François FERRY <hello@librethic.io>
|
||||
* Copyright (C) 2016 Christophe Battarel <christophe@altairis.fr>
|
||||
* Copyright (C) 2018 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2013-2016 Jean-François FERRY <hello@librethic.io>
|
||||
* Copyright (C) 2016 Christophe Battarel <christophe@altairis.fr>
|
||||
* Copyright (C) 2018 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -192,9 +193,15 @@ if (empty($reshook)) {
|
||||
$result = $object->add_contact($contactid, GETPOST("type"), 'external');
|
||||
}
|
||||
|
||||
// altairis: link ticket to project
|
||||
if (GETPOST('projectid') > 0) {
|
||||
$object->setProject(GETPOST('projectid'));
|
||||
// Link ticket to project
|
||||
if(GETPOST('origin', 'alpha') == 'projet') {
|
||||
$projectid = GETPOST('originid', 'int');
|
||||
} else {
|
||||
$projectid = GETPOST('projectid', 'int');
|
||||
}
|
||||
|
||||
if ($projectid > 0) {
|
||||
$object->setProject($projectid);
|
||||
}
|
||||
|
||||
// Auto assign user
|
||||
|
||||
@ -327,7 +327,7 @@ if ($action != 'edit' && $action != 'create') // If not bank account yet, $acco
|
||||
$holiday->id = $objp->rowid;
|
||||
$holiday->ref = $objp->rowid;
|
||||
$holiday->fk_type = $objp->fk_type;
|
||||
$nbopenedday = num_open_day($db->jdate($objp->date_debut), $db->jdate($objp->date_fin), 0, 1, $objp->halfday);
|
||||
$nbopenedday = num_open_day($db->jdate($objp->date_debut, 'gmt'), $db->jdate($objp->date_fin, 'gmt'), 0, 1, $objp->halfday);
|
||||
|
||||
print $holiday->getNomUrl(1);
|
||||
print '</td><td class="right" width="80px">'.dol_print_date($db->jdate($objp->date_debut), 'day')."</td>\n";
|
||||
|
||||
@ -440,7 +440,7 @@ if (empty($reshook)) {
|
||||
}
|
||||
|
||||
// Fill array 'array_options' with data from add form
|
||||
$ret = $extrafields->setOptionalsFromPost(null, $object);
|
||||
$ret = $extrafields->setOptionalsFromPost(null, $object, '@GETPOSTISSET');
|
||||
if ($ret < 0) {
|
||||
$error++;
|
||||
}
|
||||
@ -1259,7 +1259,7 @@ if ($action == 'create' || $action == 'adduserldap')
|
||||
|
||||
// Signature
|
||||
print '<tr><td class="tdtop">'.$langs->trans("Signature").'</td>';
|
||||
print '<td>';
|
||||
print '<td class="wordbreak">';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
$doleditor = new DolEditor('signature', GETPOST('signature'), '', 138, 'dolibarr_notes', 'In', true, true, empty($conf->global->FCKEDITOR_ENABLE_USERSIGN) ? 0 : 1, ROWS_4, '90%');
|
||||
print $doleditor->Create(1);
|
||||
@ -1905,7 +1905,7 @@ else
|
||||
}
|
||||
}
|
||||
|
||||
if ($caneditfield && (empty($conf->multicompany->enabled) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1)))
|
||||
if ($caneditfield && (empty($conf->multicompany->enabled) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $object->entity == 1)))
|
||||
{
|
||||
if (!empty($conf->global->MAIN_ONLY_LOGIN_ALLOWED))
|
||||
{
|
||||
@ -1917,7 +1917,7 @@ else
|
||||
}
|
||||
}
|
||||
elseif ($caneditpassword && !$object->ldap_sid &&
|
||||
(empty($conf->multicompany->enabled) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1)))
|
||||
(empty($conf->multicompany->enabled) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $object->entity == 1)))
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=edit">'.$langs->trans("EditPassword").'</a></div>';
|
||||
}
|
||||
@ -1930,7 +1930,7 @@ else
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("UserDisabled")).'">'.$langs->trans("ReinitPassword").'</a></div>';
|
||||
}
|
||||
elseif (($user->id != $id && $caneditpassword) && $object->login && !$object->ldap_sid &&
|
||||
((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1)))
|
||||
((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $object->entity == 1)))
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=password">'.$langs->trans("ReinitPassword").'</a></div>';
|
||||
}
|
||||
@ -1940,7 +1940,7 @@ else
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("UserDisabled")).'">'.$langs->trans("SendNewPassword").'</a></div>';
|
||||
}
|
||||
elseif (($user->id != $id && $caneditpassword) && $object->login && !$object->ldap_sid &&
|
||||
((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1)))
|
||||
((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $object->entity == 1)))
|
||||
{
|
||||
if ($object->email) print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=passwordsend">'.$langs->trans("SendNewPassword").'</a></div>';
|
||||
else print '<div class="inline-block divButAction"><a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NoEMail")).'">'.$langs->trans("SendNewPassword").'</a></div>';
|
||||
@ -1949,13 +1949,13 @@ else
|
||||
|
||||
// Enable user
|
||||
if ($user->id <> $id && $candisableuser && $object->statut == 0 &&
|
||||
((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1)))
|
||||
((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $object->entity == 1)))
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=enable">'.$langs->trans("Reactivate").'</a></div>';
|
||||
}
|
||||
// Disable user
|
||||
if ($user->id <> $id && $candisableuser && $object->statut == 1 &&
|
||||
((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1)))
|
||||
((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $object->entity == 1)))
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?action=disable&id='.$object->id.'">'.$langs->trans("DisableUser").'</a></div>';
|
||||
}
|
||||
@ -1968,7 +1968,7 @@ else
|
||||
}
|
||||
// Delete
|
||||
if ($user->id <> $id && $candisableuser &&
|
||||
((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1)))
|
||||
((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || !$user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $object->entity == 1)))
|
||||
{
|
||||
if ($user->admin || !$object->admin) // If user edited is admin, delete is possible on for an admin
|
||||
{
|
||||
|
||||
@ -219,7 +219,7 @@ if (empty($reshook)) {
|
||||
$object->note = dol_htmlcleanlastbr(trim(GETPOST("note", 'none')));
|
||||
|
||||
// Fill array 'array_options' with data from add form
|
||||
$ret = $extrafields->setOptionalsFromPost(null, $object);
|
||||
$ret = $extrafields->setOptionalsFromPost(null, $object, '@GETPOSTISSET');
|
||||
if ($ret < 0) $error++;
|
||||
|
||||
if (!empty($conf->multicompany->enabled) && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) $object->entity = 0;
|
||||
|
||||
@ -185,7 +185,7 @@ $refname = basename(dirname($original_file)."/");
|
||||
// Security check
|
||||
if (empty($modulepart)) accessforbidden('Bad value for parameter modulepart', 0, 0, 1);
|
||||
|
||||
$check_access = dol_check_secure_access_document($modulepart, $original_file, $entity, $refname);
|
||||
$check_access = dol_check_secure_access_document($modulepart, $original_file, $entity, $user, $refname);
|
||||
$accessallowed = $check_access['accessallowed'];
|
||||
$sqlprotectagainstexternals = $check_access['sqlprotectagainstexternals'];
|
||||
$fullpath_original_file = $check_access['original_file']; // $fullpath_original_file is now a full path name
|
||||
|
||||
Loading…
Reference in New Issue
Block a user