Merge remote-tracking branch 'Dolibarr/13.0' into 13

This commit is contained in:
Francis Appels 2021-02-20 19:19:16 +01:00
commit 734a5a06af
64 changed files with 562 additions and 444 deletions

View File

@ -10,18 +10,19 @@ FIX: 11.0 when a mandatory extrafield of type sellist contains '0' it should be
FIX: 11.0 when a new intervention is created from an object, a new $extrafields object is instantiated but not initialized FIX: 11.0 when a new intervention is created from an object, a new $extrafields object is instantiated but not initialized
FIX: create MO, Column 'tms' cannot be null FIX: create MO, Column 'tms' cannot be null
FIX: #14290 #15900 FIX: #14290 #15900
FIX: #16076 FIX: #16076 patch user/list.php for extrafields
FIX: #16077 FIX: #16077 patch wrong timezone
FIX: #16079 FIX: #16079 error of service date at duplicated invoice
FIX: #16080 FIX: #16080 mailing list title
FIX: 16084 FIX: #16084 DB error at projects
FIX: #16107 FIX: #16107
FIX: #16118 Timezone problem on some fields FIX: #16118 Timezone problem on some fields
FIX: #16131 FIX: #16131
FIX: #16135 FIX: #16135
FIX: #16143 FIX: #16143
FIX: #16156 FIX: #16156
FIX: #16160 FIX: #16160
FIX: #16165 Create customer discount without vat
FIX: #16185 FIX: #16185
FIX: #16189, fix download/see check deposit PDF FIX: #16189, fix download/see check deposit PDF
FIX: #16215 FIX: #16215
@ -46,7 +47,7 @@ FIX: select default mail template
FIX: Select transport mode function when creating a supplier invoice and add unique key to the table llx_c_transport_mode in migrate sql FIX: Select transport mode function when creating a supplier invoice and add unique key to the table llx_c_transport_mode in migrate sql
FIX: Merge of thirdparties : "unknow column fk_soc" + "Delivery" label FIX: Merge of thirdparties : "unknow column fk_soc" + "Delivery" label
FIX: SQL Error in group by with postgres or mysql strict mode FIX: SQL Error in group by with postgres or mysql strict mode
FIX: takepos : load date function FIX: TakePOS : load date function
FIX: Timeout during import FIX: Timeout during import
FIX: Trigger on expense report was not fired FIX: Trigger on expense report was not fired
FIX: User creation of expense report not visible FIX: User creation of expense report not visible
@ -56,6 +57,7 @@ FIX: ODT generation very slow
FIX: amount in summary of report FIX: amount in summary of report
FIX: vat value when code contains number FIX: vat value when code contains number
FIX: payment term label on PDF FIX: payment term label on PDF
FIX: date selector when using reduced year (like on smartphone)
***** ChangeLog for 13.0.0 compared to 12.0.0 ***** ***** ChangeLog for 13.0.0 compared to 12.0.0 *****
@ -307,6 +309,63 @@ Following changes may create regressions for some external modules, but were nec
* Dolibarr v13 is still compatible with any PHP version between 5.6.0 and 7.4.*; Unit tests are OK with PHP 8.0 but some warnings or troubles may appears with PHP 8.0. * Dolibarr v13 is still compatible with any PHP version between 5.6.0 and 7.4.*; Unit tests are OK with PHP 8.0 but some warnings or troubles may appears with PHP 8.0.
* All your Ajax services must contains such a line at begin of file: if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Disables token renewal * All your Ajax services must contains such a line at begin of file: if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Disables token renewal
***** ChangeLog for 12.0.5 compared to 12.0.4 *****
FIX: before crediting a withdrawal receipt, check whether it has been credited already
FIX: mandatory extrafields of type sellist
FIX: when a mandatory extrafield of type sellist contains '0' it should be considered empty and trigger an error message upon insertion
FIX: when a new intervention is created from an object, a new $extrafields object is instantiated but not initialized
FIX: "openall" filter on ticket list does not include read tickets
FIX: ticket - extrafields of type 'date' are not saved
FIX: ticket - the "openall" filter on the ticket list does not include tickets with status READ
FIX: #14290 #15900
FIX: #15388 #15891
FIX: #15465 External user sees last 5 shipments to other customers in the dashboard
FIX: #15629
FIX: #15751 Miscellaneous payment type change to 0 after updating subledger account
FIX: #15946
FIX: #15966 #15967
FIX: Accountancy - Fix some problems on CEGID export
FIX: Accountancy - label_operation is used instead of label_compte
FIX: Accountancy - Retire entire opening balance feature
FIX: add autofix of count of email target when data is corrupted
FIX: add categories params on llxHeader filter
FIX: Add critical price patch from 12 to 11.
FIX: Bad cleaning of VAT rate when numbers are into code
FIX: Bad dates filtering in the ticket list causes sql error
FIX: balance starting and ending fiscal month #14197
FIX: bom line unit display #13831
FIX: cash fence for takepos with multientity
FIX: Check of customer/vendor code fails in some cases
FIX: create ticket : thirdparty/contact notification #15629
FIX: Creation of thirdparty when setup is empty
FIX: Dates of sales start in TakePOS
FIX: dupliacete customer or supplier code must be error dipslayed with new code proposed
FIX: Export FEC - Force Carriage Return Line Feed
FIX: Facture Situation Out : status condition
FIX: Filter on date of next generation on template invoices
FIX: Fix detect dispatched product and set to received completely when the supplier order have services (support STOCK_SUPPORTS_SERVICES)
FIX: Invoice Situation Out : status condition
FIX: issue 15659 : Missing test if supplier conf is enabled
FIX: link to create event when task is in a project with a thirdparty
FIX: Localtax must be converted with price2num
FIX: manage price min for PRODUIT_CUSTOMER_PRICES
FIX: missing GETPOST parameters on card_presend.tpl.php
FIX: missing socid into link to create event from project agenda tab
FIX: Must delete extrafields before main table on product deletion.
FIX: (path) htdocs removed
FIX: php alert sms.php
FIX: right to show VAT rate in product list
FIX: select default mail template
FIX: Timeout during import
FIX: update order by api
FIX: useless tracking number displayed on pdf if empty issue #14501
FIX: Visible date of payment
FIX: warning when adding a line if $remise_percent is an empty string
FIX: When creating a new POS sell, the creation date must be modified.
FIX: wrong name for search status param issue #15516
***** ChangeLog for 12.0.4 compared to 12.0.3 ***** ***** ChangeLog for 12.0.4 compared to 12.0.3 *****
FIX: make formConfirm an addreplace-type hook FIX: make formConfirm an addreplace-type hook
FIX: regex to remove 'action' parameter: taking feedback from PR#15213 into account FIX: regex to remove 'action' parameter: taking feedback from PR#15213 into account

View File

@ -153,6 +153,7 @@ $files = new RegexIterator($iterator1, '#^(?:[A-Z]:)?(?:/(?!(?:'.($includecustom
$regextoinclude='\.(php|php3|php4|php5|phtml|phps|phar|inc|css|scss|html|xml|js|json|tpl|jpg|jpeg|png|gif|ico|sql|lang|txt|yml|md|mp3|mp4|wav|mkv|z|gz|zip|rar|tar|less|svg|eot|woff|woff2|ttf|manifest)$'; $regextoinclude='\.(php|php3|php4|php5|phtml|phps|phar|inc|css|scss|html|xml|js|json|tpl|jpg|jpeg|png|gif|ico|sql|lang|txt|yml|md|mp3|mp4|wav|mkv|z|gz|zip|rar|tar|less|svg|eot|woff|woff2|ttf|manifest)$';
$regextoexclude='('.($includecustom?'':'custom|').'documents|conf|install|public\/test|sabre\/sabre\/.*\/tests|Shared\/PCLZip|nusoap\/lib\/Mail|php\/example|php\/test|geoip\/sample.*\.php|ckeditor\/samples|ckeditor\/adapters)$'; // Exclude dirs $regextoexclude='('.($includecustom?'':'custom|').'documents|conf|install|public\/test|sabre\/sabre\/.*\/tests|Shared\/PCLZip|nusoap\/lib\/Mail|php\/example|php\/test|geoip\/sample.*\.php|ckeditor\/samples|ckeditor\/adapters)$'; // Exclude dirs
$files = dol_dir_list(DOL_DOCUMENT_ROOT, 'files', 1, $regextoinclude, $regextoexclude, 'fullname'); $files = dol_dir_list(DOL_DOCUMENT_ROOT, 'files', 1, $regextoinclude, $regextoexclude, 'fullname');
$dir=''; $dir='';
$needtoclose=0; $needtoclose=0;
foreach ($files as $filetmp) { foreach ($files as $filetmp) {
@ -160,9 +161,10 @@ foreach ($files as $filetmp) {
//$newdir = str_replace(dirname(__FILE__).'/../htdocs', '', dirname($file)); //$newdir = str_replace(dirname(__FILE__).'/../htdocs', '', dirname($file));
$newdir = str_replace(DOL_DOCUMENT_ROOT, '', dirname($file)); $newdir = str_replace(DOL_DOCUMENT_ROOT, '', dirname($file));
if ($newdir!=$dir) { if ($newdir!=$dir) {
if ($needtoclose) if ($needtoclose) {
fputs($fp, ' </dir>'."\n"); fputs($fp, ' </dir>'."\n");
fputs($fp, ' <dir name="'.$newdir.'" >'."\n"); }
fputs($fp, ' <dir name="'.$newdir.'">'."\n");
$dir = $newdir; $dir = $newdir;
$needtoclose=1; $needtoclose=1;
} }

View File

@ -579,7 +579,6 @@ if ($nboftargetok) {
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/teclib*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/teclib*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/timesheet*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/timesheet*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/webmail*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/webmail*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/workstation*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/themes/oblyon*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/themes/oblyon*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/themes/allscreen*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/themes/allscreen*`;
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/theme/common/octicons/LICENSE`; $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/theme/common/octicons/LICENSE`;
@ -624,7 +623,6 @@ if ($nboftargetok) {
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/fonts/freefont-*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/fonts/freefont-*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/fonts/ae_fonts_*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/fonts/ae_fonts_*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/fonts/utils`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/fonts/utils`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/tools`;
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/LICENSE.TXT`; $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/LICENSE.TXT`;
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/tools`; $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/tools`;
$ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/vendor`; $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/vendor`;

View File

@ -212,6 +212,7 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/product %_datadir/dolibarr/htdocs/product
%_datadir/dolibarr/htdocs/projet %_datadir/dolibarr/htdocs/projet
%_datadir/dolibarr/htdocs/public %_datadir/dolibarr/htdocs/public
%_datadir/dolibarr/htdocs/recruitment
%_datadir/dolibarr/htdocs/reception %_datadir/dolibarr/htdocs/reception
%_datadir/dolibarr/htdocs/resource %_datadir/dolibarr/htdocs/resource
%_datadir/dolibarr/htdocs/salaries %_datadir/dolibarr/htdocs/salaries

View File

@ -359,9 +359,9 @@ class AccountancyExport
print length_accountg($line->numero_compte).$separator; print length_accountg($line->numero_compte).$separator;
print length_accounta($line->subledger_account).$separator; print length_accounta($line->subledger_account).$separator;
print $line->sens.$separator; print $line->sens.$separator;
print price($line->montant).$separator; print price2fec(abs($line->montant)).$separator;
print $line->label_operation.$separator; print dol_string_unaccent($line->label_operation).$separator;
print $line->doc_ref; print dol_string_unaccent($line->doc_ref);
print $end_line; print $end_line;
} }
} }

View File

@ -31,7 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array('errors', 'admin', 'modulebuilder')); $langs->loadLangs(array('errors', 'admin', 'modulebuilder', 'exports'));
$mode = GETPOST('mode', 'alpha'); $mode = GETPOST('mode', 'alpha');
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');

View File

@ -1059,9 +1059,9 @@ if ($mode == 'deploy') {
} else { } else {
print $langs->trans("ThisIsAlternativeProcessToFollow").'<br>'; print $langs->trans("ThisIsAlternativeProcessToFollow").'<br>';
print '<b>'.$langs->trans("StepNb", 1).'</b>: '; print '<b>'.$langs->trans("StepNb", 1).'</b>: ';
print $langs->trans("FindPackageFromWebSite", $fullurl).'<br>'; print str_replace('{s1}', $fullurl, $langs->trans("FindPackageFromWebSite", '{s1}')).'<br>';
print '<b>'.$langs->trans("StepNb", 2).'</b>: '; print '<b>'.$langs->trans("StepNb", 2).'</b>: ';
print $langs->trans("DownloadPackageFromWebSite", $fullurl).'<br>'; print str_replace('{s1}', $fullurl, $langs->trans("DownloadPackageFromWebSite", '{s1}')).'<br>';
print '<b>'.$langs->trans("StepNb", 3).'</b>: '; print '<b>'.$langs->trans("StepNb", 3).'</b>: ';
} }

View File

