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

develop
This commit is contained in:
Laurent Destailleur 2021-12-01 12:10:14 +01:00
commit 259418d1dd
141 changed files with 370 additions and 252 deletions

View File

@ -142,7 +142,7 @@ $linkback = '';
print load_fiche_titre($langs->trans('ExportOptions'), $linkback, 'accountancy'); 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 'jQuery(document).ready(function () {'."\n";
print ' function initfields()'."\n"; print ' function initfields()'."\n";
print ' {'."\n"; print ' {'."\n";

View File

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

View File

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

View File

@ -24,6 +24,7 @@
* \ingroup Accountancy (Double entries) * \ingroup Accountancy (Double entries)
* \brief List operation of book keeping * \brief List operation of book keeping
*/ */
require '../../main.inc.php'; require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancyexport.class.php'; require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancyexport.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.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; $filter['t.numero_compte<='] = $search_accountancy_code_end;
$param .= '&search_accountancy_code_end='.urlencode($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)) { if (!empty($search_accountancy_aux_code_start)) {
$filter['t.subledger_account>='] = $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); $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)."'"; $sqlwhere[] = $key."='".$db->idate($value)."'";
} elseif ($key == 't.doc_date>=' || $key == 't.doc_date<=') { } elseif ($key == 't.doc_date>=' || $key == 't.doc_date<=') {
$sqlwhere[] = $key."'".$db->idate($value)."'"; $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)."'"; $sqlwhere[] = $key."'".$db->escape($value)."'";
} elseif ($key == 't.fk_doc' || $key == 't.fk_docdet' || $key == 't.piece_num') { } elseif ($key == 't.fk_doc' || $key == 't.fk_docdet' || $key == 't.piece_num') {
$sqlwhere[] = $key.'='.((int) $value); $sqlwhere[] = $key.'='.((int) $value);
} elseif ($key == 't.numero_compte') { } elseif ($key == 't.subledger_account' || $key == 't.numero_compte') {
$sqlwhere[] = $key." LIKE '".$db->escape($value)."%'"; $sqlwhere[] = $key." LIKE '".$db->escape($value)."%'";
} elseif ($key == 't.subledger_account') { } elseif ($key == 't.subledger_account') {
$sqlwhere[] = natural_search($key, $value, 0, 1); $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 // 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(document).ready(function() {
jQuery(".codeventil").change(function() { jQuery(".codeventil").change(function() {
var s=$(this).attr("id").replace("codeventil", "") 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 // 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(document).ready(function() {
jQuery(".codeventil").change(function() { jQuery(".codeventil").change(function() {
var s=$(this).attr("id").replace("codeventil", "") 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 .= ' '.$langs->trans("ShowTutorial");
$showtutorial .= '</a></div>'; $showtutorial .= '</a></div>';
$showtutorial .= '<script type="text/javascript" language="javascript"> $showtutorial .= '<script type="text/javascript">
jQuery(document).ready(function() { jQuery(document).ready(function() {
jQuery("#show_hide").click(function () { jQuery("#show_hide").click(function () {
jQuery( "#idfaq" ).toggle({ 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 // 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(document).ready(function() {
jQuery(".codeventil").change(function() { jQuery(".codeventil").change(function() {
var s=$(this).attr("id").replace("codeventil", "") 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'); print dol_get_fiche_head($head, 'website', $langs->trans("Members"), -1, 'user');
if ($conf->use_javascript_ajax) { if ($conf->use_javascript_ajax) {
print "\n".'<script type="text/javascript" language="javascript">'; print "\n".'<script type="text/javascript">';
print 'jQuery(document).ready(function () { print 'jQuery(document).ready(function () {
function initemail() function initemail()
{ {

View File

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

View File

@ -838,7 +838,7 @@ if ($rowid > 0) {
if ($conf->use_javascript_ajax) { if ($conf->use_javascript_ajax) {
//var_dump($bankdirect.'-'.$bankviainvoice.'-'.$invoiceonly.'-'.empty($conf->global->ADHERENT_BANK_USE)); //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 () { print '$(document).ready(function () {
$(".bankswitchclass, .bankswitchclass2").'.(($bankdirect || $bankviainvoice) ? 'show()' : 'hide()').'; $(".bankswitchclass, .bankswitchclass2").'.(($bankdirect || $bankviainvoice) ? 'show()' : 'hide()').';
$("#none, #invoiceonly").click(function() { $("#none, #invoiceonly").click(function() {

View File

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

View File

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

View File

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

View File

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

View File

@ -143,7 +143,7 @@ if (version_compare(phpversion(), '7.0', '>=')) {
if ($action == 'edit') { if ($action == 'edit') {
if ($conf->use_javascript_ajax) { if ($conf->use_javascript_ajax) {
print "\n".'<script type="text/javascript" language="javascript">'; print "\n".'<script type="text/javascript">';
print 'jQuery(document).ready(function () { print 'jQuery(document).ready(function () {
function initfields() 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)) { if (!empty($conf->ticket->enabled) && !empty($user->rights->ticket->read)) {
$elementList['ticket_send'] = img_picto('', 'ticket', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToTicket')); $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)) { if (!empty($conf->agenda->enabled)) {
$elementList['actioncomm_send'] = img_picto('', 'action', 'class="paddingright"').dol_escape_htmltag($langs->trans('MailToSendEventPush')); $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 ($action == 'edit') {
if ($conf->use_javascript_ajax) { if ($conf->use_javascript_ajax) {
print "\n".'<script type="text/javascript" language="javascript">'; print "\n".'<script type="text/javascript">';
print 'jQuery(document).ready(function () { print 'jQuery(document).ready(function () {
function initfields() function initfields()
{ {

View File

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

View File

@ -262,6 +262,11 @@ if ($ip) {
$text .= '<br><span class="opacitymedium">'.$langs->trans("LastActivationIP").':</span> '; $text .= '<br><span class="opacitymedium">'.$langs->trans("LastActivationIP").':</span> ';
$text .= $ip; $text .= $ip;
} }
$lastactivationversion = $tmp['lastactivationversion'];
if ($lastactivationversion) {
$text .= '<br><span class="opacitymedium">'.$langs->trans("LastActivationVersion").':</span> ';
$text .= $lastactivationversion;
}
$moreinfo = $text; $moreinfo = $text;

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); 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'); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup"); header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup");
@ -499,6 +506,22 @@ if ($conf->use_javascript_ajax) {
} }
print '</td></tr>'; 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 // Desc
print '<tr class="oddeven"><td>'.$langs->trans("HideDescOnPDF").'</td><td>'; 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>'; print '<br>';
if ($conf->use_javascript_ajax) { if ($conf->use_javascript_ajax) {
print "\n".'<script type="text/javascript" language="javascript">'; print "\n".'<script type="text/javascript">';
print 'jQuery(document).ready(function () { print 'jQuery(document).ready(function () {
function initfields() function initfields()
{ {

View File

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

View File

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

View File

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

View File

@ -54,7 +54,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) {
echo '</td>'; echo '</td>';
echo '<td class="linkedcol-name nowraponall" >'.$objectlink->getNomUrl(1).'</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); $result = $product_static->fetch($objectlink->fk_product);
if ($result < 0) { if ($result < 0) {
setEventMessage($product_static->error, 'errors'); setEventMessage($product_static->error, 'errors');
@ -62,7 +62,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) {
$product_static->getNomUrl(1); $product_static->getNomUrl(1);
} }
print '</td>'; 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">'; echo '<td class="linkedcol-amount right">';
if ($user->rights->commande->lire) { if ($user->rights->commande->lire) {
$total = $total + $objectlink->total_ht; $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("account", 1) // Categorie::TYPE_ACCOUNT is "bank_account" instead of "account"
: $categstatic->getObjectsInCateg($type, 1); : $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"'; $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("account", 1) // Categorie::TYPE_ACCOUNT is "bank_account" instead of "account"
: $categstatic->getObjectsInCateg($type, 1); : $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"'; $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 '<div class="hidden marginrightonly inline-block repeateventBYDAY">';
print $langs->trans("DayOfWeek").': <input type="input" size="4" name="BYDAY" value="'.$selectedrecurrulebyday.'">'; print $langs->trans("DayOfWeek").': <input type="input" size="4" name="BYDAY" value="'.$selectedrecurrulebyday.'">';
print '</div>'; print '</div>';
print '<script type="text/javascript" language="javascript"> print '<script type="text/javascript">
jQuery(document).ready(function() { jQuery(document).ready(function() {
function init_repeat() function init_repeat()
{ {
@ -1554,7 +1554,7 @@ if ($id > 0) {
print '<div class="hidden marginrightonly inline-block repeateventBYDAY">'; print '<div class="hidden marginrightonly inline-block repeateventBYDAY">';
print $langs->trans("DayOfWeek").': <input type="input" size="4" name="BYDAY" value="'.$selectedrecurrulebyday.'">'; print $langs->trans("DayOfWeek").': <input type="input" size="4" name="BYDAY" value="'.$selectedrecurrulebyday.'">';
print '</div>'; print '</div>';
print '<script type="text/javascript" language="javascript"> print '<script type="text/javascript">
jQuery(document).ready(function() { jQuery(document).ready(function() {
function init_repeat() function init_repeat()
{ {

View File

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

View File

@ -1050,7 +1050,7 @@ print "\n".'</form>';
print "\n"; print "\n";
// Add js code to manage click on a box // 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(document).ready(function() {
jQuery(".onclickopenref").click(function() { jQuery(".onclickopenref").click(function() {
var ref=$(this).attr(\'ref\'); 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 // 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 .= '<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(document).ready(function () {';
$out .= ' jQuery(".removedfile").click(function() {'; $out .= ' jQuery(".removedfile").click(function() {';
$out .= ' jQuery(".removedfilehidden").val(jQuery(this).val());'; $out .= ' jQuery(".removedfilehidden").val(jQuery(this).val());';

View File

@ -1442,7 +1442,7 @@ if (empty($reshook)) {
} }
// Actions to build doc // 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; $permissiontoadd = $usercancreate;
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
} }
@ -1584,6 +1584,7 @@ if ($action == 'create') {
// Third party // Third party
print '<tr>'; print '<tr>';
print '<td class="fieldrequired">'.$langs->trans('Customer').'</td>'; print '<td class="fieldrequired">'.$langs->trans('Customer').'</td>';
$shipping_method_id = 0;
if ($socid > 0) { if ($socid > 0) {
print '<td>'; print '<td>';
print $soc->getNomUrl(1); print $soc->getNomUrl(1);
@ -1700,7 +1701,7 @@ if ($action == 'create') {
// Delivery date (or manufacturing) // Delivery date (or manufacturing)
print '<tr><td>'.$langs->trans("DeliveryDate").'</td>'; print '<tr><td>'.$langs->trans("DeliveryDate").'</td>';
print '<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); $tmpdte = time() + ((7 * $conf->global->DATE_LIVRAISON_WEEK_DELAY) * 24 * 60 * 60);
$syear = date("Y", $tmpdte); $syear = date("Y", $tmpdte);
$smonth = date("m", $tmpdte); $smonth = date("m", $tmpdte);
@ -1737,7 +1738,7 @@ if ($action == 'create') {
print '<td>'; print '<td>';
print img_picto('', 'pdf').'&ensp;'; print img_picto('', 'pdf').'&ensp;';
$liste = ModelePDFPropales::liste_modeles($db); $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 $form->selectarray('model', $liste, $preselected, 0, 0, 0, '', 0, 0, 0, '', 'maxwidth200 widthcentpercentminusx', 1);
print "</td></tr>"; print "</td></tr>";
@ -1754,7 +1755,7 @@ if ($action == 'create') {
print '<tr>'; print '<tr>';
print '<td class="tdtop">'.$langs->trans('NotePublic').'</td>'; print '<td class="tdtop">'.$langs->trans('NotePublic').'</td>';
print '<td valign="top">'; 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%'); $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); 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)); $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); startSimpleTable("DraftPropals", "comm/propal/list.php", "search_status=".Propal::STATUS_DRAFT, 2, $num);
$total = 0;
if ($num) { if ($num) {
$total = 0;
$i = 0; $i = 0;
while ($i < $nbofloop) { 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 .= ' 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'; $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)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (p.rowid = ef.fk_object)";
} }
if ($sall || $search_product_category > 0) { if ($sall || $search_product_category > 0) {
@ -903,6 +903,10 @@ if ($resql) {
// Add $param from extra fields // Add $param from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; 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 // List of mass actions available
$arrayofmassactions = array( $arrayofmassactions = array(

View File

@ -1369,7 +1369,7 @@ if (empty($reshook)) {
include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php'; include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
// Actions to build doc // 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; $permissiontoadd = $usercancreate;
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; 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 .= ' 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'; $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)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."commande_extrafields as ef on (c.rowid = ef.fk_object)";
} }
if ($sall || $search_product_category > 0) { if ($sall || $search_product_category > 0) {
@ -829,6 +829,11 @@ if ($resql) {
// Add $param from extra fields // Add $param from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; 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 // List of mass actions available
$arrayofmassactions = array( $arrayofmassactions = array(
'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"), '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>';
echo '<td class="linkedcol-name nowraponall" >'.$objectlink->getNomUrl(1).'</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-ref">'.$objectlink->ref_client.'</td>';
echo '<td class="linkedcol-date" align="center">'.dol_print_date($objectlink->date, 'day').'</td>'; echo '<td class="linkedcol-date">'.dol_print_date($objectlink->date, 'day').'</td>';
echo '<td class="linkedcol-amount right">'; echo '<td class="linkedcol-amount right">';
if ($user->rights->commande->lire) { if ($user->rights->commande->lire) {
$total = $total + $objectlink->total_ht; $total = $total + $objectlink->total_ht;

View File

@ -343,7 +343,7 @@ if ($action == 'create') {
print load_fiche_titre($langs->trans("NewFinancialAccount"), '', 'bank_account'); print load_fiche_titre($langs->trans("NewFinancialAccount"), '', 'bank_account');
if ($conf->use_javascript_ajax) { if ($conf->use_javascript_ajax) {
print "\n".'<script type="text/javascript" language="javascript">'; print "\n".'<script type="text/javascript">';
print 'jQuery(document).ready(function () { print 'jQuery(document).ready(function () {
jQuery("#selecttype").change(function() { jQuery("#selecttype").change(function() {
document.formsoc.action.value="create"; document.formsoc.action.value="create";
@ -831,7 +831,7 @@ if ($action == 'create') {
print load_fiche_titre($langs->trans("EditFinancialAccount"), '', 'bank_account'); print load_fiche_titre($langs->trans("EditFinancialAccount"), '', 'bank_account');
if ($conf->use_javascript_ajax) { if ($conf->use_javascript_ajax) {
print "\n".'<script type="text/javascript" language="javascript">'; print "\n".'<script type="text/javascript">';
print 'jQuery(document).ready(function () { print 'jQuery(document).ready(function () {
jQuery("#selecttype").change(function() { jQuery("#selecttype").change(function() {
document.formsoc.action.value="edit"; document.formsoc.action.value="edit";

View File

@ -342,7 +342,7 @@ foreach ($bankcateg->fetchAll() as $bankcategory) {
if ($action == 'create') { if ($action == 'create') {
// Update fields properties in realtime // Update fields properties in realtime
if (!empty($conf->use_javascript_ajax)) { if (!empty($conf->use_javascript_ajax)) {
print "\n".'<script type="text/javascript" language="javascript">'; print "\n".'<script type="text/javascript">';
print '$(document).ready(function () { print '$(document).ready(function () {
setPaymentType(); setPaymentType();
$("#selectpaymenttype").change(function() { $("#selectpaymenttype").change(function() {

View File

@ -1660,6 +1660,11 @@ if (empty($reshook)) {
$discount->tva_tx = $lines[$i]->tva_tx; $discount->tva_tx = $lines[$i]->tva_tx;
$discount->fk_user = $user->id; $discount->fk_user = $user->id;
$discount->description = $desc; $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); $discountid = $discount->create($user);
if ($discountid > 0) { if ($discountid > 0) {
$result = $object->insert_discount($discountid); // This include link_to_invoice $result = $object->insert_discount($discountid); // This include link_to_invoice
@ -3215,7 +3220,7 @@ if ($action == 'create') {
if (empty($conf->global->INVOICE_DISABLE_DEPOSIT)) { if (empty($conf->global->INVOICE_DISABLE_DEPOSIT)) {
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">'; print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
$tmp = '<input type="radio" id="radio_deposit" name="type" value="3"'.(GETPOST('type') == 3 ? ' checked' : '').'> '; $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(document).ready(function() {
jQuery("#typestandardinvoice, #valuestandardinvoice").click(function() { jQuery("#typestandardinvoice, #valuestandardinvoice").click(function() {
jQuery("#radio_standard").prop("checked", true); jQuery("#radio_standard").prop("checked", true);
@ -3329,7 +3334,7 @@ if ($action == 'create') {
$tmp .= ' disabled'; $tmp .= ' disabled';
} }
$tmp .= '> '; $tmp .= '> ';
print '<script type="text/javascript" language="javascript"> print '<script type="text/javascript">
jQuery(document).ready(function() { jQuery(document).ready(function() {
jQuery("#fac_replacement").change(function() { jQuery("#fac_replacement").change(function() {
jQuery("#radio_replacement").prop("checked", true); jQuery("#radio_replacement").prop("checked", true);
@ -3418,7 +3423,7 @@ if ($action == 'create') {
} }
$tmp .= '> '; $tmp .= '> ';
// Show credit note options only if we checked credit note // 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() { jQuery(document).ready(function() {
if (! jQuery("#radio_creditnote").is(":checked")) if (! jQuery("#radio_creditnote").is(":checked"))
{ {
@ -3493,7 +3498,7 @@ if ($action == 'create') {
$jsListType .= (!empty($jsListType) ? ',' : '').'"'.$type.'":"'.$curent.'"'; $jsListType .= (!empty($jsListType) ? ',' : '').'"'.$type.'":"'.$curent.'"';
} }
print '<script type="text/javascript" language="javascript"> print '<script type="text/javascript">
$(document).ready(function() { $(document).ready(function() {
var listType = {'.$jsListType.'}; var listType = {'.$jsListType.'};
$("[name=\'type\'").change(function() { $("[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); $form->select_conditions_paiements($retained_warranty_fk_cond_reglement, 'retained_warranty_fk_cond_reglement', -1, 1);
print '</td></tr>'; print '</td></tr>';
print '<script type="text/javascript" language="javascript"> print '<script type="text/javascript">
$(document).ready(function() { $(document).ready(function() {
$("[name=\'type\']").change(function() { $("[name=\'type\']").change(function() {
if($( this ).prop("checked") && $.inArray($( this ).val(), '.json_encode($retainedWarrantyInvoiceAvailableType).' ) !== -1) if($( this ).prop("checked") && $.inArray($( this ).val(), '.json_encode($retainedWarrantyInvoiceAvailableType).' ) !== -1)

View File

@ -100,14 +100,6 @@ if ($action == 'addcontact' && $user->rights->facture->creer) {
* View * 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'); $title = $langs->trans('InvoiceCustomer')." - ".$langs->trans('ContactsAddresses');
$helpurl = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes"; $helpurl = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes";
llxHeader('', $title, $helpurl); llxHeader('', $title, $helpurl);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -105,7 +105,7 @@ abstract class ActionsContactCardCommon
if ($action == 'create' || $action == 'edit') { if ($action == 'create' || $action == 'edit') {
if ($conf->use_javascript_ajax) { 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(document).ready(function () {
jQuery("#selectcountry_id").change(function() { jQuery("#selectcountry_id").change(function() {
document.formsoc.action.value="'.$action.'"; 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); dol_htmloutput_errors(is_numeric($error) ? '' : $error, $errors);
if ($conf->use_javascript_ajax) { 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 () { print 'jQuery(document).ready(function () {
jQuery("#selectcountry_id").change(function() { jQuery("#selectcountry_id").change(function() {
document.formsoc.action.value="create"; document.formsoc.action.value="create";
@ -798,7 +798,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
// Unsubscribe // Unsubscribe
if (!empty($conf->mailing->enabled)) { if (!empty($conf->mailing->enabled)) {
if ($conf->use_javascript_ajax && $conf->global->MAILING_CONTACT_DEFAULT_BULK_STATUS == 2) { 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 () { print '$(document).ready(function () {
$("#email").keyup(function() { $("#email").keyup(function() {
if ($(this).val()!="") { if ($(this).val()!="") {
@ -924,7 +924,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
dol_htmloutput_errors(is_numeric($error) ? '' : $error, $errors); dol_htmloutput_errors(is_numeric($error) ? '' : $error, $errors);
if ($conf->use_javascript_ajax) { 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 () { print 'jQuery(document).ready(function () {
jQuery("#selectcountry_id").change(function() { jQuery("#selectcountry_id").change(function() {
document.formsoc.action.value="edit"; document.formsoc.action.value="edit";
@ -1071,7 +1071,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) {
// Unsubscribe // Unsubscribe
if (!empty($conf->mailing->enabled)) { 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) { 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 ' print '
jQuery(document).ready(function () { 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_fax = GETPOST("search_fax", 'alpha');
$search_email = GETPOST("search_email", 'alpha'); $search_email = GETPOST("search_email", 'alpha');
if (!empty($conf->mailing->enabled)) { 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 { } else {
$search_no_email = -1; $search_no_email = -1;
} }

View File

@ -34,18 +34,22 @@ $action = GETPOST('action', 'aZ09');
// Load translation files required by the page // Load translation files required by the page
$langs->load("companies"); $langs->load("companies");
// Security check
$id = GETPOST('id', 'int'); $id = GETPOST('id', 'int');
if ($user->socid) {
$id = $user->socid;
}
$result = restrictedArea($user, 'contact', $id, 'socpeople&societe');
$object = new Contact($db); $object = new Contact($db);
if ($id > 0) { if ($id > 0) {
$object->fetch($id); $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 $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 // 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 // Actions to build doc
$upload_dir = $conf->contrat->multidir_output[$object->entity]; $upload_dir = $conf->contrat->multidir_output[$object->entity];

View File

@ -229,6 +229,7 @@ $formother = new FormOther($db);
$socstatic = new Societe($db); $socstatic = new Societe($db);
$formcompany = new FormCompany($db); $formcompany = new FormCompany($db);
$contracttmp = new Contrat($db); $contracttmp = new Contrat($db);
$title = "";
$sql = 'SELECT'; $sql = 'SELECT';
$sql .= " c.rowid, c.ref, c.datec as date_creation, c.tms as date_update, c.date_contrat, c.statut, c.ref_customer, c.ref_supplier, c.note_private, c.note_public, c.entity,"; $sql .= " c.rowid, c.ref, c.datec as date_creation, c.tms as date_update, c.date_contrat, c.statut, c.ref_customer, c.ref_supplier, c.note_private, c.note_public, c.entity,";
@ -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."societe_commerciaux as sc";
} }
$sql .= ", ".MAIN_DB_PREFIX."contrat as c"; $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.$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"; $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'); $optioncss = GETPOST('optioncss', 'aZ09');
$massaction = GETPOST('massaction', 'alpha');
$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST("sortfield", 'alpha'); $sortfield = GETPOST("sortfield", 'alpha');
$sortorder = GETPOST("sortorder", '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."societe_commerciaux as sc,";
} }
$sql .= " ".MAIN_DB_PREFIX."contratdet as cd"; $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.$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"; $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; 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) { 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); $sql = "UPDATE ".MAIN_DB_PREFIX."projet_task SET fk_task_parent = 0 WHERE fk_task_parent = ".((int) $objecttmp->id);
$res = $db->query($sql); $res = $db->query($sql);
@ -1342,8 +1348,10 @@ if (!$error && ($massaction == 'delete' || ($action == 'delete' && $confirm == '
// Message for elements well deleted // Message for elements well deleted
if ($nbok > 1) { if ($nbok > 1) {
setEventMessages($langs->trans("RecordsDeleted", $nbok), null, 'mesgs'); setEventMessages($langs->trans("RecordsDeleted", $nbok), null, 'mesgs');
} elseif ($nbok == 1) { } elseif ($nbok > 0) {
setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs'); setEventMessages($langs->trans("RecordDeleted", $nbok), null, 'mesgs');
} else {
setEventMessages($langs->trans("NoRecordDeleted"), null, 'mesgs');
} }
// Message for elements which can't be deleted // 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>'; </script>';
// This ajax service is called only when a directory $selecteddir is opened but not when closed. // 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 "loadandshowpreview('".dol_escape_js($selecteddir)."');";
//print '</script>'; //print '</script>';
} }

View File

@ -65,9 +65,14 @@ if (!empty($user->socid)) {
$socid = $user->socid; $socid = $user->socid;
} }
/*if (empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) { if (in_array($field, array('status'))) {
accessforbidden('Calling this file is allowed only when MAIN_DIRECT_STATUS_UPDATE is set'); 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"; 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 // Registering new values
if (($action == 'set') && !empty($id)) { if (($action == 'set') && !empty($id)) {
$triggerkey = strtoupper($element).'_UPDATE'; $triggerkey = strtoupper($element).'_UPDATE';

View File

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

View File

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

View File

@ -223,7 +223,7 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes
if (!$mesg) { if (!$mesg) {
$stringtoshow = ''; $stringtoshow = '';
$stringtoshow .= '<script type="text/javascript" language="javascript"> $stringtoshow .= '<script type="text/javascript">
jQuery(document).ready(function() { jQuery(document).ready(function() {
jQuery("#idsubimg'.$this->boxcode.'").click(function() { jQuery("#idsubimg'.$this->boxcode.'").click(function() {
jQuery("#idfilter'.$this->boxcode.'").toggle(); 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); dol_print_error($this->db);
} }
$stringtoshow = '<div class="div-table-responsive-no-min">'; $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(document).ready(function() {
jQuery("#idsubimgDOLUSERCOOKIE_ticket_last_days").click(function() { jQuery("#idsubimgDOLUSERCOOKIE_ticket_last_days").click(function() {
jQuery("#idfilterDOLUSERCOOKIE_ticket_last_days").toggle(); jQuery("#idfilterDOLUSERCOOKIE_ticket_last_days").toggle();

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -869,7 +869,7 @@ abstract class CommonObject
if (!empty($conf->socialnetworks->enabled)) { if (!empty($conf->socialnetworks->enabled)) {
$outsocialnetwork = ''; $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(); $socialnetworksdict = getArrayOfSocialNetworks();
foreach ($this->socialnetworks as $key => $value) { foreach ($this->socialnetworks as $key => $value) {
if ($value) { if ($value) {
@ -4872,13 +4872,9 @@ abstract class CommonObject
$reshook = 0; $reshook = 0;
//if (is_object($hookmanager) && (($line->product_type == 9 && !empty($line->special_code)) || !empty($line->fk_parent_line))) { //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 (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);
$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('printOriginObjectLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks $reshook = $hookmanager->executeHooks('printOriginObjectSubLine', $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
}
} }
if (empty($reshook)) { if (empty($reshook)) {
$this->printOriginLine($line, '', $restrictlist, '/core/tpl', $selectedLines); $this->printOriginLine($line, '', $restrictlist, '/core/tpl', $selectedLines);

View File

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

View File

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

View File

@ -67,7 +67,7 @@ class FormBarCode
$disable = ''; $disable = '';
if (!empty($conf->use_javascript_ajax)) { 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 () { print 'jQuery(document).ready(function () {
jQuery("#select'.$idForm.'").change(function() { jQuery("#select'.$idForm.'").change(function() {
var formName = document.getElementById("form'.$idForm.'"); var formName = document.getElementById("form'.$idForm.'");

View File

@ -442,7 +442,8 @@ class FormFile
} }
$printer = 0; $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; $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>'; $out .= '">'.img_picto($langs->trans("Delete"), 'delete').'</a>';
} }
if ($printer) { 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 .= ($param ? '&'.$param : '');
$out .= '">'.img_picto($langs->trans("PrintFile", $relativepath), 'printer.png').'</a>'; $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)) { if (is_numeric($this->withfile)) {
// TODO Trick to have param removedfile containing nb of file to delete. But this does not works without javascript // 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 .= '<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(document).ready(function () {';
$out .= ' jQuery(".removedfile").click(function() {'; $out .= ' jQuery(".removedfile").click(function() {';
$out .= ' jQuery(".removedfilehidden").val(jQuery(this).val());'; $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 // Disable enter key if option MAIN_MAILFORM_DISABLE_ENTERKEY is set
if (!empty($conf->global->MAIN_MAILFORM_DISABLE_ENTERKEY)) { 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 .= 'jQuery(document).ready(function () {';
$out .= ' $(document).on("keypress", \'#mailform\', function (e) { /* Note this is called at every key pressed ! */ $out .= ' $(document).on("keypress", \'#mailform\', function (e) { /* Note this is called at every key pressed ! */
var code = e.keyCode || e.which; var code = e.keyCode || e.which;

View File

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

View File

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

View File

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

View File

@ -457,7 +457,7 @@ class SimpleOpenID
// phpcs:enable // phpcs:enable
$redirect_to = $this->GetRedirectURL(); $redirect_to = $this->GetRedirectURL();
if (headers_sent()) { // Use JavaScript to redirect if content has been previously sent (not recommended, but safe) 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 $redirect_to;
echo '\';</script>'; echo '\';</script>';
} else { // Default Header Redirect } 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)) { if (empty($conf->use_javascript_ajax)) {
print '<input type="submit" class="button buttongen button-save" name="changeobjecttype" value="'.$langs->trans("Refresh").'">'; print '<input type="submit" class="button buttongen button-save" name="changeobjecttype" value="'.$langs->trans("Refresh").'">';
} else { } else {
print '<script type="text/javascript" language="javascript"> print '<script type="text/javascript">
jQuery(document).ready(function() { jQuery(document).ready(function() {
jQuery("#objecttype").change(function() { jQuery("#objecttype").change(function() {
console.log("Reload for "+jQuery("#objecttype").val()); console.log("Reload for "+jQuery("#objecttype").val());

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 //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() { jQuery(document).ready(function() {
function init_trrunsql() function init_trrunsql()
{ {

View File

@ -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">'; //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 = '<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 .= '<!-- Add js code to open dialog popup on dialog -->';
$out .= '<script language="javascript"> $out .= '<script type="text/javascript">
jQuery(document).ready(function () { jQuery(document).ready(function () {
jQuery(".button_'.$name.'").click(function () { jQuery(".button_'.$name.'").click(function () {
console.log("Open popup with jQuery(...).dialog() on URL '.dol_escape_js(DOL_URL_ROOT.$url).'") 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) { if ($textfordropdown) {
$tmpresult = '<span class="'.$class.'text opacitymedium cursorpointer">'.$langs->trans($textfordropdown).' '.img_picto($langs->trans($textfordropdown), '1downarrow').'</span>'; $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(document).ready(function() {
jQuery(".'.$class.'text").click(function() { jQuery(".'.$class.'text").click(function() {
console.log("toggle text"); console.log("toggle text");
@ -8159,9 +8159,9 @@ function verifCond($strToEvaluate)
global $leftmenu; global $leftmenu;
global $rights; // To export to dol_eval function global $rights; // To export to dol_eval function
//print $strRights."<br>\n"; //print $strToEvaluate."<br>\n";
$rights = true; $rights = true;
if ($strToEvaluate !== '') { if (isset($strToEvaluate) && $strToEvaluate !== '') {
$str = 'if(!('.$strToEvaluate.')) { $rights = false; }'; $str = 'if(!('.$strToEvaluate.')) { $rights = false; }';
dol_eval($str); // The dol_eval must contains all the global $xxx used into a condition 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 $dolmemcache->add($memoryid, $data, $expire); // This fails if key already exists
$rescode = $dolmemcache->getResultCode(); $rescode = $dolmemcache->getResultCode();
if ($rescode == 0) { if ($rescode == 0) {
return is_array($data) ? count($data) : 0; return is_array($data) ? count($data) : (is_scalar($data) ? strlen($data) : 0);
} else { } else {
return -$rescode; return -$rescode;
} }
@ -113,7 +113,7 @@ function dol_setcache($memoryid, $data, $expire = 0)
//$dolmemcache->setOption(Memcached::OPT_COMPRESSION, false); //$dolmemcache->setOption(Memcached::OPT_COMPRESSION, false);
$result = $dolmemcache->add($memoryid, $data, false, $expire); // This fails if key already exists $result = $dolmemcache->add($memoryid, $data, false, $expire); // This fails if key already exists
if ($result) { if ($result) {
return is_array($data) ? count($data) : 0; return is_array($data) ? count($data) : (is_scalar($data) ? strlen($data) : 0);
} else { } else {
return -1; return -1;
} }

View File

@ -1363,7 +1363,11 @@ function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0,
// Description short of product line // Description short of product line
$libelleproduitservice = $label; $libelleproduitservice = $label;
if (!empty($libelleproduitservice) && !empty($conf->global->PDF_BOLD_PRODUCT_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>'; $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)) { if (!empty($prodser->sousprods) && is_array($prodser->sousprods) && count($prodser->sousprods)) {
$tmparrayofsubproducts = reset($prodser->sousprods); $tmparrayofsubproducts = reset($prodser->sousprods);
foreach ($tmparrayofsubproducts as $subprodval) { 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($hidedesc)) {
if (!empty($conf->global->MAIN_DOCUMENTS_DESCRIPTION_FIRST)) { if (!empty($conf->global->MAIN_DOCUMENTS_DESCRIPTION_FIRST)) {
$libelleproduitservice = $desc."\n".$libelleproduitservice; $libelleproduitservice = dol_concatdesc($desc, $libelleproduitservice);
} else { } else {
if (!empty($conf->global->HIDE_LABEL_VARIANT_PDF) && $prodser->isVariant()) { if (!empty($conf->global->HIDE_LABEL_VARIANT_PDF) && $prodser->isVariant()) {
$libelleproduitservice = $desc; $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 (!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>'; $ref_prodserv = '<b>'.$ref_prodserv.'</b>';
// $prefix_prodserv and $ref_prodser are not HTML var
} }
$libelleproduitservice = $prefix_prodserv.$ref_prodserv.$libelleproduitservice; $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; //print '>'.$outputlangs->charset_output.','.$period;
if (!empty($conf->global->PDF_BOLD_PRODUCT_REF_AND_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 { } else {
$libelleproduitservice .= "__N__".$period; $libelleproduitservice .= "__N__".$period;
} }

View File

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

View File

@ -957,7 +957,12 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
$tmp = json_decode($obj->note, true); $tmp = json_decode($obj->note, true);
} }
if ($obj) { if ($obj) {
return array('authorid'=>$tmp['authorid'], 'ip'=>$tmp['ip'], 'lastactivationdate'=>$this->db->jdate($obj->tms)); return array(
'authorid' => $tmp['authorid'],
'ip' => $tmp['ip'],
'lastactivationdate' => $this->db->jdate($obj->tms),
'lastactivationversion' => (!empty($tmp['lastactivationversion']) ? $tmp['lastactivationversion'] : 'unknown'),
);
} }
} }
@ -991,7 +996,13 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
$err++; $err++;
} }
$note = json_encode(array('authorid'=>(is_object($user) ? $user->id : 0), 'ip'=>(empty($_SERVER['REMOTE_ADDR']) ? '' : $_SERVER['REMOTE_ADDR']))); $note = json_encode(
array(
'authorid' => (is_object($user) ? $user->id : 0),
'ip' => (empty($_SERVER['REMOTE_ADDR']) ? '' : $_SERVER['REMOTE_ADDR']),
'lastactivationversion' => $this->version,
)
);
$sql = "INSERT INTO ".MAIN_DB_PREFIX."const (name, value, visible, entity, note) VALUES"; $sql = "INSERT INTO ".MAIN_DB_PREFIX."const (name, value, visible, entity, note) VALUES";
$sql .= " (".$this->db->encrypt($this->const_name); $sql .= " (".$this->db->encrypt($this->const_name);

View File

@ -589,7 +589,7 @@ if (!empty($conf->use_javascript_ajax)) {
} }
/* Check that mandatory fields are filled */ /* Check that mandatory fields are filled */
print '<script type="text/javascript" language="javascript"> print '<script type="text/javascript">
jQuery(document).ready(function() { jQuery(document).ready(function() {
$("#submitcrop").click(function(e) { $("#submitcrop").click(function(e) {
console.log("We click on submitcrop"); console.log("We click on submitcrop");

View File

@ -13,7 +13,7 @@ if (isset($totalarray['pos'])) {
while ($i < $totalarray['nbfield']) { while ($i < $totalarray['nbfield']) {
$i++; $i++;
if (!empty($totalarray['pos'][$i])) { if (!empty($totalarray['pos'][$i])) {
print '<td class="right">'.price($totalarray['val'][$totalarray['pos'][$i]]).'</td>'; print '<td class="right">'.price(!empty($totalarray['val'][$totalarray['pos'][$i]])?$totalarray['val'][$totalarray['pos'][$i]]:0).'</td>';
} else { } else {
if ($i == 1) { if ($i == 1) {
if (is_null($limit) || $num < $limit) { if (is_null($limit) || $num < $limit) {

View File

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

View File

@ -478,7 +478,7 @@ if ($num > 0) {
if (empty($obj)) { if (empty($obj)) {
break; break;
} }
if (!verifCond($obj->test)) { if (isset($obj->test) && !verifCond($obj->test)) {
continue; // Discard line with test = false continue; // Discard line with test = false
} }

View File

@ -162,7 +162,7 @@ if ($action == 'create') {
print load_fiche_titre($langs->trans("DoPayment")); print load_fiche_titre($langs->trans("DoPayment"));
if (!empty($conf->use_javascript_ajax)) { if (!empty($conf->use_javascript_ajax)) {
print "\n".'<script type="text/javascript" language="javascript">'; print "\n".'<script type="text/javascript">';
//Add js for AutoFill //Add js for AutoFill
print ' $(document).ready(function () {'; print ' $(document).ready(function () {';
print ' $(".AutoFillAmout").on(\'click touchstart\', function(){ print ' $(".AutoFillAmout").on(\'click touchstart\', function(){

View File

@ -494,7 +494,7 @@ $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $obje
$sql .= preg_replace('/^,/', '', $hookmanager->resPrint); $sql .= preg_replace('/^,/', '', $hookmanager->resPrint);
$sql = preg_replace('/,\s*$/', '', $sql); $sql = preg_replace('/,\s*$/', '', $sql);
$sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t"; $sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t";
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 (t.id = ef.fk_object)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.id = ef.fk_object)";
} }
$sql .= " INNER JOIN ".MAIN_DB_PREFIX."c_actioncomm as cact ON cact.id=t.fk_action AND cact.module LIKE '%@eventorganization'"; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."c_actioncomm as cact ON cact.id=t.fk_action AND cact.module LIKE '%@eventorganization'";
@ -773,7 +773,7 @@ print '</tr>'."\n";
// Detect if we need a fetch on each output line // Detect if we need a fetch on each output line
$needToFetchEachLine = 0; $needToFetchEachLine = 0;
if (is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) { if (!empty($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) {
foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) { foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) {
if (preg_match('/\$object/', $val)) { if (preg_match('/\$object/', $val)) {
$needToFetchEachLine++; // There is at least one compute field that use $object $needToFetchEachLine++; // There is at least one compute field that use $object
@ -797,6 +797,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
// Show here line of result // Show here line of result
print '<tr class="oddeven">'; print '<tr class="oddeven">';
$totalarray['nbfield'] = 0;
foreach ($object->fields as $key => $val) { foreach ($object->fields as $key => $val) {
$cssforfield = (empty($val['css']) ? '' : $val['css']); $cssforfield = (empty($val['css']) ? '' : $val['css']);
if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) { if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {

View File

@ -1021,7 +1021,7 @@ if ($action == 'create') {
$numAsked = count($object->lines); $numAsked = count($object->lines);
print '<script type="text/javascript" language="javascript">'."\n"; print '<script type="text/javascript">'."\n";
print 'jQuery(document).ready(function() {'."\n"; print 'jQuery(document).ready(function() {'."\n";
print 'jQuery("#autofill").click(function() {'; print 'jQuery("#autofill").click(function() {';
$i = 0; $i = 0;

View File

@ -284,6 +284,12 @@ if ($search_user > 0) {
$sql .= ", ".MAIN_DB_PREFIX."element_contact as ec"; $sql .= ", ".MAIN_DB_PREFIX."element_contact as ec";
$sql .= ", ".MAIN_DB_PREFIX."c_type_contact as tc"; $sql .= ", ".MAIN_DB_PREFIX."c_type_contact as tc";
} }
// Add table from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
$sql .= " WHERE e.entity IN (".getEntity('expedition').")"; $sql .= " WHERE e.entity IN (".getEntity('expedition').")";
if ($search_product_category > 0) { if ($search_product_category > 0) {
$sql .= " AND cp.fk_categorie = ".((int) $search_product_category); $sql .= " AND cp.fk_categorie = ".((int) $search_product_category);
@ -471,6 +477,11 @@ if ($optioncss != '') {
// Add $param from extra fields // Add $param from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; 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;
$arrayofmassactions = array( $arrayofmassactions = array(
'builddoc' => img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"), 'builddoc' => img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
//'classifyclose'=>$langs->trans("Close"), TODO massive close shipment ie: when truck is charged //'classifyclose'=>$langs->trans("Close"), TODO massive close shipment ie: when truck is charged

View File

@ -2250,7 +2250,7 @@ if ($action == 'create') {
} }
print '<!-- Code to open/close section to submit or link files in edit mode -->'."\n"; print '<!-- Code to open/close section to submit or link files in edit mode -->'."\n";
print '<script language="javascript">'."\n"; print '<script type="text/javascript">'."\n";
print '$(document).ready(function() { print '$(document).ready(function() {
$( ".auploadnewfilenow" ).click(function() { $( ".auploadnewfilenow" ).click(function() {
jQuery(".truploadnewfilenow").toggle(); jQuery(".truploadnewfilenow").toggle();
@ -2405,7 +2405,7 @@ if ($action == 'create') {
} }
print '<!-- Code to open/close section to submit or link files in the form to add new line -->'."\n"; print '<!-- Code to open/close section to submit or link files in the form to add new line -->'."\n";
print '<script language="javascript">'."\n"; print '<script type="text/javascript">'."\n";
print '$(document).ready(function() { print '$(document).ready(function() {
$( ".auploadnewfilenow" ).click(function() { $( ".auploadnewfilenow" ).click(function() {
console.log("We click on toggle of auploadnewfilenow"); console.log("We click on toggle of auploadnewfilenow");

View File

@ -170,7 +170,7 @@ if ($action == 'create' || empty($action)) {
// autofill remainder amount // autofill remainder amount
if (!empty($conf->use_javascript_ajax)) { if (!empty($conf->use_javascript_ajax)) {
print "\n".'<script type="text/javascript" language="javascript">'; print "\n".'<script type="text/javascript">';
//Add js for AutoFill //Add js for AutoFill
print ' $(document).ready(function () {'; print ' $(document).ready(function () {';
print ' $(".AutoFillAmount").on(\'click touchstart\', function(){ print ' $(".AutoFillAmount").on(\'click touchstart\', function(){

View File

@ -765,7 +765,7 @@ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)";
$sql .= ", ".MAIN_DB_PREFIX."commande_fournisseur as cf"; $sql .= ", ".MAIN_DB_PREFIX."commande_fournisseur as cf";
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 (cf.rowid = ef.fk_object)"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (cf.rowid = ef.fk_object)";
} }
if ($sall || $search_product_category > 0) { if ($sall || $search_product_category > 0) {

View File

@ -1995,7 +1995,7 @@ if ($action == 'create') {
if (empty($conf->global->INVOICE_DISABLE_DEPOSIT)) { if (empty($conf->global->INVOICE_DISABLE_DEPOSIT)) {
print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">'; print '<div class="tagtr listofinvoicetype"><div class="tagtd listofinvoicetype">';
$tmp='<input type="radio" id="radio_deposit" name="type" value="3"' . (GETPOST('type') == 3 ? ' checked' : '') . '> '; $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(document).ready(function() {
jQuery("#typestandardinvoice, #valuestandardinvoice").click(function() { jQuery("#typestandardinvoice, #valuestandardinvoice").click(function() {
jQuery("#radio_standard").prop("checked", true); jQuery("#radio_standard").prop("checked", true);
@ -2077,7 +2077,7 @@ if ($action == 'create') {
$tmp='<input type="radio" name="type" id="radio_replacement" value="1"' . (GETPOST('type') == 1 ? ' checked' : ''); $tmp='<input type="radio" name="type" id="radio_replacement" value="1"' . (GETPOST('type') == 1 ? ' checked' : '');
if (! $options) $tmp.=' disabled'; if (! $options) $tmp.=' disabled';
$tmp.='> '; $tmp.='> ';
print '<script type="text/javascript" language="javascript"> print '<script type="text/javascript">
jQuery(document).ready(function() { jQuery(document).ready(function() {
jQuery("#fac_replacement").change(function() { jQuery("#fac_replacement").change(function() {
jQuery("#radio_replacement").prop("checked", true); jQuery("#radio_replacement").prop("checked", true);
@ -2149,7 +2149,7 @@ if ($action == 'create') {
} }
$tmp .= '> '; $tmp .= '> ';
// Show credit note options only if we checked credit note // 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() { jQuery(document).ready(function() {
if (! jQuery("#radio_creditnote").is(":checked")) if (! jQuery("#radio_creditnote").is(":checked"))
{ {

View File

@ -383,7 +383,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
// Add realtime total information // Add realtime total information
if (!empty($conf->use_javascript_ajax)) { if (!empty($conf->use_javascript_ajax)) {
print "\n".'<script type="text/javascript" language="javascript">'; print "\n".'<script type="text/javascript">';
print '$(document).ready(function () { print '$(document).ready(function () {
function _elemToJson(selector) function _elemToJson(selector)
@ -532,7 +532,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
if (!empty($conf->use_javascript_ajax)) { if (!empty($conf->use_javascript_ajax)) {
//Add js for AutoFill //Add js for AutoFill
print "\n".'<script type="text/javascript" language="javascript">'; print "\n".'<script type="text/javascript">';
print ' $(document).ready(function () {'; print ' $(document).ready(function () {';
print ' $(".AutoFillAmout").on(\'click touchstart\', function(){ print ' $(".AutoFillAmout").on(\'click touchstart\', function(){
$("input[name="+$(this).data(\'rowname\')+"]").val($(this).data("value")); $("input[name="+$(this).data(\'rowname\')+"]").val($(this).data("value"));

View File

@ -736,6 +736,7 @@ if ($resql) {
$i = 0; $i = 0;
$totalarray = array(); $totalarray = array();
$totalarray['nbfield'] = 0; $totalarray['nbfield'] = 0;
$totalduration = 0;
while ($i < min($num, $limit)) { while ($i < min($num, $limit)) {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
@ -805,6 +806,7 @@ if ($resql) {
if (!empty($arrayfields['duration']['checked'])) { if (!empty($arrayfields['duration']['checked'])) {
print '<td class="right">'; print '<td class="right">';
$nbopenedday = num_open_day($db->jdate($obj->date_debut, 1), $db->jdate($obj->date_fin, 1), 0, 1, $obj->halfday); // user jdate(..., 1) because num_open_day need UTC dates $nbopenedday = num_open_day($db->jdate($obj->date_debut, 1), $db->jdate($obj->date_fin, 1), 0, 1, $obj->halfday); // user jdate(..., 1) because num_open_day need UTC dates
$totalduration += $nbopenedday;
print $nbopenedday.' '.$langs->trans('DurationDays'); print $nbopenedday.' '.$langs->trans('DurationDays');
print '</td>'; print '</td>';
if (!$i) { if (!$i) {
@ -887,6 +889,20 @@ if ($resql) {
$i++; $i++;
} }
if (!empty($arrayfields['duration']['checked'])) {
print '<tr class="liste_titre">';
foreach ($arrayfields as $key => $val) {
if (!empty($val['checked'])) {
if ($key == 'duration') {
print '<td class="right">'.$totalduration.' '.$langs->trans('DurationDays').'</td>';
} else {
print '<td/>';
}
}
}
print '</tr>';
}
} }
// Si il n'y a pas d'enregistrement suite à une recherche // Si il n'y a pas d'enregistrement suite à une recherche

View File

@ -1178,7 +1178,7 @@ if ($step == 4 && $datatoimport) {
if ($conf->use_javascript_ajax) { if ($conf->use_javascript_ajax) {
print '<script type="text/javascript" language="javascript">'; print '<script type="text/javascript">';
print 'jQuery(function() { print 'jQuery(function() {
jQuery("#left, #right").sortable({ jQuery("#left, #right").sortable({
/* placeholder: \'ui-state-highlight\', */ /* placeholder: \'ui-state-highlight\', */

View File

@ -598,7 +598,7 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ
} }
//if (!empty($conf->use_javascript_ajax)) { // use_javascript_ajax is not defined //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() { jQuery(document).ready(function() {
function init_trrunsql() function init_trrunsql()
{ {

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