Debug v15

This commit is contained in:
Laurent Destailleur 2021-10-30 17:19:46 +02:00
parent 47c131af74
commit 0017c15974
9 changed files with 235 additions and 51 deletions

View File

@ -2014,15 +2014,15 @@ if ($action == 'create') {
$morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $usercancreate, 'string', '', 0, 1);
$morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $usercancreate, 'string', '', null, null, '', 1);
// Thirdparty
$morehtmlref .= '<br>'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'customer');
$morehtmlref .= '<br><span class="hideonsmartphone">'.$langs->trans('ThirdParty').' : </span>'.$object->thirdparty->getNomUrl(1, 'customer');
if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) {
$morehtmlref .= ' (<a href="'.DOL_URL_ROOT.'/comm/propal/list.php?socid='.$object->thirdparty->id.'&search_societe='.urlencode($object->thirdparty->name).'">'.$langs->trans("OtherProposals").'</a>)';
}
// Project
if (!empty($conf->projet->enabled)) {
$langs->load("projects");
$morehtmlref .= '<br>'.$langs->trans('Project').' ';
if (!$usercancreate) {
$morehtmlref .= '<br><span class="paddingrightonly">'.$langs->trans('Project').'</span>';
if ($usercancreate) {
if ($action != 'classify') {
$morehtmlref .= '<a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?action=classify&token='.newToken().'&id='.$object->id.'">'.img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> : ';
}
@ -2041,7 +2041,7 @@ if ($action == 'create') {
if (!empty($object->fk_project)) {
$proj = new Project($db);
$proj->fetch($object->fk_project);
$morehtmlref .= ' : '.$proj->getNomUrl(1);
$morehtmlref .= ': '.$proj->getNomUrl(1);
if ($proj->title) {
$morehtmlref .= ' - '.$proj->title;
}

View File

@ -20,7 +20,7 @@
/**
* \file htdocs/core/bookmarks_page.php
* \brief File to return a page with the complete list of bookmarks (all search input fields)
* \brief File to return a page with the complete list of bookmarks
*/
//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled cause need to load personalized language
@ -45,7 +45,7 @@ if (GETPOST('lang', 'aZ09')) {
$langs->setDefaultLang(GETPOST('lang', 'aZ09')); // If language was forced on URL by the main.inc.php
}
$langs->load("main");
$langs->loadLangs(array("bookmarks"));
$right = ($langs->trans("DIRECTION") == 'rtl' ? 'left' : 'right');
$left = ($langs->trans("DIRECTION") == 'rtl' ? 'right' : 'left');
@ -57,7 +57,7 @@ $left = ($langs->trans("DIRECTION") == 'rtl' ? 'right' : 'left');
$title = $langs->trans("Bookmarks");
// URL http://mydolibarr/core/search_page?dol_use_jmobile=1 can be used for tests
// URL http://mydolibarr/core/bookmarks_page?dol_use_jmobile=1 can be used for tests
$head = '<!-- Bookmarks access -->'."\n";
$arrayofjs = array();
$arrayofcss = array();
@ -69,8 +69,6 @@ print '<body>'."\n";
print '<div>';
//print '<br>';
$nbofsearch = 0;
// Instantiate hooks of thirdparty module
$hookmanager->initHooks(array('bookmarks'));
@ -78,32 +76,43 @@ $hookmanager->initHooks(array('bookmarks'));
$bookmarkList = '';
$searchForm = '';
$arrayresult = array();
//include DOL_DOCUMENT_ROOT.'/core/ajax/selectsearchbox.php';
// Menu with list of bookmarks
$sql = "SELECT rowid, title, url, target FROM ".MAIN_DB_PREFIX."bookmark";
$sql .= " WHERE (fk_user = ".((int) $user->id)." OR fk_user is NULL OR fk_user = 0)";
$sql .= " AND entity IN (".getEntity('bookmarks').")";
$sql .= " ORDER BY position";
if ($resql = $db->query($sql)) {
$bookmarkList = '<div id="dropdown-bookmarks-list" class="start">';
$i = 0;
while ((empty($conf->global->BOOKMARKS_SHOW_IN_MENU) || $i < $conf->global->BOOKMARKS_SHOW_IN_MENU) && $obj = $db->fetch_object($resql)) {
$bookmarkList .= '<a class="dropdown-item bookmark-item'.(strpos($obj->url, 'http') === 0 ? ' bookmark-item-external' : '').'" id="bookmark-item-'.$obj->rowid.'" data-id="'.$obj->rowid.'" '.($obj->target == 1 ? ' target="_blank"' : '').' href="'.dol_escape_htmltag($obj->url).'" >';
$bookmarkList .= dol_escape_htmltag($obj->title);
$bookmarkList .= '</a>';
$i++;
}
$bookmarkList .= '</div>';
$searchForm .= '<input name="bookmark" id="top-bookmark-search-input" class="dropdown-search-input" placeholder="'.$langs->trans('Bookmarks').'" autocomplete="off" >';
if (empty($conf->bookmarks->enabled)) {
$langs->load("admin");
$bookmarkList .= '<br><span class="opacitymedium">'.$langs->trans("WarningModuleNotActive", $langs->transnoentitiesnoconv("Bookmarks")).'</span>';
$bookmarkList .= '<br><br>';
} else {
dol_print_error($db);
}
// Menu with list of bookmarks
$sql = "SELECT rowid, title, url, target FROM ".MAIN_DB_PREFIX."bookmark";
$sql .= " WHERE (fk_user = ".((int) $user->id)." OR fk_user is NULL OR fk_user = 0)";
$sql .= " AND entity IN (".getEntity('bookmarks').")";
$sql .= " ORDER BY position";
if ($resql = $db->query($sql)) {
$bookmarkList = '<div id="dropdown-bookmarks-list" class="start">';
$i = 0;
while ((empty($conf->global->BOOKMARKS_SHOW_IN_MENU) || $i < $conf->global->BOOKMARKS_SHOW_IN_MENU) && $obj = $db->fetch_object($resql)) {
$bookmarkList .= '<a class="dropdown-item bookmark-item'.(strpos($obj->url, 'http') === 0 ? ' bookmark-item-external' : '').'" id="bookmark-item-'.$obj->rowid.'" data-id="'.$obj->rowid.'" '.($obj->target == 1 ? ' target="_blank"' : '').' href="'.dol_escape_htmltag($obj->url).'" >';
$bookmarkList .= dol_escape_htmltag($obj->title);
$bookmarkList .= '</a>';
$i++;
}
if ($i == 0) {
$bookmarkList .= '<br><span class="opacitymedium">'.$langs->trans("NoBookmarks").'</span>';
$bookmarkList .= '<br><br>';
$newcardbutton = '';
$newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/bookmarks/card.php?action=create&backtopage='.urlencode(DOL_URL_ROOT.'/bookmarks/list.php'), '', !empty($user->rights->bookmark->creer));
$bookmarkList .= '<center>'.$newcardbutton.'</center>';
}
$bookmarkList .= '</div>';
$searchForm .= '<input name="bookmark" id="top-bookmark-search-input" class="dropdown-search-input" placeholder="'.$langs->trans('Bookmarks').'" autocomplete="off" >';
} else {
dol_print_error($db);
}
}
// Execute hook printBookmarks
$parameters = array('bookmarks'=>$bookmarkList);

View File

@ -5088,8 +5088,7 @@ class Form
if ($selected) {
$projet = new Project($this->db);
$projet->fetch($selected);
//print '<a href="'.DOL_URL_ROOT.'/projet/card.php?id='.$selected.'">'.$projet->title.'</a>';
$out .= $projet->getNomUrl(0, '', 1);
$out .= $projet->getNomUrl(1, '', 1);
} else {
$out .= "&nbsp;";
}

View File

@ -0,0 +1,147 @@
<?php
/* Copyright (C) 2005-2017 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This file is a modified version of datepicker.php from phpBSM to fix some
* bugs, to add new features and to dramatically increase speed.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/multicompany_page.php
* \brief File to return a page with the list of all entities user can switch to
*/
//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled cause need to load personalized language
//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled cause need to load personalized language
//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Not disabled cause need to do translations
if (!defined('NOCSRFCHECK')) {
define('NOCSRFCHECK', 1);
}
if (!defined('NOTOKENRENEWAL')) {
define('NOTOKENRENEWAL', 1);
}
//if (! defined('NOLOGIN')) define('NOLOGIN',1); // Not disabled cause need to load personalized language
if (!defined('NOREQUIREMENU')) {
define('NOREQUIREMENU', 1);
}
//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML',1);
require_once '../main.inc.php';
$action = GETPOST('action', 'aZ09');
$entityid = GETPOST('entity', 'int');
$backtourl = GETPOST('backtourl');
if (empty($backtourl)) {
$backtourl = DOL_URL_ROOT;
}
if (GETPOST('lang', 'aZ09')) {
$langs->setDefaultLang(GETPOST('lang', 'aZ09')); // If language was forced on URL by the main.inc.php
}
$langs->load("main");
$right = ($langs->trans("DIRECTION") == 'rtl' ? 'left' : 'right');
$left = ($langs->trans("DIRECTION") == 'rtl' ? 'right' : 'left');
/*
* Actions
*/
if (GETPOST('acction', 'aZ') == 'switchentity') {
if (is_object($mc)) {
$mc->switchEntity($entityid);
}
header("Location: ".$backtourl);
exit(0);
}
/*
* View
*/
$title = $langs->trans("Multicompanies");
// URL http://mydolibarr/core/multicompany_page?dol_use_jmobile=1 can be used for tests
$head = '<!-- Multicompany access -->'."\n";
$arrayofjs = array();
$arrayofcss = array();
top_htmlhead($head, $title, 0, 0, $arrayofjs, $arrayofcss);
print '<body>'."\n";
print '<div>';
//print '<br>';
if (empty($conf->multicompany->enabled)) {
$langs->load("admin");
$bookmarkList .= '<br><span class="opacitymedium">'.$langs->trans("WarningModuleNotActive", $langs->transnoentitiesnoconv("MultiCompany")).'</span>';
$bookmarkList .= '<br><br>';
} else {
// Instantiate hooks of thirdparty module
$hookmanager->initHooks(array('multicompany'));
// Define $bookmarks
$multicompanyList = '';
$searchForm = '';
if (is_object($mc)) {
$listofentities = $mc->getEntitiesList($user->login, false, true);
}
foreach ($listofentities as $entityid => $entitycursor) {
$url = DOL_URL_ROOT.'/core/multicompany_page.php?action=switchentity&token='.newToken().'&entity='.((int) $entityid).($backtourl ? '&backtourl='.urlencode($backtourl) : '');
$multicompanyList .= '<a class="dropdown-item multicompany-item'.(strpos($url, 'http') === 0 ? ' multicompany-item-external' : '').'" id="multicompany-item-'.$id.'" data-id="'.$id.'" href="'.dol_escape_htmltag($url).'">';
$multicompanyList .= dol_escape_htmltag($entitycursor);
$multicompanyList .= '</a>';
}
$multicompanyList .= '</div>';
$searchForm .= '<input name="bookmark" id="top-multicompany-search-input" class="dropdown-search-input" placeholder="'.$langs->trans('Entity').'" autocomplete="off" >';
// Execute hook printBookmarks
$parameters = array('multicompany'=>$multicompanyList);
$reshook = $hookmanager->executeHooks('printMultiCompanyEntities', $parameters); // Note that $action and $object may have been modified by some hooks
if (empty($reshook)) {
$multicompanyList .= $hookmanager->resPrint;
} else {
$multicompanyList = $hookmanager->resPrint;
}
print "\n";
print "<!-- Begin Multicompany list -->\n";
print '<div class="center"><div class="center" style="padding: 6px;">';
print '<style>.menu_titre { padding-top: 7px; }</style>';
print '<div id="blockvmenusearch" class="tagtable center searchpage">'."\n";
print $multicompanyList;
print '</div>'."\n";
print '</div></div>';
print "\n<!-- End SearchForm -->\n";
}
print '</div>';
print '</body></html>'."\n";
$db->close();

View File

@ -19,3 +19,4 @@ UseAnExternalHttpLinkOrRelativeDolibarrLink=Use an external/absolute link (https
ChooseIfANewWindowMustBeOpenedOnClickOnBookmark=Choose if the linked page should open in the current tab or a new tab
BookmarksManagement=Bookmarks management
BookmarksMenuShortCut=Ctrl + shift + m
NoBookmarks=No bookmarks defined

View File

@ -89,11 +89,11 @@ IdProposal=Proposal ID
IdProduct=Product ID
PrParentLine=Proposal Parent Line
LineBuyPriceHT=Buy Price Amount net of tax for line
SignPropal=Sign proposal
SignPropal=Accept proposal
RefusePropal=Refuse proposal
Sign=Sign
PropalAlreadySigned=Proposal already accepted
PropalAlreadyRefused=Proposal already refused
PropalAlreadySigned=Proposal already signed
PropalSigned=Proposal signed
PropalSigned=Proposal accepted
PropalRefused=Proposal refused
ConfirmRefusePropal=Are you sure you want to refuse this commercial proposal?

View File

@ -1183,7 +1183,7 @@ class Project extends CommonObject
$label = '';
if ($option != 'nolink') {
$label = img_picto('', $this->picto).' <u class="paddingrightonly">'.$langs->trans("Project").'</u>';
$label = img_picto('', $this->picto, 'class="pictofixedwidth"').' <u class="paddingrightonly">'.$langs->trans("Project").'</u>';
}
if (isset($this->status)) {
$label .= ' '.$this->getLibStatut(5);
@ -1252,7 +1252,7 @@ class Project extends CommonObject
$result .= $linkstart;
if ($withpicto) {
$result .= img_object(($notooltip ? '' : $label), $picto, ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
$result .= img_object(($notooltip ? '' : $label), $picto, ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip pictofixedwidth"'), 0, 0, $notooltip ? 0 : 1);
}
if ($withpicto != 2) {
$result .= $this->ref;

View File

@ -61,6 +61,7 @@ $langs->loadLangs(array("main", "other", "dict", "bills", "companies", "errors",
$action = GETPOST('action', 'aZ09');
$cancel = GETPOST('cancel', 'alpha');
$refusepropal = GETPOST('refusepropal', 'alpha');
$message = GETPOST('message', 'aZ09');
// Input are:
// type ('invoice','order','contractline'),
@ -120,25 +121,33 @@ $creditor = $mysoc->name;
$object = new Propal($db);
$object->fetch(0, $ref);
/*
* Actions
*/
if ($action == 'confirm_refusepropal') {
$db->begin();
$sql = "UPDATE ".MAIN_DB_PREFIX."propal";
$sql .= " SET fk_statut = ".((int) $object::STATUS_NOTSIGNED).", note_private = '".$object->note_private."', date_signature='".$db->idate(dol_now())."'";
$sql .= " SET fk_statut = ".((int) $object::STATUS_NOTSIGNED).", note_private = '".$db->escape($object->note_private)."', date_signature='".$db->idate(dol_now())."'";
$sql .= " WHERE rowid = ".((int) $object->id);
dol_syslog(__METHOD__, LOG_DEBUG);
$resql = $db->query($sql);
if (!$resql) {
$error++;
}
if (!$error) {
$db->commit();
setEventMessage("PropalRefused");
$message = 'refused';
setEventMessages("PropalRefused", null, 'warning');
} else {
$db->rollback();
}
$object->fetch(0, $ref);
}
@ -367,7 +376,7 @@ if ($action == "dosign" && empty($cancel)) {
success: function(response) {
if(response == "success"){
console.log("Success on saving signature");
window.location.replace("'.$_SERVER["SELF"].'?ref='.$ref.'");
window.location.replace("'.$_SERVER["SELF"].'?ref='.$ref.'&message=signed");
}else{
console.error(response);
}
@ -390,10 +399,18 @@ if ($action == "dosign" && empty($cancel)) {
} else {
if ($object->status == $object::STATUS_SIGNED) {
print '<br>';
print '<span class="ok">'.$langs->trans("PropalAlreadySigned").'</span>';
if ($message == 'signed') {
print '<span class="ok">'.$langs->trans("PropalSigned").'</span>';
} else {
print '<span class="ok">'.$langs->trans("PropalAlreadySigned").'</span>';
}
} elseif ($object->status == $object::STATUS_NOTSIGNED) {
print '<br>';
print '<span class="warning">'.$langs->trans("PropalAlreadyRefused").'</span>';
if ($message == 'refused') {
print '<span class="ok">'.$langs->trans("PropalRefused").'</span>';
} else {
print '<span class="warning">'.$langs->trans("PropalAlreadyRefused").'</span>';
}
} else {
print '<input type="submit" class="butAction small wraponsmartphone marginbottomonly marginleftonly marginrightonly reposition" value="'.$langs->trans("SignPropal").'">';
print '<input name="refusepropal" type="submit" class="butActionDelete small wraponsmartphone marginbottomonly marginleftonly marginrightonly" value="'.$langs->trans("RefusePropal").'">';

View File

@ -83,6 +83,21 @@ if (empty($endpoint_secret)) {
exit();
}
if (!empty($conf->global->STRIPE_USER_ACCOUNT_FOR_ACTIONS)) {
// We set the user to use for all ipn actions in Dolibarr
$user = new User($db);
$user->fetch($conf->global->STRIPE_USER_ACCOUNT_FOR_ACTIONS);
$user->getrights();
} else {
print 'Error: Setup of module Stripe not complete for mode '.$service.'. The STRIPE_USER_ACCOUNT_FOR_ACTIONS is not defined.';
http_response_code(400); // PHP 5.4 or greater
exit();
}
// TODO Add a check on a security key
/*
* Actions
@ -110,10 +125,6 @@ try {
$langs->load("main");
// TODO Do we really need a user in setup just to have a name to fill an email topic when it is a technical system notification email
$user = new User($db);
$user->fetch($conf->global->STRIPE_USER_ACCOUNT_FOR_ACTIONS);
$user->getrights();
if (!empty($conf->multicompany->enabled) && !empty($conf->stripeconnect->enabled) && is_object($mc)) {
$sql = "SELECT entity";
@ -276,11 +287,11 @@ if ($event->type == 'payout.created') {
$ret = $mailfile->sendfile();
http_response_code(200); // PHP 5.4 or greater
http_response_code(200);
return 1;
} else {
$error++;
http_response_code(500); // PHP 5.4 or greater
http_response_code(500);
return -1;
}
} elseif ($event->type == 'customer.source.created') {
@ -385,4 +396,4 @@ if ($event->type == 'payout.created') {
// This event is deprecated.
}
http_response_code(200); // PHP 5.4 or greater
http_response_code(200);