@ -374,14 +374,6 @@ if (!$error && $xml)
} }
$out .= '</table>'; $out .= '</table>';
$out .= '</div>'; $out .= '</div>';
// Show warning
if (empty($tmpfilelist) && empty($tmpfilelist2) && empty($tmpfilelist3))
{
setEventMessages($langs->trans("FileIntegrityIsStrictlyConformedWithReference"), null, 'mesgs');
} else {
setEventMessages($langs->trans("FileIntegritySomeFilesWereRemovedOrModified"), null, 'warnings');
}
} else { } else {
print 'Error: Failed to found dolibarr_htdocs_dir into XML file '.$xmlfile; print 'Error: Failed to found dolibarr_htdocs_dir into XML file '.$xmlfile;
$error++; $error++;
@ -407,6 +399,8 @@ if (!$error && $xml)
var_dump($checksumtoget); var_dump($checksumtoget);
var_dump($checksumget == $checksumtoget);*/ var_dump($checksumget == $checksumtoget);*/
$resultcomment = '';
$outexpectedchecksum = ($checksumtoget ? $checksumtoget : $langs->trans("Unknown")); $outexpectedchecksum = ($checksumtoget ? $checksumtoget : $langs->trans("Unknown"));
if ($checksumget == $checksumtoget) if ($checksumget == $checksumtoget)
{ {
@ -414,7 +408,7 @@ if (!$error && $xml)
{ {
$resultcode = 'warning'; $resultcode = 'warning';
$resultcomment = 'FileIntegrityIsOkButFilesWereAdded'; $resultcomment = 'FileIntegrityIsOkButFilesWereAdded';
$outcurrentchecksum = $checksumget.' - <span class="'.$resultcode.'">'.$langs->trans("FileIntegrityIsOkButFilesWereAdded").'</span>'; $outcurrentchecksum = $checksumget.' - <span class="'.$resultcode.'">'.$langs->trans($resultcomment).'</span>';
} else { } else {
$resultcode = 'ok'; $resultcode = 'ok';
$resultcomment = 'Success'; $resultcomment = 'Success';
@ -426,7 +420,18 @@ if (!$error && $xml)
$outcurrentchecksum = '<span class="'.$resultcode.'">'.$checksumget.'</span>'; $outcurrentchecksum = '<span class="'.$resultcode.'">'.$checksumget.'</span>';
} }
print load_fiche_titre($langs->trans("GlobalChecksum")).'<br>'; // Show warning
if (empty($tmpfilelist) && empty($tmpfilelist2) && empty($tmpfilelist3) && $resultcode == 'ok') {
setEventMessages($langs->trans("FileIntegrityIsStrictlyConformedWithReference"), null, 'mesgs');
} else {
if ($resultcode == 'warning') {
setEventMessages($langs->trans($resultcomment), null, 'warnings');
} else {
setEventMessages($langs->trans("FileIntegritySomeFilesWereRemovedOrModified"), null, 'errors');
}
}
print load_fiche_titre($langs->trans("GlobalChecksum"));
print $langs->trans("ExpectedChecksum").' = '.$outexpectedchecksum.'<br>'; print $langs->trans("ExpectedChecksum").' = '.$outexpectedchecksum.'<br>';
print $langs->trans("CurrentChecksum").' = '.$outcurrentchecksum; print $langs->trans("CurrentChecksum").' = '.$outcurrentchecksum;

View File

@ -125,38 +125,18 @@ if (empty($reshook))
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
} }
/* /*
* View * View
* *
* Put here all code to build page
*/ */
$form = new Form($db); $form = new Form($db);
$formfile = new FormFile($db); $formfile = new FormFile($db);
$title = $langs->trans("Assets").' - '.$langs->trans("Card"); $title = $langs->trans("Asset").' - '.$langs->trans("Card");
$help_url = ''; $help_url = '';
llxHeader('', $title, $help_url); llxHeader('', $title, $help_url);
// Example : Adding jquery code
print '<script type="text/javascript" language="javascript">
jQuery(document).ready(function() {
function init_myfunc()
{
jQuery("#myid").removeAttr(\'disabled\');
jQuery("#myid").attr(\'disabled\',\'disabled\');
}
init_myfunc();
jQuery("#mybutton").click(function() {
init_myfunc();
});
});
</script>';
// Part to create // Part to create
if ($action == 'create') if ($action == 'create')
{ {
@ -240,14 +220,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Confirmation to delete // Confirmation to delete
if ($action == 'delete') if ($action == 'delete')
{ {
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteAssets'), $langs->trans('ConfirmDeleteAssets'), 'confirm_delete', '', 0, 1); $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteAssets'), $langs->trans('ConfirmDeleteAsset'), 'confirm_delete', '', 0, 1);
}
// Confirmation of action xxxx
if ($action == 'xxx')
{
$formquestion = array();
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('XXX'), $text, 'confirm_xxx', $formquestion, 0, 1, 220);
} }
// Call Hook formConfirm // Call Hook formConfirm
@ -292,28 +265,24 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '</table>'; print '</table>';
print '</div>'; print '</div>';
print '</div>';
print '</div>';
print '<div class="clearboth"></div>'; print '<div class="clearboth"></div>';
print dol_get_fiche_end(); print dol_get_fiche_end();
// Buttons for actions /*
if ($action != 'presend' && $action != 'editline') { * Buttons
print '<div class="tabsAction">'."\n"; */
if ($user->socid == 0)
{
print '<div class="tabsAction">';
$parameters = array(); $parameters = array();
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
if (empty($reshook)) if (empty($reshook))
{ {
// Send
if (empty($user->socid)) {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&mode=init#formmailbeforetitle">'.$langs->trans('SendMail').'</a>'."\n";
}
if ($user->rights->asset->write) if ($user->rights->asset->write)
{ {
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=edit">'.$langs->trans("Modify").'</a>'."\n"; print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=edit">'.$langs->trans("Modify").'</a>'."\n";
@ -328,13 +297,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans('Delete').'</a>'."\n"; print '<a class="butActionRefused classfortooltip" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans('Delete').'</a>'."\n";
} }
} }
print '</div>'."\n"; print "</div>";
}
// Select mail models is same action as presend
if (GETPOST('modelselected')) {
$action = 'presend';
} }
if ($action != 'presend') if ($action != 'presend')
@ -343,27 +306,23 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '<a name="builddoc"></a>'; // ancre print '<a name="builddoc"></a>'; // ancre
// Documents // Documents
/*$objref = dol_sanitizeFileName($object->ref); $filename = dol_sanitizeFileName($object->ref);
$relativepath = $comref . '/' . $comref . '.pdf'; $filedir = $conf->contrat->dir_output."/".dol_sanitizeFileName($object->ref);
$filedir = $conf->asset->dir_output . '/' . $objref; $urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id;
$urlsource = $_SERVER["PHP_SELF"] . "?id=" . $object->id;
$genallowed = $user->rights->asset->read; // If you can read, you can build the PDF to read content $genallowed = $user->rights->asset->read; // If you can read, you can build the PDF to read content
$delallowed = $user->rights->asset->create; // If you can create/edit, you can remove a file on card $delallowed = $user->rights->asset->write; // If you can create/edit, you can remove a file on card
print $formfile->showdocuments('asset', $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $soc->default_lang);
*/ print $formfile->showdocuments('asset', $filename, $filedir, $urlsource, 0, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $soc->default_lang);
// Show links to link elements // Show links to link elements
$linktoelem = $form->showLinkToObjectBlock($object, null, array('asset')); $linktoelem = $form->showLinkToObjectBlock($object, null, array('asset'));
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem); $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
print '</div><div class="fichehalfright"><div class="ficheaddleft">'; print '</div><div class="fichehalfright"><div class="ficheaddleft">';
$MAXEVENT = 10; $MAXEVENT = 10;
$morehtmlright = '<a href="'.dol_buildpath('/asset/asset_info.php', 1).'?id='.$object->id.'">'; $morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-list-alt imgforviewmode', DOL_URL_ROOT.'/asset/info.php?id='.$object->id);
$morehtmlright .= $langs->trans("SeeAll");
$morehtmlright .= '</a>';
// List of actions on element // List of actions on element
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
@ -372,19 +331,6 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print '</div></div></div>'; print '</div></div></div>';
} }
//Select mail models is same action as presend
if (GETPOST('modelselected')) $action = 'presend';
// Presend form
/*
$modelmail='asset';
$defaulttopic='InformationMessage';
$diroutput = $conf->asset->dir_output.'/asset';
$trackid = 'asset'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';
*/
} }

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2007-2017 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2007-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2018 Alexandre Spangaro <aspangaro@open-dsi.fr> * Copyright (C) 2018-2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -19,7 +19,7 @@
/** /**
* \file htdocs/asset/document.php * \file htdocs/asset/document.php
* \ingroup asset * \ingroup asset
* \brief Tab for documents linked to Assets * \brief Page for attached files on assets
*/ */
require '../main.inc.php'; require '../main.inc.php';
@ -31,18 +31,21 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array("assets", "companies")); $langs->loadLangs(array('assets', 'companies', 'other'));
$action = GETPOST('action', 'aZ09'); $id = (GETPOST('id', 'int') ?GETPOST('id', 'int') : GETPOST('facid', 'int')); // For backward compatibility
$confirm = GETPOST('confirm');
$id = (GETPOST('socid', 'int') ? GETPOST('socid', 'int') : GETPOST('id', 'int'));
$ref = GETPOST('ref', 'alpha'); $ref = GETPOST('ref', 'alpha');
$socid = GETPOST('socid', 'int');
$action = GETPOST('action', 'aZ09');
$confirm = GETPOST('confirm', 'alpha');
// Security check - Protection if external user // Security check
//if ($user->socid > 0) accessforbidden(); if ($user->socid)
//if ($user->socid > 0) $socid = $user->socid; {
//$result = restrictedArea($user, 'asset', $id); $socid = $user->socid;
}
$result=restrictedArea($user, 'asset', $id, '');
// Get parameters // Get parameters
$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
@ -56,100 +59,79 @@ $pagenext = $page + 1;
if (!$sortorder) $sortorder = "ASC"; if (!$sortorder) $sortorder = "ASC";
if (!$sortfield) $sortfield = "name"; if (!$sortfield) $sortfield = "name";
// Initialize technical objects
$object = new Asset($db); $object = new Asset($db);
$extrafields = new ExtraFields($db); if ($object->fetch($id))
$diroutputmassaction = $conf->assets->dir_output.'/temp/massgeneration/'.$user->id; {
$hookmanager->initHooks(array('assetdocument')); // Note that conf->hooks_modules contains array $upload_dir = $conf->asset->dir_output."/".dol_sanitizeFileName($object->ref);
}
// Fetch optionals attributes and labels
$extrafields->fetch_name_optionals_label($object->table_element);
// Load object
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
// Security check
if (!empty($user->socid)) $socid = $user->socid;
$result = restrictedArea($user, 'asset', $id);
//if ($id > 0 || ! empty($ref)) $upload_dir = $conf->sellyoursaas->multidir_output[$object->entity] . "/packages/" . dol_sanitizeFileName($object->id);
if ($id > 0 || !empty($ref)) $upload_dir = $conf->sellyoursaas->multidir_output[$object->entity]."/packages/".dol_sanitizeFileName($object->ref);
/* /*
* Actions * Actions
*/ */
include_once DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php'; include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
/* /*
* View * View
*/ */
$title = $langs->trans('Assets')." - ".$langs->trans('Documents');
$helpurl = '';
llxHeader('', $title, $helpurl);
$form = new Form($db); $form = new Form($db);
$title = $langs->trans("Assets").' - '.$langs->trans("Files");
$help_url = '';
//$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
llxHeader('', $title, $help_url);
if ($object->id)
if ($id > 0 || !empty($ref))
{ {
/* if ($object->fetch($id, $ref) > 0)
* Show tabs
*/
if (!empty($conf->notification->enabled)) $langs->load("mails");
$head = asset_prepare_head($object);
print dol_get_fiche_head($head, 'document', $langs->trans("Asset"), -1, 'generic');
// Build file list
$filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC), 1);
$totalsize = 0;
foreach ($filearray as $key => $file)
{ {
$totalsize += $file['size']; $upload_dir = $conf->asset->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref);
$head = asset_prepare_head($object);
print dol_get_fiche_head($head, 'documents', $langs->trans('Asset'), -1, 'accounting');
// Build file list
$filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC), 1);
$totalsize = 0;
foreach ($filearray as $key => $file)
{
$totalsize += $file['size'];
}
// Asset content
$linkback = '<a href="'.DOL_URL_ROOT.'/asset/list.php?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
$morehtmlref = '';
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0);
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border tableforfield centpercent">';
print '<tr><td class="titlefield">'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.dol_print_size($totalsize, 1, 1).'</td></tr>';
print "</table>\n";
print "</div>\n";
print dol_get_fiche_end();
$modulepart = 'asset';
$permission = $user->rights->asset->write;
$permtoedit = $user->rights->asset->write;
$param = '&id='.$object->id;
include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';
} else {
dol_print_error($db);
} }
// Object card
// ------------------------------------------------------------
$linkback = '<a href="'.dol_buildpath('/asset/list.php', 1).'?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border tableforfield centpercent">';
// Number of files
print '<tr><td class="titlefield">'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
// Total size
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>';
print '</table>';
print '</div>';
print dol_get_fiche_end();
$modulepart = 'asset';
//$permission = $user->rights->asset->create;
$permission = 1;
//$permtoedit = $user->rights->asset->create;
$permtoedit = 1;
$param = '&id='.$object->id;
//$relativepathwithnofile='asset/' . dol_sanitizeFileName($object->id).'/';
$relativepathwithnofile = 'asset/'.dol_sanitizeFileName($object->ref).'/';
include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';
} else { } else {
accessforbidden('', 0, 1); print $langs->trans("ErrorUnknown");
} }
// End of page // End of page

View File

@ -157,7 +157,7 @@ if ($action == 'update' && $user->rights->asset->write)
if ($ret >= 0 && !count($object->errors)) if ($ret >= 0 && !count($object->errors))
{ {
setEventMessages($langs->trans("AssetsTypeModified"), null, 'mesgs'); setEventMessages($langs->trans("AssetTypeModified"), null, 'mesgs');
} else { } else {
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
} }

View File

