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

develop
This commit is contained in:
Laurent Destailleur
2022-11-16 20:35:29 +01:00
19 changed files with 230 additions and 189 deletions

View File

@@ -621,7 +621,6 @@ if ($nboftargetok) {
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nnnick/chartjs/scripts`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nnnick/chartjs/src`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nnnick/chartjs/test`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nusoap/lib/Mail`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nusoap/samples`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/php-iban/docs`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/sabre/sabre/*/tests`;

View File

@@ -347,6 +347,10 @@ 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);

View File

@@ -113,6 +113,9 @@ $outputdir = $conf->admin->dir_output.'/backup';
$result = dol_mkdir($outputdir);
$lowmemorydump = GETPOSTISSET("lowmemorydump") ? GETPOST("lowmemorydump") : getDolGlobalString('MAIN_LOW_MEMORY_DUMP');
// MYSQL
if ($what == 'mysql') {
$cmddump = GETPOST("mysqldump", 'none'); // Do not sanitize here with 'alpha', will be sanitize later by dol_sanitizePathName and escapeshellarg
@@ -132,7 +135,7 @@ if ($what == 'mysql') {
}
if (!$errormsg) {
$utils->dumpDatabase(GETPOST('compression', 'alpha'), $what, 0, $file);
$utils->dumpDatabase(GETPOST('compression', 'alpha'), $what, 0, $file, 0, 0, $lowmemorydump);
$errormsg = $utils->error;
$_SESSION["commandbackuplastdone"] = $utils->result['commandbackuplastdone'];
$_SESSION["commandbackuptorun"] = $utils->result['commandbackuptorun'];
@@ -141,7 +144,7 @@ if ($what == 'mysql') {
// MYSQL NO BIN
if ($what == 'mysqlnobin') {
$utils->dumpDatabase(GETPOST('compression', 'alpha'), $what, 0, $file);
$utils->dumpDatabase(GETPOST('compression', 'alpha'), $what, 0, $file, 0, 0, $lowmemorydump);
$errormsg = $utils->error;
$_SESSION["commandbackuplastdone"] = $utils->result['commandbackuplastdone'];
@@ -170,7 +173,7 @@ if ($what == 'postgresql') {
}
if (!$errormsg) {
$utils->dumpDatabase(GETPOST('compression', 'alpha'), $what, 0, $file);
$utils->dumpDatabase(GETPOST('compression', 'alpha'), $what, 0, $file, 0, 0, $lowmemorydump);
$errormsg = $utils->error;
$_SESSION["commandbackuplastdone"] = $utils->result['commandbackuplastdone'];
$_SESSION["commandbackuptorun"] = $utils->result['commandbackuptorun'];

View File

@@ -522,9 +522,10 @@ if (empty($reshook)) {
exit;
}
$mesgs[] = $object->error;
$mesgs = array_merge($mesgs, $object->errors);
}
setEventMessages(null, $mesgs, 'errors');
setEventMessages('', $mesgs, 'errors');
$action = "create";
}
@@ -609,9 +610,10 @@ if (empty($reshook)) {
exit;
}
$mesgs[] = $object->error;
$mesgs = array_merge($mesgs, $object->errors);
}
setEventMessages($mesg, $mesgs, 'errors');
setEventMessages('', $mesgs, 'errors');
$action = "edit";
} else {
$action = "edit";

View File

@@ -99,8 +99,7 @@ class box_commandes extends ModeleBoxes
$sql .= ", c.total_ht";
$sql .= ", c.total_tva";
$sql .= ", c.total_ttc";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql .= ", ".MAIN_DB_PREFIX."commande as c";
$sql .= " FROM ".MAIN_DB_PREFIX."commande as c, ".MAIN_DB_PREFIX."societe as s";
if (empty($user->rights->societe->client->voir) && !$user->socid) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}

View File

@@ -99,11 +99,10 @@ class box_factures extends ModeleBoxes
$sql .= ", s.code_client, s.code_compta, s.client";
$sql .= ", s.logo, s.email, s.entity";
$sql .= ", s.tva_intra, s.siren as idprof1, s.siret as idprof2, s.ape as idprof3, s.idprof4, s.idprof5, s.idprof6";
$sql .= " FROM (".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f";
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."societe as s";
if (empty($user->rights->societe->client->voir) && !$user->socid) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}
$sql .= ")";
$sql .= " WHERE f.fk_soc = s.rowid";
$sql .= " AND f.entity IN (".getEntity('invoice').")";
if (empty($user->rights->societe->client->voir) && !$user->socid) {

View File

@@ -88,8 +88,7 @@ class box_propales extends ModeleBoxes
$sql .= ", s.code_client, s.code_compta, s.client";
$sql .= ", s.logo, s.email, s.entity";
$sql .= ", p.rowid, p.ref, p.fk_statut as status, p.datep as dp, p.datec, p.fin_validite, p.date_cloture, p.total_ht, p.total_tva, p.total_ttc, p.tms";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
$sql .= ", ".MAIN_DB_PREFIX."propal as p";
$sql .= " FROM ".MAIN_DB_PREFIX."propal as p, ".MAIN_DB_PREFIX."societe as s";
if (empty($user->rights->societe->client->voir) && !$user->socid) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
}

View File

@@ -203,9 +203,10 @@ class Utils
* @param string $file 'auto' or filename to build
* @param int $keeplastnfiles Keep only last n files (not used yet)
* @param int $execmethod 0=Use default method (that is 1 by default), 1=Use the PHP 'exec' - need size of dump in memory, but low memory method is used if GETPOST('lowmemorydump') is set, 2=Use the 'popen' method (low memory method)
* @param int $lowmemorydump 1=Use the low memory method. If $lowmemorydump is set, it means we want to make the compression using an external pipe instead retreiving the content of the dump in PHP memory array $output_arr and then print it into the PHP pipe open with xopen().
* @return int 0 if OK, < 0 if KO (this function is used also by cron so only 0 is OK)
*/
public function dumpDatabase($compression = 'none', $type = 'auto', $usedefault = 1, $file = 'auto', $keeplastnfiles = 0, $execmethod = 0)
public function dumpDatabase($compression = 'none', $type = 'auto', $usedefault = 1, $file = 'auto', $keeplastnfiles = 0, $execmethod = 0, $lowmemorydump = 0)
{
global $db, $conf, $langs, $dolibarr_main_data_root;
global $dolibarr_main_db_name, $dolibarr_main_db_host, $dolibarr_main_db_user, $dolibarr_main_db_port, $dolibarr_main_db_pass;
@@ -358,10 +359,6 @@ class Utils
$handle = '';
// If $lowmemorydump is set, it means we want to make the compression using an external pipe instead retreiving the
// content of the dump in PHP memory array $output_arr and then print it into the PHP pipe open with xopen().
$lowmemorydump = GETPOSTISSET("lowmemorydump") ? GETPOST("lowmemorydump") : getDolGlobalString('MAIN_LOW_MEMORY_DUMP');
// Start call method to execute dump
$fullcommandcrypted = $command." ".$paramcrypted." 2>&1";
$fullcommandclear = $command." ".$paramclear." 2>&1";
@@ -377,23 +374,23 @@ class Utils
}
} else {
if ($compression == 'none') {
$fullcommandclear .= ' > "'.dol_sanitizePathName($outputfile).'"';
$fullcommandcrypted .= ' > "'.dol_sanitizePathName($outputfile).'"';
$fullcommandclear .= ' | grep -v "Warning: Using a password on the command line interface can be insecure." > "'.dol_sanitizePathName($outputfile).'"';
$fullcommandcrypted .= ' | grep -v "Warning: Using a password on the command line interface can be insecure." > "'.dol_sanitizePathName($outputfile).'"';
$handle = 1;
} elseif ($compression == 'gz') {
$fullcommandclear .= ' | gzip > "'.dol_sanitizePathName($outputfile).'"';
$fullcommandcrypted .= ' | gzip > "'.dol_sanitizePathName($outputfile).'"';
$paramcrypted .= ' | gzip';
$fullcommandclear .= ' | grep -v "Warning: Using a password on the command line interface can be insecure." | gzip > "'.dol_sanitizePathName($outputfile).'"';
$fullcommandcrypted .= ' | grep -v "Warning: Using a password on the command line interface can be insecure." | gzip > "'.dol_sanitizePathName($outputfile).'"';
$paramcrypted .= ' | grep -v "Warning: Using a password on the command line interface can be insecure." | gzip';
$handle = 1;
} elseif ($compression == 'bz') {
$fullcommandclear .= ' | bzip2 > "'.dol_sanitizePathName($outputfile).'"';
$fullcommandcrypted .= ' | bzip2 > "'.dol_sanitizePathName($outputfile).'"';
$paramcrypted .= ' | bzip2';
$fullcommandclear .= ' | grep -v "Warning: Using a password on the command line interface can be insecure." | bzip2 > "'.dol_sanitizePathName($outputfile).'"';
$fullcommandcrypted .= ' | grep -v "Warning: Using a password on the command line interface can be insecure." | bzip2 > "'.dol_sanitizePathName($outputfile).'"';
$paramcrypted .= ' | grep -v "Warning: Using a password on the command line interface can be insecure." | bzip2';
$handle = 1;
} elseif ($compression == 'zstd') {
$fullcommandclear .= ' | zstd > "'.dol_sanitizePathName($outputfile).'"';
$fullcommandcrypted .= ' | zstd > "'.dol_sanitizePathName($outputfile).'"';
$paramcrypted .= ' | zstd';
$fullcommandclear .= ' | grep -v "Warning: Using a password on the command line interface can be insecure." | zstd > "'.dol_sanitizePathName($outputfile).'"';
$fullcommandcrypted .= ' | grep -v "Warning: Using a password on the command line interface can be insecure." | zstd > "'.dol_sanitizePathName($outputfile).'"';
$paramcrypted .= ' | grep -v "Warning: Using a password on the command line interface can be insecure." | zstd';
$handle = 1;
}
}

