Merge branch 'develop' of github.com:Dolibarr/dolibarr into fix_missing_formsetup_elements

This commit is contained in:
ATM john 2021-12-04 13:59:27 +01:00
commit f640a9fbad
202 changed files with 905 additions and 768 deletions

View File

@ -105,6 +105,7 @@ NEW: Use an ajax call for the clicktodial feature instead of href link.
NEW: when multiple order linked to facture, show list into note.
NEW: when we delete several objects with massaction, if somes object has child we must see which objects are concerned and nevertheless delete objects which can be deleted
NEW: Editing a page in website module keep old page with name .back
NEW: External backups can be downloaded from the "About info page".
For developers:

View File

@ -142,7 +142,7 @@ $linkback = '';
print load_fiche_titre($langs->trans('ExportOptions'), $linkback, 'accountancy');
print "\n".'<script type="text/javascript" language="javascript">'."\n";
print "\n".'<script type="text/javascript">'."\n";
print 'jQuery(document).ready(function () {'."\n";
print ' function initfields()'."\n";
print ' {'."\n";

View File

@ -127,7 +127,6 @@ if ($result) {
$title = $langs->trans('AccountingPeriods');
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $params, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_accountancy', 0, $addbutton, '', $limit, 1);
// Load attribute_label
print '<div class="div-table-responsive">';
print '<table class="tagtable liste centpercent">';
print '<tr class="liste_titre">';

View File

@ -753,7 +753,7 @@ if ($result) {
print '</table>';
print '</div>';
print '<script type="text/javascript" language="javascript">
print '<script type="text/javascript">
jQuery(document).ready(function() {
function init_savebutton()
{

View File

@ -241,7 +241,7 @@ if ($action != 'export_csv') {
if (empty($reshook)) {
$button = '<input type="button" id="exportcsvbutton" name="exportcsvbutton" class="butAction" value="'.$langs->trans("Export").' ('.$conf->global->ACCOUNTING_EXPORT_FORMAT.')" />';
print '<script type="text/javascript" language="javascript">
print '<script type="text/javascript">
jQuery(document).ready(function() {
jQuery("#exportcsvbutton").click(function() {
event.preventDefault();

View File

@ -24,6 +24,7 @@
* \ingroup Accountancy (Double entries)
* \brief List operation of book keeping
*/
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancyexport.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
@ -333,10 +334,6 @@ if (empty($reshook)) {
$filter['t.numero_compte<='] = $search_accountancy_code_end;
$param .= '&search_accountancy_code_end='.urlencode($search_accountancy_code_end);
}
if (!empty($search_accountancy_aux_code)) {
$filter['t.subledger_account'] = $search_accountancy_aux_code;
$param .= '&search_accountancy_aux_code='.urlencode($search_accountancy_aux_code);
}
if (!empty($search_accountancy_aux_code_start)) {
$filter['t.subledger_account>='] = $search_accountancy_aux_code_start;
$param .= '&search_accountancy_aux_code_start='.urlencode($search_accountancy_aux_code_start);
@ -533,11 +530,11 @@ if (count($filter) > 0) {
$sqlwhere[] = $key."='".$db->idate($value)."'";
} elseif ($key == 't.doc_date>=' || $key == 't.doc_date<=') {
$sqlwhere[] = $key."'".$db->idate($value)."'";
} elseif ($key == 't.numero_compte>=' || $key == 't.numero_compte<=') {
} elseif ($key == 't.numero_compte>=' || $key == 't.numero_compte<=' || $key == 't.subledger_account>=' || $key == 't.subledger_account<=') {
$sqlwhere[] = $key."'".$db->escape($value)."'";
} elseif ($key == 't.fk_doc' || $key == 't.fk_docdet' || $key == 't.piece_num') {
$sqlwhere[] = $key.'='.((int) $value);
} elseif ($key == 't.numero_compte') {
} elseif ($key == 't.subledger_account' || $key == 't.numero_compte') {
$sqlwhere[] = $key." LIKE '".$db->escape($value)."%'";
} elseif ($key == 't.subledger_account') {
$sqlwhere[] = natural_search($key, $value, 0, 1);

View File

@ -738,7 +738,7 @@ if ($db->type == 'mysqli') {
}
// Add code to auto check the box when we select an account
print '<script type="text/javascript" language="javascript">
print '<script type="text/javascript">
jQuery(document).ready(function() {
jQuery(".codeventil").change(function() {
var s=$(this).attr("id").replace("codeventil", "")

View File

@ -470,7 +470,7 @@ if ($result) {
}
// Add code to auto check the box when we select an account
print '<script type="text/javascript" language="javascript">
print '<script type="text/javascript">
jQuery(document).ready(function() {
jQuery(".codeventil").change(function() {
var s=$(this).attr("id").replace("codeventil", "")

View File

@ -100,7 +100,7 @@ if (!empty($conf->global->INVOICE_USE_SITUATION) && $conf->global->INVOICE_USE_S
$showtutorial .= ' '.$langs->trans("ShowTutorial");
$showtutorial .= '</a></div>';
$showtutorial .= '<script type="text/javascript" language="javascript">
$showtutorial .= '<script type="text/javascript">
jQuery(document).ready(function() {
jQuery("#show_hide").click(function () {
jQuery( "#idfaq" ).toggle({

View File

@ -747,7 +747,7 @@ if ($db->type == 'mysqli') {
}
// Add code to auto check the box when we select an account
print '<script type="text/javascript" language="javascript">
print '<script type="text/javascript">
jQuery(document).ready(function() {
jQuery(".codeventil").change(function() {
var s=$(this).attr("id").replace("codeventil", "")

View File

@ -113,7 +113,7 @@ print '<input type="hidden" name="token" value="'.newToken().'">';
print dol_get_fiche_head($head, 'website', $langs->trans("Members"), -1, 'user');
if ($conf->use_javascript_ajax) {
print "\n".'<script type="text/javascript" language="javascript">';
print "\n".'<script type="text/javascript">';
print 'jQuery(document).ready(function () {
function initemail()
{

View File

@ -104,7 +104,7 @@ abstract class ActionsAdherentCardCommon
if ($action == 'create' || $action == 'edit') {
if ($conf->use_javascript_ajax) {
$this->tpl['ajax_selectcountry'] = "\n".'<script type="text/javascript" language="javascript">
$this->tpl['ajax_selectcountry'] = "\n".'<script type="text/javascript">
jQuery(document).ready(function () {
jQuery("#selectcountry_id").change(function() {
document.formsoc.action.value="'.$action.'";

View File

@ -953,7 +953,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
print load_fiche_titre($langs->trans("NewMember"), '', $object->picto);
if ($conf->use_javascript_ajax) {
print "\n".'<script type="text/javascript" language="javascript">';
print "\n".'<script type="text/javascript">';
print 'jQuery(document).ready(function () {
jQuery("#selectcountry_id").change(function() {
document.formsoc.action.value="create";
@ -1183,7 +1183,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
if ($conf->use_javascript_ajax) {
print "\n".'<script type="text/javascript" language="javascript">';
print "\n".'<script type="text/javascript">';
print 'jQuery(document).ready(function () {
jQuery("#selectcountry_id").change(function() {
document.formsoc.action.value="edit";

View File

@ -119,7 +119,7 @@ if ((!empty($foruserid) || !empty($foruserlogin) || !empty($mode)) && !$mesg) {
}
//if (!empty($objp->$key))
// $objp->array_options[$tmpkey] = $objp->$key;
//$objp->array_options[$tmpkey] = $extrafields->showOutputField($key, $objp->$tmpkey, '', 1); //$objp->$tmpkey;
//$objp->array_options[$tmpkey] = $extrafields->showOutputField($key, $objp->$tmpkey, '', $object->table_element); //$objp->$tmpkey;
}
}

View File

@ -1398,6 +1398,7 @@ class Adherent extends CommonObject
$this->photo = $obj->photo;
$this->statut = $obj->statut;
$this->status = $obj->statut;
$this->public = $obj->public;
$this->datec = $this->db->jdate($obj->datec);

View File

@ -543,14 +543,13 @@ class AdherentType extends CommonObject
}
/**
* Return list of amount by type id
* Return the array of all amounts per membership type id
*
* @param int $status Filter on status of type
* @return array List of types of members
* @return array Array of membership type
*/
public function amountByType($status = null)
{
global $conf, $langs;
$amountbytype = array();
@ -578,6 +577,7 @@ class AdherentType extends CommonObject
} else {
print $this->db->error();
}
return $amountbytype;
}

View File

@ -838,7 +838,7 @@ if ($rowid > 0) {
if ($conf->use_javascript_ajax) {
//var_dump($bankdirect.'-'.$bankviainvoice.'-'.$invoiceonly.'-'.empty($conf->global->ADHERENT_BANK_USE));
print "\n".'<script type="text/javascript" language="javascript">';
print "\n".'<script type="text/javascript">';
print '$(document).ready(function () {
$(".bankswitchclass, .bankswitchclass2").'.(($bankdirect || $bankviainvoice) ? 'show()' : 'hide()').';
$("#none, #invoiceonly").click(function() {

View File

@ -100,7 +100,7 @@ print "<br><br>\n";
* Edit parameters
*/
if (!empty($conf->use_javascript_ajax)) {
print "\n".'<script type="text/javascript" language="javascript">';
print "\n".'<script type="text/javascript">';
print '$(document).ready(function () {
$("#selectcountry_id").change(function() {
document.form_index.action.value="updateedit";

View File

@ -385,7 +385,7 @@ print "<br><br>\n";
* Edit parameters
*/
if (!empty($conf->use_javascript_ajax)) {
print "\n".'<script type="text/javascript" language="javascript">';
print "\n".'<script type="text/javascript">';
print '$(document).ready(function () {
$("#selectcountry_id").change(function() {
document.form_index.action.value="updateedit";

View File

@ -222,7 +222,7 @@ if (empty($conf->use_javascript_ajax)) {
// Add env of ckeditor
// This is to show how CKEditor detect browser to understand why editor is disabled or not. To help debug.
/*
print '<br><script language="javascript">
print '<br><script type="text/javascript">
function jsdump(obj, id) {
var out = \'\';
for (var i in obj) {

View File

@ -173,7 +173,7 @@ if (version_compare(phpversion(), '7.0', '>=')) {
if ($action == 'edit') {
if ($conf->use_javascript_ajax) {
print "\n".'<script type="text/javascript" language="javascript">';
print "\n".'<script type="text/javascript">';
print 'jQuery(document).ready(function () {
function initfields()
{

View File

@ -143,7 +143,7 @@ if (version_compare(phpversion(), '7.0', '>=')) {
if ($action == 'edit') {
if ($conf->use_javascript_ajax) {
print "\n".'<script type="text/javascript" language="javascript">';
print "\n".'<script type="text/javascript">';
print 'jQuery(document).ready(function () {
function initfields()
{

View File

@ -225,6 +225,9 @@ if (!empty($conf->contrat->enabled) && !empty($user->rights->contrat->lire)) {
if (!empty($conf->ticket->enabled) && !empty($user->rights->ticket->read)) {
$elementList['ticket_send'] = img_picto('', 'ticket', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToTicket'));
}
if (!empty($conf->expensereport->enabled) && !empty($user->rights->expensereport->lire)) {
$elementList['expensereport_send'] = img_picto('', 'trip', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToTExpenseReport'));
}
if (!empty($conf->agenda->enabled)) {
$elementList['actioncomm_send'] = img_picto('', 'action', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendEventPush'));
}

View File

@ -142,7 +142,7 @@ if (version_compare(phpversion(), '7.0', '>=')) {
if ($action == 'edit') {
if ($conf->use_javascript_ajax) {
print "\n".'<script type="text/javascript" language="javascript">';
print "\n".'<script type="text/javascript">';
print 'jQuery(document).ready(function () {
function initfields()
{

View File

@ -255,7 +255,7 @@ llxHeader('', $langs->trans("Menu"));
if ($action == 'create') {
print '<script type="text/javascript" language="javascript">
print '<script type="text/javascript">
jQuery(document).ready(function() {
function init_topleft()
{

View File

@ -262,6 +262,11 @@ if ($ip) {
$text .= '<br><span class="opacitymedium">'.$langs->trans("LastActivationIP").':</span> ';
$text .= $ip;
}
$lastactivationversion = $tmp['lastactivationversion'];
if ($lastactivationversion) {
$text .= '<br><span class="opacitymedium">'.$langs->trans("LastActivationVersion").':</span> ';
$text .= $lastactivationversion;
}
$moreinfo = $text;
@ -326,6 +331,13 @@ if ($mode == 'desc') {
$textexternal = '';
if ($objMod->isCoreOrExternalModule() == 'external') {
$textexternal .= '<br><span class="opacitymedium">'.$langs->trans("Origin").':</span> '.$langs->trans("ExternalModule").' - '.$langs->trans("InstalledInto", $dirofmodule);
global $dolibarr_allow_download_external_modules;
if (!empty($dolibarr_allow_download_external_modules) && preg_match('/\/custom\//', $dirofmodule)) {
// Add a link to download a zip of the module
$textexternal .= ' <a href="'.DOL_URL_ROOT.'/admin/tools/export_files.php?export_type=externalmodule&what='.urlencode($moduledir).'&compression=zip&zipfilename_template=module_'.$moduledir.'-'.$version.'.notorig" target="_blank" rel="noopener">'.img_picto('', 'download').'</a>';
}
if ($objMod->editor_name != 'dolibarr') {
$textexternal .= '<br><span class="opacitymedium">'.$langs->trans("Publisher").':</span> '.(empty($objMod->editor_name) ? $langs->trans("Unknown") : $objMod->editor_name);
}

View File

@ -170,6 +170,13 @@ if ($action == 'update') {
dolibarr_set_const($db, "PDF_USE_A", GETPOST('PDF_USE_A', 'alpha'), 'chaine', 0, '', $conf->entity);
}
if (GETPOSTISSET('PDF_BOLD_PRODUCT_LABEL')) {
dolibarr_set_const($db, "PDF_BOLD_PRODUCT_LABEL", GETPOST('PDF_BOLD_PRODUCT_LABEL', 'alpha'), 'chaine', 0, '', $conf->entity);
}
if (GETPOSTISSET('PDF_BOLD_PRODUCT_REF_AND_PERIOD')) {
dolibarr_set_const($db, "PDF_BOLD_PRODUCT_REF_AND_PERIOD", GETPOST('PDF_BOLD_PRODUCT_REF_AND_PERIOD', 'alpha'), 'chaine', 0, '', $conf->entity);
}
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup");
@ -499,6 +506,22 @@ if ($conf->use_javascript_ajax) {
}
print '</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("BoldLabelOnPDF").'</td><td>';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('PDF_BOLD_PRODUCT_LABEL');
} else {
print $form->selectyesno('PDF_BOLD_PRODUCT_LABEL', (!empty($conf->global->PDF_BOLD_PRODUCT_LABEL)) ? $conf->global->PDF_BOLD_PRODUCT_LABEL : 0, 1);
}
print '</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("BoldRefAndPeriodOnPDF").'</td><td>';
if ($conf->use_javascript_ajax) {
print ajax_constantonoff('PDF_BOLD_PRODUCT_REF_AND_PERIOD');
} else {
print $form->selectyesno('PDF_BOLD_PRODUCT_REF_AND_PERIOD', (!empty($conf->global->PDF_BOLD_PRODUCT_REF_AND_PERIOD)) ? $conf->global->PDF_BOLD_PRODUCT_REF_AND_PERIOD : 0, 1);
}
print '</td></tr>';
// Desc
print '<tr class="oddeven"><td>'.$langs->trans("HideDescOnPDF").'</td><td>';

View File

@ -98,7 +98,7 @@ print dol_get_fiche_head($head, 'proxy', '', -1);
print '<br>';
if ($conf->use_javascript_ajax) {
print "\n".'<script type="text/javascript" language="javascript">';
print "\n".'<script type="text/javascript">';
print 'jQuery(document).ready(function () {
function initfields()
{

View File

@ -165,7 +165,7 @@ if (ini_get('opcache.preload')) {
print '<br>';
// HTTPCacheStaticResources
print '<script type="text/javascript" language="javascript">
print '<script type="text/javascript">
jQuery(document).ready(function() {
var getphpurl;
var cachephpstring;

View File

@ -138,7 +138,23 @@ $dirtocompress = basename($fulldirtocompress);
if ($compression == 'zip') {
$file .= '.zip';
$excludefiles = '/(\.back|\.old|\.log|[\/\\\]temp[\/\\\]|documents[\/\\\]admin[\/\\\]documents[\/\\\])/i';
$ret = dol_compress_dir($fulldirtocompress, $outputdir."/".$file, $compression, $excludefiles);
//var_dump($fulldirtocompress);
//var_dump($outputdir."/".$file);exit;
$rootdirinzip = '';
if ($export_type == 'externalmodule' && !empty($what)) {
$rootdirinzip = $what;
global $dolibarr_allow_download_external_modules;
if (empty($dolibarr_allow_download_external_modules)) {
print 'Download of external modules is not allowed by $dolibarr_allow_download_external_modules in conf.php file';
$db->close();
exit();
}
}
$ret = dol_compress_dir($fulldirtocompress, $outputdir."/".$file, $compression, $excludefiles, $rootdirinzip);
if ($ret < 0) {
if ($ret == -2) {
$langs->load("errors");
@ -183,17 +199,37 @@ if ($compression == 'zip') {
unlink($outputdir."/".$file);
}
}
}
if ($errormsg) {
setEventMessages($langs->trans("Error")." : ".$errormsg, null, 'errors');
} else {
setEventMessages($langs->trans("BackupFileSuccessfullyCreated").'.<br>'.$langs->trans("YouCanDownloadBackupFile"), null, 'mesgs');
$errormsg = 'Bad value for compression method';
print $errormsg;
}
$db->close();
if ($export_type != 'externalmodule' || empty($what)) {
if ($errormsg) {
setEventMessages($langs->trans("Error")." : ".$errormsg, null, 'errors');
} else {
setEventMessages($langs->trans("BackupFileSuccessfullyCreated").'.<br>'.$langs->trans("YouCanDownloadBackupFile"), null, 'mesgs');
}
// Redirect to calling page
$returnto = 'dolibarr_export.php';
$db->close();
header("Location: ".$returnto);
// Redirect to calling page
$returnto = 'dolibarr_export.php';
header("Location: ".$returnto);
exit();
} else {
$zipname = $outputdir."/".$file;
// Then download the zipped file.
header('Content-Type: application/zip');
header('Content-disposition: attachment; filename='.basename($zipname));
header('Content-Length: '.filesize($zipname));
readfile($zipname);
dol_delete_file($zipname);
$db->close();
exit();
}

View File

@ -224,7 +224,7 @@ if ($conf->societe->enabled) {
// For products
if ($conf->product->enabled || $conf->product->service) {
// Example 1 : Adding jquery code
print '<script type="text/javascript" language="javascript">
print '<script type="text/javascript">
function confirm_erase() {
return confirm("'.dol_escape_js($langs->trans("ConfirmEraseAllCurrentBarCode")).'");
}

View File

@ -315,7 +315,7 @@ print '<br>';
// Add javascript to make choice dynamic
print '<script type="text/javascript" language="javascript">
print '<script type="text/javascript">
jQuery(document).ready(function() {
function init_selectors()
{

View File

@ -54,7 +54,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) {
echo '</td>';
echo '<td class="linkedcol-name nowraponall" >'.$objectlink->getNomUrl(1).'</td>';
echo '<td class="linkedcol-ref" align="center">';
echo '<td class="linkedcol-ref">';
$result = $product_static->fetch($objectlink->fk_product);
if ($result < 0) {
setEventMessage($product_static->error, 'errors');
@ -62,7 +62,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) {
$product_static->getNomUrl(1);
}
print '</td>';
echo '<td class="linkedcol-date" align="center">'.dol_print_date($objectlink->date_creation, 'day').'</td>';
echo '<td class="linkedcol-date">'.dol_print_date($objectlink->date_creation, 'day').'</td>';
echo '<td class="linkedcol-amount right">';
if ($user->rights->commande->lire) {
$total = $total + $objectlink->total_ht;

View File

@ -186,7 +186,7 @@ foreach ($fulltree as $key => $val) {
? $categstatic->getObjectsInCateg("account", 1) // Categorie::TYPE_ACCOUNT is "bank_account" instead of "account"
: $categstatic->getObjectsInCateg($type, 1);
$counter = "<td class='left' width='40px;'>".(is_countable($elements) ? count($elements) : '0')."</td>";
$counter = "<td class='left' width='40px;'>".(is_array($elements) ? count($elements) : '0')."</td>";
}
$color = $categstatic->color ? ' style="background: #'.sprintf("%06s", $categstatic->color).';"' : ' style="background: #bbb"';

View File

@ -413,7 +413,7 @@ if ($cats < 0) {
? $categstatic->getObjectsInCateg("account", 1) // Categorie::TYPE_ACCOUNT is "bank_account" instead of "account"
: $categstatic->getObjectsInCateg($type, 1);
$counter = "<td class='left' width='40px;'>".(is_countable($elements) ? count($elements) : '0')."</td>";
$counter = "<td class='left' width='40px;'>".(is_array($elements) ? count($elements) : '0')."</td>";
}
$color = $categstatic->color ? ' style="background: #'.sprintf("%06s", $categstatic->color).';"' : ' style="background: #bbb"';

View File

@ -1075,7 +1075,7 @@ if ($action == 'create') {
print '<div class="hidden marginrightonly inline-block repeateventBYDAY">';
print $langs->trans("DayOfWeek").': <input type="input" size="4" name="BYDAY" value="'.$selectedrecurrulebyday.'">';
print '</div>';
print '<script type="text/javascript" language="javascript">
print '<script type="text/javascript">
jQuery(document).ready(function() {
function init_repeat()
{
@ -1554,7 +1554,7 @@ if ($id > 0) {
print '<div class="hidden marginrightonly inline-block repeateventBYDAY">';
print $langs->trans("DayOfWeek").': <input type="input" size="4" name="BYDAY" value="'.$selectedrecurrulebyday.'">';
print '</div>';
print '<script type="text/javascript" language="javascript">
print '<script type="text/javascript">
jQuery(document).ready(function() {
function init_repeat()
{

View File

@ -882,7 +882,7 @@ print "\n".'</form>';
print "\n";
// Add js code to manage click on a box
print '<script type="text/javascript" language="javascript">
print '<script type="text/javascript">
jQuery(document).ready(function() {
jQuery(".onclickopenref").click(function() {
var ref=$(this).attr(\'ref\');

View File

@ -1050,7 +1050,7 @@ print "\n".'</form>';
print "\n";
// Add js code to manage click on a box
print '<script type="text/javascript" language="javascript">
print '<script type="text/javascript">
jQuery(document).ready(function() {
jQuery(".onclickopenref").click(function() {
var ref=$(this).attr(\'ref\');

View File

@ -1221,7 +1221,7 @@ if ($action == 'create') {
// TODO Trick to have param removedfile containing nb of image to delete. But this does not works without javascript
$out .= '<input type="hidden" class="removedfilehidden" name="removedfile" value="">'."\n";
$out .= '<script type="text/javascript" language="javascript">';
$out .= '<script type="text/javascript">';
$out .= 'jQuery(document).ready(function () {';
$out .= ' jQuery(".removedfile").click(function() {';
$out .= ' jQuery(".removedfilehidden").val(jQuery(this).val());';

View File

@ -1442,7 +1442,7 @@ if (empty($reshook)) {
}
// Actions to build doc
$upload_dir = $conf->propal->multidir_output[$object->entity];
$upload_dir = !empty($conf->propal->multidir_output[$object->entity])?$conf->propal->multidir_output[$object->entity]:$conf->propal->dir_output;
$permissiontoadd = $usercancreate;
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
}
@ -1584,6 +1584,7 @@ if ($action == 'create') {
// Third party
print '<tr>';
print '<td class="fieldrequired">'.$langs->trans('Customer').'</td>';
$shipping_method_id = 0;
if ($socid > 0) {
print '<td>';
print $soc->getNomUrl(1);
@ -1700,7 +1701,7 @@ if ($action == 'create') {
// Delivery date (or manufacturing)
print '<tr><td>'.$langs->trans("DeliveryDate").'</td>';
print '<td>';
if ($conf->global->DATE_LIVRAISON_WEEK_DELAY != "") {
if (isset($conf->global->DATE_LIVRAISON_WEEK_DELAY) && is_numeric($conf->global->DATE_LIVRAISON_WEEK_DELAY)) {
$tmpdte = time() + ((7 * $conf->global->DATE_LIVRAISON_WEEK_DELAY) * 24 * 60 * 60);
$syear = date("Y", $tmpdte);
$smonth = date("m", $tmpdte);
@ -1737,7 +1738,7 @@ if ($action == 'create') {
print '<td>';
print img_picto('', 'pdf').'&ensp;';
$liste = ModelePDFPropales::liste_modeles($db);
$preselected = ($conf->global->PROPALE_ADDON_PDF_ODT_DEFAULT ? $conf->global->PROPALE_ADDON_PDF_ODT_DEFAULT : $conf->global->PROPALE_ADDON_PDF);
$preselected = (!empty($conf->global->PROPALE_ADDON_PDF_ODT_DEFAULT) ? $conf->global->PROPALE_ADDON_PDF_ODT_DEFAULT : getDolGlobalString("PROPALE_ADDON_PDF"));
print $form->selectarray('model', $liste, $preselected, 0, 0, 0, '', 0, 0, 0, '', 'maxwidth200 widthcentpercentminusx', 1);
print "</td></tr>";
@ -1754,7 +1755,7 @@ if ($action == 'create') {
print '<tr>';
print '<td class="tdtop">'.$langs->trans('NotePublic').'</td>';
print '<td valign="top">';
$note_public = $object->getDefaultCreateValueFor('note_public', (is_object($objectsrc) ? $objectsrc->note_public : null));
$note_public = $object->getDefaultCreateValueFor('note_public', (!empty($objectsrc) ? $objectsrc->note_public : null));
$doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, empty($conf->global->FCKEDITOR_ENABLE_NOTE_PUBLIC) ? 0 : 1, ROWS_3, '90%');
print $doleditor->Create(1);

View File

@ -100,8 +100,8 @@ if (!empty($conf->propal->enabled)) {
$nbofloop = min($num, (empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD));
startSimpleTable("DraftPropals", "comm/propal/list.php", "search_status=".Propal::STATUS_DRAFT, 2, $num);
$total = 0;
if ($num) {
$total = 0;
$i = 0;
while ($i < $nbofloop) {

View File

@ -534,7 +534,7 @@ if (!empty($search_categ_cus) && $search_categ_cus != '-1') {
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cc ON s.rowid = cc.fk_soc"; // We'll need this table joined to the select in order to filter by categ
}
$sql .= ', '.MAIN_DB_PREFIX.'propal as p';
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
if (!empty($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (p.rowid = ef.fk_object)";
}
if ($sall || $search_product_category > 0) {
@ -903,6 +903,10 @@ if ($resql) {
// Add $param from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
// Add $param from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object); // Note that $action and $object may have been modified by hook
$param .= $hookmanager->resPrint;
// List of mass actions available
$arrayofmassactions = array(

View File

@ -1369,7 +1369,7 @@ if (empty($reshook)) {
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
// Actions to build doc
$upload_dir = $conf->commande->multidir_output[$object->entity];
$upload_dir = !empty($conf->propal->multidir_output[$object->entity])?$conf->propal->multidir_output[$object->entity]:$conf->propal->dir_output;
$permissiontoadd = $usercancreate;
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';

View File

@ -452,7 +452,7 @@ if (($search_categ_cus > 0) || ($search_categ_cus == -2)) {
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cc ON s.rowid = cc.fk_soc"; // We'll need this table joined to the select in order to filter by categ
}
$sql .= ', '.MAIN_DB_PREFIX.'commande as c';
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
if (!empty($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."commande_extrafields as ef on (c.rowid = ef.fk_object)";
}
if ($sall || $search_product_category > 0) {
@ -829,6 +829,11 @@ if ($resql) {
// Add $param from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
// Add $param from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object); // Note that $action and $object may have been modified by hook
$param .= $hookmanager->resPrint;
// List of mass actions available
$arrayofmassactions = array(
'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"),

View File

@ -52,8 +52,8 @@ foreach ($linkedObjectBlock as $key => $objectlink) {
}
echo '</td>';
echo '<td class="linkedcol-name nowraponall" >'.$objectlink->getNomUrl(1).'</td>';
echo '<td class="linkedcol-ref" align="center">'.$objectlink->ref_client.'</td>';
echo '<td class="linkedcol-date" align="center">'.dol_print_date($objectlink->date, 'day').'</td>';
echo '<td class="linkedcol-ref">'.$objectlink->ref_client.'</td>';
echo '<td class="linkedcol-date">'.dol_print_date($objectlink->date, 'day').'</td>';
echo '<td class="linkedcol-amount right">';
if ($user->rights->commande->lire) {
$total = $total + $objectlink->total_ht;

View File

@ -499,7 +499,7 @@ if ($result && $action == "dl" && !$error) {
$zip->addFromString('transactions.csv', $log);
$zip->close();
///Then download the zipped file.
// Then download the zipped file.
header('Content-Type: application/zip');
header('Content-disposition: attachment; filename='.basename($zipname));
header('Content-Length: '.filesize($zipname));

View File

@ -343,7 +343,7 @@ if ($action == 'create') {
print load_fiche_titre($langs->trans("NewFinancialAccount"), '', 'bank_account');
if ($conf->use_javascript_ajax) {
print "\n".'<script type="text/javascript" language="javascript">';
print "\n".'<script type="text/javascript">';
print 'jQuery(document).ready(function () {
jQuery("#selecttype").change(function() {
document.formsoc.action.value="create";
@ -429,7 +429,7 @@ if ($action == 'create') {
print '<tr><td>'.$langs->trans("Web").'</td>';
print '<td>';
print img_picto('', 'globe', 'class="pictofixedwidth"');
print '<input class="minwidth300" type="text" class="flat" name="url" value="'.GETPOST("url").'">';
print '<input class="minwidth300 widthcentpercentminusx maxwidth500" type="text" class="flat" name="url" value="'.GETPOST("url").'">';
print '</td></tr>';
// Tags-Categories
@ -831,7 +831,7 @@ if ($action == 'create') {
print load_fiche_titre($langs->trans("EditFinancialAccount"), '', 'bank_account');
if ($conf->use_javascript_ajax) {
print "\n".'<script type="text/javascript" language="javascript">';
print "\n".'<script type="text/javascript">';
print 'jQuery(document).ready(function () {
jQuery("#selecttype").change(function() {
document.formsoc.action.value="edit";

View File

@ -342,7 +342,7 @@ foreach ($bankcateg->fetchAll() as $bankcategory) {
if ($action == 'create') {
// Update fields properties in realtime
if (!empty($conf->use_javascript_ajax)) {
print "\n".'<script type="text/javascript" language="javascript">';
print "\n".'<script type="text/javascript">';
print '$(document).ready(function () {
setPaymentType();
$("#selectpaymenttype").change(function() {
@ -415,7 +415,7 @@ if ($action == 'create') {
if (!empty($conf->banque->enabled)) {
print '<tr><td>';
print $form->editfieldkey('BankAccount', 'selectaccountid', '', $object, 0, 'string', '', 1).'</td><td>';
$form->select_comptes($accountid, "accountid", 0, '', 2); // Affiche liste des comptes courant
print img_picto('', 'bank_account', 'class="pictofixedwidth"').$form->select_comptes($accountid, "accountid", 0, '', 2, '', 0, '', 1); // Affiche liste des comptes courant
print '</td></tr>';
}
@ -490,9 +490,8 @@ if ($action == 'create') {
$langs->load("projects");
print '<tr><td>'.$langs->trans("Project").'</td><td>';
$numproject = $formproject->select_projects(-1, $projectid, 'fk_project', 0, 0, 1, 1);
print img_picto('', 'bank_account', 'class="pictofixedwidth"');
print $formproject->select_projects(-1, $projectid, 'fk_project', 0, 0, 1, 1, 0, 0, 0, '', 1);
print '</td></tr>';
}

View File

@ -160,7 +160,7 @@ $arrayfields = array(
'ref' =>array('label'=>"Ref", 'checked'=>1, 'position'=>100),
'label' =>array('label'=>"Label", 'checked'=>1, 'position'=>110),
'datep' =>array('label'=>"DatePayment", 'checked'=>1, 'position'=>120),
'datev' =>array('label'=>"DateValue", 'checked'=>1, 'position'=>130),
'datev' =>array('label'=>"DateValue", 'checked'=>-1, 'position'=>130),
'type' =>array('label'=>"PaymentMode", 'checked'=>1, 'position'=>140),
'project' =>array('label'=>"Project", 'checked'=>1, 'position'=>200, "enabled"=>!empty($conf->projet->enabled)),
'bank' =>array('label'=>"BankAccount", 'checked'=>1, 'position'=>300, "enabled"=>!empty($conf->banque->enabled)),

View File

@ -1660,6 +1660,11 @@ if (empty($reshook)) {
$discount->tva_tx = $lines[$i]->tva_tx;
$discount->fk_user = $user->id;
$discount->description = $desc;
$discount->multicurrency_subprice = abs($lines[$i]->multicurrency_subprice);
$discount->multicurrency_amount_ht = abs($lines[$i]->multicurrency_total_ht);
$discount->multicurrency_amount_tva = abs($lines[$i]->multicurrency_total_tva);
$discount->multicurrency_amount_ttc = abs($lines[$i]->multicurrency_total_ttc);
$discountid = $discount->create($user);
if ($discountid > 0) {
$result = $object->insert_discount($discountid); // This include link_to_invoice
@ -3215,7 +3220,7 @@ if ($action == 'create') {
if (empty($conf->global->INVOICE_DISABLE_DEPOSIT)) {
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
$tmp = '<input type="radio" id="radio_deposit" name="type" value="3"'.(GETPOST('type') == 3 ? ' checked' : '').'> ';
print '<script type="text/javascript" language="javascript">
print '<script type="text/javascript">
jQuery(document).ready(function() {
jQuery("#typestandardinvoice, #valuestandardinvoice").click(function() {
jQuery("#radio_standard").prop("checked", true);
@ -3329,7 +3334,7 @@ if ($action == 'create') {
$tmp .= ' disabled';
}
$tmp .= '> ';
print '<script type="text/javascript" language="javascript">
print '<script type="text/javascript">
jQuery(document).ready(function() {
jQuery("#fac_replacement").change(function() {
jQuery("#radio_replacement").prop("checked", true);
@ -3418,7 +3423,7 @@ if ($action == 'create') {
}
$tmp .= '> ';
// Show credit note options only if we checked credit note
print '<script type="text/javascript" language="javascript">
print '<script type="text/javascript">
jQuery(document).ready(function() {
if (! jQuery("#radio_creditnote").is(":checked"))
{
@ -3493,7 +3498,7 @@ if ($action == 'create') {
$jsListType .= (!empty($jsListType) ? ',' : '').'"'.$type.'":"'.$curent.'"';
}
print '<script type="text/javascript" language="javascript">
print '<script type="text/javascript">
$(document).ready(function() {
var listType = {'.$jsListType.'};
$("[name=\'type\'").change(function() {
@ -3581,7 +3586,7 @@ if ($action == 'create') {
$form->select_conditions_paiements($retained_warranty_fk_cond_reglement, 'retained_warranty_fk_cond_reglement', -1, 1);
print '</td></tr>';
print '<script type="text/javascript" language="javascript">
print '<script type="text/javascript">
$(document).ready(function() {
$("[name=\'type\']").change(function() {
if($( this ).prop("checked") && $.inArray($( this ).val(), '.json_encode($retainedWarrantyInvoiceAvailableType).' ) !== -1)
@ -4278,7 +4283,7 @@ if ($action == 'create') {
print '<div class="fichehalfleft">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border tableforfield" width="100%">';
print '<table class="border tableforfield centpercent">';
// Type
print '<tr><td class="titlefield fieldname_type">'.$langs->trans('Type').'</td><td class="valuefield fieldname_type">';
@ -4359,7 +4364,7 @@ if ($action == 'create') {
// Date invoice
print '<tr><td>';
print '<table class="nobordernopadding" width="100%"><tr><td>';
print '<table class="nobordernopadding centpercent"><tr><td>';
print $langs->trans('DateInvoice');
print '</td>';
if ($action != 'editinvoicedate' && !empty($object->brouillon) && $usercancreate && empty($conf->global->FAC_FORCE_DATE_VALIDATION)) {
@ -4380,7 +4385,7 @@ if ($action == 'create') {
if (!empty($conf->global->INVOICE_POINTOFTAX_DATE)) {
// Date invoice
print '<tr><td>';
print '<table class="nobordernopadding" width="100%"><tr><td>';
print '<table class="nobordernopadding centpercent"><tr><td>';
print $langs->trans('DatePointOfTax');
print '</td>';
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editdate_pointoftax&token='.newToken().'&facid='.$object->id.'">'.img_edit($langs->trans('SetDate'), 1).'</a></td>';
@ -4396,7 +4401,7 @@ if ($action == 'create') {
// Payment term
print '<tr><td>';
print '<table class="nobordernopadding" width="100%"><tr><td>';
print '<table class="nobordernopadding centpercent"><tr><td>';
print $langs->trans('PaymentConditionsShort');
print '</td>';
if ($object->type != Facture::TYPE_CREDIT_NOTE && $action != 'editconditions' && $usercancreate) {
@ -4417,7 +4422,7 @@ if ($action == 'create') {
// Date payment term
print '<tr><td>';
print '<table class="nobordernopadding" width="100%"><tr><td>';
print '<table class="nobordernopadding centpercent"><tr><td>';
print $langs->trans('DateMaxPayment');
print '</td>';
if ($object->type != Facture::TYPE_CREDIT_NOTE && $action != 'editpaymentterm' && $usercancreate) {
@ -4441,7 +4446,7 @@ if ($action == 'create') {
// Payment mode
print '<tr><td>';
print '<table class="nobordernopadding" width="100%"><tr><td>';
print '<table class="nobordernopadding centpercent"><tr><td>';
print $langs->trans('PaymentMode');
print '</td>';
if ($action != 'editmode' && $usercancreate) {
@ -4461,7 +4466,7 @@ if ($action == 'create') {
// Multicurrency code
print '<tr>';
print '<td>';
print '<table class="nobordernopadding" width="100%"><tr><td>';
print '<table class="nobordernopadding centpercent"><tr><td>';
print $form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0);
print '</td>';
if ($usercancreate && $action != 'editmulticurrencycode' && !empty($object->brouillon)) {
@ -4505,7 +4510,7 @@ if ($action == 'create') {
// Bank Account
if (!empty($conf->banque->enabled)) {
print '<tr><td class="nowrap">';
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
print '<table class="nobordernopadding centpercent"><tr><td class="nowrap">';
print $langs->trans('BankAccount');
print '<td>';
if (($action != 'editbankaccount') && $usercancreate) {
@ -4525,7 +4530,7 @@ if ($action == 'create') {
// Incoterms
if (!empty($conf->incoterm->enabled)) {
print '<tr><td>';
print '<table width="100%" class="nobordernopadding"><tr><td>';
print '<table class="nobordernopadding centpercent"><tr><td>';
print $langs->trans('IncotermLabel');
print '<td><td class="right">';
if ($usercancreate) {
@ -4653,7 +4658,8 @@ if ($action == 'create') {
print '<div class="fichehalfright">';
print '<!-- amounts -->'."\n";
print '<table class="border bordertop tableforfield centpercent">';
print '<div class="underbanner clearboth"></div>'."\n";
print '<table class="border tableforfield centpercent">';
$sign = 1;
if (!empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE_SCREEN) && $object->type == $object::TYPE_CREDIT_NOTE) {

View File

@ -463,11 +463,17 @@ class Facture extends CommonInvoice
$this->status = self::STATUS_DRAFT;
$this->statut = self::STATUS_DRAFT;
// Multicurrency (test on $this->multicurrency_tx because we should take the default rate only if not using origin rate)
if (!empty($this->multicurrency_code) && empty($this->multicurrency_tx)) {
list($this->fk_multicurrency, $this->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($this->db, $this->multicurrency_code, $this->date);
if (!empty($this->multicurrency_code)) {
// Multicurrency (test on $this->multicurrency_tx because we should take the default rate of multicurrency_code only if not using original rate)
if (empty($this->multicurrency_tx)) {
// If original rate is not set, we take a default value from date
list($this->fk_multicurrency, $this->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($this->db, $this->multicurrency_code, $this->date);
} else {
// original rate multicurrency_tx and multicurrency_code are set, we use them
$this->fk_multicurrency = MultiCurrency::getIdFromCode($this->db, $this->multicurrency_code);
}
} else {
$this->fk_multicurrency = MultiCurrency::getIdFromCode($this->db, $this->multicurrency_code);
$this->fk_multicurrency = 0;
}
if (empty($this->fk_multicurrency)) {
$this->multicurrency_code = $conf->currency;

View File

@ -100,14 +100,6 @@ if ($action == 'addcontact' && $user->rights->facture->creer) {
* View
*/
if (empty($object->id)) {
llxHeader();
$langs->load('errors');
echo '<div class="error">'.$langs->trans("ErrorRecordNotFound").'</div>';
llxFooter();
exit;
}
$title = $langs->trans('InvoiceCustomer')." - ".$langs->trans('ContactsAddresses');
$helpurl = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes";
llxHeader('', $title, $helpurl);

View File

@ -348,7 +348,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
// Add realtime total information
if (!empty($conf->use_javascript_ajax)) {
print "\n".'<script type="text/javascript" language="javascript">';
print "\n".'<script type="text/javascript">';
print '$(document).ready(function () {
setPaiementCode();

View File

@ -409,7 +409,7 @@ if ($action == 'new') {
foreach ($accounts as $bid => $account_label) {
print '
<script language="javascript" type="text/javascript">
<script type="text/javascript">
jQuery(document).ready(function()
{
jQuery("#checkall_'.$bid.'").click(function()

View File

@ -154,7 +154,7 @@ if ($action == 'create') {
$total = $charge->amount;
if (!empty($conf->use_javascript_ajax)) {
print "\n".'<script type="text/javascript" language="javascript">';
print "\n".'<script type="text/javascript">';
//Add js for AutoFill
print ' $(document).ready(function () {';

View File

@ -154,7 +154,7 @@ if ($action == 'create') {
$total = $tva->amount;
if (!empty($conf->use_javascript_ajax)) {
print "\n".'<script type="text/javascript" language="javascript">';
print "\n".'<script type="text/javascript">';
//Add js for AutoFill
print ' $(document).ready(function () {';

View File

@ -401,7 +401,7 @@ if ($action == 'create') {
print load_fiche_titre($langs->trans("VAT").' - '.$langs->trans("New"));
if (!empty($conf->use_javascript_ajax)) {
print "\n".'<script type="text/javascript" language="javascript">';
print "\n".'<script type="text/javascript">';
print /** @lang JavaScript */'
$(document).ready(function () {
let onAutoCreatePaiementChange = function () {

View File

@ -331,6 +331,12 @@ $dolibarr_cron_allow_cli='0';
// Examples:
// $dolibarr_strict_mode=0;
// dolibarr_allow_download_external_modules
// Provide a link to download the zip of an external modules installed into custom directory from the web admin.
// Default value: 0
// Examples:
// $dolibarr_allow_download_external_modules=0;
//#################################

View File

@ -105,7 +105,7 @@ abstract class ActionsContactCardCommon
if ($action == 'create' || $action == 'edit') {
if ($conf->use_javascript_ajax) {
$this->tpl['ajax_selectcountry'] = "\n".'<script type="text/javascript" language="javascript">
$this->tpl['ajax_selectcountry'] = "\n".'<script type="text/javascript">
jQuery(document).ready(function () {
jQuery("#selectcountry_id").change(function() {
document.formsoc.action.value="'.$action.'";

View File

@ -620,7 +620,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
dol_htmloutput_errors(is_numeric($error) ? '' : $error, $errors);
if ($conf->use_javascript_ajax) {
print "\n".'<script type="text/javascript" language="javascript">'."\n";
print "\n".'<script type="text/javascript">'."\n";
print 'jQuery(document).ready(function () {
jQuery("#selectcountry_id").change(function() {
document.formsoc.action.value="create";
@ -798,7 +798,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
// Unsubscribe
if (!empty($conf->mailing->enabled)) {
if ($conf->use_javascript_ajax && $conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS == 2) {
print "\n".'<script type="text/javascript" language="javascript">'."\n";
print "\n".'<script type="text/javascript">'."\n";
print '$(document).ready(function () {
$("#email").keyup(function() {
if ($(this).val()!="") {
@ -924,7 +924,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
dol_htmloutput_errors(is_numeric($error) ? '' : $error, $errors);
if ($conf->use_javascript_ajax) {
print "\n".'<script type="text/javascript" language="javascript">'."\n";
print "\n".'<script type="text/javascript">'."\n";
print 'jQuery(document).ready(function () {
jQuery("#selectcountry_id").change(function() {
document.formsoc.action.value="edit";
@ -1071,7 +1071,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
// Unsubscribe
if (!empty($conf->mailing->enabled)) {
if ($conf->use_javascript_ajax && isset($conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS) && $conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS == 2) {
print "\n".'<script type="text/javascript" language="javascript">'."\n";
print "\n".'<script type="text/javascript">'."\n";
print '
jQuery(document).ready(function () {

View File

@ -76,7 +76,7 @@ $search_phone_mobile = GETPOST("search_phone_mobile", 'alpha');
$search_fax = GETPOST("search_fax", 'alpha');
$search_email = GETPOST("search_email", 'alpha');
if (!empty($conf->mailing->enabled)) {
$search_no_email = GETPOST("search_no_email", 'int');
$search_no_email = GETPOSTISSET("search_no_email") ? GETPOST("search_no_email", 'int') : -1;
} else {
$search_no_email = -1;
}

View File

@ -34,18 +34,22 @@ $action = GETPOST('action', 'aZ09');
// Load translation files required by the page
$langs->load("companies");
// Security check
$id = GETPOST('id', 'int');
if ($user->socid) {
$id = $user->socid;
}
$result = restrictedArea($user, 'contact', $id, 'socpeople&societe');
$object = new Contact($db);
if ($id > 0) {
$object->fetch($id);
}
// Security check
if ($user->socid > 0) {
if ($object->fk_soc > 0 && $object->fk_soc != $user->socid) {
accessforbidden();
}
}
$result = restrictedArea($user, 'contact', $id, 'socpeople&societe');
$permissionnote = $user->rights->societe->creer; // Used by the include of actions_setnotes.inc.php
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context

View File

@ -916,6 +916,8 @@ if (empty($reshook)) {
}
}
// Actions when printing a doc from card
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
// Actions to build doc
$upload_dir = $conf->contrat->multidir_output[$object->entity];

View File

@ -229,6 +229,7 @@ $formother = new FormOther($db);
$socstatic = new Societe($db);
$formcompany = new FormCompany($db);
$contracttmp = new Contrat($db);
$title = "";
$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,";
@ -259,7 +260,7 @@ if ($search_sale > 0 || (empty($user->rights->societe->client->voir) && !$socid)
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= ", ".MAIN_DB_PREFIX."contrat as c";
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
if (!empty($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (c.rowid = ef.fk_object)";
}
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."contratdet as cd ON c.rowid = cd.fk_contrat";

View File

@ -37,6 +37,7 @@ $langs->loadLangs(array('products', 'contracts', 'companies'));
$optioncss = GETPOST('optioncss', 'aZ09');
$massaction = GETPOST('massaction', 'alpha');
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", 'alpha');
@ -248,7 +249,7 @@ if (empty($user->rights->societe->client->voir) && !$socid) {
$sql .= " ".MAIN_DB_PREFIX."societe_commerciaux as sc,";
}
$sql .= " ".MAIN_DB_PREFIX."contratdet as cd";
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
if (!empty($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (cd.rowid = ef.fk_object)";
}
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON cd.fk_product = p.rowid";

View File

@ -1306,6 +1306,12 @@ if (!$error && ($massaction == 'delete' || ($action == 'delete' && $confirm == '
continue;
}
if ($objectclass == 'Holiday' && ! in_array($objecttmp->statut, array(Holiday::STATUS_DRAFT, Holiday::STATUS_CANCELED, Holiday::STATUS_REFUSED))) {
$nbignored++;
$resaction .= '<div class="error">'.$langs->trans('ErrorLeaveRequestMustBeDraftCanceledOrRefusedToBeDeleted', $objecttmp->ref).'</div><br>';
continue;
}
if ($objectclass == "Task" && $objecttmp->hasChildren() > 0) {
$sql = "UPDATE ".MAIN_DB_PREFIX."projet_task SET fk_task_parent = 0 WHERE fk_task_parent = ".((int) $objecttmp->id);
$res = $db->query($sql);
@ -1342,8 +1348,10 @@ if (!$error && ($massaction == 'delete' || ($action == 'delete' && $confirm == '
// Message for elements well deleted
if ($nbok > 1) {
setEventMessages($langs->trans("RecordsDeleted", $nbok), null, 'mesgs');
} elseif ($nbok == 1) {
setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs');
} elseif ($nbok > 0) {
setEventMessages($langs->trans("RecordDeleted", $nbok), null, 'mesgs');
} else {
setEventMessages($langs->trans("NoRecordDeleted"), null, 'mesgs');
}
// Message for elements which can't be deleted

View File

@ -160,7 +160,7 @@ if (!empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_
</script>';
// This ajax service is called only when a directory $selecteddir is opened but not when closed.
//print '<script language="javascript">';
//print '<script type="text/javascript">';
//print "loadandshowpreview('".dol_escape_js($selecteddir)."');";
//print '</script>';
}

View File

@ -65,9 +65,14 @@ if (!empty($user->socid)) {
$socid = $user->socid;
}
/*if (empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) {
accessforbidden('Calling this file is allowed only when MAIN_DIRECT_STATUS_UPDATE is set');
}*/
if (in_array($field, array('status'))) {
restrictedArea($user, $element, $id);
} elseif ($element == 'product' && in_array($field, array('tosell', 'tobuy', 'tobatch'))) { // Special case for products
restrictedArea($user, 'produit|service', $id, 'product&product', '', '', 'rowid');
} else {
accessforbidden("Bad value for combination of parameters element/field.", 0, 0, 1);
exit;
}
/*
@ -78,15 +83,6 @@ top_httphead();
print '<!-- Ajax page called with url '.dol_escape_htmltag($_SERVER["PHP_SELF"]).'?'.dol_escape_htmltag($_SERVER["QUERY_STRING"]).' -->'."\n";
if (in_array($field, array('status'))) {
restrictedArea($user, $element, $id);
} elseif ($element == 'product' && in_array($field, array('tosell', 'tobuy', 'tobatch'))) { // Special case for products
restrictedArea($user, 'produit|service', $id, 'product&product', '', '', 'rowid');
} else {
accessforbidden("Bad value for combination of parameters element/field.", 0, 0, 1);
exit;
}
// Registering new values
if (($action == 'set') && !empty($id)) {
$triggerkey = strtoupper($element).'_UPDATE';

View File

@ -237,7 +237,7 @@ class box_funnel_of_prospection extends ModeleBoxes
$dolgraph->setBorderColor(array_values($bordercolorseries));
$dolgraph->setShowLegend(2);
if (!empty($conf->dol_optimize_smallscreen)) {
$px1->SetWidth(320);
$dolgraph->SetWidth(320);
}
$dolgraph->setShowPercent(1);
$dolgraph->setMirrorGraphValues(true);

View File

@ -227,7 +227,7 @@ class box_graph_invoices_permonth extends ModeleBoxes
if (!$mesg) {
$stringtoshow = '';
$stringtoshow .= '<script type="text/javascript" language="javascript">
$stringtoshow .= '<script type="text/javascript">
jQuery(document).ready(function() {
jQuery("#idsubimg'.$this->boxcode.'").click(function() {
jQuery("#idfilter'.$this->boxcode.'").toggle();

View File

@ -223,7 +223,7 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes
if (!$mesg) {
$stringtoshow = '';
$stringtoshow .= '<script type="text/javascript" language="javascript">
$stringtoshow .= '<script type="text/javascript">
jQuery(document).ready(function() {
jQuery("#idsubimg'.$this->boxcode.'").click(function() {
jQuery("#idfilter'.$this->boxcode.'").toggle();

View File

@ -140,7 +140,7 @@ class box_graph_nb_ticket_last_x_days extends ModeleBoxes
dol_print_error($this->db);
}
$stringtoshow = '<div class="div-table-responsive-no-min">';
$stringtoshow .= '<script type="text/javascript" language="javascript">
$stringtoshow .= '<script type="text/javascript">
jQuery(document).ready(function() {
jQuery("#idsubimgDOLUSERCOOKIE_ticket_last_days").click(function() {
jQuery("#idfilterDOLUSERCOOKIE_ticket_last_days").toggle();

View File

@ -228,7 +228,7 @@ class box_graph_orders_permonth extends ModeleBoxes
if (!$mesg) {
$stringtoshow = '';
$stringtoshow .= '<script type="text/javascript" language="javascript">
$stringtoshow .= '<script type="text/javascript">
jQuery(document).ready(function() {
jQuery("#idsubimg'.$this->boxcode.'").click(function() {
jQuery("#idfilter'.$this->boxcode.'").toggle();

View File

@ -227,7 +227,7 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes
if (!$mesg) {
$stringtoshow = '';
$stringtoshow .= '<script type="text/javascript" language="javascript">
$stringtoshow .= '<script type="text/javascript">
jQuery(document).ready(function() {
jQuery("#idsubimg'.$this->boxcode.'").click(function() {
jQuery("#idfilter'.$this->boxcode.'").toggle();

View File

@ -352,7 +352,7 @@ class box_graph_product_distribution extends ModeleBoxes
if (!$mesg) {
$stringtoshow = '';
$stringtoshow .= '<script type="text/javascript" language="javascript">
$stringtoshow .= '<script type="text/javascript">
jQuery(document).ready(function() {
jQuery("#idsubimg'.$this->boxcode.'").click(function() {
jQuery("#idfilter'.$this->boxcode.'").toggle();

View File

@ -231,7 +231,7 @@ class box_graph_propales_permonth extends ModeleBoxes
if (!$mesg) {
$stringtoshow = '';
$stringtoshow .= '<script type="text/javascript" language="javascript">
$stringtoshow .= '<script type="text/javascript">
jQuery(document).ready(function() {
jQuery("#idsubimg'.$this->boxcode.'").click(function() {
jQuery("#idfilter'.$this->boxcode.'").toggle();

View File

@ -126,7 +126,7 @@ class box_task extends ModeleBoxes
$boxcontent .= '</form>'."\n";
$boxcontent .= '</div>'."\n";
if (!empty($conf->use_javascript_ajax)) {
$boxcontent .= '<script type="text/javascript" language="javascript">
$boxcontent .= '<script type="text/javascript">
jQuery(document).ready(function() {
jQuery("#idsubimg'.$this->boxcode.'").click(function() {
jQuery(".showiffilter'.$this->boxcode.'").toggle();

View File

@ -550,7 +550,7 @@ abstract class CommonObject
dol_print_error(get_class()."::isExistingObject ".$error, LOG_ERR);
return -1;
}
if ($ref || $ref_ext) {
if ($ref || $ref_ext) { // Because the same ref can exists in 2 different entities, we force the current one in priority
$sql .= " AND entity = ".((int) $conf->entity);
}
@ -869,7 +869,7 @@ abstract class CommonObject
if (!empty($conf->socialnetworks->enabled)) {
$outsocialnetwork = '';
if (!empty($this->socialnetworks) && is_countable($this->socialnetworks) && count($this->socialnetworks) > 0) {
if (!empty($this->socialnetworks) && is_array($this->socialnetworks) && count($this->socialnetworks) > 0) {
$socialnetworksdict = getArrayOfSocialNetworks();
foreach ($this->socialnetworks as $key => $value) {
if ($value) {
@ -4872,13 +4872,9 @@ abstract class CommonObject
$reshook = 0;
//if (is_object($hookmanager) && (($line->product_type == 9 && !empty($line->special_code)) || !empty($line->fk_parent_line))) {
if (is_object($hookmanager)) { // Old code is commented on preceding line.
if (empty($line->fk_parent_line)) {
$parameters = array('line'=>$line, 'i'=>$i, 'restrictlist'=>$restrictlist, 'selectedLines'=> $selectedLines);
$reshook = $hookmanager->executeHooks('printOriginObjectLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
} else {
$parameters = array('line'=>$line, 'i'=>$i, 'restrictlist'=>$restrictlist, 'selectedLines'=> $selectedLines, 'fk_parent_line'=>$line->fk_parent_line);
$reshook = $hookmanager->executeHooks('printOriginObjectSubLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
}
$parameters = array('line'=>$line, 'i'=>$i, 'restrictlist'=>$restrictlist, 'selectedLines'=> $selectedLines);
if (!empty($line->fk_parent_line)) { $parameters['fk_parent_line'] = $line->fk_parent_line; }
$reshook = $hookmanager->executeHooks('printOriginObjectSubLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
}
if (empty($reshook)) {
$this->printOriginLine($line, '', $restrictlist, '/core/tpl', $selectedLines);
@ -7862,7 +7858,7 @@ abstract class CommonObject
switch ($mode) {
case "view":
$out .= $extrafields->showOutputField($key, $value);
$out .= $extrafields->showOutputField($key, $value, '', $this->table_element);
break;
case "create":
$out .= $extrafields->showInputField($key, $value, '', $keysuffix, '', 0, $this->id, $this->table_element);

View File

@ -167,15 +167,16 @@ class Conf
* Load setup values into conf object (read llx_const) for a specified entity
* Note that this->db->xxx, this->file->xxx and this->multicompany have been already loaded when setValues is called.
*
* @param DoliDB $db Database handler
* @param int $entity Entity to get
* @return int < 0 if KO, >= 0 if OK
*/
public function setEntityValues($entity)
public function setEntityValues($db, $entity)
{
if ($this->entity != $entity) {
// If we ask to reload setup for a new entity
$this->entity = $entity;
return $this->setValues($this->db);
return $this->setValues($db);
}
return 0;

View File

@ -244,7 +244,7 @@ class DolEditor
$out .= '<div class="aceeditorstatusbar" id="statusBar'.$this->htmlname.'">'.$titlecontent;
$out .= ' &nbsp; - &nbsp; <a id="morelines" href="#" class="right morelines'.$this->htmlname.' reposition">'.dol_escape_htmltag($langs->trans("ShowMoreLines")).'</a> &nbsp; &nbsp; ';
$out .= '</div>';
$out .= '<script type="text/javascript" language="javascript">'."\n";
$out .= '<script type="text/javascript">'."\n";
$out .= 'jQuery(document).ready(function() {'."\n";
$out .= ' var aceEditor = window.ace.edit("'.$this->htmlname.'aceeditorid");
var StatusBar = window.ace.require("ace/ext/statusbar").StatusBar; // Init status bar. Need lib ext-statusbar
@ -281,7 +281,7 @@ class DolEditor
$out .= htmlspecialchars($this->content);
$out .= '</textarea>';
$out .= '<script type="text/javascript" language="javascript">'."\n";
$out .= '<script type="text/javascript">'."\n";
$out .= 'var aceEditor = window.ace.edit("'.$this->htmlname.'aceeditorid");
aceEditor.session.setMode("ace/mode/'.$format.'");

View File

@ -42,12 +42,6 @@ class ExtraFields
*/
public $db;
/**
* @var array Array with type of element (for what object is the extrafield)
* @deprecated
*/
public $attribute_elementtype;
/**
* @var array Array with type of the extra field
* @deprecated
@ -60,90 +54,12 @@ class ExtraFields
*/
public $attribute_label;
/**
* @var array Array with size of extra field
* @deprecated
*/
public $attribute_size;
/**
* @var array Array with list of possible values for some types of extra fields
* @deprecated
*/
public $attribute_choice;
/**
* @var array Array to store compute formula for computed fields
* @deprecated
*/
public $attribute_computed;
/**
* @var array Array to store default value
* @deprecated
*/
public $attribute_default;
/**
* @var array Array to store if attribute is unique or not
* @deprecated
*/
public $attribute_unique;
/**
* @var array Array to store if attribute is required or not
* @deprecated
*/
public $attribute_required;
/**
* @var array Array to store parameters of attribute (used in select type)
* @deprecated
*/
public $attribute_param;
/**
* @var array Array to store position of attribute
* @deprecated
*/
public $attribute_pos;
/**
* @var array Array to store if attribute is editable regardless of the document status
* @deprecated
*/
public $attribute_alwayseditable;
/**
* @var array Array to store permission to check
* @deprecated
*/
public $attribute_perms;
/**
* @var array Array to store language file to translate label of values
* @deprecated
*/
public $attribute_langfile;
/**
* @var array Array to store if field is visible by default on list
* @deprecated
*/
public $attribute_list;
/**
* @var array Array to store if field is summable
* @deprecated
*/
public $attribute_totalizable;
/**
* @var array Array to store entity id of extrafield
* @deprecated
*/
public $attribute_entityid;
/**
* @var array New array to store extrafields definition
@ -203,17 +119,8 @@ class ExtraFields
$this->attributes = array();
// For old usage
$this->attribute_elementtype = array();
$this->attribute_type = array();
$this->attribute_label = array();
$this->attribute_size = array();
$this->attribute_computed = array();
$this->attribute_default = array();
$this->attribute_unique = array();
$this->attribute_required = array();
$this->attribute_perms = array();
$this->attribute_langfile = array();
$this->attribute_list = array();
}
/**
@ -238,7 +145,7 @@ class ExtraFields
* @param string $langfile Language file
* @param string $enabled Condition to have the field enabled or not
* @param int $totalizable Is a measure. Must show a total on lists
* @param int $printable Is extrafield displayed on PDF
* @param int $printable Is extrafield displayed on PDF
* @return int <=0 if KO, >0 if OK
*/
public function addExtraField($attrname, $label, $type, $pos, $size, $elementtype, $unique = 0, $required = 0, $default_value = '', $param = '', $alwayseditable = 0, $perms = '', $list = '-1', $help = '', $computed = '', $entity = '', $langfile = '', $enabled = '1', $totalizable = 0, $printable = 0)
@ -873,7 +780,7 @@ class ExtraFields
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Load array this->attributes, or old this->attribute_xxx like attribute_label, attribute_type, ...
* Load array this->attributes (and some old this->attribute_xxx like attribute_label, attribute_type, ...
*
* @param string $elementtype Type of element ('' = all or $object->table_element like 'adherent', 'commande', 'thirdparty', 'facture', 'propal', 'product', ...).
* @param boolean $forceload Force load of extra fields whatever is status of cache.
@ -932,20 +839,6 @@ class ExtraFields
// Old usage
$this->attribute_type[$tab->name] = $tab->type;
$this->attribute_label[$tab->name] = $tab->label;
$this->attribute_size[$tab->name] = $tab->size;
$this->attribute_elementtype[$tab->name] = $tab->elementtype;
$this->attribute_default[$tab->name] = $tab->fielddefault;
$this->attribute_computed[$tab->name] = $tab->fieldcomputed;
$this->attribute_unique[$tab->name] = $tab->fieldunique;
$this->attribute_required[$tab->name] = $tab->fieldrequired;
$this->attribute_param[$tab->name] = ($tab->param ? jsonOrUnserialize($tab->param) : '');
$this->attribute_pos[$tab->name] = $tab->pos;
$this->attribute_alwayseditable[$tab->name] = $tab->alwayseditable;
$this->attribute_perms[$tab->name] = (strlen($tab->perms) == 0 ? 1 : $tab->perms);
$this->attribute_langfile[$tab->name] = $tab->langs;
$this->attribute_list[$tab->name] = $tab->list;
$this->attribute_totalizable[$tab->name] = $tab->totalizable;
$this->attribute_entityid[$tab->name] = $tab->entity;
// New usage
$this->attributes[$tab->elementtype]['type'][$tab->name] = $tab->type;
@ -1028,20 +921,10 @@ class ExtraFields
$totalizable = $this->attributes[$extrafieldsobjectkey]['totalizable'][$key];
$help = $this->attributes[$extrafieldsobjectkey]['help'][$key];
$hidden = (empty($list) ? 1 : 0); // If empty, we are sure it is hidden, otherwise we show. If it depends on mode (view/create/edit form or list, this must be filtered by caller)
} else // Old usage
{
} else {
// Old usage
$label = $this->attribute_label[$key];
$type = $this->attribute_type[$key];
$size = $this->attribute_size[$key];
$elementtype = $this->attribute_elementtype[$key]; // Seems not used
$default = $this->attribute_default[$key];
$computed = $this->attribute_computed[$key];
$unique = $this->attribute_unique[$key];
$required = $this->attribute_required[$key];
$param = $this->attribute_param[$key];
$langfile = $this->attribute_langfile[$key];
$list = $this->attribute_list[$key];
$totalizable = $this->attribute_totalizable[$key];
$hidden = (empty($list) ? 1 : 0); // If empty, we are sure it is hidden, otherwise we show. If it depends on mode (view/create/edit form or list, this must be filtered by caller)
}
@ -1626,20 +1509,10 @@ class ExtraFields
$list = dol_eval($this->attributes[$extrafieldsobjectkey]['list'][$key], 1);
$help = $this->attributes[$extrafieldsobjectkey]['help'][$key];
$hidden = (empty($list) ? 1 : 0); // If $list empty, we are sure it is hidden, otherwise we show. If it depends on mode (view/create/edit form or list, this must be filtered by caller)
} else // Old usage
{
//dol_syslog("Warning: parameter 'extrafieldsobjectkey' is missing", LOG_WARNING);
} else {
// Old usage
$label = $this->attribute_label[$key];
$type = $this->attribute_type[$key];
$size = $this->attribute_size[$key];
$default = $this->attribute_default[$key];
$computed = $this->attribute_computed[$key];
$unique = $this->attribute_unique[$key];
$required = $this->attribute_required[$key];
$param = $this->attribute_param[$key];
$perms = dol_eval($this->attribute_perms[$key], 1);
$langfile = $this->attribute_langfile[$key];
$list = dol_eval($this->attribute_list[$key], 1);
$help = ''; // Not supported with old syntax
$hidden = (empty($list) ? 1 : 0); // If $list empty, we are sure it is hidden, otherwise we show. If it depends on mode (view/create/edit form or list, this must be filtered by caller)
}

View File

@ -2173,7 +2173,7 @@ class Form
// Method with no ajax
if ($action != 'view') {
$out .= '<input type="hidden" class="removedassignedhidden" name="removedassigned" value="">';
$out .= '<script type="text/javascript" language="javascript">jQuery(document).ready(function () {';
$out .= '<script type="text/javascript">jQuery(document).ready(function () {';
$out .= 'jQuery(".removedassigned").click(function() { jQuery(".removedassignedhidden").val(jQuery(this).val()); });';
$out .= 'jQuery(".assignedtouser").change(function() { console.log(jQuery(".assignedtouser option:selected").val());';
$out .= ' if (jQuery(".assignedtouser option:selected").val() > 0) { jQuery("#'.$action.'assignedtouser").attr("disabled", false); }';

View File

@ -67,7 +67,7 @@ class FormBarCode
$disable = '';
if (!empty($conf->use_javascript_ajax)) {
print "\n".'<script type="text/javascript" language="javascript">';
print "\n".'<script type="text/javascript">';
print 'jQuery(document).ready(function () {
jQuery("#select'.$idForm.'").change(function() {
var formName = document.getElementById("form'.$idForm.'");

View File

@ -442,7 +442,8 @@ class FormFile
}
$printer = 0;
if (in_array($modulepart, array('facture', 'supplier_proposal', 'propal', 'proposal', 'order', 'commande', 'expedition', 'commande_fournisseur', 'expensereport', 'delivery', 'ticket'))) { // The direct print feature is implemented only for such elements
// The direct print feature is implemented only for such elements
if (in_array($modulepart, array('contract', 'facture', 'supplier_proposal', 'propal', 'proposal', 'order', 'commande', 'expedition', 'commande_fournisseur', 'expensereport', 'delivery', 'ticket'))) {
$printer = (!empty($user->rights->printing->read) && !empty($conf->printing->enabled)) ?true:false;
}
@ -944,7 +945,7 @@ class FormFile
$out .= '">'.img_picto($langs->trans("Delete"), 'delete').'</a>';
}
if ($printer) {
$out .= '<a class="marginleftonly reposition" href="'.$urlsource.(strpos($urlsource, '?') ? '&' : '?').'action=print_file&token='.newToken().'printer='.urlencode($modulepart).'&file='.urlencode($relativepath);
$out .= '<a class="marginleftonly reposition" href="'.$urlsource.(strpos($urlsource, '?') ? '&' : '?').'action=print_file&token='.newToken().'&printer='.urlencode($modulepart).'&file='.urlencode($relativepath);
$out .= ($param ? '&'.$param : '');
$out .= '">'.img_picto($langs->trans("PrintFile", $relativepath), 'printer.png').'</a>';
}

View File

@ -783,7 +783,7 @@ class FormMail extends Form
if (is_numeric($this->withfile)) {
// TODO Trick to have param removedfile containing nb of file to delete. But this does not works without javascript
$out .= '<input type="hidden" class="removedfilehidden" name="removedfile" value="">'."\n";
$out .= '<script type="text/javascript" language="javascript">';
$out .= '<script type="text/javascript">';
$out .= 'jQuery(document).ready(function () {';
$out .= ' jQuery(".removedfile").click(function() {';
$out .= ' jQuery(".removedfilehidden").val(jQuery(this).val());';
@ -978,7 +978,7 @@ class FormMail extends Form
// Disable enter key if option MAIN_MAILFORM_DISABLE_ENTERKEY is set
if (!empty($conf->global->MAIN_MAILFORM_DISABLE_ENTERKEY)) {
$out .= '<script type="text/javascript" language="javascript">';
$out .= '<script type="text/javascript">';
$out .= 'jQuery(document).ready(function () {';
$out .= ' $(document).on("keypress", \'#mailform\', function (e) { /* Note this is called at every key pressed ! */
var code = e.keyCode || e.which;

View File

@ -1194,7 +1194,7 @@ class FormOther
// Javascript code for dynamic actions
if (!empty($conf->use_javascript_ajax)) {
$selectboxlist .= '<script type="text/javascript" language="javascript">
$selectboxlist .= '<script type="text/javascript">
// To update list of activated boxes
function updateBoxOrder(closing) {
@ -1381,12 +1381,13 @@ class FormOther
while ($i < $num) {
$obj = $this->db->fetch_object($result);
if ($selected == $obj->rowid || $selected == $obj->$keyfield) {
print '<option value="'.$obj->$keyfield.'" selected>';
if ($selected == $obj->rowid || $selected == $obj->{$keyfield}) {
print '<option value="'.$obj->{$keyfield}.'" selected>';
} else {
print '<option value="'.$obj->$keyfield.'">';
print '<option value="'.$obj->{$keyfield}.'">';
}
print $obj->$labelfield;
$label = ($langs->trans($dictionarytable.$obj->{$keyfield}) != ($dictionarytable.$obj->{$labelfield}) ? $langs->trans($dictionarytable.$obj->{$keyfield}) : $obj->{$labelfield});
print $label;
print '</option>';
$i++;
}

View File

@ -127,7 +127,7 @@ class FormSms
print "\n<!-- Begin form SMS -->\n";
print '
<script language="javascript">
<script type="text/javascript">
function limitChars(textarea, limit, infodiv)
{
var text = textarea.value;

View File

@ -366,7 +366,7 @@ class FormTicket
$out .= '<td>';
// TODO Trick to have param removedfile containing nb of image to delete. But this does not works without javascript
$out .= '<input type="hidden" class="removedfilehidden" name="removedfile" value="">'."\n";
$out .= '<script type="text/javascript" language="javascript">';
$out .= '<script type="text/javascript">';
$out .= 'jQuery(document).ready(function () {';
$out .= ' jQuery(".removedfile").click(function() {';
$out .= ' jQuery(".removedfilehidden").val(jQuery(this).val());';
@ -1204,7 +1204,7 @@ class FormTicket
$send_email = GETPOST('send_email', 'int') ? GETPOST('send_email', 'int') : 0;
// Example 1 : Adding jquery code
print '<script type="text/javascript" language="javascript">
print '<script type="text/javascript">
jQuery(document).ready(function() {
send_email=' . $send_email.';
if (send_email) {
@ -1404,7 +1404,7 @@ class FormTicket
$out .= '<td>';
// TODO Trick to have param removedfile containing nb of image to delete. But this does not works without javascript
$out .= '<input type="hidden" class="removedfilehidden" name="removedfile" value="">'."\n";
$out .= '<script type="text/javascript" language="javascript">';
$out .= '<script type="text/javascript">';
$out .= 'jQuery(document).ready(function () {';
$out .= ' jQuery(".removedfile").click(function() {';
$out .= ' jQuery(".removedfilehidden").val(jQuery(this).val());';

View File

@ -62,13 +62,11 @@ class Notify
*/
public $fk_project;
// Les codes actions sont definis dans la table llx_notify_def
// codes actions supported are
// @todo defined also into interface_50_modNotification_Notification.class.php
public $arrayofnotifsupported = array(
// This codes actions are defined into table llx_notify_def
static public $arrayofnotifsupported = array(
'BILL_VALIDATE',
'BILL_PAYED',
'ORDER_CREATE',
'ORDER_VALIDATE',
'PROPAL_VALIDATE',
'PROPAL_CLOSE_SIGNED',
@ -85,7 +83,6 @@ class Notify
'ACTION_CREATE'
);
/**
* Constructor
*
@ -348,7 +345,7 @@ class Notify
global $dolibarr_main_url_root;
global $action;
if (!in_array($notifcode, $this->arrayofnotifsupported)) {
if (!in_array($notifcode, Notify::$arrayofnotifsupported)) {
return 0;
}
@ -439,10 +436,10 @@ class Notify
$notifcodedefid = $obj->adid;
$trackid = '';
if ($obj->type_target == 'tocontactid') {
$trackid = 'con'.$obj->id;
$trackid = 'con'.$obj->cid;
}
if ($obj->type_target == 'touserid') {
$trackid = 'use'.$obj->id;
$trackid = 'use'.$obj->cid;
}
if (dol_strlen($obj->email)) {

View File

@ -457,7 +457,7 @@ class SimpleOpenID
// phpcs:enable
$redirect_to = $this->GetRedirectURL();
if (headers_sent()) { // Use JavaScript to redirect if content has been previously sent (not recommended, but safe)
echo '<script language="JavaScript" type="text/javascript">window.location=\'';
echo '<script type="text/javascript">window.location=\'';
echo $redirect_to;
echo '\';</script>';
} else { // Default Header Redirect

View File

@ -351,7 +351,7 @@ print $form->selectarray('objecttype', $newarrayoftype, $objecttype, 0, 0, 0, ''
if (empty($conf->use_javascript_ajax)) {
print '<input type="submit" class="button buttongen button-save" name="changeobjecttype" value="'.$langs->trans("Refresh").'">';
} else {
print '<script type="text/javascript" language="javascript">
print '<script type="text/javascript">
jQuery(document).ready(function() {
jQuery("#objecttype").change(function() {
console.log("Reload for "+jQuery("#objecttype").val());

View File

@ -68,22 +68,27 @@ print ' var time_auto_update = '.$conf->global->MAIN_BROWSER_NOTIFICATION_FREQUE
print ' var time_js_next_test;'."\n";
?>
/* Check if permission ok */
if (Notification.permission !== "granted") {
console.log("Ask Notification.permission");
Notification.requestPermission()
/* Check if Notification is supported */
if ("Notification" in window) {
/* Check if permission ok */
if (Notification.permission !== "granted") {
console.log("Ask Notification.permission");
Notification.requestPermission()
}
/* Launch timer */
// We set a delay before launching first test so next check will arrive after the time_auto_update compared to previous one.
//var time_first_execution = (time_auto_update + (time_js_next_test - nowtime)) * 1000; //need milliseconds
var time_first_execution = <?php echo max(3, empty($conf->global->MAIN_BROWSER_NOTIFICATION_CHECK_FIRST_EXECUTION) ? 0 : $conf->global->MAIN_BROWSER_NOTIFICATION_CHECK_FIRST_EXECUTION); ?>;
setTimeout(first_execution, time_first_execution * 1000);
time_js_next_test = nowtime + time_first_execution;
console.log("Launch browser notif check: setTimeout is set to launch 'first_execution' function after a wait of time_first_execution="+time_first_execution+". nowtime (time php page generation) = "+nowtime+" time_js_next_check = "+time_js_next_test);
} else {
console.log("This browser in this context does not support Notification.");
}
/* Launch timer */
// We set a delay before launching first test so next check will arrive after the time_auto_update compared to previous one.
//var time_first_execution = (time_auto_update + (time_js_next_test - nowtime)) * 1000; //need milliseconds
var time_first_execution = <?php echo max(3, empty($conf->global->MAIN_BROWSER_NOTIFICATION_CHECK_FIRST_EXECUTION) ? 0 : $conf->global->MAIN_BROWSER_NOTIFICATION_CHECK_FIRST_EXECUTION); ?>;
setTimeout(first_execution, time_first_execution * 1000);
time_js_next_test = nowtime + time_first_execution;
console.log("Launch browser notif check: setTimeout is set to launch 'first_execution' function after a wait of time_first_execution="+time_first_execution+". nowtime (time php page generation) = "+nowtime+" time_js_next_check = "+time_js_next_test);
function first_execution() {
console.log("Call first_execution then set repeat time to time_auto_update = MAIN_BROWSER_NOTIFICATION_FREQUENCY = "+time_auto_update);

View File

@ -451,7 +451,7 @@ function run_sql($sqlfile, $silent = 1, $entity = '', $usesavepoint = 1, $handle
}
//if (!empty($conf->use_javascript_ajax)) { // use_javascript_ajax is not defined
print '<script type="text/javascript" language="javascript">
print '<script type="text/javascript">
jQuery(document).ready(function() {
function init_trrunsql()
{

View File

@ -274,6 +274,7 @@ function societe_prepare_head(Societe $object)
if (getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR') == 'thirdparty') {
if (!empty($user->rights->partnership->read)) {
$langs->load("partnership");
$nbPartnership = is_array($object->partnerships) ? count($object->partnerships) : 0;
$head[$h][0] = DOL_URL_ROOT.'/societe/partnership.php?socid='.$object->id;
$head[$h][1] = $langs->trans("Partnership");

View File

@ -2004,11 +2004,15 @@ function dol_compress_file($inputfile, $outputfile, $mode = "gz", &$errorstring
// Skip directories (they would be added automatically)
if (!$file->isDir()) {
// Get real and relative path for current file
$filePath = $file->getRealPath();
$relativePath = substr($filePath, strlen($rootPath) + 1);
$filePath = $file->getPath(); // the full path with filename using the $inputdir root.
$fileName = $file->getFilename();
$fileFullRealPath = $file->getRealPath(); // the full path with name and transformed to use real path directory.
//$relativePath = substr($fileFullRealPath, strlen($rootPath) + 1);
$relativePath = substr(($filePath ? $filePath.'/' : '').$fileName, strlen($rootPath) + 1);
// Add current file to archive
$zip->addFile($filePath, $relativePath);
$zip->addFile($fileFullRealPath, $relativePath);
}
}
@ -2196,22 +2200,29 @@ function dol_compress_dir($inputdir, $outputfile, $mode = "zip", $excludefiles =
}
// Create recursive directory iterator
// This does not return symbolic links
/** @var SplFileInfo[] $files */
$files = new RecursiveIteratorIterator(
new RecursiveDirectoryIterator($inputdir),
RecursiveIteratorIterator::LEAVES_ONLY
);
//var_dump($inputdir);
foreach ($files as $name => $file) {
// Skip directories (they would be added automatically)
if (!$file->isDir()) {
// Get real and relative path for current file
$filePath = $file->getRealPath();
$relativePath = ($rootdirinzip ? $rootdirinzip.'/' : '').substr($filePath, strlen($inputdir) + 1);
$filePath = $file->getPath(); // the full path with filename using the $inputdir root.
$fileName = $file->getFilename();
$fileFullRealPath = $file->getRealPath(); // the full path with name and transformed to use real path directory.
if (empty($excludefiles) || !preg_match($excludefiles, $filePath)) {
//$relativePath = ($rootdirinzip ? $rootdirinzip.'/' : '').substr($fileFullRealPath, strlen($inputdir) + 1);
$relativePath = ($rootdirinzip ? $rootdirinzip.'/' : '').substr(($filePath ? $filePath.'/' : '').$fileName, strlen($inputdir) + 1);
//var_dump($filePath);var_dump($fileFullRealPath);var_dump($relativePath);
if (empty($excludefiles) || !preg_match($excludefiles, $fileFullRealPath)) {
// Add current file to archive
$zip->addFile($filePath, $relativePath);
$zip->addFile($fileFullRealPath, $relativePath);
}
}
}

View File

@ -835,7 +835,7 @@ function checkVal($out = '', $check = 'alphanohtml', $filter = null, $options =
$out = dol_string_onlythesehtmltags($out, 0, 1, 1);
// We should also exclude non expected attributes
// We should also exclude non expected HTML attributes and clean content of some attributes.
if (!empty($conf->global->MAIN_RESTRICTHTML_REMOVE_ALSO_BAD_ATTRIBUTES)) {
// Warning, the function may add a LF so we are forced to trim to compare with old $out without having always a difference and an infinit loop.
$out = trim(dol_string_onlythesehtmlattributes($out));
@ -1569,7 +1569,7 @@ function dolButtonToOpenUrlInDialogPopup($name, $label, $buttonstring, $url, $di
//print '<input type="submit" class="button bordertransp"'.$disabled.' value="'.dol_escape_htmltag($langs->trans("MediaFiles")).'" name="file_manager">';
$out = '<a class="button bordertransp button_'.$name.'"'.$disabled.' title="'.dol_escape_htmltag($label).'">'.$buttonstring.'</a>';
$out .= '<!-- Add js code to open dialog popup on dialog -->';
$out .= '<script language="javascript">
$out .= '<script type="text/javascript">
jQuery(document).ready(function () {
jQuery(".button_'.$name.'").click(function () {
console.log("Open popup with jQuery(...).dialog() on URL '.dol_escape_js(DOL_URL_ROOT.$url).'")
@ -4490,7 +4490,7 @@ function info_admin($text, $infoonimgalt = 0, $nodiv = 0, $admin = '1', $morecss
if ($textfordropdown) {
$tmpresult = '<span class="'.$class.'text opacitymedium cursorpointer">'.$langs->trans($textfordropdown).' '.img_picto($langs->trans($textfordropdown), '1downarrow').'</span>';
$tmpresult .= '<script type="text/javascript" language="javascript">
$tmpresult .= '<script type="text/javascript">
jQuery(document).ready(function() {
jQuery(".'.$class.'text").click(function() {
console.log("toggle text");
@ -6476,9 +6476,27 @@ function dol_string_onlythesehtmlattributes($stringtoclean, $allowed_attributes
if (is_object($dom)) {
for ($els = $dom->getElementsByTagname('*'), $i = $els->length - 1; $i >= 0; $i--) {
for ($attrs = $els->item($i)->attributes, $ii = $attrs->length - 1; $ii >= 0; $ii--) {
// Delete attribute if not into allowed_attributes
if (! empty($attrs->item($ii)->name) && ! in_array($attrs->item($ii)->name, $allowed_attributes)) {
$els->item($i)->removeAttribute($attrs->item($ii)->name);
//var_dump($attrs->item($ii));
if (! empty($attrs->item($ii)->name)) {
// Delete attribute if not into allowed_attributes
if (! in_array($attrs->item($ii)->name, $allowed_attributes)) {
$els->item($i)->removeAttribute($attrs->item($ii)->name);
} elseif (in_array($attrs->item($ii)->name, array('style'))) {
$valuetoclean = $attrs->item($ii)->value;
do {
$oldvaluetoclean = $valuetoclean;
$valuetoclean = preg_replace('/\/\*.*\*\//m', '', $valuetoclean); // clean css comments
$valuetoclean = preg_replace('/position\s*:\s*[a-z]+/mi', '', $valuetoclean);
if ($els->item($i)->tagName == 'a') { // more paranoiac cleaning for clickable tags.
$valuetoclean = preg_replace('/display\s*://m', '', $valuetoclean);
$valuetoclean = preg_replace('/z-index\s*://m', '', $valuetoclean);
$valuetoclean = preg_replace('/\s+(top|left|right|bottom)\s*://m', '', $valuetoclean);
}
} while ($oldvaluetoclean != $valuetoclean);
$attrs->item($ii)->value = $valuetoclean;
}
}
}
}
@ -8141,9 +8159,9 @@ function verifCond($strToEvaluate)
global $leftmenu;
global $rights; // To export to dol_eval function
//print $strRights."<br>\n";
//print $strToEvaluate."<br>\n";
$rights = true;
if ($strToEvaluate !== '') {
if (isset($strToEvaluate) && $strToEvaluate !== '') {
$str = 'if(!('.$strToEvaluate.')) { $rights = false; }';
dol_eval($str); // The dol_eval must contains all the global $xxx used into a condition
}

View File

@ -93,7 +93,7 @@ function dol_setcache($memoryid, $data, $expire = 0)
$dolmemcache->add($memoryid, $data, $expire); // This fails if key already exists
$rescode = $dolmemcache->getResultCode();
if ($rescode == 0) {
return is_countable($data) ? count($data) : 0;
return is_array($data) ? count($data) : (is_scalar($data) ? strlen($data) : 0);
} else {
return -$rescode;
}
@ -113,7 +113,7 @@ function dol_setcache($memoryid, $data, $expire = 0)
//$dolmemcache->setOption(Memcached::OPT_COMPRESSION, false);
$result = $dolmemcache->add($memoryid, $data, false, $expire); // This fails if key already exists
if ($result) {
return is_countable($data) ? count($data) : 0;
return is_array($data) ? count($data) : (is_scalar($data) ? strlen($data) : 0);
} else {
return -1;
}

View File

@ -1363,7 +1363,11 @@ function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0,
// Description short of product line
$libelleproduitservice = $label;
if (!empty($libelleproduitservice) && !empty($conf->global->PDF_BOLD_PRODUCT_LABEL)) {
// This part of code is bugged. It introduces a HTML tag making the label a html string but without converting \n into br if it was a full text non html string before.
// Adding <b> may convert the original string into a HTML string. Sowe have to first
// convert \n into <br> we text is not already HTML.
if (!dol_textishtml($libelleproduitservice)) {
$libelleproduitservice = str_replace("\n", '<br>', $libelleproduitservice);
}
$libelleproduitservice = '<b>'.$libelleproduitservice.'</b>';
}
}
@ -1375,7 +1379,7 @@ function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0,
if (!empty($prodser->sousprods) && is_array($prodser->sousprods) && count($prodser->sousprods)) {
$tmparrayofsubproducts = reset($prodser->sousprods);
foreach ($tmparrayofsubproducts as $subprodval) {
$libelleproduitservice .= "\n * ".$subprodval[5].(($subprodval[5] && $subprodval[3]) ? ' - ' : '').$subprodval[3].' ('.$subprodval[1].')';
$libelleproduitservice = dol_concatdesc($libelleproduitservice, " * ".$subprodval[5].(($subprodval[5] && $subprodval[3]) ? ' - ' : '').$subprodval[3].' ('.$subprodval[1].')');
}
}
}
@ -1419,7 +1423,7 @@ function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0,
}
if (empty($hidedesc)) {
if (!empty($conf->global->MAIN_DOCUMENTS_DESCRIPTION_FIRST)) {
$libelleproduitservice = $desc."\n".$libelleproduitservice;
$libelleproduitservice = dol_concatdesc($desc, $libelleproduitservice);
} else {
if (!empty($conf->global->HIDE_LABEL_VARIANT_PDF) && $prodser->isVariant()) {
$libelleproduitservice = $desc;
@ -1493,7 +1497,11 @@ function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0,
}
if (!empty($ref_prodserv) && !empty($conf->global->PDF_BOLD_PRODUCT_REF_AND_PERIOD)) {
if (!dol_textishtml($libelleproduitservice)) {
$libelleproduitservice = str_replace("\n", '<br>', $libelleproduitservice);
}
$ref_prodserv = '<b>'.$ref_prodserv.'</b>';
// $prefix_prodserv and $ref_prodser are not HTML var
}
$libelleproduitservice = $prefix_prodserv.$ref_prodserv.$libelleproduitservice;
@ -1527,7 +1535,10 @@ function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0,
}
//print '>'.$outputlangs->charset_output.','.$period;
if (!empty($conf->global->PDF_BOLD_PRODUCT_REF_AND_PERIOD)) {
$libelleproduitservice .= '<b style="color:#333666;" ><em>'."__N__</b> ".$period.'</em>';
if (!dol_textishtml($libelleproduitservice)) {
$libelleproduitservice = str_replace("\n", '<br>', $libelleproduitservice);
}
$libelleproduitservice .= '<br><b style="color:#333666;" ><em>'.$period.'</em></b>';
} else {
$libelleproduitservice .= "__N__".$period;
}

View File

@ -121,7 +121,7 @@ function tree_recur($tab, $pere, $rang, $iddivjstree = 'iddivjstree', $donoreset
if ($rang == 0) {
// Test also done with jstree and dynatree (not able to have <a> inside label)
print '<script type="text/javascript" language="javascript">
print '<script type="text/javascript">
$(document).ready(function(){
$("#'.$iddivjstree.'").treeview({
collapsed: true,

View File

@ -149,18 +149,20 @@ function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage,
global $conf, $db;
// Now create the .tpl file (duplicate code with actions updatesource or updatecontent but we need this to save new header)
dol_syslog("We regenerate the tpl page filetpl=".$filetpl);
dol_syslog("dolSavePageContent We regenerate the tpl page filetpl=".$filetpl);
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
if ($backupold) {
dol_delete_file($filetpl.'.old');
$result = dol_move($filetpl, $filetpl.'.old', 0, 1, 0, 0);
if (! $result) {
return false;
if (dol_is_file($filetpl)) {
if ($backupold) {
dol_delete_file($filetpl.'.old');
$result = dol_move($filetpl, $filetpl.'.old', 0, 1, 0, 0);
if (! $result) {
return false;
}
} else {
dol_delete_file($filetpl);
}
} else {
dol_delete_file($filetpl);
}
$shortlangcode = '';

Some files were not shown because too many files have changed in this diff Show More