@ -730,8 +730,8 @@ if (empty($reshook) && GETPOST('actionmove', 'alpha') == 'mupdate')
{ {
$error = 0; $error = 0;
$shour = dol_print_date($object->datep, "%H"); $shour = dol_print_date($object->datep, "%H", 'tzuserrel'); // We take the date visible by user $newdate is also date visible by user.
$smin = dol_print_date($object->datep, "%M"); $smin = dol_print_date($object->datep, "%M", 'tzuserrel');
$newdate = GETPOST('newdate', 'alpha'); $newdate = GETPOST('newdate', 'alpha');
if (empty($newdate) || strpos($newdate, 'dayevent_') != 0) if (empty($newdate) || strpos($newdate, 'dayevent_') != 0)
@ -740,7 +740,9 @@ if (empty($reshook) && GETPOST('actionmove', 'alpha') == 'mupdate')
exit; exit;
} }
$datep = dol_mktime($shour, $smin, 0, substr($newdate, 13, 2), substr($newdate, 15, 2), substr($newdate, 9, 4)); $datep = dol_mktime($shour, $smin, 0, substr($newdate, 13, 2), substr($newdate, 15, 2), substr($newdate, 9, 4), 'tzuserrel');
//print dol_print_date($datep, 'dayhour');exit;
if ($datep != $object->datep) if ($datep != $object->datep)
{ {
if (!empty($object->datef)) if (!empty($object->datef))

View File

@ -1343,14 +1343,14 @@ if (empty($action) || $action == 'show_month') // View by month
for ($iter_day = 0; $iter_day < 7; $iter_day++) { for ($iter_day = 0; $iter_day < 7; $iter_day++) {
// Show days of the current week // Show days of the current week
$curtime = dol_time_plus_duree($firstdaytoshow, $iter_day, 'd'); $curtime = dol_time_plus_duree($firstdaytoshow, $iter_day, 'd'); // $firstdaytoshow is in timezone of server
$tmparray = dol_getdate($curtime, true); $tmpday = dol_print_date($curtime, '%d', 'tzuserrel');
$tmpday = $tmparray['mday']; $tmpmonth = dol_print_date($curtime, '%m', 'tzuserrel');
$tmpmonth = $tmparray['mon']; $tmpyear = dol_print_date($curtime, '%Y', 'tzuserrel');
$tmpyear = $tmparray['year'];
$style = 'cal_current_month'; $style = 'cal_current_month';
if ($iter_day == 6) $style .= ' cal_other_month_right'; if ($iter_day == 6) $style .= ' cal_other_month_right';
$today = 0; $today = 0;
$todayarray = dol_getdate($now, 'fast'); $todayarray = dol_getdate($now, 'fast');
if ($todayarray['mday'] == $tmpday && $todayarray['mon'] == $tmpmonth && $todayarray['year'] == $tmpyear) $today = 1; if ($todayarray['mday'] == $tmpday && $todayarray['mon'] == $tmpmonth && $todayarray['year'] == $tmpyear) $today = 1;
@ -1501,11 +1501,11 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
} }
// Line with title of day // Line with title of day
print '<div id="dayevent_'.$dateint.'" class="cursorpointer dayevent tagtable centpercent nobordernopadding" onclick="window.location=\''.$urltocreate.'\';">'."\n"; print '<div id="dayevent_'.$dateint.'" class="dayevent tagtable centpercent nobordernopadding">'."\n";
if ($nonew <= 0) if ($nonew <= 0)
{ {
print '<div class="tagtr"><div class="nowrap tagtd"><div class="left inline-block">'; print '<div class="tagtr cursorpointer" onclick="window.location=\''.$urltocreate.'\';"><div class="nowrap tagtd"><div class="left inline-block">';
print '<a class="dayevent-aday" style="color: #666" href="'.$urltoshow.'">'; print '<a class="dayevent-aday" style="color: #666" href="'.$urltoshow.'">';
if ($showinfo) print dol_print_date($curtime, 'daytextshort'); if ($showinfo) print dol_print_date($curtime, 'daytextshort');
else print dol_print_date($curtime, '%d'); else print dol_print_date($curtime, '%d');
@ -1630,7 +1630,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
$tmpyearend = date('Y', $event->date_end_in_calendar); $tmpyearend = date('Y', $event->date_end_in_calendar);
$tmpmonthend = date('m', $event->date_end_in_calendar); $tmpmonthend = date('m', $event->date_end_in_calendar);
$tmpdayend = date('d', $event->date_end_in_calendar); $tmpdayend = date('d', $event->date_end_in_calendar);
if ($tmpyearend == $annee && $tmpmonthend == $mois && $tmpdayend == $jour) if ($tmpyearend != $annee || $tmpmonthend != $mois || $tmpdayend != $jour)
{ {
$cssclass .= " unmovable"; $cssclass .= " unmovable";
} }

View File

@ -243,7 +243,7 @@ if (empty($reshook))
elseif ($action == 'add' && $usercancreate) elseif ($action == 'add' && $usercancreate)
{ {
$datecommande = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')); $datecommande = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
$datelivraison = dol_mktime(12, 0, 0, GETPOST('liv_month'), GETPOST('liv_day'), GETPOST('liv_year')); $date_delivery = dol_mktime(GETPOST('liv_hour', 'int'), GETPOST('liv_min', 'int'), 0, GETPOST('liv_month', 'int'), GETPOST('liv_day', 'int'), GETPOST('liv_year', 'int'));
$selectedLines = GETPOST('toselect', 'array'); $selectedLines = GETPOST('toselect', 'array');
if ($datecommande == '') { if ($datecommande == '') {
@ -276,8 +276,8 @@ if (empty($reshook))
$object->fk_account = GETPOST('fk_account', 'int'); $object->fk_account = GETPOST('fk_account', 'int');
$object->availability_id = GETPOST('availability_id'); $object->availability_id = GETPOST('availability_id');
$object->demand_reason_id = GETPOST('demand_reason_id'); $object->demand_reason_id = GETPOST('demand_reason_id');
$object->date_livraison = $datelivraison; // deprecated $object->date_livraison = $date_delivery; // deprecated
$object->delivery_date = $datelivraison; $object->delivery_date = $date_delivery;
$object->shipping_method_id = GETPOST('shipping_method_id', 'int'); $object->shipping_method_id = GETPOST('shipping_method_id', 'int');
$object->warehouse_id = GETPOST('warehouse_id', 'int'); $object->warehouse_id = GETPOST('warehouse_id', 'int');
$object->fk_delivery_address = GETPOST('fk_address'); $object->fk_delivery_address = GETPOST('fk_address');
@ -1618,7 +1618,7 @@ if ($action == 'create' && $usercancreate)
print '<tr><td>'.$langs->trans("DateDeliveryPlanned").'</td>'; print '<tr><td>'.$langs->trans("DateDeliveryPlanned").'</td>';
print '<td colspan="3">'; print '<td colspan="3">';
$date_delivery = ($date_delivery ? $date_delivery : $object->date_delivery); $date_delivery = ($date_delivery ? $date_delivery : $object->date_delivery);
print $form->selectDate($date_delivery ? $date_delivery : -1, 'date_delivery', 1, 1, 1); print $form->selectDate($date_delivery ? $date_delivery : -1, 'liv_', 1, 1, 1);
print "</td>\n"; print "</td>\n";
print '</tr>'; print '</tr>';

View File

@ -251,7 +251,7 @@ if ($result)
if ($typeid > 0) $param .= '&typeid='.urlencode($typeid); if ($typeid > 0) $param .= '&typeid='.urlencode($typeid);
if ($search_amount_deb) $param .= '&search_amount_deb='.urlencode($search_amount_deb); if ($search_amount_deb) $param .= '&search_amount_deb='.urlencode($search_amount_deb);
if ($search_amount_cred) $param .= '&search_amount_cred='.urlencode($search_amount_cred); if ($search_amount_cred) $param .= '&search_amount_cred='.urlencode($search_amount_cred);
if ($search_bank_account > 0) $param .= '&search_amount='.urlencode($search_bank_account); if ($search_bank_account > 0) $param .= '&search_account='.urlencode($search_bank_account);
if ($search_accountancy_account > 0) $param .= '&search_accountancy_account='.urlencode($search_accountancy_account); if ($search_accountancy_account > 0) $param .= '&search_accountancy_account='.urlencode($search_accountancy_account);
if ($search_accountancy_subledger > 0) $param .= '&search_accountancy_subledger='.urlencode($search_accountancy_subledger); if ($search_accountancy_subledger > 0) $param .= '&search_accountancy_subledger='.urlencode($search_accountancy_subledger);

View File

@ -110,7 +110,7 @@ $sql .= " WHERE pf.fk_facture = f.rowid AND p.rowid = pf.fk_paiement AND cp.id =
$sql .= " AND f.module_source = '".$db->escape($posmodule)."'"; $sql .= " AND f.module_source = '".$db->escape($posmodule)."'";
$sql .= " AND f.pos_source = '".$db->escape($terminalid)."'"; $sql .= " AND f.pos_source = '".$db->escape($terminalid)."'";
$sql .= " AND f.paye = 1"; $sql .= " AND f.paye = 1";
$sql .= " AND p.entity IN (".getEntity('facture').")"; $sql .= " AND p.entity = ".$conf->entity; // Never share entities for features related to accountancy
/*if ($key == 'cash') $sql.=" AND cp.code = 'LIQ'"; /*if ($key == 'cash') $sql.=" AND cp.code = 'LIQ'";
elseif ($key == 'cheque') $sql.=" AND cp.code = 'CHQ'"; elseif ($key == 'cheque') $sql.=" AND cp.code = 'CHQ'";
elseif ($key == 'card') $sql.=" AND cp.code = 'CB'"; elseif ($key == 'card') $sql.=" AND cp.code = 'CB'";

View File

@ -289,11 +289,11 @@ if (empty($reshook))
elseif ($action == 'setref' && $user->rights->facture->creer) elseif ($action == 'setref' && $user->rights->facture->creer)
{ {
//var_dump(GETPOST('ref', 'alpha'));exit; //var_dump(GETPOST('ref', 'alpha'));exit;
$result = $object->setValueFrom('title', $ref, '', null, 'text', '', $user, 'BILLREC_MODIFY'); $result = $object->setValueFrom('titre', $ref, '', null, 'text', '', $user, 'BILLREC_MODIFY');
if ($result > 0) if ($result > 0)
{ {
$object->titre = GETPOST('ref', 'alpha'); // deprecated $object->titre = $ref; // deprecated
$object->title = GETPOST('ref', 'alpha'); $object->title = $ref;
$object->ref = $object->title; $object->ref = $object->title;
} else { } else {
$error++; $error++;

View File

@ -4104,7 +4104,7 @@ if ($action == 'create')
if ($objectidnext > 0) { if ($objectidnext > 0) {
$facthatreplace = new Facture($db); $facthatreplace = new Facture($db);
$facthatreplace->fetch($objectidnext); $facthatreplace->fetch($objectidnext);
print ' <span class="opacitymediumbycolor paddingleft">('.$langs->transnoentities("ReplacedByInvoice", $facthatreplace->getNomUrl(1)).')</span>'; print ' <span class="opacitymediumbycolor paddingleft">('.str_replace('{s1}', $facthatreplace->getNomUrl(1), $langs->transnoentities("ReplacedByInvoice", '{s1}')).')</span>';
} }
if ($object->type == Facture::TYPE_CREDIT_NOTE || $object->type == Facture::TYPE_DEPOSIT) { if ($object->type == Facture::TYPE_CREDIT_NOTE || $object->type == Facture::TYPE_DEPOSIT) {
@ -4112,7 +4112,10 @@ if ($action == 'create')
$result = $discount->fetch(0, $object->id); $result = $discount->fetch(0, $object->id);
if ($result > 0) { if ($result > 0) {
print ' <span class="opacitymediumbycolor paddingleft">'; print ' <span class="opacitymediumbycolor paddingleft">';
print $langs->transnoentities("CreditNoteConvertedIntoDiscount", $object->getLibType(1), $discount->getNomUrl(1, 'discount')); $s = $langs->trans("CreditNoteConvertedIntoDiscount", '{s1}', '{s2}');
$s = str_replace('{s1}', $object->getLibType(1), $s);
$s = str_replace('{s2}', $discount->getNomUrl(1, 'discount'), $s);
print $s;
print '</span><br>'; print '</span><br>';
} }
} }
@ -4123,7 +4126,9 @@ if ($action == 'create')
$result = $tmptemplate->fetch($object->fk_fac_rec_source); $result = $tmptemplate->fetch($object->fk_fac_rec_source);
if ($result > 0) { if ($result > 0) {
print ' <span class="opacitymediumbycolor paddingleft">'; print ' <span class="opacitymediumbycolor paddingleft">';
print $langs->transnoentities("GeneratedFromTemplate", '<a href="'.DOL_URL_ROOT.'/compta/facture/card-rec.php?facid='.$tmptemplate->id.'">'.dol_escape_htmltag($tmptemplate->ref).'</a>'); $s = $langs->transnoentities("GeneratedFromTemplate", '{s1}');
$s = str_replace('{s1}', '<a href="'.DOL_URL_ROOT.'/compta/facture/card-rec.php?facid='.$tmptemplate->id.'">'.dol_escape_htmltag($tmptemplate->ref).'</a>', $s);
print $s;
print '</span>'; print '</span>';
} }
} }

View File

@ -268,7 +268,7 @@ if ($search_status != '' && $search_status >= -1)
if ($search_status == -1) $sql .= ' AND suspended = 1'; if ($search_status == -1) $sql .= ' AND suspended = 1';
} }
$sql .= dolSqlDateFilter('f.date_last_gen', $search_day, $search_month, $search_year); $sql .= dolSqlDateFilter('f.date_last_gen', $search_day, $search_month, $search_year);
$sql .= dolSqlDateFilter('f.date_last_gen', $search_day_date_when, $search_month_date_when, $search_year_date_when); $sql .= dolSqlDateFilter('f.date_when', $search_day_date_when, $search_month_date_when, $search_year_date_when);
$sql .= $db->order($sortfield, $sortorder); $sql .= $db->order($sortfield, $sortorder);

View File

@ -507,19 +507,19 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
print '<tr><td>'.$langs->trans('Numero'); print '<tr><td>'.$langs->trans('Numero');
print ' <em>('.$langs->trans("ChequeOrTransferNumber").')</em>'; print ' <em>('.$langs->trans("ChequeOrTransferNumber").')</em>';
print '</td>'; print '</td>';
print '<td><input name="num_paiement" type="text" value="'.$paymentnum.'"></td></tr>'; print '<td><input name="num_paiement" type="text" class="maxwidth200" value="'.$paymentnum.'"></td></tr>';
// Check transmitter // Check transmitter
print '<tr><td class="'.(GETPOST('paiementcode') == 'CHQ' ? 'fieldrequired ' : '').'fieldrequireddyn">'.$langs->trans('CheckTransmitter'); print '<tr><td class="'.(GETPOST('paiementcode') == 'CHQ' ? 'fieldrequired ' : '').'fieldrequireddyn">'.$langs->trans('CheckTransmitter');
print ' <em>('.$langs->trans("ChequeMaker").')</em>'; print ' <em>('.$langs->trans("ChequeMaker").')</em>';
print '</td>'; print '</td>';
print '<td><input id="fieldchqemetteur" name="chqemetteur" size="30" type="text" value="'.GETPOST('chqemetteur', 'alphanohtml').'"></td></tr>'; print '<td><input id="fieldchqemetteur" class="maxwidth300" name="chqemetteur" type="text" value="'.GETPOST('chqemetteur', 'alphanohtml').'"></td></tr>';
// Bank name // Bank name
print '<tr><td>'.$langs->trans('Bank'); print '<tr><td>'.$langs->trans('Bank');
print ' <em>('.$langs->trans("ChequeBank").')</em>'; print ' <em>('.$langs->trans("ChequeBank").')</em>';
print '</td>'; print '</td>';
print '<td><input name="chqbank" size="30" type="text" value="'.GETPOST('chqbank', 'alphanohtml').'"></td></tr>'; print '<td><input name="chqbank" class="maxwidth300" type="text" value="'.GETPOST('chqbank', 'alphanohtml').'"></td></tr>';
// Comments // Comments
print '<tr><td>'.$langs->trans('Comments').'</td>'; print '<tr><td>'.$langs->trans('Comments').'</td>';
@ -577,6 +577,8 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
$i = 0; $i = 0;
//print '<tr><td colspan="3">'; //print '<tr><td colspan="3">';
print '<br>'; print '<br>';
print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
print '<table class="noborder centpercent">'; print '<table class="noborder centpercent">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
@ -785,7 +787,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
print "</tr>\n"; print "</tr>\n";
} }
print "</table>"; print "</table>";
//print "</td></tr>\n"; print "</div>\n";
} }
$db->free($resql); $db->free($resql);
} else { } else {

View File

@ -43,12 +43,20 @@ $action = GETPOST('action', 'aZ09');
$confirm = GETPOST('confirm', 'alpha'); $confirm = GETPOST('confirm', 'alpha');
$backtopage = GETPOST('backtopage', 'alpha'); $backtopage = GETPOST('backtopage', 'alpha');
$object = new Paiement($db);
// Load object
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
$result = restrictedArea($user, $object->element, $object->id, 'paiement', '');
// Security check // Security check
if ($user->socid) $socid = $user->socid; if ($user->socid) $socid = $user->socid;
// TODO ajouter regle pour restreindre acces paiement // Now check also permission on thirdparty of invoices of payments. Thirdparty were loaded by the fetch_object before based on first invoice.
//$result = restrictedArea($user, 'facture', $id,''); // It should be enough because all payments are done on invoices of the same thirdparty.
if ($socid && $socid != $object->thirdparty->id) {
$object = new Paiement($db); accessforbidden();
}
/* /*
@ -59,7 +67,6 @@ if ($action == 'setnote' && $user->rights->facture->paiement)
{ {
$db->begin(); $db->begin();
$object->fetch($id);
$result = $object->update_note(GETPOST('note', 'restricthtml')); $result = $object->update_note(GETPOST('note', 'restricthtml'));
if ($result > 0) if ($result > 0)
{ {
@ -75,7 +82,6 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->facture->
{ {
$db->begin(); $db->begin();
$object->fetch($id);
$result = $object->delete(); $result = $object->delete();
if ($result > 0) if ($result > 0)
{ {
@ -100,7 +106,6 @@ if ($action == 'confirm_validate' && $confirm == 'yes' && $user->rights->facture
{ {
$db->begin(); $db->begin();
$object->fetch($id);
if ($object->validate($user) > 0) if ($object->validate($user) > 0)
{ {
$db->commit(); $db->commit();
@ -134,7 +139,6 @@ if ($action == 'confirm_validate' && $confirm == 'yes' && $user->rights->facture
if ($action == 'setnum_paiement' && !empty($_POST['num_paiement'])) if ($action == 'setnum_paiement' && !empty($_POST['num_paiement']))
{ {
$object->fetch($id);
$res = $object->update_num($_POST['num_paiement']); $res = $object->update_num($_POST['num_paiement']);
if ($res === 0) if ($res === 0)
{ {
@ -146,7 +150,6 @@ if ($action == 'setnum_paiement' && !empty($_POST['num_paiement']))
if ($action == 'setdatep' && !empty($_POST['datepday'])) if ($action == 'setdatep' && !empty($_POST['datepday']))
{ {
$object->fetch($id);
$datepaye = dol_mktime(GETPOST('datephour', 'int'), GETPOST('datepmin', 'int'), GETPOST('datepsec', 'int'), GETPOST('datepmonth', 'int'), GETPOST('datepday', 'int'), GETPOST('datepyear', 'int')); $datepaye = dol_mktime(GETPOST('datephour', 'int'), GETPOST('datepmin', 'int'), GETPOST('datepsec', 'int'), GETPOST('datepmonth', 'int'), GETPOST('datepday', 'int'), GETPOST('datepyear', 'int'));
$res = $object->update_date($datepaye); $res = $object->update_date($datepaye);
if ($res === 0) if ($res === 0)

View File

@ -1293,7 +1293,8 @@ class Paiement extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/** /**
* Load the third party of object, from id into this->thirdparty * Load the third party of object, from id into this->thirdparty.
* For payments, take the thirdparty linked to the first invoice found. This is enough because payments are done on invoices of the same thirdparty.
* *
* @param int $force_thirdparty_id Force thirdparty id * @param int $force_thirdparty_id Force thirdparty id
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
@ -1311,7 +1312,7 @@ class Paiement extends CommonObject
$invoice = new Facture($this->db); $invoice = new Facture($this->db);
if ($invoice->fetch($billsarray[0]) > 0) if ($invoice->fetch($billsarray[0]) > 0)
{ {
$force_thirdparty_id = $invoice->fk_soc; $force_thirdparty_id = $invoice->socid;
} }
} }
} }

View File

@ -36,6 +36,23 @@ $ref = GETPOST('ref', 'alpha');
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$confirm = GETPOST('confirm', 'alpha'); $confirm = GETPOST('confirm', 'alpha');
$object = new Paiement($db);
// Load object
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
$result = restrictedArea($user, $object->element, $object->id, 'paiement', '');
// Security check
if ($user->socid) $socid = $user->socid;
// Now check also permission on thirdparty of invoices of payments. Thirdparty were loaded by the fetch_object before based on first invoice.
// It should be enough because all payments are done on invoices of the same thirdparty.
if ($socid && $socid != $object->thirdparty->id) {
accessforbidden();
}
/* /*
* Actions * Actions
*/ */
@ -49,8 +66,6 @@ $confirm = GETPOST('confirm', 'alpha');
llxHeader('', $langs->trans("Payment")); llxHeader('', $langs->trans("Payment"));
$object = new Paiement($db);
$object->fetch($id, $ref);
$object->info($object->id); $object->info($object->id);
$head = payment_prepare_head($object); $head = payment_prepare_head($object);

View File

@ -30,9 +30,6 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
// Security check
if (!$user->rights->facture->lire) accessforbidden();
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$socid = 0; $socid = 0;
@ -48,6 +45,9 @@ if (!$user->rights->societe->client->voir || $socid) $dir .= '/private/'.$user->
$year = GETPOST('year', 'int'); $year = GETPOST('year', 'int');
if (!$year) { $year = date("Y"); } if (!$year) { $year = date("Y"); }
// Security check
if (empty($user->rights->facture->lire)) accessforbidden();
/* /*
* Actions * Actions

View File

@ -27,10 +27,6 @@ require '../../main.inc.php';
// Load translation files required by the page // Load translation files required by the page
$langs->load("bills"); $langs->load("bills");
// Security check
if (!$user->rights->facture->lire)
accessforbidden();
$socid = 0; $socid = 0;
if ($user->socid > 0) if ($user->socid > 0)
{ {
@ -50,6 +46,9 @@ $pagenext = $page + 1;
if (!$sortorder) $sortorder = "DESC"; if (!$sortorder) $sortorder = "DESC";
if (!$sortfield) $sortfield = "p.rowid"; if (!$sortfield) $sortfield = "p.rowid";
// Security check
if (empty($user->rights->facture->lire)) accessforbidden();
/* /*
* Actions * Actions

View File

@ -2137,7 +2137,7 @@ if ($action == 'create')
$delallowed = $user->rights->contrat->creer; $delallowed = $user->rights->contrat->creer;
print $formfile->showdocuments('contract', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', 0, '', $soc->default_lang, '', $object); print $formfile->showdocuments('contract', $filename, $filedir, $urlsource, $genallowed, $delallowed, ($object->model_pdf ? $object->model_pdf : $conf->global->CONTRACT_ADDON_PDF), 1, 0, 0, 28, 0, '', 0, '', $soc->default_lang, '', $object);
// Show links to link elements // Show links to link elements

View File

@ -201,7 +201,7 @@ $socstatic = new Societe($db);
$contracttmp = new Contrat($db); $contracttmp = new Contrat($db);
$sql = 'SELECT'; $sql = 'SELECT';
$sql .= " c.rowid, c.ref, c.datec as date_creation, c.tms as date_update, c.date_contrat, c.statut, c.ref_customer, c.ref_supplier, c.note_private, c.note_public, c.entity"; $sql .= " c.rowid, c.ref, c.datec as date_creation, c.tms as date_update, c.date_contrat, c.statut, c.ref_customer, c.ref_supplier, c.note_private, c.note_public, c.entity,";
$sql .= ' s.rowid as socid, s.nom as name, s.name_alias, s.email, s.town, s.zip, s.fk_pays as country_id, s.client, s.code_client, s.status as company_status, s.logo as company_logo,'; $sql .= ' s.rowid as socid, s.nom as name, s.name_alias, s.email, s.town, s.zip, s.fk_pays as country_id, s.client, s.code_client, s.status as company_status, s.logo as company_logo,';
$sql .= " typent.code as typent_code,"; $sql .= " typent.code as typent_code,";
$sql .= " state.code_departement as state_code, state.nom as state_name,"; $sql .= " state.code_departement as state_code, state.nom as state_name,";

View File

@ -222,6 +222,7 @@ class DiscountAbsolute
if (empty($this->multicurrency_amount_ht)) $this->multicurrency_amount_ht = 0; if (empty($this->multicurrency_amount_ht)) $this->multicurrency_amount_ht = 0;
if (empty($this->multicurrency_amount_tva)) $this->multicurrency_amount_tva = 0; if (empty($this->multicurrency_amount_tva)) $this->multicurrency_amount_tva = 0;
if (empty($this->multicurrency_amount_ttc)) $this->multicurrency_amount_ttc = 0; if (empty($this->multicurrency_amount_ttc)) $this->multicurrency_amount_ttc = 0;
if (empty($this->tva_tx)) $this->tva_tx = 0;
// Check parameters // Check parameters
if (empty($this->description)) if (empty($this->description))

View File

@ -253,9 +253,9 @@ class Form
if (empty($notabletag)) $ret .= '<td class="left">'; if (empty($notabletag)) $ret .= '<td class="left">';
//else $ret.='<div class="clearboth"></div>'; //else $ret.='<div class="clearboth"></div>';
$ret .= '<input type="submit" class="button'.(empty($notabletag) ? '' : ' ').'" name="modify" value="'.$langs->trans("Modify").'">'; $ret .= '<input type="submit" class="smallpaddingimp button'.(empty($notabletag) ? '' : ' ').'" name="modify" value="'.$langs->trans("Modify").'">';
if (preg_match('/ckeditor|textarea/', $typeofdata) && empty($notabletag)) $ret .= '<br>'."\n"; if (preg_match('/ckeditor|textarea/', $typeofdata) && empty($notabletag)) $ret .= '<br>'."\n";
$ret .= '<input type="submit" class="button button-cancel'.(empty($notabletag) ? '' : ' ').'" name="cancel" value="'.$langs->trans("Cancel").'">'; $ret .= '<input type="submit" class="smallpaddingimp button button-cancel'.(empty($notabletag) ? '' : ' ').'" name="cancel" value="'.$langs->trans("Cancel").'">';
if (empty($notabletag)) $ret .= '</td>'; if (empty($notabletag)) $ret .= '</td>';
if (empty($notabletag)) $ret .= '</tr></table>'."\n"; if (empty($notabletag)) $ret .= '</tr></table>'."\n";
@ -3044,10 +3044,10 @@ class Form
// Add new entry // Add new entry
// "key" value of json key array is used by jQuery automatically as selected value // "key" value of json key array is used by jQuery automatically as selected value. Example: 'type' = product or service, 'price_ht' = unit price without tax
// "label" value of json key array is used by jQuery automatically as text for combo box // "label" value of json key array is used by jQuery automatically as text for combo box
$out .= $opt; $out .= $opt;
array_push($outarray, array('key'=>$outkey, 'value'=>$outref, 'label'=>$outval, 'qty'=>$outqty, 'up'=>price2num($objp->unitprice, 'MT'), 'discount'=>$outdiscount, 'type'=>$outtype, 'duration_value'=>$outdurationvalue, 'duration_unit'=>$outdurationunit, 'disabled'=>(empty($objp->idprodfournprice) ?true:false))); array_push($outarray, array('key'=>$outkey, 'value'=>$outref, 'label'=>$outval, 'qty'=>$outqty, 'price_ht'=>price2num($objp->unitprice, 'MT'), 'up'=>price2num($objp->unitprice, 'MT'), 'discount'=>$outdiscount, 'type'=>$outtype, 'duration_value'=>$outdurationvalue, 'duration_unit'=>$outdurationunit, 'disabled'=>(empty($objp->idprodfournprice) ?true:false)));
// Exemple of var_dump $outarray // Exemple of var_dump $outarray
// array(1) {[0]=>array(6) {[key"]=>string(1) "2" ["value"]=>string(3) "ppp" // array(1) {[0]=>array(6) {[key"]=>string(1) "2" ["value"]=>string(3) "ppp"
// ["label"]=>string(76) "ppp (<strong>f</strong>ff2) - ppp - 20,00 Euros/1unité (20,00 Euros/unité)" // ["label"]=>string(76) "ppp (<strong>f</strong>ff2) - ppp - 20,00 Euros/1unité (20,00 Euros/unité)"
@ -5614,6 +5614,9 @@ class Form
if ($h == 3) $shour = ''; if ($h == 3) $shour = '';
if ($m == 3) $smin = ''; if ($m == 3) $smin = '';
$nowgmt = dol_now('gmt');
//var_dump(dol_print_date($nowgmt, 'dayhourinputnoreduce', 'tzuserrel'));
// You can set MAIN_POPUP_CALENDAR to 'eldy' or 'jquery' // You can set MAIN_POPUP_CALENDAR to 'eldy' or 'jquery'
$usecalendar = 'combo'; $usecalendar = 'combo';
if (!empty($conf->use_javascript_ajax) && (empty($conf->global->MAIN_POPUP_CALENDAR) || $conf->global->MAIN_POPUP_CALENDAR != "none")) { if (!empty($conf->use_javascript_ajax) && (empty($conf->global->MAIN_POPUP_CALENDAR) || $conf->global->MAIN_POPUP_CALENDAR != "none")) {
@ -5636,13 +5639,13 @@ class Form
// Calendrier popup version eldy // Calendrier popup version eldy
if ($usecalendar == "eldy") if ($usecalendar == "eldy")
{ {
// Zone de saisie manuelle de la date // Input area to enter date manually
$retstring .= '<input id="'.$prefix.'" name="'.$prefix.'" type="text" class="maxwidthdate" maxlength="11" value="'.$formated_date.'"'; $retstring .= '<input id="'.$prefix.'" name="'.$prefix.'" type="text" class="maxwidthdate" maxlength="11" value="'.$formated_date.'"';
$retstring .= ($disabled ? ' disabled' : ''); $retstring .= ($disabled ? ' disabled' : '');
$retstring .= ' onChange="dpChangeDay(\''.$prefix.'\',\''.$langs->trans("FormatDateShortJavaInput").'\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript $retstring .= ' onChange="dpChangeDay(\''.$prefix.'\',\''.$langs->trans("FormatDateShortJavaInput").'\'); "'; // FormatDateShortInput for dol_print_date / FormatDateShortJavaInput that is same for javascript
$retstring .= '>'; $retstring .= '>';
// Icone calendrier // Icon calendar
if (!$disabled) if (!$disabled)
{ {
$retstring .= '<button id="'.$prefix.'Button" type="button" class="dpInvisibleButtons"'; $retstring .= '<button id="'.$prefix.'Button" type="button" class="dpInvisibleButtons"';
@ -5822,8 +5825,7 @@ class Form
{ {
// Script which will be inserted in the onClick of the "Now" link // Script which will be inserted in the onClick of the "Now" link
$reset_scripts = ""; $reset_scripts = "";
if ($addnowlink == 2) // local computer time if ($addnowlink == 2) { // local computer time
{
// pad add leading 0 on numbers // pad add leading 0 on numbers
$reset_scripts .= "Number.prototype.pad = function(size) { $reset_scripts .= "Number.prototype.pad = function(size) {
var s = String(this); var s = String(this);
@ -5834,14 +5836,12 @@ class Form
} }
// Generate the date part, depending on the use or not of the javascript calendar // Generate the date part, depending on the use or not of the javascript calendar
if ($addnowlink == 1) // server time expressed in user time setup if ($addnowlink == 1) { // server time expressed in user time setup
{ $reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date($nowgmt, 'day', 'tzuserrel').'\');';
$reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date(dol_now(), 'day', 'tzuser').'\');'; $reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date($nowgmt, '%d', 'tzuserrel').'\');';
$reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date(dol_now(), '%d', 'tzuser').'\');'; $reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date($nowgmt, '%m', 'tzuserrel').'\');';
$reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date(dol_now(), '%m', 'tzuser').'\');'; $reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date($nowgmt, '%Y', 'tzuserrel').'\');';
$reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date(dol_now(), '%Y', 'tzuser').'\');'; } elseif ($addnowlink == 2) {
} elseif ($addnowlink == 2)
{
/* Disabled because the output does not use the string format defined by FormatDateShort key to forge the value into #prefix. /* Disabled because the output does not use the string format defined by FormatDateShort key to forge the value into #prefix.
* This break application for foreign languages. * This break application for foreign languages.
$reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(d.toLocaleDateString(\''.str_replace('_', '-', $langs->defaultlang).'\'));'; $reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(d.toLocaleDateString(\''.str_replace('_', '-', $langs->defaultlang).'\'));';
@ -5849,10 +5849,10 @@ class Form
$reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(parseInt(d.getMonth().pad()) + 1);'; $reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(parseInt(d.getMonth().pad()) + 1);';
$reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(d.getFullYear());'; $reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(d.getFullYear());';
*/ */
$reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date(dol_now(), 'day', 'tzuser').'\');'; $reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date($nowgmt, 'day', 'tzuserrel').'\');';
$reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date(dol_now(), '%d', 'tzuser').'\');'; $reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date($nowgmt, '%d', 'tzuserrel').'\');';
$reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date(dol_now(), '%m', 'tzuser').'\');'; $reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date($nowgmt, '%m', 'tzuserrel').'\');';
$reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date(dol_now(), '%Y', 'tzuser').'\');'; $reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date($nowgmt, '%Y', 'tzuserrel').'\');';
} }
/*if ($usecalendar == "eldy") /*if ($usecalendar == "eldy")
{ {
@ -5872,7 +5872,7 @@ class Form
//$reset_scripts .= 'this.form.elements[\''.$prefix.'hour\'].value=formatDate(new Date(), \'HH\'); '; //$reset_scripts .= 'this.form.elements[\''.$prefix.'hour\'].value=formatDate(new Date(), \'HH\'); ';
if ($addnowlink == 1) if ($addnowlink == 1)
{ {
$reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(\''.dol_print_date(dol_now(), '%H', 'tzuser').'\');'; $reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(\''.dol_print_date($nowgmt, '%H', 'tzuserrel').'\');';
$reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').change();'; $reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').change();';
} elseif ($addnowlink == 2) } elseif ($addnowlink == 2)
{ {
@ -5889,7 +5889,7 @@ class Form
//$reset_scripts .= 'this.form.elements[\''.$prefix.'min\'].value=formatDate(new Date(), \'mm\'); '; //$reset_scripts .= 'this.form.elements[\''.$prefix.'min\'].value=formatDate(new Date(), \'mm\'); ';
if ($addnowlink == 1) if ($addnowlink == 1)
{ {
$reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(\''.dol_print_date(dol_now(), '%M', 'tzuser').'\');'; $reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(\''.dol_print_date($nowgmt, '%M', 'tzuserrel').'\');';
$reset_scripts .= 'jQuery(\'#'.$prefix.'min\').change();'; $reset_scripts .= 'jQuery(\'#'.$prefix.'min\').change();';
} elseif ($addnowlink == 2) } elseif ($addnowlink == 2)
{ {
@ -5914,22 +5914,22 @@ class Form
$reset_scripts = ""; $reset_scripts = "";
// Generate the date part, depending on the use or not of the javascript calendar // Generate the date part, depending on the use or not of the javascript calendar
$reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date(dol_now(), 'day').'\');'; $reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(\''.dol_print_date($nowgmt, 'dayinputnoreduce', 'tzuserrel').'\');';
$reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date(dol_now(), '%d').'\');'; $reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date($nowgmt, '%d', 'tzuserrel').'\');';
$reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date(dol_now(), '%m').'\');'; $reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date($nowgmt, '%m', 'tzuserrel').'\');';
$reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date(dol_now(), '%Y').'\');'; $reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date($nowgmt, '%Y', 'tzuserrel').'\');';
// Update the hour part // Update the hour part
if ($h) if ($h)
{ {
if ($fullday) $reset_scripts .= " if (jQuery('#fullday:checked').val() == null) {"; if ($fullday) $reset_scripts .= " if (jQuery('#fullday:checked').val() == null) {";
$reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(\''.dol_print_date(dol_now(), '%H').'\');'; $reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(\''.dol_print_date($nowgmt, '%H', 'tzuserrel').'\');';
if ($fullday) $reset_scripts .= ' } '; if ($fullday) $reset_scripts .= ' } ';
} }
// Update the minute part // Update the minute part
if ($m) if ($m)
{ {
if ($fullday) $reset_scripts .= " if (jQuery('#fullday:checked').val() == null) {"; if ($fullday) $reset_scripts .= " if (jQuery('#fullday:checked').val() == null) {";
$reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(\''.dol_print_date(dol_now(), '%M').'\');'; $reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(\''.dol_print_date($nowgmt, '%M', 'tzuserrel').'\');';
if ($fullday) $reset_scripts .= ' } '; if ($fullday) $reset_scripts .= ' } ';
} }
// If reset_scripts is not empty, print the link with the reset_scripts in the onClick // If reset_scripts is not empty, print the link with the reset_scripts in the onClick
@ -5941,12 +5941,12 @@ class Form
} }
} }
// Add a "Plus one hour" link // Add a link to set data
if ($conf->use_javascript_ajax && $adddateof) if ($conf->use_javascript_ajax && $adddateof)
{ {
$tmparray = dol_getdate($adddateof); $tmparray = dol_getdate($adddateof);
if (empty($labeladddateof)) $labeladddateof = $langs->trans("DateInvoice"); if (empty($labeladddateof)) $labeladddateof = $langs->trans("DateInvoice");
$retstring .= ' - <button class="dpInvisibleButtons datenowlink" id="dateofinvoice" type="button" name="_dateofinvoice" value="now" onclick="jQuery(\'#re\').val(\''.dol_print_date($adddateof, 'day').'\');jQuery(\'#reday\').val(\''.$tmparray['mday'].'\');jQuery(\'#remonth\').val(\''.$tmparray['mon'].'\');jQuery(\'#reyear\').val(\''.$tmparray['year'].'\');">'.$labeladddateof.'</a>'; $retstring .= ' - <button class="dpInvisibleButtons datenowlink" id="dateofinvoice" type="button" name="_dateofinvoice" value="now" onclick="console.log(\'Click on now link\'); jQuery(\'#re\').val(\''.dol_print_date($adddateof, 'dayinputnoreduce').'\');jQuery(\'#reday\').val(\''.$tmparray['mday'].'\');jQuery(\'#remonth\').val(\''.$tmparray['mon'].'\');jQuery(\'#reyear\').val(\''.$tmparray['year'].'\');">'.$labeladddateof.'</a>';
} }
return $retstring; return $retstring;

View File

@ -20,7 +20,7 @@
/** /**
* \file htdocs/core/class/html.formactions.class.php * \file htdocs/core/class/html.formactions.class.php
* \ingroup core * \ingroup core
* \brief Fichier de la classe des fonctions predefinie de composants html actions * \brief File of class with predefined functions and HTML components
*/ */

View File

@ -1022,11 +1022,10 @@ class FormCompany extends Form
public function formThirdpartyType($page, $selected = '', $htmlname = 'socid', $filter = '', $nooutput = 0) public function formThirdpartyType($page, $selected = '', $htmlname = 'socid', $filter = '', $nooutput = 0)
{ {
// phpcs:enable // phpcs:enable
global $langs; global $conf, $langs;
$out = ''; $out = '';
if ($htmlname != "none") if ($htmlname != "none") {
{
$out .= '<form method="post" action="'.$page.'">'; $out .= '<form method="post" action="'.$page.'">';
$out .= '<input type="hidden" name="action" value="set_thirdpartytype">'; $out .= '<input type="hidden" name="action" value="set_thirdpartytype">';
$out .= '<input type="hidden" name="token" value="'.newToken().'">'; $out .= '<input type="hidden" name="token" value="'.newToken().'">';
@ -1035,8 +1034,7 @@ class FormCompany extends Form
$out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">'; $out .= '<input type="submit" class="button smallpaddingimp valignmiddle" value="'.$langs->trans("Modify").'">';
$out .= '</form>'; $out .= '</form>';
} else { } else {
if ($selected) if ($selected) {
{
$arr = $this->typent_array(0); $arr = $this->typent_array(0);
$typent = $arr[$selected]; $typent = $arr[$selected];
$out .= $typent; $out .= $typent;
@ -1045,7 +1043,10 @@ class FormCompany extends Form
} }
} }
if ($nooutput) return $out; if ($nooutput) {
else print $out; return $out;
} else {
print $out;
}
} }
} }

View File

@ -426,7 +426,7 @@ class FormFile
if ($modulepart == 'company') if ($modulepart == 'company')
{ {
$showempty = 1; $showempty = 1; // can have no template active
if (is_array($genallowed)) $modellist = $genallowed; if (is_array($genallowed)) $modellist = $genallowed;
else { else {
include_once DOL_DOCUMENT_ROOT.'/core/modules/societe/modules_societe.class.php'; include_once DOL_DOCUMENT_ROOT.'/core/modules/societe/modules_societe.class.php';
@ -490,6 +490,7 @@ class FormFile
} }
} elseif ($modulepart == 'contract') } elseif ($modulepart == 'contract')
{ {
$showempty = 1; // can have no template active
if (is_array($genallowed)) $modellist = $genallowed; if (is_array($genallowed)) $modellist = $genallowed;
else { else {
include_once DOL_DOCUMENT_ROOT.'/core/modules/contract/modules_contract.php'; include_once DOL_DOCUMENT_ROOT.'/core/modules/contract/modules_contract.php';
@ -553,6 +554,7 @@ class FormFile
} }
} elseif ($modulepart == 'facture_fournisseur' || $modulepart == 'supplier_invoice') } elseif ($modulepart == 'facture_fournisseur' || $modulepart == 'supplier_invoice')
{ {
$showempty = 1; // can have no template active
if (is_array($genallowed)) $modellist = $genallowed; if (is_array($genallowed)) $modellist = $genallowed;
else { else {
include_once DOL_DOCUMENT_ROOT.'/core/modules/supplier_invoice/modules_facturefournisseur.php'; include_once DOL_DOCUMENT_ROOT.'/core/modules/supplier_invoice/modules_facturefournisseur.php';

View File

@ -183,17 +183,18 @@ function getObjectFromID(id){
} }
// Called after selection of a date to save details into detailed fields // Called after selection of a date to save details into detailed fields
function dpChangeDay(dateFieldID,format) function dpChangeDay(dateFieldID, format)
{ {
//showDP.datefieldID=dateFieldID; //showDP.datefieldID=dateFieldID;
console.log("Call dpChangeDay, we save date into detailed fields."); console.log("Call dpChangeDay, we save date into detailed fields from format = "+format);
var thefield=getObjectFromID(dateFieldID); var thefield=getObjectFromID(dateFieldID);
var thefieldday=getObjectFromID(dateFieldID+"day"); var thefieldday=getObjectFromID(dateFieldID+"day");
var thefieldmonth=getObjectFromID(dateFieldID+"month"); var thefieldmonth=getObjectFromID(dateFieldID+"month");
var thefieldyear=getObjectFromID(dateFieldID+"year"); var thefieldyear=getObjectFromID(dateFieldID+"year");
var date=getDateFromFormat(thefield.value,format); var date=getDateFromFormat(thefield.value, format);
//console.log(date);
if (date) if (date)
{ {
thefieldday.value=date.getDate(); thefieldday.value=date.getDate();

View File

@ -80,7 +80,7 @@ function asset_prepare_head(Asset $object)
$h = 0; $h = 0;
$head = array(); $head = array();
$head[$h][0] = DOL_URL_ROOT.'/asset/card.php'; $head[$h][0] = DOL_URL_ROOT.'/asset/card.php?id='.$object->id;
$head[$h][1] = $langs->trans("Card"); $head[$h][1] = $langs->trans("Card");
$head[$h][2] = 'card'; $head[$h][2] = 'card';
$h++; $h++;

View File

@ -1192,6 +1192,16 @@ function dol_delete_file($file, $disableglob = 0, $nophperrors = 0, $nohook = 0,
{ {
if ($nophperrors) $ok = @unlink($filename); if ($nophperrors) $ok = @unlink($filename);
else $ok = unlink($filename); else $ok = unlink($filename);
// If it fails and it is because of the missing write permission on parent dir
if (!$ok && file_exists(dirname($filename)) && !(fileperms(dirname($filename)) & 0200)) {
dol_syslog("Error in deletion, but parent directory exists with no permission to write, we try to change permission on parent directory and retry...", LOG_DEBUG);
@chmod(dirname($filename), fileperms(dirname($filename)) | 0200);
// Now we retry deletion
if ($nophperrors) $ok = @unlink($filename);
else $ok = unlink($filename);
}
if ($ok) if ($ok)
{ {
dol_syslog("Removed file ".$filename, LOG_DEBUG); dol_syslog("Removed file ".$filename, LOG_DEBUG);

View File

@ -1969,7 +1969,7 @@ function dol_strftime($fmt, $ts = false, $is_gmt = false)
* "%d/%m/%Y %H:%M", * "%d/%m/%Y %H:%M",
* "%d/%m/%Y %H:%M:%S", * "%d/%m/%Y %H:%M:%S",
* "%B"=Long text of month, "%A"=Long text of day, "%b"=Short text of month, "%a"=Short text of day * "%B"=Long text of month, "%A"=Long text of day, "%b"=Short text of month, "%a"=Short text of day
* "day", "daytext", "dayhour", "dayhourldap", "dayhourtext", "dayrfc", "dayhourrfc", "...reduceformat" * "day", "daytext", "dayhour", "dayhourldap", "dayhourtext", "dayrfc", "dayhourrfc", "...inputnoreduce", "...reduceformat"
* @param string $tzoutput true or 'gmt' => string is for Greenwich location * @param string $tzoutput true or 'gmt' => string is for Greenwich location
* false or 'tzserver' => output string is for local PHP server TZ usage * false or 'tzserver' => output string is for local PHP server TZ usage
* 'tzuser' => output string is for user TZ (current browser TZ with current dst) => In a future, we should have same behaviour than 'tzuserrel' * 'tzuser' => output string is for user TZ (current browser TZ with current dst) => In a future, we should have same behaviour than 'tzuserrel'
@ -2013,13 +2013,17 @@ function dol_print_date($time, $format = '', $tzoutput = 'auto', $outputlangs =
} }
if (!is_object($outputlangs)) $outputlangs = $langs; if (!is_object($outputlangs)) $outputlangs = $langs;
if (!$format) $format = 'daytextshort'; if (!$format) $format = 'daytextshort';
$reduceformat = (!empty($conf->dol_optimize_smallscreen) && in_array($format, array('day', 'dayhour'))) ? 1 : 0;
// Do we have to reduce the length of date (year on 2 chars) to save space.
// Note: dayinputnoreduce is same than day but no reduction of year length will be done
$reduceformat = (!empty($conf->dol_optimize_smallscreen) && in_array($format, array('day', 'dayhour'))) ? 1 : 0; // Test on original $format param.
$format = preg_replace('/inputnoreduce/', '', $format); // so format 'dayinputnoreduce' is processed like day
$formatwithoutreduce = preg_replace('/reduceformat/', '', $format); $formatwithoutreduce = preg_replace('/reduceformat/', '', $format);
if ($formatwithoutreduce != $format) { $format = $formatwithoutreduce; $reduceformat = 1; } // so format 'dayreduceformat' is processed like day if ($formatwithoutreduce != $format) { $format = $formatwithoutreduce; $reduceformat = 1; } // so format 'dayreduceformat' is processed like day
// Change predefined format into computer format. If found translation in lang file we use it, otherwise we use default. // Change predefined format into computer format. If found translation in lang file we use it, otherwise we use default.
// TODO Add format daysmallyear and dayhoursmallyear // TODO Add format daysmallyear and dayhoursmallyear
if ($format == 'day') $format = ($outputlangs->trans("FormatDateShort") != "FormatDateShort" ? $outputlangs->trans("FormatDateShort") : $conf->format_date_short); if ($format == 'day') $format = ($outputlangs->trans("FormatDateShort") != "FormatDateShort" ? $outputlangs->trans("FormatDateShort") : $conf->format_date_short);
elseif ($format == 'hour') $format = ($outputlangs->trans("FormatHourShort") != "FormatHourShort" ? $outputlangs->trans("FormatHourShort") : $conf->format_hour_short); elseif ($format == 'hour') $format = ($outputlangs->trans("FormatHourShort") != "FormatHourShort" ? $outputlangs->trans("FormatHourShort") : $conf->format_hour_short);
elseif ($format == 'hourduration') $format = ($outputlangs->trans("FormatHourShortDuration") != "FormatHourShortDuration" ? $outputlangs->trans("FormatHourShortDuration") : $conf->format_hour_short_duration); elseif ($format == 'hourduration') $format = ($outputlangs->trans("FormatHourShortDuration") != "FormatHourShortDuration" ? $outputlangs->trans("FormatHourShortDuration") : $conf->format_hour_short_duration);
elseif ($format == 'daytext') $format = ($outputlangs->trans("FormatDateText") != "FormatDateText" ? $outputlangs->trans("FormatDateText") : $conf->format_date_text); elseif ($format == 'daytext') $format = ($outputlangs->trans("FormatDateText") != "FormatDateText" ? $outputlangs->trans("FormatDateText") : $conf->format_date_text);

View File

@ -189,7 +189,7 @@ function invoice_rec_prepare_head($object)
$head = array(); $head = array();
$head[$h][0] = DOL_URL_ROOT.'/compta/facture/card-rec.php?id='.$object->id; $head[$h][0] = DOL_URL_ROOT.'/compta/facture/card-rec.php?id='.$object->id;
$head[$h][1] = $langs->trans("CardBill"); $head[$h][1] = $langs->trans("RepeatableInvoice");
$head[$h][2] = 'card'; $head[$h][2] = 'card';
$h++; $h++;

View File

@ -165,6 +165,7 @@ function dol_verifyHash($chain, $hash, $type = '0')
/** /**
* Check permissions of a user to show a page and an object. Check read permission. * Check permissions of a user to show a page and an object. Check read permission.
* If GETPOST('action','aZ09') defined, we also check write and delete permission. * If GETPOST('action','aZ09') defined, we also check write and delete permission.
* This method check permission on module then call checkUserAccessToObject() for permission on object (according to entity and socid of user).
* *
* @param User $user User to check * @param User $user User to check
* @param string $features Features to check (it must be module $object->element. Examples: 'societe', 'contact', 'produit&service', 'produit|service', ...) * @param string $features Features to check (it must be module $object->element. Examples: 'societe', 'contact', 'produit&service', 'produit|service', ...)
@ -175,20 +176,22 @@ function dol_verifyHash($chain, $hash, $type = '0')
* @param string $dbt_select Field name for select if not rowid. Not used if objectid is null (optional) * @param string $dbt_select Field name for select if not rowid. Not used if objectid is null (optional)
* @param int $isdraft 1=The object with id=$objectid is a draft * @param int $isdraft 1=The object with id=$objectid is a draft
* @return int Always 1, die process if not allowed * @return int Always 1, die process if not allowed
* @see dol_check_secure_access_document() * @see dol_check_secure_access_document(), checkUserAccessToObject()
*/ */
function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $feature2 = '', $dbt_keyfield = 'fk_soc', $dbt_select = 'rowid', $isdraft = 0) function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $feature2 = '', $dbt_keyfield = 'fk_soc', $dbt_select = 'rowid', $isdraft = 0)
{ {
global $db, $conf; global $db, $conf;
global $hookmanager; global $hookmanager;
//dol_syslog("functions.lib:restrictedArea $feature, $objectid, $dbtablename,$feature2,$dbt_socfield,$dbt_select"); //dol_syslog("functions.lib:restrictedArea $feature, $objectid, $dbtablename, $feature2, $dbt_socfield, $dbt_select, $isdraft");
//print "user_id=".$user->id.", features=".$features.", feature2=".$feature2.", objectid=".$objectid; //print "user_id=".$user->id.", features=".$features.", feature2=".$feature2.", objectid=".$objectid;
//print ", dbtablename=".$dbtablename.", dbt_socfield=".$dbt_keyfield.", dbt_select=".$dbt_select; //print ", dbtablename=".$dbtablename.", dbt_socfield=".$dbt_keyfield.", dbt_select=".$dbt_select;
//print ", perm: ".$features."->".$feature2."=".($user->rights->$features->$feature2->lire)."<br>"; //print ", perm: ".$features."->".$feature2."=".($user->rights->$features->$feature2->lire)."<br>";
$parentfortableentity = ''; $parentfortableentity = '';
// Fix syntax of $features param
$originalfeatures = $features;
if ($features == 'facturerec') $features = 'facture'; if ($features == 'facturerec') $features = 'facture';
if ($features == 'mo') $features = 'mrp'; if ($features == 'mo') $features = 'mrp';
if ($features == 'member') $features = 'adherent'; if ($features == 'member') $features = 'adherent';
@ -198,7 +201,7 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f
if ($features == 'product') $features = 'produit'; if ($features == 'product') $features = 'produit';
// Get more permissions checks from hooks // Get more permissions checks from hooks
$parameters = array('features'=>$features, 'objectid'=>$objectid, 'idtype'=>$dbt_select); $parameters = array('features'=>$features, 'originalfeatures'=>$originalfeatures, 'objectid'=>$objectid, 'dbt_select'=>$dbt_select, 'idtype'=>$dbt_select, 'isdraft'=>$isdraft);
$reshook = $hookmanager->executeHooks('restrictedArea', $parameters); $reshook = $hookmanager->executeHooks('restrictedArea', $parameters);
if (isset($hookmanager->resArray['result'])) { if (isset($hookmanager->resArray['result'])) {
@ -218,11 +221,6 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f
// More subfeatures to check // More subfeatures to check
if (!empty($feature2)) $feature2 = explode("|", $feature2); if (!empty($feature2)) $feature2 = explode("|", $feature2);
// More parameters
$params = explode('&', $tableandshare);
$dbtablename = (!empty($params[0]) ? $params[0] : '');
$sharedelement = (!empty($params[1]) ? $params[1] : $dbtablename);
$listofmodules = explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL); $listofmodules = explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL);
// Check read permission from module // Check read permission from module
@ -247,6 +245,10 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f
if (!$user->rights->banque->cheque) { $readok = 0; $nbko++; } if (!$user->rights->banque->cheque) { $readok = 0; $nbko++; }
} elseif ($feature == 'projet') { } elseif ($feature == 'projet') {
if (!$user->rights->projet->lire && !$user->rights->projet->all->lire) { $readok = 0; $nbko++; } if (!$user->rights->projet->lire && !$user->rights->projet->all->lire) { $readok = 0; $nbko++; }
} elseif ($feature == 'payment') {
if (!$user->rights->facture->lire) { $readok = 0; $nbko++; }
} elseif ($feature == 'payment_supplier') {
if (!$user->rights->fournisseur->facture->lire) { $readok = 0; $nbko++; }
} elseif (!empty($feature2)) { // This is for permissions on 2 levels } elseif (!empty($feature2)) { // This is for permissions on 2 levels
$tmpreadok = 1; $tmpreadok = 1;
foreach ($feature2 as $subfeature) { foreach ($feature2 as $subfeature) {
@ -426,6 +428,10 @@ function checkUserAccessToObject($user, $featuresarray, $objectid = 0, $tableand
{ {
global $db, $conf; global $db, $conf;
//dol_syslog("functions.lib:restrictedArea $feature, $objectid, $dbtablename, $feature2, $dbt_socfield, $dbt_select, $isdraft");
//print "user_id=".$user->id.", features=".join(',', $featuresarray).", feature2=".$feature2.", objectid=".$objectid;
//print ", tableandshare=".$tableandshare.", dbt_socfield=".$dbt_keyfield.", dbt_select=".$dbt_select."<br>";
// More parameters // More parameters
$params = explode('&', $tableandshare); $params = explode('&', $tableandshare);
$dbtablename = (!empty($params[0]) ? $params[0] : ''); $dbtablename = (!empty($params[0]) ? $params[0] : '');
@ -440,13 +446,13 @@ function checkUserAccessToObject($user, $featuresarray, $objectid = 0, $tableand
if ($feature == 'project') $feature = 'projet'; if ($feature == 'project') $feature = 'projet';
if ($feature == 'task') $feature = 'projet_task'; if ($feature == 'task') $feature = 'projet_task';
$check = array('adherent', 'banque', 'bom', 'don', 'mrp', 'user', 'usergroup', 'product', 'produit', 'service', 'produit|service', 'categorie', 'resource', 'expensereport', 'holiday', 'website'); // Test on entity only (Objects with no link to company) $check = array('adherent', 'banque', 'bom', 'don', 'mrp', 'user', 'usergroup', 'payment', 'payment_supplier', 'product', 'produit', 'service', 'produit|service', 'categorie', 'resource', 'expensereport', 'holiday', 'website'); // Test on entity only (Objects with no link to company)
$checksoc = array('societe'); // Test for societe object $checksoc = array('societe'); // Test for societe object
$checkother = array('contact', 'agenda'); // Test on entity and link to third party. Allowed if link is empty (Ex: contacts...). $checkother = array('contact', 'agenda'); // Test on entity + link to third party on field $dbt_keyfield. Allowed if link is empty (Ex: contacts...).
$checkproject = array('projet', 'project'); // Test for project object $checkproject = array('projet', 'project'); // Test for project object
$checktask = array('projet_task'); // Test for task object $checktask = array('projet_task'); // Test for task object
$nocheck = array('barcode', 'stock'); // No test $nocheck = array('barcode', 'stock'); // No test
//$checkdefault = 'all other not already defined'; // Test on entity and link to third party. Not allowed if link is empty (Ex: invoice, orders...). //$checkdefault = 'all other not already defined'; // Test on entity + link to third party on field $dbt_keyfield. Not allowed if link is empty (Ex: invoice, orders...).
// If dbtablename not defined, we use same name for table than module name // If dbtablename not defined, we use same name for table than module name
if (empty($dbtablename)) if (empty($dbtablename))
@ -455,17 +461,14 @@ function checkUserAccessToObject($user, $featuresarray, $objectid = 0, $tableand
$sharedelement = (!empty($params[1]) ? $params[1] : $dbtablename); // We change dbtablename, so we set sharedelement too. $sharedelement = (!empty($params[1]) ? $params[1] : $dbtablename); // We change dbtablename, so we set sharedelement too.
} }
// Check permission for object with entity // Check permission for object on entity only
if (in_array($feature, $check)) if (in_array($feature, $check))
{ {
$sql = "SELECT COUNT(dbt.".$dbt_select.") as nb"; $sql = "SELECT COUNT(dbt.".$dbt_select.") as nb";
$sql .= " FROM ".MAIN_DB_PREFIX.$dbtablename." as dbt"; $sql .= " FROM ".MAIN_DB_PREFIX.$dbtablename." as dbt";
if (($feature == 'user' || $feature == 'usergroup') && !empty($conf->multicompany->enabled)) if (($feature == 'user' || $feature == 'usergroup') && !empty($conf->multicompany->enabled)) { // Special for multicompany
{ if (!empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
if (!empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) if ($conf->entity == 1 && $user->admin && !$user->entity) {
{
if ($conf->entity == 1 && $user->admin && !$user->entity)
{
$sql .= " WHERE dbt.".$dbt_select." IN (".$objectid.")"; $sql .= " WHERE dbt.".$dbt_select." IN (".$objectid.")";
$sql .= " AND dbt.entity IS NOT NULL"; $sql .= " AND dbt.entity IS NOT NULL";
} else { } else {
@ -490,15 +493,12 @@ function checkUserAccessToObject($user, $featuresarray, $objectid = 0, $tableand
$sql .= " AND dbt.entity IN (".getEntity($sharedelement, 1).")"; $sql .= " AND dbt.entity IN (".getEntity($sharedelement, 1).")";
} }
} }
} elseif (in_array($feature, $checksoc)) // We check feature = checksoc } elseif (in_array($feature, $checksoc)) { // We check feature = checksoc
{ if ($user->socid > 0) {
// If external user: Check permission for external users // If external user: Check permission for external users
if ($user->socid > 0)
{
if ($user->socid <> $objectid) return false; if ($user->socid <> $objectid) return false;
} // If internal user: Check permission for internal users that are restricted on their objects } elseif (!empty($conf->societe->enabled) && ($user->rights->societe->lire && !$user->rights->societe->client->voir)) {
elseif (!empty($conf->societe->enabled) && ($user->rights->societe->lire && !$user->rights->societe->client->voir)) // If internal user: Check permission for internal users that are restricted on their objects
{
$sql = "SELECT COUNT(sc.fk_soc) as nb"; $sql = "SELECT COUNT(sc.fk_soc) as nb";
$sql .= " FROM (".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql .= " FROM (".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql .= ", ".MAIN_DB_PREFIX."societe as s)"; $sql .= ", ".MAIN_DB_PREFIX."societe as s)";
@ -506,15 +506,14 @@ function checkUserAccessToObject($user, $featuresarray, $objectid = 0, $tableand
$sql .= " AND sc.fk_user = ".$user->id; $sql .= " AND sc.fk_user = ".$user->id;
$sql .= " AND sc.fk_soc = s.rowid"; $sql .= " AND sc.fk_soc = s.rowid";
$sql .= " AND s.entity IN (".getEntity($sharedelement, 1).")"; $sql .= " AND s.entity IN (".getEntity($sharedelement, 1).")";
} // If multicompany and internal users with all permissions, check user is in correct entity } elseif (!empty($conf->multicompany->enabled)) {
elseif (!empty($conf->multicompany->enabled)) // If multicompany and internal users with all permissions, check user is in correct entity
{
$sql = "SELECT COUNT(s.rowid) as nb"; $sql = "SELECT COUNT(s.rowid) as nb";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql .= " WHERE s.rowid IN (".$objectid.")"; $sql .= " WHERE s.rowid IN (".$objectid.")";
$sql .= " AND s.entity IN (".getEntity($sharedelement, 1).")"; $sql .= " AND s.entity IN (".getEntity($sharedelement, 1).")";
} }
} elseif (in_array($feature, $checkother)) // Test on entity and link to societe. Allowed if link is empty (Ex: contacts...). } elseif (in_array($feature, $checkother)) // Test on entity + link to thirdparty. Allowed if link is empty (Ex: contacts...).
{ {
// If external user: Check permission for external users // If external user: Check permission for external users
if ($user->socid > 0) if ($user->socid > 0)

View File

@ -1451,7 +1451,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
$newmenu->add("/asset/list.php?leftmenu=asset&amp;mainmenu=accountancy", $langs->trans("MenuListAssets"), 1, $user->rights->asset->read); $newmenu->add("/asset/list.php?leftmenu=asset&amp;mainmenu=accountancy", $langs->trans("MenuListAssets"), 1, $user->rights->asset->read);
$newmenu->add("/asset/type.php?leftmenu=asset_type", $langs->trans("MenuTypeAssets"), 1, $user->rights->asset->read, '', $mainmenu, 'asset_type'); $newmenu->add("/asset/type.php?leftmenu=asset_type", $langs->trans("MenuTypeAssets"), 1, $user->rights->asset->read, '', $mainmenu, 'asset_type');
if ($usemenuhider || empty($leftmenu) || preg_match('/asset_type/', $leftmenu)) { if ($usemenuhider || empty($leftmenu) || preg_match('/asset_type/', $leftmenu)) {
$newmenu->add("/asset/type.php?leftmenu=asset_type&amp;action=create", $langs->trans("MenuNewTypeAssets"), 2, (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->setup_advance)); $newmenu->add("/asset/type.php?leftmenu=asset_type&amp;action=create", $langs->trans("MenuNewTypeAssets"), 2, $user->rights->asset->setup_advance);
$newmenu->add("/asset/type.php?leftmenu=asset_type", $langs->trans("MenuListTypeAssets"), 2, $user->rights->asset->read); $newmenu->add("/asset/type.php?leftmenu=asset_type", $langs->trans("MenuListTypeAssets"), 2, $user->rights->asset->read);
} }
} }

View File

@ -173,7 +173,7 @@ class ImportXlsx extends ModeleImports
$this->workbook->getActiveSheet()->getStyle('1')->getFont()->setBold(true); $this->workbook->getActiveSheet()->getStyle('1')->getFont()->setBold(true);
$this->workbook->getActiveSheet()->getStyle('1')->getAlignment()->setHorizontal(Alignment::HORIZONTAL_LEFT); $this->workbook->getActiveSheet()->getStyle('1')->getAlignment()->setHorizontal(Alignment::HORIZONTAL_LEFT);
$col = 0; $col = 1;
foreach ($headerlinefields as $field) { foreach ($headerlinefields as $field) {
$this->workbook->getActiveSheet()->SetCellValueByColumnAndRow($col, 1, $outputlangs->transnoentities($field)); $this->workbook->getActiveSheet()->SetCellValueByColumnAndRow($col, 1, $outputlangs->transnoentities($field));
// set autowidth // set autowidth
@ -195,7 +195,7 @@ class ImportXlsx extends ModeleImports
public function write_record_example($outputlangs, $contentlinevalues) public function write_record_example($outputlangs, $contentlinevalues)
{ {
// phpcs:enable // phpcs:enable
$col = 0; $col = 1;
$row = 2; $row = 2;
foreach ($contentlinevalues as $cell) { foreach ($contentlinevalues as $cell) {
$this->workbook->getActiveSheet()->SetCellValueByColumnAndRow($col, $row, $cell); $this->workbook->getActiveSheet()->SetCellValueByColumnAndRow($col, $row, $cell);
@ -289,7 +289,7 @@ class ImportXlsx extends ModeleImports
$xlsx = new Xlsx(); $xlsx = new Xlsx();
$info = $xlsx->listWorksheetinfo($this->file); $info = $xlsx->listWorksheetinfo($this->file);
$countcolumns = $info[0]['totalColumns']; $countcolumns = $info[0]['totalColumns'];
for ($col = 0; $col < $countcolumns; $col++) { for ($col = 1; $col <= $countcolumns; $col++) {
$this->headers[$col] = $this->workbook->getActiveSheet()->getCellByColumnAndRow($col, 1)->getValue(); $this->headers[$col] = $this->workbook->getActiveSheet()->getCellByColumnAndRow($col, 1)->getValue();
} }
return 0; return 0;
@ -314,7 +314,7 @@ class ImportXlsx extends ModeleImports
$xlsx = new Xlsx(); $xlsx = new Xlsx();
$info = $xlsx->listWorksheetinfo($this->file); $info = $xlsx->listWorksheetinfo($this->file);
$countcolumns = $info[0]['totalColumns']; $countcolumns = $info[0]['totalColumns'];
for ($col = 0; $col < $countcolumns; $col++) { for ($col = 1; $col <= $countcolumns; $col++) {
$val = $this->workbook->getActiveSheet()->getCellByColumnAndRow($col, $this->record)->getValue(); $val = $this->workbook->getActiveSheet()->getCellByColumnAndRow($col, $this->record)->getValue();
$array[$col]['val'] = $val; $array[$col]['val'] = $val;
$array[$col]['type'] = (dol_strlen($val) ? 1 : -1); // If empty we consider it null $array[$col]['type'] = (dol_strlen($val) ? 1 : -1); // If empty we consider it null
@ -372,7 +372,7 @@ class ImportXlsx extends ModeleImports
//var_dump($sort_array_match_file_to_database); //var_dump($sort_array_match_file_to_database);
if (count($arrayrecord) == 0 || (count($arrayrecord) == 1 && empty($arrayrecord[0]['val']))) { if (count($arrayrecord) == 0 || (count($arrayrecord) == 1 && empty($arrayrecord[1]['val']))) {
//print 'W'; //print 'W';
$this->warnings[$warning]['lib'] = $langs->trans('EmptyLine'); $this->warnings[$warning]['lib'] = $langs->trans('EmptyLine');
$this->warnings[$warning]['type'] = 'EMPTY'; $this->warnings[$warning]['type'] = 'EMPTY';
@ -420,7 +420,7 @@ class ImportXlsx extends ModeleImports
if ($key <= $maxfields) { if ($key <= $maxfields) {
// Set $newval with value to insert and set $listvalues with sql request part for insert // Set $newval with value to insert and set $listvalues with sql request part for insert
$newval = ''; $newval = '';
if ($arrayrecord[($key - 1)]['type'] > 0) $newval = $arrayrecord[($key - 1)]['val']; // If type of field into input file is not empty string (so defined into input file), we get value if ($arrayrecord[($key)]['type'] > 0) $newval = $arrayrecord[($key)]['val']; // If type of field into input file is not empty string (so defined into input file), we get value
// Make some tests on $newval // Make some tests on $newval
@ -572,21 +572,21 @@ class ImportXlsx extends ModeleImports
$newval = $this->thirpartyobject->code_client; $newval = $this->thirpartyobject->code_client;
//print 'code_client='.$newval; //print 'code_client='.$newval;
} }
if (empty($newval)) $arrayrecord[($key - 1)]['type'] = -1; // If we get empty value, we will use "null" if (empty($newval)) $arrayrecord[($key)]['type'] = -1; // If we get empty value, we will use "null"
} elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'getsuppliercodeifauto') { } elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'getsuppliercodeifauto') {
if (strtolower($newval) == 'auto') { if (strtolower($newval) == 'auto') {
$newval = $this->thirpartyobject->get_codefournisseur(0, 1); $newval = $this->thirpartyobject->get_codefournisseur(0, 1);
$newval = $this->thirpartyobject->code_fournisseur; $newval = $this->thirpartyobject->code_fournisseur;
//print 'code_fournisseur='.$newval; //print 'code_fournisseur='.$newval;
} }
if (empty($newval)) $arrayrecord[($key - 1)]['type'] = -1; // If we get empty value, we will use "null" if (empty($newval)) $arrayrecord[($key)]['type'] = -1; // If we get empty value, we will use "null"
} elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'getcustomeraccountancycodeifauto') { } elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'getcustomeraccountancycodeifauto') {
if (strtolower($newval) == 'auto') { if (strtolower($newval) == 'auto') {
$this->thirpartyobject->get_codecompta('customer'); $this->thirpartyobject->get_codecompta('customer');
$newval = $this->thirpartyobject->code_compta; $newval = $this->thirpartyobject->code_compta;
//print 'code_compta='.$newval; //print 'code_compta='.$newval;
} }
if (empty($newval)) $arrayrecord[($key - 1)]['type'] = -1; // If we get empty value, we will use "null" if (empty($newval)) $arrayrecord[($key)]['type'] = -1; // If we get empty value, we will use "null"
} elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'getsupplieraccountancycodeifauto') { } elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'getsupplieraccountancycodeifauto') {
if (strtolower($newval) == 'auto') { if (strtolower($newval) == 'auto') {
$this->thirpartyobject->get_codecompta('supplier'); $this->thirpartyobject->get_codecompta('supplier');
@ -594,7 +594,7 @@ class ImportXlsx extends ModeleImports
if (empty($newval)) $arrayrecord[($key - 1)]['type'] = -1; // If we get empty value, we will use "null" if (empty($newval)) $arrayrecord[($key - 1)]['type'] = -1; // If we get empty value, we will use "null"
//print 'code_compta_fournisseur='.$newval; //print 'code_compta_fournisseur='.$newval;
} }
if (empty($newval)) $arrayrecord[($key - 1)]['type'] = -1; // If we get empty value, we will use "null" if (empty($newval)) $arrayrecord[($key)]['type'] = -1; // If we get empty value, we will use "null"
} elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'getrefifauto') { } elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'getrefifauto') {
$defaultref = ''; $defaultref = '';
// TODO provide the $modTask (module of generation of ref) as parameter of import_insert function // TODO provide the $modTask (module of generation of ref) as parameter of import_insert function
@ -624,7 +624,7 @@ class ImportXlsx extends ModeleImports
$errorforthistable++; $errorforthistable++;
$error++; $error++;
} else { } else {
$newval = $arrayrecord[($key - 1)]['val']; //We get new value computed. $newval = $arrayrecord[($key)]['val']; //We get new value computed.
} }
} elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'numeric') { } elseif ($objimport->array_import_convertvalue[0][$val]['rule'] == 'numeric') {
$newval = price2num($newval); $newval = price2num($newval);
@ -695,8 +695,8 @@ class ImportXlsx extends ModeleImports
$listfields[] = $fieldname; $listfields[] = $fieldname;
// Note: arrayrecord (and 'type') is filled with ->import_read_record called by import.php page before calling import_insert // Note: arrayrecord (and 'type') is filled with ->import_read_record called by import.php page before calling import_insert
if (empty($newval) && $arrayrecord[($key - 1)]['type'] < 0) $listvalues[] = ($newval == '0' ? $newval : "null"); if (empty($newval) && $arrayrecord[($key)]['type'] < 0) $listvalues[] = ($newval == '0' ? $newval : "null");
elseif (empty($newval) && $arrayrecord[($key - 1)]['type'] == 0) $listvalues[] = "''"; elseif (empty($newval) && $arrayrecord[($key)]['type'] == 0) $listvalues[] = "''";
else $listvalues[] = "'" . $this->db->escape($newval) . "'"; else $listvalues[] = "'" . $this->db->escape($newval) . "'";
} }
$i++; $i++;

View File

@ -79,7 +79,7 @@ class modAsset extends DolibarrModules
// Data directories to create when module is enabled. // Data directories to create when module is enabled.
// Example: this->dirs = array("/asset/temp","/asset/subdir"); // Example: this->dirs = array("/asset/temp","/asset/subdir");
$this->dirs = array(); $this->dirs = array("/asset/temp");
// Config pages. Put here list of php page, stored into asset/admin directory, to use to setup module. // Config pages. Put here list of php page, stored into asset/admin directory, to use to setup module.
$this->config_page_url = array("setup.php@asset"); $this->config_page_url = array("setup.php@asset");

View File

@ -547,7 +547,7 @@ class modProduct extends DolibarrModules
// field order as per structure of table llx_product // field order as per structure of table llx_product
$import_sample = array( $import_sample = array(
'p.ref' => "PREF123456", 'p.ref' => "ref:PREF123456",
'p.datec' => dol_print_date(dol_now(), '%Y-%m-%d'), 'p.datec' => dol_print_date(dol_now(), '%Y-%m-%d'),
'p.label' => "Product name in default language", 'p.label' => "Product name in default language",
'p.description' => "Product description in default language", 'p.description' => "Product description in default language",
@ -687,7 +687,7 @@ class modProduct extends DolibarrModules
); );
$this->import_examplevalues_array[$r] = array( $this->import_examplevalues_array[$r] = array(
'sp.fk_product' => "PRODUCT_REF or id:123456", 'sp.fk_product' => "ref:PRODUCT_REF or id:123456",
'sp.fk_soc' => "My Supplier", 'sp.fk_soc' => "My Supplier",
'sp.ref_fourn' => "XYZ-F123456", 'sp.ref_fourn' => "XYZ-F123456",
'sp.quantity' => "5", 'sp.quantity' => "5",
@ -749,13 +749,13 @@ class modProduct extends DolibarrModules
$this->import_convertvalue_array[$r] = array( $this->import_convertvalue_array[$r] = array(
'pr.fk_product'=>array('rule'=>'fetchidfromref', 'classfile'=>'/product/class/product.class.php', 'class'=>'Product', 'method'=>'fetch', 'element'=>'Product') 'pr.fk_product'=>array('rule'=>'fetchidfromref', 'classfile'=>'/product/class/product.class.php', 'class'=>'Product', 'method'=>'fetch', 'element'=>'Product')
); );
$this->import_examplevalues_array[$r] = array('pr.fk_product'=>"PRODUCT_REF or id:123456", $this->import_examplevalues_array[$r] = array('pr.fk_product'=>"ref:PRODUCT_REF or id:123456",
'pr.price_base_type'=>"HT (for excl tax) or TTC (for inc tax)", 'pr.price_level'=>"1", 'pr.price_base_type'=>"HT (for excl tax) or TTC (for inc tax)", 'pr.price_level'=>"1",
'pr.price'=>"100", 'pr.price_ttc'=>"110", 'pr.price'=>"100", 'pr.price_ttc'=>"110",
'pr.price_min'=>"100", 'pr.price_min_ttc'=>"110", 'pr.price_min'=>"100", 'pr.price_min_ttc'=>"110",
'pr.tva_tx'=>'20', 'pr.tva_tx'=>'20',
'pr.recuperableonly'=>'0', 'pr.recuperableonly'=>'0',
'pr.date_price'=>'2013-04-10'); 'pr.date_price'=>'2020-12-31');
} }
if (!empty($conf->global->MAIN_MULTILANGS)) if (!empty($conf->global->MAIN_MULTILANGS))

View File

@ -1,6 +1,6 @@
<?php <?php
// This tpl file is included into the init part of pages, so before action.
print '<!-- extrafields_list_array_fields.tpl.php -->'."\n"; // So no output must be done.
// Protection to avoid direct call of template // Protection to avoid direct call of template
if (empty($conf) || !is_object($conf)) if (empty($conf) || !is_object($conf))

View File

@ -47,7 +47,7 @@ class InterfaceContactRoles extends DolibarrTriggers
$this->description = "Triggers of this module auto link contact to company."; $this->description = "Triggers of this module auto link contact to company.";
// 'development', 'experimental', 'dolibarr' or version // 'development', 'experimental', 'dolibarr' or version
$this->version = self::VERSION_DOLIBARR; $this->version = self::VERSION_DOLIBARR;
$this->picto = 'action'; $this->picto = 'company';
} }
/** /**

View File

@ -2513,7 +2513,12 @@ if ($action == 'create')
$discount = new DiscountAbsolute($db); $discount = new DiscountAbsolute($db);
$result = $discount->fetch(0, 0, $object->id); $result = $discount->fetch(0, 0, $object->id);
if ($result > 0) { if ($result > 0) {
print ' '.$langs->trans("CreditNoteConvertedIntoDiscount", $object->getLibType(1), $discount->getNomUrl(1, 'discount')).'<br>'; print ' <span class="opacitymediumbycolor paddingleft">';
$s = $langs->trans("CreditNoteConvertedIntoDiscount", '{s1}', '{s2}');
$s = str_replace('{s1}', $object->getLibType(1), $s);
$s = str_replace('{s2}', $discount->getNomUrl(1, 'discount'), $s);
print $s;
print '</span><br>';
} }
} }
print '</td></tr>'; print '</td></tr>';

View File

@ -40,10 +40,19 @@ $confirm = GETPOST('confirm', 'alpha');
$object = new PaiementFourn($db); $object = new PaiementFourn($db);
// PDF // Load object
$hidedetails = (GETPOST('hidedetails', 'int') ? GETPOST('hidedetails', 'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0)); include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
$hidedesc = (GETPOST('hidedesc', 'int') ? GETPOST('hidedesc', 'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0));
$hideref = (GETPOST('hideref', 'int') ? GETPOST('hideref', 'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0)); $result = restrictedArea($user, $object->element, $object->id, 'paiementfourn', '');
// Security check
if ($user->socid) $socid = $user->socid;
// Now check also permission on thirdparty of invoices of payments. Thirdparty were loaded by the fetch_object before based on first invoice.
// It should be enough because all payments are done on invoices of the same thirdparty.
if ($socid && $socid != $object->thirdparty->id) {
accessforbidden();
}
/* /*
* Actions * Actions
@ -177,41 +186,46 @@ if ($result > 0)
print '<table class="border centpercent">'; print '<table class="border centpercent">';
/*print '<tr>'; /*print '<tr>';
print '<td width="20%" colspan="2">'.$langs->trans('Ref').'</td><td colspan="3">'; print '<td width="20%">'.$langs->trans('Ref').'</td><td>';
print $form->showrefnav($object,'id','',1,'rowid','ref'); print $form->showrefnav($object,'id','',1,'rowid','ref');
print '</td></tr>';*/ print '</td></tr>';*/
// Date of payment // Date of payment
print '<tr><td class="titlefield" colspan="2">'.$form->editfieldkey("Date", 'datep', $object->date, $object, $object->statut == 0 && $user->rights->fournisseur->facture->creer).'</td><td colspan="3">'; print '<tr><td class="titlefield">'.$form->editfieldkey("Date", 'datep', $object->date, $object, $object->statut == 0 && $user->rights->fournisseur->facture->creer).'</td>';
print '<td>';
print $form->editfieldval("Date", 'datep', $object->date, $object, $object->statut == 0 && $user->rights->fournisseur->facture->creer, 'datehourpicker', '', null, $langs->trans('PaymentDateUpdateSucceeded')); print $form->editfieldval("Date", 'datep', $object->date, $object, $object->statut == 0 && $user->rights->fournisseur->facture->creer, 'datehourpicker', '', null, $langs->trans('PaymentDateUpdateSucceeded'));
print '</td></tr>'; print '</td></tr>';
// Payment mode // Payment mode
$labeltype = $langs->trans("PaymentType".$object->type_code) != ("PaymentType".$object->type_code) ? $langs->trans("PaymentType".$object->type_code) : $object->type_label; $labeltype = $langs->trans("PaymentType".$object->type_code) != ("PaymentType".$object->type_code) ? $langs->trans("PaymentType".$object->type_code) : $object->type_label;
print '<tr><td colspan="2">'.$langs->trans('PaymentMode').'</td><td colspan="3">'.$labeltype; print '<tr><td>'.$langs->trans('PaymentMode').'</td>';
print '<td>'.$labeltype;
print $object->num_payment ? ' - '.$object->num_payment : ''; print $object->num_payment ? ' - '.$object->num_payment : '';
print '</td></tr>'; print '</td></tr>';
// Payment numero // Payment numero
/* TODO Add field num_payment into payment table and save it /* TODO Add field num_payment into payment table and save it
print '<tr><td colspan="2">'.$form->editfieldkey("Numero",'num_paiement',$object->num_paiement,$object,$object->statut == 0 && $user->rights->fournisseur->facture->creer).'</td><td colspan="3">'; print '<tr><td>'.$form->editfieldkey("Numero",'num_paiement',$object->num_paiement,$object,$object->statut == 0 && $user->rights->fournisseur->facture->creer).'</td>';
print '<td>';
print $form->editfieldval("Numero",'num_paiement',$object->num_paiement,$object,$object->statut == 0 && $user->rights->fournisseur->facture->creer,'string','',null,$langs->trans('PaymentNumberUpdateSucceeded')); print $form->editfieldval("Numero",'num_paiement',$object->num_paiement,$object,$object->statut == 0 && $user->rights->fournisseur->facture->creer,'string','',null,$langs->trans('PaymentNumberUpdateSucceeded'));
print '</td></tr>'; print '</td></tr>';
*/ */
// Amount // Amount
print '<tr><td colspan="2">'.$langs->trans('Amount').'</td><td colspan="3">'.price($object->amount, '', $langs, 0, 0, -1, $conf->currency).'</td></tr>'; print '<tr><td>'.$langs->trans('Amount').'</td>';
print '<td>'.price($object->amount, '', $langs, 0, 0, -1, $conf->currency).'</td></tr>';
if (!empty($conf->global->BILL_ADD_PAYMENT_VALIDATION)) if (!empty($conf->global->BILL_ADD_PAYMENT_VALIDATION))
{ {
print '<tr><td colspan="2">'.$langs->trans('Status').'</td><td colspan="3">'.$object->getLibStatut(4).'</td></tr>'; print '<tr><td>'.$langs->trans('Status').'</td>';
print '<td>'.$object->getLibStatut(4).'</td></tr>';
} }
$allow_delete = 1; $allow_delete = 1;
// Bank account // Bank account
if (!empty($conf->banque->enabled)) if (!empty($conf->banque->enabled))
{ {
if ($object->bank_account) if ($object->fk_account)
{ {
$bankline = new AccountLine($db); $bankline = new AccountLine($db);
$bankline->fetch($object->bank_line); $bankline->fetch($object->bank_line);
@ -222,8 +236,8 @@ if ($result > 0)
} }
print '<tr>'; print '<tr>';
print '<td colspan="2">'.$langs->trans('BankAccount').'</td>'; print '<td>'.$langs->trans('BankAccount').'</td>';
print '<td colspan="3">'; print '<td>';
$accountstatic = new Account($db); $accountstatic = new Account($db);
$accountstatic->fetch($bankline->fk_account); $accountstatic->fetch($bankline->fk_account);
print $accountstatic->getNomUrl(1); print $accountstatic->getNomUrl(1);
@ -231,8 +245,8 @@ if ($result > 0)
print '</tr>'; print '</tr>';
print '<tr>'; print '<tr>';
print '<td colspan="2">'.$langs->trans('BankTransactionLine').'</td>'; print '<td>'.$langs->trans('BankTransactionLine').'</td>';
print '<td colspan="3">'; print '<td>';
print $bankline->getNomUrl(1, 0, 'showconciliated'); print $bankline->getNomUrl(1, 0, 'showconciliated');
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
@ -240,7 +254,8 @@ if ($result > 0)
} }
// Note // Note
print '<tr><td colspan="2">'.$form->editfieldkey("Note", 'note', $object->note, $object, $user->rights->fournisseur->facture->creer).'</td><td colspan="3">'; print '<tr><td>'.$form->editfieldkey("Comments", 'note', $object->note, $object, $user->rights->fournisseur->facture->creer).'</td>';
print '<td>';
print $form->editfieldval("Note", 'note', $object->note, $object, $user->rights->fournisseur->facture->creer, 'textarea'); print $form->editfieldval("Note", 'note', $object->note, $object, $user->rights->fournisseur->facture->creer, 'textarea');
print '</td></tr>'; print '</td></tr>';

View File

@ -33,8 +33,26 @@ $langs->loadLangs(array("bills", "suppliers", "companies"));
$id = GETPOST('id', 'int'); $id = GETPOST('id', 'int');
$object = new PaiementFourn($db); $object = new PaiementFourn($db);
$object->fetch($id);
$object->info($id); // Load object
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
$result = restrictedArea($user, $object->element, $object->id, 'paiementfourn', '');
// Security check
if ($user->socid) $socid = $user->socid;
// Now check also permission on thirdparty of invoices of payments. Thirdparty were loaded by the fetch_object before based on first invoice.
// It should be enough because all payments are done on invoices of the same thirdparty.
if ($socid && $socid != $object->thirdparty->id) {
accessforbidden();
}
/*
* Actions
*/
// None
/* /*
@ -43,10 +61,14 @@ $object->info($id);
llxHeader(); llxHeader();
$object->info($id);
$head = payment_supplier_prepare_head($object); $head = payment_supplier_prepare_head($object);
print dol_get_fiche_head($head, 'info', $langs->trans("SupplierPayment"), 0, 'payment'); print dol_get_fiche_head($head, 'info', $langs->trans("SupplierPayment"), 0, 'payment');
$linkback = '<a href="'.DOL_URL_ROOT.'/fourn/paiement/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
dol_banner_tab($object, 'id', $linkback, -1, 'rowid', 'ref'); dol_banner_tab($object, 'id', $linkback, -1, 'rowid', 'ref');
print dol_get_fiche_end(); print dol_get_fiche_end();

View File

@ -178,7 +178,7 @@ if ($search_all) $sql .= natural_search(array_keys($fieldstosearchall), $search_
// Add where from extra fields // Add where from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
$sql .= ' GROUP BY p.rowid, p.datep, p.amount, p.num_paiement, s.rowid, s.nom, c.code, c.libelle, ba.rowid, ba.label'; $sql .= ' GROUP BY p.rowid, p.ref, p.datep, p.amount, p.num_paiement, s.rowid, s.nom, s.email, c.code, c.libelle, ba.rowid, ba.label';
if (!$user->rights->societe->client->voir) $sql .= ', sc.fk_soc, sc.fk_user'; if (!$user->rights->societe->client->voir) $sql .= ', sc.fk_soc, sc.fk_user';
$sql .= $db->order($sortfield, $sortorder); $sql .= $db->order($sortfield, $sortorder);

View File

@ -30,7 +30,7 @@
-- Types action comm -- Types action comm
-- --
delete from llx_c_actioncomm where id in (1,2,3,4,5,8,9,10,30,31,40,50); delete from llx_c_actioncomm where id in (1,2,3,4,5,6,8,9,10,11,30,31,40,50);
-- Code used from 3.3+ when type of event is used -- Code used from 3.3+ when type of event is used
insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 1,'AC_TEL','system','Phone call',NULL, 1, 2); insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 1,'AC_TEL','system','Phone call',NULL, 1, 2);
insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 2,'AC_FAX','system','Send Fax',NULL, 1, 3); insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 2,'AC_FAX','system','Send Fax',NULL, 1, 3);

View File

@ -576,3 +576,6 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value
-- Removed no more used function -- Removed no more used function
-- VPGSQL8.2 DROP FUNCTION IF EXISTS update_modified_column_date_m CASCADE; -- VPGSQL8.2 DROP FUNCTION IF EXISTS update_modified_column_date_m CASCADE;
insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) values ( 6,'AC_EMAIL_IN','system','reception Email',NULL, 1, 4);

View File

@ -37,7 +37,7 @@ CREATE TABLE llx_recruitment_recruitmentcandidature(
date_birth date, date_birth date,
remuneration_requested integer, remuneration_requested integer,
remuneration_proposed integer, remuneration_proposed integer,
email_msgid varchar(255), email_msgid varchar(175), -- Do not use a too large value, it generates trouble with unique index
fk_recruitment_origin INTEGER NULL fk_recruitment_origin INTEGER NULL
-- END MODULEBUILDER FIELDS -- END MODULEBUILDER FIELDS
) ENGINE=innodb; ) ENGINE=innodb;

View File

@ -61,5 +61,7 @@ MenuListTypeAssets = List
# #
# Module # Module
# #
Asset=Asset
NewAssetType=New asset type NewAssetType=New asset type
NewAsset=New asset NewAsset=New asset
ConfirmDeleteAsset=Are you sure you want to delete this asset ?

View File

@ -56,7 +56,8 @@ Paymentnumpad=Type of Pad to enter payment
Numberspad=Numbers Pad Numberspad=Numbers Pad
BillsCoinsPad=Coins and banknotes Pad BillsCoinsPad=Coins and banknotes Pad
DolistorePosCategory=TakePOS modules and other POS solutions for Dolibarr DolistorePosCategory=TakePOS modules and other POS solutions for Dolibarr
TakeposNeedsCategories=TakePOS needs product categories to work TakeposNeedsCategories=TakePOS needs at least one product categorie to work
TakeposNeedsAtLeastOnSubCategoryIntoParentCategory=TakePOS needs at least 1 product category under the category <b>%s</b> to work
OrderNotes=Order Notes OrderNotes=Order Notes
CashDeskBankAccountFor=Default account to use for payments in CashDeskBankAccountFor=Default account to use for payments in
NoPaimementModesDefined=No paiment mode defined in TakePOS configuration NoPaimementModesDefined=No paiment mode defined in TakePOS configuration

View File

@ -114,9 +114,9 @@ $upload_dir = $conf->mymodule->multidir_output[isset($object->entity) ? $object-
//if ($user->socid > 0) accessforbidden(); //if ($user->socid > 0) accessforbidden();
//if ($user->socid > 0) $socid = $user->socid; //if ($user->socid > 0) $socid = $user->socid;
//$isdraft = (($object->statut == $object::STATUS_DRAFT) ? 1 : 0); //$isdraft = (($object->statut == $object::STATUS_DRAFT) ? 1 : 0);
//$result = restrictedArea($user, 'mymodule', $object->id, '', '', 'fk_soc', 'rowid', $isdraft); //$result = restrictedArea($user, $object->element, $object->id, '', '', 'fk_soc', 'rowid', $isdraft);
//if (!$permissiontoread) accessforbidden(); //if (empty($permissiontoread)) accessforbidden();
/* /*

View File

@ -402,7 +402,7 @@ if ($id > 0 || $ref)
print '<div class="fichecenter">'; print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
print '<table class="border tableforfield" width="100%">'; print '<table class="border tableforfield centpercent">';
// Cost price. Can be used for margin module for option "calculate margin on explicit cost price // Cost price. Can be used for margin module for option "calculate margin on explicit cost price
print '<tr><td>'; print '<tr><td>';
@ -415,14 +415,14 @@ if ($id > 0 || $ref)
print '</td></tr>'; print '</td></tr>';
// PMP // PMP
print '<tr><td class="titlefield">'.$form->textwithpicto($langs->trans("AverageUnitPricePMPShort"), $langs->trans("AverageUnitPricePMPDesc")).'</td>'; print '<tr><td class="titlefieldcreate">'.$form->textwithpicto($langs->trans("AverageUnitPricePMPShort"), $langs->trans("AverageUnitPricePMPDesc")).'</td>';
print '<td>'; print '<td>';
if ($object->pmp > 0) print price($object->pmp).' '.$langs->trans("HT"); if ($object->pmp > 0) print price($object->pmp).' '.$langs->trans("HT");
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
// Best buying Price // Best buying Price
print '<tr><td class="titlefield">'.$langs->trans("BuyingPriceMin").'</td>'; print '<tr><td class="titlefieldcreate">'.$langs->trans("BuyingPriceMin").'</td>';
print '<td colspan="2">'; print '<td colspan="2">';
$product_fourn = new ProductFournisseur($db); $product_fourn = new ProductFournisseur($db);
if ($product_fourn->find_min_price_product_fournisseur($object->id) > 0) if ($product_fourn->find_min_price_product_fournisseur($object->id) > 0)
@ -462,7 +462,7 @@ if ($id > 0 || $ref)
print '<table class="border centpercent">'; print '<table class="border centpercent">';
// Supplier // Supplier
print '<tr><td class="titlefield fieldrequired">'.$langs->trans("Supplier").'</td><td>'; print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("Supplier").'</td><td>';
if ($rowid) if ($rowid)
{ {
$supplier = new Fournisseur($db); $supplier = new Fournisseur($db);
@ -729,7 +729,7 @@ END;
// Option to define a transport cost on supplier price // Option to define a transport cost on supplier price
print '<tr>'; print '<tr>';
print '<td>'.$langs->trans('BarcodeValue').'</td>'; print '<td>'.$langs->trans('BarcodeValue').'</td>';
print '<td><input class="flat" name="barcode" value="'.($rowid ? $object->supplier_barcode : '').'"></td>'; print '<td>'.img_picto('', 'barcode', 'class="pictofixedwidth"').'<input class="flat" name="barcode" value="'.($rowid ? $object->supplier_barcode : '').'"></td>';
print '</tr>'; print '</tr>';
$formbarcode = new FormBarCode($db); $formbarcode = new FormBarCode($db);

View File

@ -241,7 +241,7 @@ class Project extends CommonObject
if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) $this->fields['rowid']['visible'] = 0; if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) $this->fields['rowid']['visible'] = 0;
if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { if (empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
$this->fields['fk_opp_status']['enabled'] = 0; $this->fields['fk_opp_status']['enabled'] = 0;
$this->fields['opp_percent']['enabled'] = 0; $this->fields['opp_percent']['enabled'] = 0;
$this->fields['opp_amount']['enabled'] = 0; $this->fields['opp_amount']['enabled'] = 0;

View File

@ -9,9 +9,13 @@ if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
session_cache_limiter('public'); session_cache_limiter('public');
require_once '../../../main.inc.php'; require_once '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php';
if ($dolibarr_main_prod) {
accessforbidden();
}
?> ?>
<!doctype html> <!doctype html>
<html lang="en"> <html lang="en">
@ -19,13 +23,11 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php';
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="Documentation and examples for theme."> <meta name="description" content="Documentation and examples for theme.">
<link href="../style.css.php" rel="stylesheet">
<link href="doc.css" rel="stylesheet"> <link href="<?php echo DOL_URL_ROOT ?>/theme/eldy/style.css.php" rel="stylesheet">
</head> </head>
<body class="docpage" > <body class="docpage" style="padding: 20px;">
<main role="main" > <main role="main" >
<h1 class="bd-title" id="content">Badges</h1> <h1 class="bd-title" id="content">Badges</h1>
<p class="bd-lead">Documentation and examples for badges, our small count and labeling component.</p> <p class="bd-lead">Documentation and examples for badges, our small count and labeling component.</p>
@ -33,7 +35,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php';
<h2 id="example">Example</h2> <h2 id="example">Example</h2>
<p>Badges scale to match the size of the immediate parent element by using relative font sizing and em units.</p> <p>Badges scale to match the size of the immediate parent element by using relative font sizing and em units.</p>
<div class="bd-example"> <div class="bd-example">
<h1>Example heading <span class="badge badge-secondary">New</span></h1> <h1>Example heading <span class="badge badge-secondary">New</span></h1>
<h2>Example heading <span class="badge badge-secondary">New</span></h2> <h2>Example heading <span class="badge badge-secondary">New</span></h2>
@ -42,39 +44,39 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php';
<h5>Example heading <span class="badge badge-secondary">New</span></h5> <h5>Example heading <span class="badge badge-secondary">New</span></h5>
<h6>Example heading <span class="badge badge-secondary">New</span></h6> <h6>Example heading <span class="badge badge-secondary">New</span></h6>
</div> </div>
<figure class="highlight"> <figure class="highlight">
<pre> <pre>
&lt;h1&gt;Example heading &lt;span class=&quot;badge badge-secondary&quot;&gt;New&lt;/span&gt;&lt;/h1&gt; &lt;h1&gt;Example heading &lt;span class=&quot;badge badge-secondary&quot;&gt;New&lt;/span&gt;&lt;/h1&gt;
&lt;h2&gt;Example heading &lt;span class=&quot;badge badge-secondary&quot;&gt;New&lt;/span&gt;&lt;/h2&gt; &lt;h2&gt;Example heading &lt;span class=&quot;badge badge-secondary&quot;&gt;New&lt;/span&gt;&lt;/h2&gt;
&lt;h3&gt;Example heading &lt;span class=&quot;badge badge-secondary&quot;&gt;New&lt;/span&gt;&lt;/h3&gt; &lt;h3&gt;Example heading &lt;span class=&quot;badge badge-secondary&quot;&gt;New&lt;/span&gt;&lt;/h3&gt;
&lt;h4&gt;Example heading &lt;span class=&quot;badge badge-secondary&quot;&gt;New&lt;/span&gt;&lt;/h4&gt; &lt;h4&gt;Example heading &lt;span class=&quot;badge badge-secondary&quot;&gt;New&lt;/span&gt;&lt;/h4&gt;
&lt;h5&gt;Example heading &lt;span class=&quot;badge badge-secondary&quot;&gt;New&lt;/span&gt;&lt;/h5&gt; &lt;h5&gt;Example heading &lt;span class=&quot;badge badge-secondary&quot;&gt;New&lt;/span&gt;&lt;/h5&gt;
&lt;h6&gt;Example heading &lt;span class=&quot;badge badge-secondary&quot;&gt;New&lt;/span&gt;&lt;/h6&gt; &lt;h6&gt;Example heading &lt;span class=&quot;badge badge-secondary&quot;&gt;New&lt;/span&gt;&lt;/h6&gt;
</pre> </pre>
</figure> </figure>
<p>Badges can be used as part of links or buttons to provide a counter.</p> <p>Badges can be used as part of links or buttons to provide a counter.</p>
<div class="bd-example"> <div class="bd-example">
<button type="button" class="button"> <button type="button" class="button">
Notifications <span class="badge badge-primary">4</span> Notifications <span class="badge badge-primary">4</span>
</button> </button>
</div> </div>
<figure class="highlight"><pre> <figure class="highlight"><pre>
&lt;button type=&quot;button&quot; class=&quot;button&quot;&gt; &lt;button type=&quot;button&quot; class=&quot;button&quot;&gt;
Notifications &lt;span class=&quot;badge badge-primary&quot;&gt;4&lt;/span&gt; Notifications &lt;span class=&quot;badge badge-primary&quot;&gt;4&lt;/span&gt;
&lt;/button&gt; &lt;/button&gt;
</pre></figure> </pre></figure>
<div class="warning"> <div class="warning">
<p>Note that depending on how they are used, badges may be confusing for users of screen readers and similar assistive technologies. While the styling of badges provides a visual cue as to their purpose, these users will simply be presented with the content of the badge. Depending on the specific situation, these badges may seem like random additional words or numbers at the end of a sentence, link, or button.</p> <p>Note that depending on how they are used, badges may be confusing for users of screen readers and similar assistive technologies. While the styling of badges provides a visual cue as to their purpose, these users will simply be presented with the content of the badge. Depending on the specific situation, these badges may seem like random additional words or numbers at the end of a sentence, link, or button.</p>
<p>Unless the context is clear (as with the “Notifications” example, where it is understood that the “4” is the number of notifications), consider including additional context with a visually hidden piece of additional text.</p> <p>Unless the context is clear (as with the “Notifications” example, where it is understood that the “4” is the number of notifications), consider including additional context with a visually hidden piece of additional text.</p>
<p><strong>Remember to use aria-label attribute for accessibility in Dolibarr. Don't forget to use aria-hidden on icons included in badges</strong></p> <p><strong>Remember to use aria-label attribute for accessibility in Dolibarr. Don't forget to use aria-hidden on icons included in badges</strong></p>
</div> </div>
@ -84,26 +86,26 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php';
<span class="sr-only">unread messages</span> <span class="sr-only">unread messages</span>
</button> </button>
</div> </div>
<figure class="highlight"> <figure class="highlight">
<pre> <pre>
&lt;button type=&quot;button&quot; class=&quot;btn btn-primary&quot;&gt; &lt;button type=&quot;button&quot; class=&quot;btn btn-primary&quot;&gt;
Profile &lt;span class=&quot;badge badge-light&quot; aria-label=&quot;9 unread messages&quot; &gt;9&lt;/span&gt; Profile &lt;span class=&quot;badge badge-light&quot; aria-label=&quot;9 unread messages&quot; &gt;9&lt;/span&gt;
&lt;span class=&quot;sr-only&quot;&gt;unread messages&lt;/span&gt; &lt;span class=&quot;sr-only&quot;&gt;unread messages&lt;/span&gt;
&lt;/button&gt; &lt;/button&gt;
</pre> </pre>
</figure> </figure>
<h2 id="contextual-variations">Contextual variations</h2> <h2 id="contextual-variations">Contextual variations</h2>
<p>Add any of the below mentioned modifier classes to change the appearance of a badge.</p> <p>Add any of the below mentioned modifier classes to change the appearance of a badge.</p>
<div class="bd-example"> <div class="bd-example">
<span class="badge badge-primary">Primary</span> <span class="badge badge-primary">Primary</span>
<span class="badge badge-secondary">Secondary</span> <span class="badge badge-secondary">Secondary</span>
<span class="badge badge-success">Success</span> <span class="badge badge-success">Success</span>
@ -113,10 +115,10 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php';
<span class="badge badge-light">Light</span> <span class="badge badge-light">Light</span>
<span class="badge badge-dark">Dark</span> <span class="badge badge-dark">Dark</span>
</div> </div>
<figure class="highlight"> <figure class="highlight">
<pre> <pre>
&lt;span class=&quot;badge badge-primary&quot;&gt;Primary&lt;/span&gt; &lt;span class=&quot;badge badge-primary&quot;&gt;Primary&lt;/span&gt;
&lt;span class=&quot;badge badge-secondary&quot;&gt;Secondary&lt;/span&gt; &lt;span class=&quot;badge badge-secondary&quot;&gt;Secondary&lt;/span&gt;
&lt;span class=&quot;badge badge-success&quot;&gt;Success&lt;/span&gt; &lt;span class=&quot;badge badge-success&quot;&gt;Success&lt;/span&gt;
@ -125,22 +127,22 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php';
&lt;span class=&quot;badge badge-info&quot;&gt;Info&lt;/span&gt; &lt;span class=&quot;badge badge-info&quot;&gt;Info&lt;/span&gt;
&lt;span class=&quot;badge badge-light&quot;&gt;Light&lt;/span&gt; &lt;span class=&quot;badge badge-light&quot;&gt;Light&lt;/span&gt;
&lt;span class=&quot;badge badge-dark&quot;&gt;Dark&lt;/span&gt; &lt;span class=&quot;badge badge-dark&quot;&gt;Dark&lt;/span&gt;
</pre> </pre>
</figure> </figure>
<div class="warning"> <div class="warning">
<h5 id="conveying-meaning-to-assistive-technologies">Conveying meaning to assistive technologies</h5> <h5 id="conveying-meaning-to-assistive-technologies">Conveying meaning to assistive technologies</h5>
<p>Using color to add meaning only provides a visual indication, which will not be conveyed to users of assistive technologies – such as screen readers. Ensure that information denoted by the color is either obvious from the content itself (e.g. the visible text), or is included through alternative means, such as additional text hidden with the .sr-only class.</p> <p>Using color to add meaning only provides a visual indication, which will not be conveyed to users of assistive technologies – such as screen readers. Ensure that information denoted by the color is either obvious from the content itself (e.g. the visible text), or is included through alternative means, such as additional text hidden with the .sr-only class.</p>
</div> </div>
<h2 id="contextual-variations">Default status</h2> <h2 id="contextual-variations">Default status</h2>
<p>Add any of the below mentioned modifier classes to change the appearance of a badge to be linked to a default status.</p> <p>Add any of the below mentioned modifier classes to change the appearance of a badge to be linked to a default status.</p>
<div class="bd-example"> <div class="bd-example">
<?php for ($i = 0; $i <= 9; $i++): ?> <?php for ($i = 0; $i <= 9; $i++): ?>
<span class="badge badge-status<?php print $i; ?>" >status-<?php print $i; ?></span> <span class="badge badge-status<?php print $i; ?>" >status-<?php print $i; ?></span>
@ -152,14 +154,14 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php';
&lt;span class="badge badge-status<?php print $i; ?>" &gt;status<?php print $i; ?>&lt;/span&gt; &lt;span class="badge badge-status<?php print $i; ?>" &gt;status<?php print $i; ?>&lt;/span&gt;
<?php endfor; ?> <?php endfor; ?>
</pre></figure> </pre></figure>
<h2 id="pill-badges">Pill badges</h2> <h2 id="pill-badges">Pill badges</h2>
<p>Use the .badge-pill modifier class to make badges more rounded (with a larger border-radius and additional horizontal padding).</p> <p>Use the .badge-pill modifier class to make badges more rounded (with a larger border-radius and additional horizontal padding).</p>
<div class="bd-example"> <div class="bd-example">
<span class="badge badge-pill badge-primary">Primary</span> <span class="badge badge-pill badge-primary">Primary</span>
<span class="badge badge-pill badge-secondary">Secondary</span> <span class="badge badge-pill badge-secondary">Secondary</span>
<span class="badge badge-pill badge-success">Success</span> <span class="badge badge-pill badge-success">Success</span>
@ -168,16 +170,16 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php';
<span class="badge badge-pill badge-info">Info</span> <span class="badge badge-pill badge-info">Info</span>
<span class="badge badge-pill badge-light">Light</span> <span class="badge badge-pill badge-light">Light</span>
<span class="badge badge-pill badge-dark">Dark</span> <span class="badge badge-pill badge-dark">Dark</span>
<?php for ($i = 0; $i <= 9; $i++): ?> <?php for ($i = 0; $i <= 9; $i++): ?>
<span class="badge badge-pill badge-status<?php print $i; ?>" >status<?php print $i; ?></span> <span class="badge badge-pill badge-status<?php print $i; ?>" >status<?php print $i; ?></span>
<?php endfor; ?> <?php endfor; ?>
</div> </div>
<figure class="highlight"> <figure class="highlight">
<pre> <pre>
&lt;span class=&quot;badge badge-pill badge-primary&quot;&gt;Primary&lt;/span&gt; &lt;span class=&quot;badge badge-pill badge-primary&quot;&gt;Primary&lt;/span&gt;
&lt;span class=&quot;badge badge-pill badge-secondary&quot;&gt;Secondary&lt;/span&gt; &lt;span class=&quot;badge badge-pill badge-secondary&quot;&gt;Secondary&lt;/span&gt;
&lt;span class=&quot;badge badge-pill badge-success&quot;&gt;Success&lt;/span&gt; &lt;span class=&quot;badge badge-pill badge-success&quot;&gt;Success&lt;/span&gt;
@ -190,15 +192,15 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php';
&lt;span class="badge badge-pill badge-status<?php print $i; ?>" &gt;status<?php print $i; ?>&lt;/span&gt; &lt;span class="badge badge-pill badge-status<?php print $i; ?>" &gt;status<?php print $i; ?>&lt;/span&gt;
<?php endfor; ?> <?php endfor; ?>
</pre></figure> </pre></figure>
<h2 id="dot-badges">Dot badges</h2> <h2 id="dot-badges">Dot badges</h2>
<p>.dot-pill modifier class to make badges circle.</p> <p>.dot-pill modifier class to make badges circle.</p>
<div class="bd-example"> <div class="bd-example">
<span class="badge badge-dot badge-primary"></span> <span class="badge badge-dot badge-primary"></span>
<span class="badge badge-dot badge-secondary"></span> <span class="badge badge-dot badge-secondary"></span>
<span class="badge badge-dot badge-success"></span> <span class="badge badge-dot badge-success"></span>
@ -207,16 +209,16 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php';
<span class="badge badge-dot badge-info"></span> <span class="badge badge-dot badge-info"></span>
<span class="badge badge-dot badge-light"></span> <span class="badge badge-dot badge-light"></span>
<span class="badge badge-dot badge-dark"></span> <span class="badge badge-dot badge-dark"></span>
<?php for ($i = 0; $i <= 9; $i++): ?> <?php for ($i = 0; $i <= 9; $i++): ?>
<span class="badge badge-dot badge-status<?php print $i; ?>" ></span> <span class="badge badge-dot badge-status<?php print $i; ?>" ></span>
<?php endfor; ?> <?php endfor; ?>
</div> </div>
<figure class="highlight"> <figure class="highlight">
<pre> <pre>
&lt;span class=&quot;badge badge-dot badge-primary&quot;&gt;&lt;/span&gt; &lt;span class=&quot;badge badge-dot badge-primary&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;badge badge-dot badge-secondary&quot;&gt;&lt;/span&gt; &lt;span class=&quot;badge badge-dot badge-secondary&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;badge badge-dot badge-success&quot;&gt;&lt;/span&gt; &lt;span class=&quot;badge badge-dot badge-success&quot;&gt;&lt;/span&gt;
@ -229,23 +231,23 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php';
&lt;span class="badge badge-dot badge-status<?php print $i; ?>" &gt;&lt;/span&gt; &lt;span class="badge badge-dot badge-status<?php print $i; ?>" &gt;&lt;/span&gt;
<?php endfor; ?> <?php endfor; ?>
</pre></figure> </pre></figure>
<div class="warning"> <div class="warning">
<p>Note that depending on how they are used, badges may be confusing for users of screen readers and similar assistive technologies. While the styling of badges provides a visual cue as to their purpose, these users will simply be presented with the content of the badge. Depending on the specific situation, these badges may seem like random additional words or numbers at the end of a sentence, link, or button.</p> <p>Note that depending on how they are used, badges may be confusing for users of screen readers and similar assistive technologies. While the styling of badges provides a visual cue as to their purpose, these users will simply be presented with the content of the badge. Depending on the specific situation, these badges may seem like random additional words or numbers at the end of a sentence, link, or button.</p>
<p>Unless the context is clear (as with the “Notifications” example, where it is understood that the “4” is the number of notifications), consider including additional context with a visually hidden piece of additional text.</p> <p>Unless the context is clear (as with the “Notifications” example, where it is understood that the “4” is the number of notifications), consider including additional context with a visually hidden piece of additional text.</p>
<p><strong>Remember to use aria-label attribute for accessibility in Dolibarr. Don't forget to use aria-hidden on icons included in badges</strong></p> <p><strong>Remember to use aria-label attribute for accessibility in Dolibarr. Don't forget to use aria-hidden on icons included in badges</strong></p>
</div> </div>
<h2 id="links">Links</h2> <h2 id="links">Links</h2>
<p>Using the contextual .badge-* classes on an &lt;a&gt; element quickly provide <em>actionable</em> badges with hover and focus states.</p> <p>Using the contextual .badge-* classes on an &lt;a&gt; element quickly provide <em>actionable</em> badges with hover and focus states.</p>
<div class="bd-example"> <div class="bd-example">
<a href="#" class="badge badge-primary">Primary</a> <a href="#" class="badge badge-primary">Primary</a>
<a href="#" class="badge badge-secondary">Secondary</a> <a href="#" class="badge badge-secondary">Secondary</a>
<a href="#" class="badge badge-success">Success</a> <a href="#" class="badge badge-success">Success</a>
@ -257,9 +259,9 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php';
<?php for ($i = 0; $i <= 9; $i++): ?> <?php for ($i = 0; $i <= 9; $i++): ?>
<a href="#" class="badge badge-status<?php print $i; ?>" >status<?php print $i; ?></a> <a href="#" class="badge badge-status<?php print $i; ?>" >status<?php print $i; ?></a>
<?php endfor; ?> <?php endfor; ?>
</div> </div>
<figure class="highlight"><pre> <figure class="highlight"><pre>
&lt;a href=&quot;#&quot; class=&quot;badge badge-primary&quot;&gt;Primary&lt;/a&gt; &lt;a href=&quot;#&quot; class=&quot;badge badge-primary&quot;&gt;Primary&lt;/a&gt;
&lt;a href=&quot;#&quot; class=&quot;badge badge-secondary&quot;&gt;Secondary&lt;/a&gt; &lt;a href=&quot;#&quot; class=&quot;badge badge-secondary&quot;&gt;Secondary&lt;/a&gt;
@ -280,12 +282,12 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php';
<?php print dolGetBadge('your label for accessibility', 'your label <u>with</u> <em>html</em>', 'primary') ?> <?php print dolGetBadge('your label for accessibility', 'your label <u>with</u> <em>html</em>', 'primary') ?>
<?php print dolGetBadge('your label for accessibility', 'your label <u>with</u> <em>html</em>', 'danger', 'pill') ?> <?php print dolGetBadge('your label for accessibility', 'your label <u>with</u> <em>html</em>', 'danger', 'pill') ?>
<?php print dolGetBadge('your label for accessibility', 'your label <u>with</u> <em>html</em>', 'warning', 'dot') ?> <?php print dolGetBadge('your label for accessibility', 'your label <u>with</u> <em>html</em>', 'warning', 'dot') ?>
<figure class="highlight"><pre> <figure class="highlight"><pre>
&lt;?php print dolGetBadge('your label for accessibility', 'your label &lt;u&gt;with&lt;/u&gt; &lt;em&gt;html&lt;/em&gt;', 'danger', 'pill') ?&gt; &lt;?php print dolGetBadge('your label for accessibility', 'your label &lt;u&gt;with&lt;/u&gt; &lt;em&gt;html&lt;/em&gt;', 'danger', 'pill') ?&gt;
&lt;?php print dolGetBadge('your label for accessibility', 'your label &lt;u&gt;with&lt;/u&gt; &lt;em&gt;html&lt;/em&gt;', 'warning', 'dot') ?&gt; &lt;?php print dolGetBadge('your label for accessibility', 'your label &lt;u&gt;with&lt;/u&gt; &lt;em&gt;html&lt;/em&gt;', 'warning', 'dot') ?&gt;
</pre></figure> </pre></figure>
<h2 id="helper">Use status helper function</h2> <h2 id="helper">Use status helper function</h2>
<p>Using the dolGetStatus function provide in core/lib/functions.lib.php. This function is recommended for code uniformisation and easy maintain</p> <p>Using the dolGetStatus function provide in core/lib/functions.lib.php. This function is recommended for code uniformisation and easy maintain</p>
<?php <?php
@ -311,8 +313,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php';
<p><?php print dolGetStatus('your label for accessibility', 'your label', 'your label <u>with</u> <em>html</em>', 'status4', 6) ?></p> <p><?php print dolGetStatus('your label for accessibility', 'your label', 'your label <u>with</u> <em>html</em>', 'status4', 6) ?></p>
<?php $conf->global->MAIN_STATUS_USES_CSS = $saveGlobalConf; ?> <?php $conf->global->MAIN_STATUS_USES_CSS = $saveGlobalConf; ?>
<figure class="highlight"><pre> <figure class="highlight"><pre>
&lt;?php print dolGetStatus('your label for accessibility', 'your label', 'your label &lt;u&gt;with&lt;/u&gt; &lt;em&gt;html&lt;/em&gt;', 'status4') ?&gt; &lt;?php print dolGetStatus('your label for accessibility', 'your label', 'your label &lt;u&gt;with&lt;/u&gt; &lt;em&gt;html&lt;/em&gt;', 'status4') ?&gt;
&lt;?php print dolGetStatus('your label for accessibility', 'your label', 'your label &lt;u&gt;with&lt;/u&gt; &lt;em&gt;html&lt;/em&gt;', 'status4',1) ?&gt; &lt;?php print dolGetStatus('your label for accessibility', 'your label', 'your label &lt;u&gt;with&lt;/u&gt; &lt;em&gt;html&lt;/em&gt;', 'status4',1) ?&gt;
@ -323,8 +325,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php';
&lt;?php print dolGetStatus('your label for accessibility', 'your label', 'your label &lt;u&gt;with&lt;/u&gt; &lt;em&gt;html&lt;/em&gt;', 'status4',6) ?&gt; &lt;?php print dolGetStatus('your label for accessibility', 'your label', 'your label &lt;u&gt;with&lt;/u&gt; &lt;em&gt;html&lt;/em&gt;', 'status4',6) ?&gt;
</pre></figure> </pre></figure>
</main> </main>
</body> </body>
</html> </html>

View File

@ -1099,14 +1099,18 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
$("#radiocompany").click(function() { $("#radiocompany").click(function() {
$(".individualline").hide(); $(".individualline").hide();
$("#typent_id").val(0); $("#typent_id").val(0);
$("#typent_id").change();
$("#effectif_id").val(0); $("#effectif_id").val(0);
$("#effectif_id").change();
$("#TypeName").html(document.formsoc.ThirdPartyName.value); $("#TypeName").html(document.formsoc.ThirdPartyName.value);
document.formsoc.private.value=0; document.formsoc.private.value=0;
}); });
$("#radioprivate").click(function() { $("#radioprivate").click(function() {
$(".individualline").show(); $(".individualline").show();
$("#typent_id").val(id_te_private); $("#typent_id").val(id_te_private);
$("#typent_id").change();
$("#effectif_id").val(id_ef15); $("#effectif_id").val(id_ef15);
$("#effectif_id").change();
$("#TypeName").html(document.formsoc.LastName.value); $("#TypeName").html(document.formsoc.LastName.value);
document.formsoc.private.value=1; document.formsoc.private.value=1;
}); });

View File

@ -133,9 +133,9 @@ define('DOL_URL_ROOT', $suburi); // URL relative root ('', '/dolibarr', ...)
if (empty($character_set_client)) $character_set_client = "UTF-8"; if (empty($character_set_client)) $character_set_client = "UTF-8";
$conf->file->character_set_client = strtoupper($character_set_client); $conf->file->character_set_client = strtoupper($character_set_client);
if (empty($dolibarr_main_db_character_set)) $dolibarr_main_db_character_set = ($conf->db->type == 'mysql' ? 'latin1' : ''); // Old installation if (empty($dolibarr_main_db_character_set)) $dolibarr_main_db_character_set = ($conf->db->type == 'mysqli' ? 'utf8' : ''); // Old installation
$conf->db->character_set = $dolibarr_main_db_character_set; $conf->db->character_set = $dolibarr_main_db_character_set;
if (empty($dolibarr_main_db_collation)) $dolibarr_main_db_collation = ($conf->db->type == 'mysql' ? 'latin1_swedish_ci' : ''); // Old installation if (empty($dolibarr_main_db_collation)) $dolibarr_main_db_collation = ($conf->db->type == 'mysqli' ? 'utf8_unicode_ci' : ''); // Old installation
$conf->db->dolibarr_main_db_collation = $dolibarr_main_db_collation; $conf->db->dolibarr_main_db_collation = $dolibarr_main_db_collation;
if (empty($dolibarr_main_db_encryption)) $dolibarr_main_db_encryption = 0; if (empty($dolibarr_main_db_encryption)) $dolibarr_main_db_encryption = 0;
$conf->db->dolibarr_main_db_encryption = $dolibarr_main_db_encryption; $conf->db->dolibarr_main_db_encryption = $dolibarr_main_db_encryption;

View File

@ -140,6 +140,7 @@ if ($conf->global->TAKEPOS_ROOT_CATEGORY_ID > 0)
} }
} }
} }
$levelofmaincategories = $levelofrootcategory + 1; $levelofmaincategories = $levelofrootcategory + 1;
$maincategories = array(); $maincategories = array();
@ -961,7 +962,13 @@ if (empty($paiementsModes)) {
setEventMessages($langs->trans("ProblemIsInSetupOfTerminal", $_SESSION["takeposterminal"]), null, 'errors'); setEventMessages($langs->trans("ProblemIsInSetupOfTerminal", $_SESSION["takeposterminal"]), null, 'errors');
} }
if (count($maincategories) == 0) { if (count($maincategories) == 0) {
setEventMessages($langs->trans("TakeposNeedsCategories"), null, 'errors'); if ($conf->global->TAKEPOS_ROOT_CATEGORY_ID > 0) {
$tmpcategory = new Categorie($db);
$tmpcategory->fetch($conf->global->TAKEPOS_ROOT_CATEGORY_ID);
setEventMessages($langs->trans("TakeposNeedsAtLeastOnSubCategoryIntoParentCategory", $tmpcategory->label), null, 'errors');
} else {
setEventMessages($langs->trans("TakeposNeedsCategories"), null, 'errors');
}
} }
// User menu and external TakePOS modules // User menu and external TakePOS modules
$menus = array(); $menus = array();

View File

@ -1,5 +0,0 @@
/* Simple css for Doc page */
body.docpage{
background: #fff;
padding:20px;
}

View File

@ -35,6 +35,7 @@ if (!defined('NOLOGIN')) define('NOLOGIN', '1');
if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1');
if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1');
if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
if (!defined('NOSESSION')) define('NOSESSION', '1');
require_once __DIR__.'/../../main.inc.php'; require_once __DIR__.'/../../main.inc.php';
@ -42,6 +43,15 @@ $appli = constant('DOL_APPLICATION_TITLE');
if (!empty($conf->global->MAIN_APPLICATION_TITLE)) $appli = $conf->global->MAIN_APPLICATION_TITLE; if (!empty($conf->global->MAIN_APPLICATION_TITLE)) $appli = $conf->global->MAIN_APPLICATION_TITLE;
top_httphead('text/json'); top_httphead('text/json');
// Important: Following code is to avoid page request by browser and PHP CPU at each Dolibarr page access.
if (empty($dolibarr_nocache)) {
header('Cache-Control: max-age=10800, public, must-revalidate');
// For a text/json, we must set an Expires to avoid to have it forced to an expired value by the web server
header('Expires: '.gmdate('D, d M Y H:i:s', dol_now('gmt') + 10800) . ' GMT');
}
else {
header('Cache-Control: no-cache');
}
?> ?>
{ {

View File

@ -35,6 +35,7 @@ if (!defined('NOLOGIN')) define('NOLOGIN', '1');
if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1');
if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1');
if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1');
if (!defined('NOSESSION')) define('NOSESSION', '1');
require_once __DIR__.'/../../main.inc.php'; require_once __DIR__.'/../../main.inc.php';
@ -42,6 +43,15 @@ $appli = constant('DOL_APPLICATION_TITLE');
if (!empty($conf->global->MAIN_APPLICATION_TITLE)) $appli = $conf->global->MAIN_APPLICATION_TITLE; if (!empty($conf->global->MAIN_APPLICATION_TITLE)) $appli = $conf->global->MAIN_APPLICATION_TITLE;
top_httphead('text/json'); top_httphead('text/json');
// Important: Following code is to avoid page request by browser and PHP CPU at each Dolibarr page access.
if (empty($dolibarr_nocache)) {
header('Cache-Control: max-age=10800, public, must-revalidate');
// For a text/json, we must set an Expires to avoid to have it forced to an expired value by the web server
header('Expires: '.gmdate('D, d M Y H:i:s', dol_now('gmt') + 10800) . ' GMT');
}
else {
header('Cache-Control: no-cache');
}
?> ?>
{ {

View File

@ -142,6 +142,10 @@ class ImportTest extends PHPUnit\Framework\TestCase
// according to option // according to option
$this->assertEquals(0, 0); $this->assertEquals(0, 0);
// TODO Export and compare the file exported with the $file imported.
return true; return true;
} }
} }