View File

@@ -183,7 +183,7 @@ class modBlockedLog extends DolibarrModules
$result = $b->setObjectData($object, 'MODULE_SET', 0);
if ($result < 0) {
$this->error = $b->error;
$this->errors = $b->erros;
$this->errors = $b->errors;
return 0;
}
@@ -226,7 +226,7 @@ class modBlockedLog extends DolibarrModules
$result = $b->setObjectData($object, 'MODULE_RESET', 0);
if ($result < 0) {
$this->error = $b->error;
$this->errors = $b->erros;
$this->errors = $b->errors;
return 0;
}

View File

@@ -99,7 +99,7 @@ class modCron extends DolibarrModules
// Cronjobs
$this->cronjobs = array(
0=>array('entity'=>0, 'label'=>'PurgeDeleteTemporaryFilesShort', 'jobtype'=>'method', 'class'=>'core/class/utils.class.php', 'objectname'=>'Utils', 'method'=>'purgeFiles', 'parameters'=>'tempfilesold+logfiles', 'comment'=>'PurgeDeleteTemporaryFiles', 'frequency'=>2, 'unitfrequency'=>3600 * 24 * 7, 'priority'=>50, 'status'=>1, 'test'=>true),
1=>array('entity'=>0, 'label'=>'MakeLocalDatabaseDumpShort', 'jobtype'=>'method', 'class'=>'core/class/utils.class.php', 'objectname'=>'Utils', 'method'=>'dumpDatabase', 'parameters'=>'none,auto,1,auto,10', 'comment'=>'MakeLocalDatabaseDump', 'frequency'=>1, 'unitfrequency'=>3600 * 24 * 7, 'priority'=>90, 'status'=>0, 'test'=>'in_array($conf->db->type, array(\'mysql\', \'mysqli\'))'),
1=>array('entity'=>0, 'label'=>'MakeLocalDatabaseDumpShort', 'jobtype'=>'method', 'class'=>'core/class/utils.class.php', 'objectname'=>'Utils', 'method'=>'dumpDatabase', 'parameters'=>'none,auto,1,auto,10,0,0', 'comment'=>'MakeLocalDatabaseDump', 'frequency'=>1, 'unitfrequency'=>3600 * 24 * 7, 'priority'=>90, 'status'=>0, 'test'=>'in_array($conf->db->type, array(\'mysql\', \'mysqli\'))'),
2=>array('entity'=>0, 'label'=>'MakeSendLocalDatabaseDumpShort', 'jobtype'=>'method', 'class'=>'core/class/utils.class.php', 'objectname'=>'Utils', 'method'=>'sendBackup', 'parameters'=>',,,,,sql', 'comment'=>'MakeSendLocalDatabaseDump', 'frequency'=>1, 'unitfrequency'=>604800, 'priority'=>91, 'status'=>0, 'test'=>'!empty($conf->global->MAIN_ALLOW_BACKUP_BY_EMAIL) && in_array($conf->db->type, array(\'mysql\', \'mysqli\'))'),
3=>array('entity'=>0, 'label'=>'CleanUnfinishedCronjobShort', 'jobtype'=>'method', 'class'=>'core/class/utils.class.php', 'objectname'=>'Utils', 'method'=>'cleanUnfinishedCronjob', 'parameters'=>'', 'comment'=>'CleanUnfinishedCronjob', 'frequency'=>5, 'unitfrequency'=>60, 'priority'=>10, 'status'=>0, 'test'=>'getDolGlobalInt("MAIN_FEATURES_LEVEL") >= 2'),
// 1=>array('entity'=>0, 'label'=>'My label', 'jobtype'=>'command', 'command'=>'', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>1, 'unitfrequency'=>3600*24)

View File

@@ -5,7 +5,7 @@
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2017 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2014-2017 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018-2022 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2020-2021 Udo Tamm <dev@dolibit.de>
* Copyright (C) 2022 Anthony Berton <anthony.berton@bb2a.fr>
*
@@ -261,6 +261,12 @@ if (empty($reshook)) {
$error++;
}
// Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost(null, $object);
if ($ret < 0) {
$error++;
}
$result = 0;
if (!$error) {

View File

@@ -3,7 +3,7 @@
* Copyright (C) 2013-2020 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012-2016 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2018 Charlene Benke <charlie@patas-monkey.com>
* Copyright (C) 2019-2021 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2019-2022 Frédéric France <frederic.france@netlogic.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -923,6 +923,8 @@ if ($resql) {
}
}
}
// status
print '<td></td>';
print '</tr>';
}
}

View File

@@ -1,10 +0,0 @@
/*
Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/
(function(a){if("undefined"==typeof a)throw Error("jQuery should be loaded before CKEditor jQuery adapter.");if("undefined"==typeof CKEDITOR)throw Error("CKEditor should be loaded before CKEditor jQuery adapter.");CKEDITOR.config.jqueryOverrideVal="undefined"==typeof CKEDITOR.config.jqueryOverrideVal?!0:CKEDITOR.config.jqueryOverrideVal;a.extend(a.fn,{ckeditorGet:function(){var a=this.eq(0).data("ckeditorInstance");if(!a)throw"CKEditor is not initialized yet, use ckeditor() with a callback.";return a},
ckeditor:function(g,e){if(!CKEDITOR.env.isCompatible)throw Error("The environment is incompatible.");if("function"!==typeof g){var m=e;e=g;g=m}var k=[];e=e||{};this.each(function(){var b=a(this),c=b.data("ckeditorInstance"),f=b.data("_ckeditorInstanceLock"),h=this,l=new a.Deferred;k.push(l.promise());if(c&&!f)g&&g.apply(c,[this]),l.resolve();else if(f)c.once("instanceReady",function(){setTimeout(function d(){c.element?(c.element.$==h&&g&&g.apply(c,[h]),l.resolve()):setTimeout(d,100)},0)},null,null,
9999);else{if(e.autoUpdateElement||"undefined"==typeof e.autoUpdateElement&&CKEDITOR.config.autoUpdateElement)e.autoUpdateElementJquery=!0;e.autoUpdateElement=!1;b.data("_ckeditorInstanceLock",!0);c=a(this).is("textarea")?CKEDITOR.replace(h,e):CKEDITOR.inline(h,e);b.data("ckeditorInstance",c);c.on("instanceReady",function(e){var d=e.editor;setTimeout(function n(){if(d.element){e.removeListener();d.on("dataReady",function(){b.trigger("dataReady.ckeditor",[d])});d.on("setData",function(a){b.trigger("setData.ckeditor",
[d,a.data])});d.on("getData",function(a){b.trigger("getData.ckeditor",[d,a.data])},999);d.on("destroy",function(){b.trigger("destroy.ckeditor",[d])});d.on("save",function(){a(h.form).trigger("submit");return!1},null,null,20);if(d.config.autoUpdateElementJquery&&b.is("textarea")&&a(h.form).length){var c=function(){b.ckeditor(function(){d.updateElement()})};a(h.form).on("submit",c);a(h.form).on("form-pre-serialize",c);b.on("destroy.ckeditor",function(){a(h.form).off("submit",c);a(h.form).off("form-pre-serialize",
c)})}d.on("destroy",function(){b.removeData("ckeditorInstance")});b.removeData("_ckeditorInstanceLock");b.trigger("instanceReady.ckeditor",[d]);g&&g.apply(d,[h]);l.resolve()}else setTimeout(n,100)},0)},null,null,9999)}});var f=new a.Deferred;this.promise=f.promise();a.when.apply(this,k).then(function(){f.resolve()});this.editor=this.eq(0).data("ckeditorInstance");return this}});CKEDITOR.config.jqueryOverrideVal&&(a.fn.val=CKEDITOR.tools.override(a.fn.val,function(g){return function(e){if(arguments.length){var m=
this,k=[],f=this.each(function(){var b=a(this),c=b.data("ckeditorInstance");if(b.is("textarea")&&c){var f=new a.Deferred;c.setData(e,function(){f.resolve()});k.push(f.promise());return!0}return g.call(b,e)});if(k.length){var b=new a.Deferred;a.when.apply(this,k).done(function(){b.resolveWith(m)});return b.promise()}return f}var f=a(this).eq(0),c=f.data("ckeditorInstance");return f.is("textarea")&&c?c.getData():g.call(f)}}))})(window.jQuery);

View File

@@ -731,7 +731,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
// Show links to link elements
$linktoelem = $form->showLinkToObjectBlock($object, null, array('mo'));
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem, false, 'MOChild');
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem, false);
print '</div><div class="fichehalfright">';

View File

@@ -39,48 +39,79 @@ $langs->load("bom");
$total = 0;
$ilink = 0;
$mo_static = new Mo($db);
$res = $mo_static->fetch($object->id);
$TMoChilds = $mo_static->getMoChilds();
$hookmanager->initHooks('LinesLinkedObjectBlock');
$parameters = array('TMoChilds' => $TMoChilds);
$reshook = $hookmanager->executeHooks('LinesLinkedObjectBlock', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if (empty($reshook)) {
foreach ($TMoChilds as $key => $objectlink) {
if ($object->element == 'mo') {
$mo_static = new Mo($db);
$res = $mo_static->fetch($object->id);
$TMoChilds = $mo_static->getMoChilds();
$hookmanager->initHooks('LinesLinkedObjectBlock');
$parameters = array('TMoChilds' => $TMoChilds);
$reshook = $hookmanager->executeHooks('LinesLinkedObjectBlock', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if (empty($reshook)) {
foreach ($TMoChilds as $key => $objectlink) {
$ilink++;
$trclass = 'oddeven';
echo '<tr class="' . $trclass . '" >';
echo '<td class="linkedcol-element" >' . $langs->trans("ManufacturingOrder");
if (!empty($showImportButton) && $conf->global->MAIN_ENABLE_IMPORT_LINKED_OBJECT_LINES) {
print '<a class="objectlinked_importbtn" href="' . $objectlink->getNomUrl(0, '', 0, 1) . '&amp;action=selectlines" data-element="' . $objectlink->element . '" data-id="' . $objectlink->id . '" > <i class="fa fa-indent"></i> </a';
}
echo '</td>';
echo '<td class="linkedcol-name nowraponall" >' . $objectlink->getNomUrl(1) . '</td>';
echo '<td class="linkedcol-ref" align="center">';
// $result = $product_static->fetch($objectlink->fk_product);
print '</td>';
echo '<td class="linkedcol-date" align="center">' . dol_print_date($objectlink->date_creation, 'day') . '</td>';
echo '<td class="linkedcol-amount right">-</td>';
echo '<td class="linkedcol-statut right">' . $objectlink->getLibStatut(3) . '</td>';
echo '<td class="linkedcol-action right">';
// we want to make the link via element_element for delete action
$sql = " Select rowid from " . MAIN_DB_PREFIX . "element_element";
$sql .= " WHERE fk_source = " . (int) $object->id . " and fk_target = '" . dol_escape_htmltag($key) . "'";
$resql = $db->query($sql);
$k = 0;
if ($resql) {
$obj = $db->fetch_object($resql);
if ($obj->rowid && $obj->rowid > 0) $k = $obj->rowid;
}
echo '<a class="reposition" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=dellink&token=' . newToken() . '&dellinkid=' . $k . '">' . img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink') . '</a>';
echo '</td>';
echo "</tr>\n";
}
}
} else {
$linkedObjectBlock = dol_sort_array($linkedObjectBlock, 'date', 'desc', 0, 0, 1);
$total = 0;
$ilink = 0;
foreach ($linkedObjectBlock as $key => $objectlink) {
$ilink++;
$trclass = 'oddeven';
echo '<tr class="' . $trclass . '" >';
echo '<td class="linkedcol-element" >' . $langs->trans("ManufacturingOrder");
if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) {
$trclass .= ' liste_sub_total';
}
print '<tr class="'.$trclass.'" data-element="'.$objectlink->element.'" data-id="'.$objectlink->id.'" >';
print '<td class="linkedcol-element" >'.$langs->trans("ManufacturingOrder");
if (!empty($showImportButton) && $conf->global->MAIN_ENABLE_IMPORT_LINKED_OBJECT_LINES) {
print '<a class="objectlinked_importbtn" href="' . $objectlink->getNomUrl(0, '', 0, 1) . '&amp;action=selectlines" data-element="' . $objectlink->element . '" data-id="' . $objectlink->id . '" > <i class="fa fa-indent"></i> </a';
$url = DOL_URL_ROOT.'/mrp/mo_card.php?id='.$objectlink->id;
print '<a class="objectlinked_importbtn" href="'.$url.'&amp;action=selectlines" data-element="'.$objectlink->element.'" data-id="'.$objectlink->id.'" > <i class="fa fa-indent"></i> </a>';
}
echo '</td>';
echo '<td class="linkedcol-name nowraponall">'.$objectlink->getNomUrl(1).'</td>';
echo '<td class="linkedcol-ref" align="center">';
// $result = $product_static->fetch($objectlink->fk_product);
print '</td>';
echo '<td class="linkedcol-date" align="center">' . dol_print_date($objectlink->date_creation, 'day') . '</td>';
echo '<td class="linkedcol-amount right">-</td>';
echo '<td class="linkedcol-statut right">' . $objectlink->getLibStatut(3) . '</td>';
echo '<td class="linkedcol-action right">';
// we want to make the link via element_element for delete action
$sql = " Select rowid from " . MAIN_DB_PREFIX . "element_element";
$sql .= " WHERE fk_source = ". (int) $object->id . " and fk_target = '" . dol_escape_htmltag($key) ."'";
$resql = $db->query($sql);
$k = 0;
if ($resql) {
$obj = $db->fetch_object($resql);
if ($obj->rowid && $obj->rowid > 0 ) $k = $obj->rowid;
}
echo '<a class="reposition" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=dellink&token=' . newToken() . '&dellinkid=' . $k . '">' . img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink') . '</a>';
echo '</td>';
echo "</tr>\n";
print '<td class="linkedcol-name nowraponall" >'.$objectlink->getNomUrl(1).'</td>';
print '<td class="linkedcol-ref" >'.$objectlink->ref_client.'</td>';
print '<td class="linkedcol-date center">'.dol_print_date($objectlink->date_start_planned, 'day').'</td>';
print '<td class="linkedcol-amount right">-</td>';
print '<td class="linkedcol-statut right">'.$objectlink->getLibStatut(3).'</td>';
print '<td class="linkedcol-action right"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=dellink&token='.newToken().'&dellinkid='.$key.'">'.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').'</a></td>';
print "</tr>\n";
}
}
echo "<!-- END PHP TEMPLATE -->\n";

View File

@@ -1217,9 +1217,9 @@ if (!empty($conf->global->PRODUIT_MULTIPRICES) || !empty($conf->global->PRODUIT_
if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) { // TODO Fix the form inside tr instead of td
print '<tr><td>'.$langs->trans("PriceByQuantity");
if ($object->prices_by_qty[0] == 0) {
print '&nbsp; <a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=activate_price_by_qty&level=1">('.$langs->trans("Activate").')';
print '&nbsp; <a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=activate_price_by_qty&level=1&token='.newToken().'">('.$langs->trans("Activate").')';
} else {
print '&nbsp; <a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=disable_price_by_qty&level=1">('.$langs->trans("DisablePriceByQty").')';
print '&nbsp; <a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=disable_price_by_qty&level=1&token='.newToken().'">('.$langs->trans("DisablePriceByQty").')';
}
print '</td><td>';

View File

@@ -147,7 +147,7 @@ $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $obje
$sql .= $hookmanager->resPrint;
$sql .= ' FROM '.MAIN_DB_PREFIX.'product as p';
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_stock as s ON p.rowid = s.fk_product';
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'entrepot as e ON s.fk_entrepot = e.rowid AND e.entity IN ('.getEntity('entrepot').')';
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'entrepot as e ON s.fk_entrepot = e.rowid AND e.entity IN ('.getEntity('stock').')';
if (!empty($conf->global->PRODUCT_USE_UNITS)) {
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_units as u on p.fk_unit = u.rowid';
}

View File

@@ -2203,7 +2203,7 @@ class Task extends CommonObjectLine
$sql .= " t.rowid as taskid, t.progress as progress, t.fk_statut as status,";
$sql .= " t.dateo as date_start, t.datee as datee";
$sql .= " FROM ".MAIN_DB_PREFIX."projet as p";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on p.fk_soc = s.rowid";
//$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on p.fk_soc = s.rowid";
//if (! $user->rights->societe->client->voir && ! $socid) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON sc.fk_soc = s.rowid";
$sql .= ", ".MAIN_DB_PREFIX."projet_task as t";
$sql .= " WHERE p.entity IN (".getEntity('project', 0).')';

View File

@@ -292,137 +292,146 @@ if (empty($reshook) && $action == 'add') {
$error++;
}
$result = $adh->create($user);
if ($result > 0) {
require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
$object = $adh;
if (!$error) {
$result = $adh->create($user);
if ($result > 0) {
require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
$object = $adh;
$adht = new AdherentType($db);
$adht->fetch($object->typeid);
$adht = new AdherentType($db);
$adht->fetch($object->typeid);
if ($object->email) {
$subject = '';
$msg = '';
if ($object->email) {
$subject = '';
$msg = '';
// Send subscription email
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
$formmail = new FormMail($db);
// Set output language
$outputlangs = new Translate('', $conf);
$outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang);
// Load traductions files required by page
$outputlangs->loadLangs(array("main", "members"));
// Get email content from template
$arraydefaultmessage = null;
$labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_AUTOREGISTER;
// Send subscription email
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
$formmail = new FormMail($db);
// Set output language
$outputlangs = new Translate('', $conf);
$outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang);
// Load traductions files required by page
$outputlangs->loadLangs(array("main", "members"));
// Get email content from template
$arraydefaultmessage = null;
$labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_AUTOREGISTER;
if (!empty($labeltouse)) {
$arraydefaultmessage = $formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse);
if (!empty($labeltouse)) {
$arraydefaultmessage = $formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse);
}
if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
$subject = $arraydefaultmessage->topic;
$msg = $arraydefaultmessage->content;
}
$substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object);
complete_substitutions_array($substitutionarray, $outputlangs, $object);
$subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs);
$texttosend = make_substitutions(dol_concatdesc($msg, $adht->getMailOnValid()), $substitutionarray, $outputlangs);
if ($subjecttosend && $texttosend) {
$moreinheader = 'X-Dolibarr-Info: send_an_email by public/members/new.php'."\r\n";
$result = $object->send_an_email($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, -1, '', $moreinheader);
}
/*if ($result < 0) {
$error++;
setEventMessages($object->error, $object->errors, 'errors');
}*/
}
if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
$subject = $arraydefaultmessage->topic;
$msg = $arraydefaultmessage->content;
}
$substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object);
complete_substitutions_array($substitutionarray, $outputlangs, $object);
$subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs);
$texttosend = make_substitutions(dol_concatdesc($msg, $adht->getMailOnValid()), $substitutionarray, $outputlangs);
if ($subjecttosend && $texttosend) {
$moreinheader = 'X-Dolibarr-Info: send_an_email by public/members/new.php'."\r\n";
$result = $object->send_an_email($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, -1, '', $moreinheader);
}
/*if ($result < 0) {
$error++;
setEventMessages($object->error, $object->errors, 'errors');
}*/
}
// Send email to the foundation to say a new member subscribed with autosubscribe form
if (!empty($conf->global->MAIN_INFO_SOCIETE_MAIL) && !empty($conf->global->ADHERENT_AUTOREGISTER_NOTIF_MAIL_SUBJECT) &&
!empty($conf->global->ADHERENT_AUTOREGISTER_NOTIF_MAIL)) {
// Define link to login card
$appli = constant('DOL_APPLICATION_TITLE');
if (!empty($conf->global->MAIN_APPLICATION_TITLE)) {
$appli = $conf->global->MAIN_APPLICATION_TITLE;
if (preg_match('/\d\.\d/', $appli)) {
if (!preg_match('/'.preg_quote(DOL_VERSION).'/', $appli)) {
$appli .= " (".DOL_VERSION.")"; // If new title contains a version that is different than core
// Send email to the foundation to say a new member subscribed with autosubscribe form
if (!empty($conf->global->MAIN_INFO_SOCIETE_MAIL) && !empty($conf->global->ADHERENT_AUTOREGISTER_NOTIF_MAIL_SUBJECT) &&
!empty($conf->global->ADHERENT_AUTOREGISTER_NOTIF_MAIL)) {
// Define link to login card
$appli = constant('DOL_APPLICATION_TITLE');
if (!empty($conf->global->MAIN_APPLICATION_TITLE)) {
$appli = $conf->global->MAIN_APPLICATION_TITLE;
if (preg_match('/\d\.\d/', $appli)) {
if (!preg_match('/'.preg_quote(DOL_VERSION).'/', $appli)) {
$appli .= " (".DOL_VERSION.")"; // If new title contains a version that is different than core
}
} else {
$appli .= " ".DOL_VERSION;
}
} else {
$appli .= " ".DOL_VERSION;
}
$to = $adh->makeSubstitution($conf->global->MAIN_INFO_SOCIETE_MAIL);
$from = $conf->global->ADHERENT_MAIL_FROM;
$mailfile = new CMailFile(
'['.$appli.'] '.$conf->global->ADHERENT_AUTOREGISTER_NOTIF_MAIL_SUBJECT,
$to,
$from,
$adh->makeSubstitution($conf->global->ADHERENT_AUTOREGISTER_NOTIF_MAIL),
array(),
array(),
array(),
"",
"",
0,
-1
);
if (!$mailfile->sendfile()) {
dol_syslog($langs->trans("ErrorFailedToSendMail", $from, $to), LOG_ERR);
}
}
// Auto-create thirdparty on member creation
if (!empty($conf->global->ADHERENT_DEFAULT_CREATE_THIRDPARTY)) {
$company = new Societe($db);
$result = $company->create_from_member($adh);
if ($result < 0) {
$error++;
$errmsg .= join('<br>', $company->errors);
}
}
if (!empty($backtopage)) {
$urlback = $backtopage;
} elseif (!empty($conf->global->MEMBER_URL_REDIRECT_SUBSCRIPTION)) {
$urlback = $conf->global->MEMBER_URL_REDIRECT_SUBSCRIPTION;
// TODO Make replacement of __AMOUNT__, etc...
} else {
$appli .= " ".DOL_VERSION;
$urlback = $_SERVER["PHP_SELF"]."?action=added&token=".newToken();
}
$to = $adh->makeSubstitution($conf->global->MAIN_INFO_SOCIETE_MAIL);
$from = $conf->global->ADHERENT_MAIL_FROM;
$mailfile = new CMailFile(
'['.$appli.'] '.$conf->global->ADHERENT_AUTOREGISTER_NOTIF_MAIL_SUBJECT,
$to,
$from,
$adh->makeSubstitution($conf->global->ADHERENT_AUTOREGISTER_NOTIF_MAIL),
array(),
array(),
array(),
"",
"",
0,
-1
);
if (!empty($conf->global->MEMBER_NEWFORM_PAYONLINE) && $conf->global->MEMBER_NEWFORM_PAYONLINE != '-1') {
if (empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT)) { // If edition of amount not allowed
// TODO Check amount is same than the amount required for the type of member or if not defined as the defeault amount into $conf->global->MEMBER_NEWFORM_AMOUNT
// It is not so important because a test is done on return of payment validation.
}
if (!$mailfile->sendfile()) {
dol_syslog($langs->trans("ErrorFailedToSendMail", $from, $to), LOG_ERR);
}
}
$urlback = getOnlinePaymentUrl(0, 'member', $adh->ref, price2num(GETPOST('amount', 'alpha'), 'MT'), '', 0);
// Auto-create thirdparty on member creation
if (!empty($conf->global->ADHERENT_DEFAULT_CREATE_THIRDPARTY)) {
$company = new Societe($db);
$result = $company->create_from_member($adh);
if ($result < 0) {
$error++;
$errmsg .= join('<br>', $company->errors);
if (GETPOST('email')) {
$urlback .= '&email='.urlencode(GETPOST('email'));
}
if ($conf->global->MEMBER_NEWFORM_PAYONLINE != '-1' && $conf->global->MEMBER_NEWFORM_PAYONLINE != 'all') {
$urlback .= '&paymentmethod='.urlencode($conf->global->MEMBER_NEWFORM_PAYONLINE);
}
} else {
if (!empty($entity)) {
$urlback .= '&entity='.((int) $entity);
}
}
}
if (!empty($backtopage)) {
$urlback = $backtopage;
dol_syslog("member ".$adh->ref." was created, we redirect to ".$urlback);
} elseif (!empty($conf->global->MEMBER_URL_REDIRECT_SUBSCRIPTION)) {
$urlback = $conf->global->MEMBER_URL_REDIRECT_SUBSCRIPTION;
// TODO Make replacement of __AMOUNT__, etc...
dol_syslog("member ".$adh->ref." was created, we redirect to ".$urlback);
} else {
$urlback = $_SERVER["PHP_SELF"]."?action=added&token=".newToken();
$error++;
$errmsg .= join('<br>', $adh->errors);
}
if (!empty($conf->global->MEMBER_NEWFORM_PAYONLINE) && $conf->global->MEMBER_NEWFORM_PAYONLINE != '-1') {
if (empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT)) { // If edition of amount not allowed
// TODO Check amount is same than the amount required for the type of member or if not defined as the defeault amount into $conf->global->MEMBER_NEWFORM_AMOUNT
// It is not so important because a test is done on return of payment validation.
}
$urlback = getOnlinePaymentUrl(0, 'member', $adh->ref, price2num(GETPOST('amount', 'alpha'), 'MT'), '', 0);
if (GETPOST('email')) {
$urlback .= '&email='.urlencode(GETPOST('email'));
}
if ($conf->global->MEMBER_NEWFORM_PAYONLINE != '-1' && $conf->global->MEMBER_NEWFORM_PAYONLINE != 'all') {
$urlback .= '&paymentmethod='.urlencode($conf->global->MEMBER_NEWFORM_PAYONLINE);
}
} else {
if (!empty($entity)) {
$urlback .= '&entity='.((int) $entity);
}
}
dol_syslog("member ".$adh->ref." was created, we redirect to ".$urlback);
} else {
$error++;
$errmsg .= join('<br>', $adh->errors);
}
}
@@ -484,6 +493,7 @@ if (!empty($conf->global->MEMBER_NEWFORM_TEXT)) {
print '</div>';
dol_htmloutput_errors($errmsg);
dol_htmloutput_events();
// Print form
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST" name="newmember">'."\n";