Merge branch 'develop' into 11.0_salaries

This commit is contained in:
Alexandre SPANGARO 2019-07-19 23:11:06 +02:00 committed by GitHub
commit 0af1206892
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
51 changed files with 553 additions and 360 deletions

View File

@ -14,7 +14,7 @@ WARNING:
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
* Properties ->libelle_incoterms were renamed into ->label_incoterms
* Removed the method liste_array() of project class. It was not used by core code.
***** ChangeLog for 10.0.0 compared to 9.0.0 *****

View File

@ -27,6 +27,15 @@ With
ESCPOS:
-------
Replace
private $connector;
With
protected $connector;
NUSOAP:
-------
* In file nusoap.php, to avoid a warning,

View File

@ -162,7 +162,7 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha'))
{
if ($fieldnamekey == 'libelle' || ($fieldnamekey == 'label')) $fieldnamekey='Label';
if ($fieldnamekey == 'code') $fieldnamekey = 'Code';
if ($fieldnamekey == 'nature') $fieldnamekey = 'Nature';
if ($fieldnamekey == 'nature') $fieldnamekey = 'NatureOfJournal';
}
// Other checks
if (isset($_POST["code"]))
@ -437,7 +437,7 @@ if ($id)
$valuetoshow=$langs->trans("Label");
}
if ($fieldlist[$field]=='nature') {
$valuetoshow=$langs->trans("Nature");
$valuetoshow=$langs->trans("NatureOfJournal");
}
if ($valuetoshow != '') {
@ -516,7 +516,7 @@ if ($id)
}
// Title line with search boxes
print '<tr class="liste_titre_filter liste_titre_add">';
/*print '<tr class="liste_titre_filter liste_titre_add">';
print '<td class="liste_titre"></td>';
print '<td class="liste_titre"></td>';
print '<td class="liste_titre"></td>';
@ -524,16 +524,14 @@ if ($id)
print '<td class="liste_titre"></td>';
print '<td class="liste_titre"></td>';
print '<td class="liste_titre center">';
if ($filterfound)
{
$searchpicto=$form->showFilterAndCheckAddButtons(0);
print $searchpicto;
}
$searchpicto=$form->showFilterButtons();
print $searchpicto;
print '</td>';
print '</tr>';
*/
// Title of lines
print '<tr class="liste_titre">';
print '<tr class="liste_titre liste_titre_add">';
foreach ($fieldlist as $field => $value)
{
// Determine le nom du champ par rapport aux noms possibles
@ -558,7 +556,7 @@ if ($id)
$valuetoshow=$langs->trans("Label");
}
if ($fieldlist[$field]=='nature') {
$valuetoshow=$langs->trans("Nature");
$valuetoshow=$langs->trans("NatureOfJournal");
}
// Affiche nom du champ

View File

@ -1622,7 +1622,11 @@ if ($id)
elseif ($obj->code == 'RECEP') { $iserasable = 0; $canbedisabled = 0; }
elseif ($obj->code == 'EF0') { $iserasable = 0; $canbedisabled = 0; }
}
if ($id == 25 && in_array($obj->code, array('banner', 'blogpost', 'other', 'page')))
{
$iserasable = 0; $canbedisabled = 0;
if (in_array($obj->code, array('banner'))) $canbedisabled = 1;
}
if (isset($obj->type) && in_array($obj->type, array('system', 'systemauto'))) { $iserasable=0; }
if (in_array($obj->code, array('AC_OTH','AC_OTH_AUTO')) || in_array($obj->type, array('systemauto'))) { $canbedisabled=0; $canbedisabled = 0; }
$canbemodified=$iserasable;

View File

@ -201,6 +201,7 @@ dol_fiche_head($head, 'holiday', $langs->trans("Holidays"), -1, 'holiday');
print load_fiche_titre($langs->trans("HolidaysNumberingModules"), '', '');
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td width="100">'.$langs->trans("Name").'</td>';
@ -294,8 +295,10 @@ foreach ($dirmodels as $reldir)
}
}
print '</table><br>';
print '</table>';
print '</div>';
print '<br>';
if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
@ -331,6 +334,7 @@ else
}
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Name").'</td>';
@ -457,6 +461,7 @@ foreach ($dirmodels as $reldir)
}
print '</table>';
print '</div>';
print "<br>";
@ -469,6 +474,8 @@ print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="set_other">';
print load_fiche_titre($langs->trans("OtherOptions"), '', '');
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Parameter").'</td>';
@ -506,6 +513,8 @@ print '<input size="50" class="flat" type="text" name="HOLIDAY_DRAFT_WATERMARK"
print '</td></tr>'."\n";
print '</table>';
print '</div>';
print '<div class="center">';
print '<input type="submit" class="button" value="'.$langs->trans("Save").'">';

View File

@ -87,7 +87,8 @@ if ($action == 'update')
$result=$menu->fetch(GETPOST('menuId', 'int'));
if ($result > 0)
{
$menu->titre=GETPOST('titre', 'alpha');
$menu->titre=GETPOST('titre', 'alpha'); // deprecated
$menu->title=GETPOST('titre', 'alpha');
$menu->leftmenu=GETPOST('leftmenu', 'aZ09');
$menu->url=GETPOST('url', 'alpha');
$menu->langs=GETPOST('langs', 'alpha');
@ -205,7 +206,8 @@ if ($action == 'add')
$menu = new Menubase($db);
$menu->menu_handler=preg_replace('/_menu$/', '', GETPOST('menu_handler', 'aZ09'));
$menu->type=GETPOST('type', 'alpha');
$menu->titre=GETPOST('titre', 'alpha');
$menu->titre=GETPOST('titre', 'alpha'); // deprecated
$menu->title=GETPOST('titre', 'alpha');
$menu->url=GETPOST('url', 'alpha');
$menu->langs=GETPOST('langs', 'alpha');
$menu->position=GETPOST('position', 'int');
@ -494,7 +496,7 @@ elseif ($action == 'edit')
//print '<tr><td>'.$langs->trans('Level').'</td><td>'.$menu->level.'</td><td>'.$langs->trans('DetailLevel').'</td></tr>';
// Title
print '<tr><td class="fieldrequired">'.$langs->trans('Title').'</td><td><input type="text" class="minwidth300" name="titre" value="'.dol_escape_htmltag($menu->titre).'"></td><td>'.$langs->trans('DetailTitre').'</td></tr>';
print '<tr><td class="fieldrequired">'.$langs->trans('Title').'</td><td><input type="text" class="minwidth300" name="titre" value="'.dol_escape_htmltag($menu->titre ? $menu->titre : $menu->title).'"></td><td>'.$langs->trans('DetailTitre').'</td></tr>';
// Url
print '<tr><td class="fieldrequired">'.$langs->trans('URL').'</td><td><input type="text" class="quatrevingtpercent" name="url" value="'.$menu->url.'"></td><td>'.$langs->trans('DetailUrl').'</td></tr>';

View File

@ -244,13 +244,13 @@ print "<br>\n";
// Confirmation for remove menu entry
if ($action == 'delete')
{
$sql = "SELECT m.titre";
$sql = "SELECT m.titre as title";
$sql.= " FROM ".MAIN_DB_PREFIX."menu as m";
$sql.= " WHERE m.rowid = ".GETPOST('menuId', 'int');
$result = $db->query($sql);
$obj = $db->fetch_object($result);
print $form->formconfirm("index.php?menu_handler=".$menu_handler."&menuId=".GETPOST('menuId', 'int'), $langs->trans("DeleteMenu"), $langs->trans("ConfirmDeleteMenu", $obj->titre), "confirm_delete");
print $form->formconfirm("index.php?menu_handler=".$menu_handler."&menuId=".GETPOST('menuId', 'int'), $langs->trans("DeleteMenu"), $langs->trans("ConfirmDeleteMenu", $obj->title), "confirm_delete");
}
$newcardbutton='';

View File

@ -70,6 +70,18 @@ else
}
print '<br>';
// Module log
print '<br>';
print '<strong>'.$langs->trans("Syslog").'</strong>: ';
$test=empty($conf->syslog->enabled);
if ($test) print img_picto('', 'tick.png').' '.$langs->trans("NotInstalled");
else
{
print img_picto('', 'warning').' '.$langs->trans("ModuleActivated", $langs->transnoentities("Syslog"));
//print ' '.$langs->trans("MoreInformation").' <a href="'.DOL_URL_ROOT.'/admin/system/xdebug.php'.'">XDebug admin page</a>';
}
print '<br>';
// Module debugbar
print '<br>';
print '<strong>'.$langs->trans("DebugBar").'</strong>: ';
@ -77,7 +89,7 @@ $test=empty($conf->debugbar->enabled);
if ($test) print img_picto('', 'tick.png').' '.$langs->trans("NotInstalled");
else
{
print img_picto('', 'warning').' '.$langs->trans("DebugBarModuleActivated");
print img_picto('', 'warning').' '.$langs->trans("ModuleActivated", $langs->transnoentities("DebugBar"));
//print ' '.$langs->trans("MoreInformation").' <a href="'.DOL_URL_ROOT.'/admin/system/xdebug.php'.'">XDebug admin page</a>';
}
print '<br>';
@ -110,20 +122,20 @@ $test=function_exists('xcache_info');
if (! $foundcache && $test)
{
$foundcache++;
print img_picto('', 'tick.png').' '.$langs->trans("XCacheInstalled");
print img_picto('', 'tick.png').' '.$langs->trans("PHPModuleLoaded", "XCache");
print ' '.$langs->trans("MoreInformation").' <a href="'.DOL_URL_ROOT.'/admin/system/xcache.php'.'">Xcache admin page</a>';
}
$test=function_exists('eaccelerator_info');
if (! $foundcache && $test)
{
$foundcache++;
print img_picto('', 'tick.png').' '.$langs->trans("EAcceleratorInstalled");
print img_picto('', 'tick.png').' '.$langs->trans("PHPModuleLoaded", "Eaccelerator");
}
$test=function_exists('opcache_get_status');
if (! $foundcache && $test)
{
$foundcache++;
print img_picto('', 'tick.png').' '.$langs->trans("ZendOPCacheInstalled"); // Should be by default starting with PHP 5.5
print img_picto('', 'tick.png').' '.$langs->trans("PHPModuleLoaded", "ZendOPCache"); // Should be by default starting with PHP 5.5
//$tmp=opcache_get_status();
//var_dump($tmp);
}
@ -144,6 +156,21 @@ if (! $foundcache && $test)
if (! $foundcache) print $langs->trans("NoOPCodeCacheFound");
print '<br>';
// Use of preload bootstrap
if (ini_get('opcache.preload'))
{
print '<br>';
print '<strong>'.$langs->trans("PreloadOPCode").'</strong>: ';
print ini_get('opcache.preload');
}
else
{
print '<br>';
print '<strong>'.$langs->trans("PreloadOPCode").'</strong>: ';
print $langs->trans("No");
}
print '<br>';
// HTTPCacheStaticResources
print '<script type="text/javascript" language="javascript">
jQuery(document).ready(function() {
@ -467,16 +494,46 @@ if ($resql)
{
if (empty($conf->global->PRODUCT_DONOTSEARCH_ANYWHERE))
{
print img_picto('', 'warning.png').' '.$langs->trans("YouHaveXProductUseSearchOptim", $nb);
print img_picto('', 'warning.png').' '.$langs->trans("YouHaveXObjectUseSearchOptim", $nb, $langs->transnoentitiesnoconv("ProductsOrServices"), 'PRODUCT_DONOTSEARCH_ANYWHERE');
}
else
{
print img_picto('', 'tick.png').' '.$langs->trans("YouHaveXProductAndSearchOptimOn", $nb);
print img_picto('', 'tick.png').' '.$langs->trans("YouHaveXObjectAndSearchOptimOn", $nb, $langs->transnoentitiesnoconv("ProductsOrServices"));
}
}
else
{
print img_picto('', 'tick.png').' '.$langs->trans("NbOfProductIsLowerThanNoPb", $nb);
print img_picto('', 'tick.png').' '.$langs->trans("NbOfObjectIsLowerThanNoPb", $nb, $langs->transnoentitiesnoconv("ProductsOrServices"));
}
print '<br>';
$db->free($resql);
}
// Thirdparty search
$tab = array();
$sql = "SELECT COUNT(*) as nb";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
$resql=$db->query($sql);
if ($resql)
{
$limitforoptim=10000;
$num=$db->num_rows($resql);
$obj=$db->fetch_object($resql);
$nb=$obj->nb;
if ($nb > $limitforoptim)
{
if (empty($conf->global->THIRDPARTY_DONOTSEARCH_ANYWHERE))
{
print img_picto('', 'warning.png').' '.$langs->trans("YouHaveXObjectUseSearchOptim", $nb, $langs->transnoentitiesnoconv("ThirdParties"), 'THIRDPARTY_DONOTSEARCH_ANYWHERE');
}
else
{
print img_picto('', 'tick.png').' '.$langs->trans("YouHaveXObjectAndSearchOptimOn", $nb, $langs->transnoentitiesnoconv("ThirdParties"));
}
}
else
{
print img_picto('', 'tick.png').' '.$langs->trans("NbOfObjectIsLowerThanNoPb", $nb, $langs->transnoentitiesnoconv("ThirdParties"));
}
print '<br>';
$db->free($resql);

View File

@ -495,7 +495,7 @@ if (is_array($blocks))
print '<td'.(preg_match('/<a/', $object_link) ? ' class="nowrap"' : '').'><!-- object_link -->'.$object_link.'</td>';
// Amount
print '<td class="right">'.price($block->amounts).'</td>';
print '<td class="right nowraponall">'.price($block->amounts).'</td>';
// Details link
print '<td align="center"><a href="#" data-blockid="'.$block->id.'" rel="show-info">'.img_info($langs->trans('ShowDetails')).'</a></td>';

View File

@ -526,6 +526,7 @@ if ($resql)
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/cactioncomm.class.php';
$caction=new CActionComm($db);
$arraylist=$caction->liste_array(1, 'code', '', (empty($conf->global->AGENDA_USE_EVENT_TYPE)?1:0), '', 1);
$contactListCache = array();
while ($i < min($num, $limit))
{
@ -645,7 +646,34 @@ if ($resql)
// Contact
if (! empty($arrayfields['a.fk_contact']['checked'])) {
print '<td>';
if ($obj->fk_contact > 0)
$actionstatic->fetchResources();
if(!empty($actionstatic->socpeopleassigned))
{
$contactList = array();
foreach ($actionstatic->socpeopleassigned as $socpeopleId => $socpeopleassigned)
{
if(!isset($contactListCache[$socpeopleassigned['id']]))
{
// if no cache found we fetch it
$contact = new Contact($db);
if($contact->fetch($socpeopleassigned['id'])>0)
{
$contactListCache[$socpeopleassigned['id']] = $contact->getNomUrl(1, '', 28);
$contactList[] = $contact->getNomUrl(1, '', 28);
}
}
else{
// use cache
$contactList[] = $contactListCache[$socpeopleassigned['id']];
}
}
if(!empty($contactList)){
print implode(', ', $contactList);
}
}
elseif ($obj->fk_contact > 0) //keep for retrocompatibility with faraway event
{
$contactstatic->id=$obj->fk_contact;
$contactstatic->email=$obj->email;

View File

@ -1330,9 +1330,9 @@ class Propal extends CommonObject
// Hook of thirdparty module
if (is_object($hookmanager))
{
$parameters=array('objFrom'=>$this,'clonedObj'=>$clonedObj);
$parameters=array('objFrom'=>$this,'clonedObj'=>$object);
$action='';
$reshook=$hookmanager->executeHooks('createFrom', $parameters, $clonedObj, $action); // Note that $action and $object may have been modified by some hooks
$reshook=$hookmanager->executeHooks('createFrom', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) $error++;
}
}

View File

@ -1519,11 +1519,11 @@ if ($action == 'create' && $user->rights->commande->creer)
if ($element == 'order' || $element == 'commande') {
$element = $subelement = 'commande';
}
if ($element == 'propal') {
elseif ($element == 'propal') {
$element = 'comm/propal';
$subelement = 'propal';
}
if ($element == 'contract') {
elseif ($element == 'contract') {
$element = $subelement = 'contrat';
}

View File

@ -2773,7 +2773,7 @@ if ($action == 'create')
$note_public = $invoice_predefined->note_public;
$note_private = $invoice_predefined->note_private;
$sql = 'SELECT r.rowid, r.titre, r.total_ttc';
$sql = 'SELECT r.rowid, r.titre as title, r.total_ttc';
$sql .= ' FROM ' . MAIN_DB_PREFIX . 'facture_rec as r';
$sql .= ' WHERE r.fk_soc = ' . $invoice_predefined->socid;
@ -2797,7 +2797,7 @@ if ($action == 'create')
print ' selected';
$exampletemplateinvoice->fetch(GETPOST('fac_rec'));
}
print '>' . $objp->titre . ' (' . price($objp->total_ttc) . ' ' . $langs->trans("TTC") . ')</option>';
print '>' . $objp->title . ' (' . price($objp->total_ttc) . ' ' . $langs->trans("TTC") . ')</option>';
$i ++;
}
print '</select>';

View File

@ -123,7 +123,8 @@ class FactureRec extends CommonInvoice
$now=dol_now();
// Clean parameters
$this->titre=trim($this->titre);
$this->titre=trim($this->titre); // deprecated
$this->title=trim($this->title);
$this->usenewprice=empty($this->usenewprice)?0:$this->usenewprice;
if (empty($this->suspended)) $this->suspended=0;
@ -180,7 +181,7 @@ class FactureRec extends CommonInvoice
$sql.= ", multicurrency_tx";
$sql.= ", suspended";
$sql.= ") VALUES (";
$sql.= "'".$this->db->escape($this->titre)."'";
$sql.= "'".$this->db->escape($this->titre ? $this->titre : $this->title)."'";
$sql.= ", ".$facsrc->socid;
$sql.= ", ".$conf->entity;
$sql.= ", '".$this->db->idate($now)."'";
@ -376,7 +377,7 @@ class FactureRec extends CommonInvoice
*/
public function fetch($rowid, $ref = '', $ref_ext = '', $ref_int = '')
{
$sql = 'SELECT f.rowid, f.entity, f.titre, f.suspended, f.fk_soc, f.amount, f.tva, f.localtax1, f.localtax2, f.total, f.total_ttc';
$sql = 'SELECT f.rowid, f.entity, f.titre as title, f.suspended, f.fk_soc, f.amount, f.tva, f.localtax1, f.localtax2, f.total, f.total_ttc';
$sql.= ', f.remise_percent, f.remise_absolue, f.remise';
$sql.= ', f.date_lim_reglement as dlr';
$sql.= ', f.note_private, f.note_public, f.fk_user_author';
@ -410,8 +411,9 @@ class FactureRec extends CommonInvoice
$this->id = $obj->rowid;
$this->entity = $obj->entity;
$this->titre = $obj->titre;
$this->ref = $obj->titre;
$this->titre = $obj->title; // deprecated
$this->title = $obj->title;
$this->ref = $obj->title;
$this->ref_client = $obj->ref_client;
$this->suspended = $obj->suspended;
$this->type = $obj->type;

View File

@ -187,7 +187,8 @@ if (empty($reshook))
if (! $error)
{
$object->titre = GETPOST('titre', 'alpha');
$object->titre = GETPOST('titre', 'alpha'); // deprecated
$object->title = GETPOST('titre', 'alpha');
$object->note_private = GETPOST('note_private', 'none');
$object->note_public = GETPOST('note_public', 'none');
$object->modelpdf = GETPOST('modelpdf', 'alpha');
@ -295,8 +296,9 @@ if (empty($reshook))
$result=$object->setValueFrom('titre', GETPOST('ref', 'alpha'), '', null, 'text', '', $user, 'BILLREC_MODIFY');
if ($result > 0)
{
$object->titre = GETPOST('ref', 'alpha');
$object->ref = $object->titre;
$object->titre = GETPOST('ref', 'alpha'); // deprecated
$object->title = GETPOST('ref', 'alpha');
$object->ref = $object->title;
}
else dol_print_error($db, $object->error, $object->errors);
}

View File

@ -213,7 +213,7 @@ $today = dol_mktime(23, 59, 59, $tmparray['mon'], $tmparray['mday'], $tmparray['
/*
* List mode
*/
$sql = "SELECT s.nom as name, s.rowid as socid, f.rowid as facid, f.titre, f.total, f.tva as total_vat, f.total_ttc, f.frequency, f.unit_frequency,";
$sql = "SELECT s.nom as name, s.rowid as socid, f.rowid as facid, f.titre as title, f.total, f.tva as total_vat, f.total_ttc, f.frequency, f.unit_frequency,";
$sql.= " f.nb_gen_done, f.nb_gen_max, f.date_last_gen, f.date_when, f.suspended,";
$sql.= " f.datec, f.tms,";
$sql.= " f.fk_cond_reglement, f.fk_mode_reglement";
@ -514,7 +514,7 @@ if ($resql)
$invoicerectmp->unit_frequency=$objp->unit_frequency;
$invoicerectmp->nb_gen_max=$objp->nb_gen_max;
$invoicerectmp->nb_gen_done=$objp->nb_gen_done;
$invoicerectmp->ref=$objp->titre;
$invoicerectmp->ref=$objp->title;
print '<tr class="oddeven">';

View File

@ -62,42 +62,52 @@ if ($id > 0 || ! empty($ref))
}
}
$hookmanager->initHooks(array('directdebitcard','globalcard'));
/*
* Actions
*/
if ($action == "new")
$parameters = array('socid' => $socid);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
if (empty($reshook))
{
if ($object->id > 0)
if ($action == "new")
{
$db->begin();
$result = $object->demande_prelevement($user, GETPOST('withdraw_request_amount'));
if ($result > 0)
if ($object->id > 0)
{
$db->commit();
$db->begin();
setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
}
else
{
$db->rollback();
setEventMessages($object->error, $object->errors, 'errors');
$result = $object->demande_prelevement($user, GETPOST('withdraw_request_amount'));
if ($result > 0)
{
$db->commit();
setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
}
else
{
$db->rollback();
setEventMessages($object->error, $object->errors, 'errors');
}
}
$action='';
}
$action='';
}
if ($action == "delete")
{
if ($object->id > 0)
if ($action == "delete")
{
$result = $object->demande_prelevement_delete($user, GETPOST('did'));
if ($result == 0)
if ($object->id > 0)
{
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
exit;
$result = $object->demande_prelevement_delete($user, GETPOST('did'));
if ($result == 0)
{
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
exit;
}
}
}
}

View File

@ -1133,32 +1133,56 @@ class BonPrelevement extends CommonObject
/**
* Get object and lines from database
* Get object and lines from database
*
* @param User $user Object user that delete
* @return int >0 if OK, <0 if KO
* @param int $notrigger 1=Does not execute triggers, 0= execute triggers
* @return int >0 if OK, <0 if KO
*/
public function delete($user = null)
public function delete($user = null, $notrigger = 0)
{
$this->db->begin();
$sql = "DELETE FROM ".MAIN_DB_PREFIX."prelevement_facture WHERE fk_prelevement_lignes IN (SELECT rowid FROM ".MAIN_DB_PREFIX."prelevement_lignes WHERE fk_prelevement_bons = ".$this->id.")";
$resql1=$this->db->query($sql);
if (! $resql1) dol_print_error($this->db);
$error = 0;
$resql1 = $resql2 = $resql3 = $resql4 = 0;
$sql = "DELETE FROM ".MAIN_DB_PREFIX."prelevement_lignes WHERE fk_prelevement_bons = ".$this->id;
$resql2=$this->db->query($sql);
if (! $resql2) dol_print_error($this->db);
if (! $notrigger)
{
// Call trigger
$result=$this->call_trigger('BON_PRELEVEMENT_DELETE', $user);
if ($result < 0) $error++;
// End call triggers
}
$sql = "DELETE FROM ".MAIN_DB_PREFIX."prelevement_bons WHERE rowid = ".$this->id;
$resql3=$this->db->query($sql);
if (! $resql3) dol_print_error($this->db);
if (! $error)
{
$sql = "DELETE FROM ".MAIN_DB_PREFIX."prelevement_facture WHERE fk_prelevement_lignes IN (SELECT rowid FROM ".MAIN_DB_PREFIX."prelevement_lignes WHERE fk_prelevement_bons = ".$this->id.")";
$resql1=$this->db->query($sql);
if (! $resql1) dol_print_error($this->db);
}
$sql = "UPDATE ".MAIN_DB_PREFIX."prelevement_facture_demande SET fk_prelevement_bons = NULL, traite = 0 WHERE fk_prelevement_bons = ".$this->id;
$resql4=$this->db->query($sql);
if (! $resql4) dol_print_error($this->db);
if (! $error)
{
$sql = "DELETE FROM ".MAIN_DB_PREFIX."prelevement_lignes WHERE fk_prelevement_bons = ".$this->id;
$resql2=$this->db->query($sql);
if (! $resql2) dol_print_error($this->db);
}
if ($resql1 && $resql2 && $resql3)
if (! $error)
{
$sql = "DELETE FROM ".MAIN_DB_PREFIX."prelevement_bons WHERE rowid = ".$this->id;
$resql3=$this->db->query($sql);
if (! $resql3) dol_print_error($this->db);
}
if (! $error)
{
$sql = "UPDATE ".MAIN_DB_PREFIX."prelevement_facture_demande SET fk_prelevement_bons = NULL, traite = 0 WHERE fk_prelevement_bons = ".$this->id;
$resql4=$this->db->query($sql);
if (! $resql4) dol_print_error($this->db);
}
if ($resql1 && $resql2 && $resql3 && $resql4 && ! $error)
{
$this->db->commit();
return 1;

View File

@ -52,42 +52,52 @@ $page = GETPOST("page", 'int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $limit * $page;
$hookmanager->initHooks(array('directdebitcreatecard','globalcard'));
/*
* Actions
*/
// Change customer bank information to withdraw
if ($action == 'modify')
{
for ($i = 1 ; $i < 9 ; $i++)
{
dolibarr_set_const($db, GETPOST("nom$i"), GETPOST("value$i"), 'chaine', 0, '', $conf->entity);
}
}
if ($action == 'create')
{
// $conf->global->PRELEVEMENT_CODE_BANQUE and $conf->global->PRELEVEMENT_CODE_GUICHET should be empty
$bprev = new BonPrelevement($db);
$executiondate = dol_mktime(0, 0, 0, GETPOST('remonth'), (GETPOST('reday')+$conf->global->PRELEVEMENT_ADDDAYS), GETPOST('reyear'));
$parameters = array('mode' => $mode, 'format' => $format, 'limit' => $limit, 'page' => $page, 'offset' => $offset);
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
$result = $bprev->create($conf->global->PRELEVEMENT_CODE_BANQUE, $conf->global->PRELEVEMENT_CODE_GUICHET, $mode, $format, $executiondate);
if ($result < 0)
if (empty($reshook))
{
// Change customer bank information to withdraw
if ($action == 'modify')
{
setEventMessages($bprev->error, $bprev->errors, 'errors');
}
elseif ($result == 0)
{
$mesg=$langs->trans("NoInvoiceCouldBeWithdrawed", $format);
setEventMessages($mesg, null, 'errors');
$mesg.='<br>'."\n";
foreach($bprev->invoice_in_error as $key => $val)
for ($i = 1 ; $i < 9 ; $i++)
{
$mesg.='<span class="warning">'.$val."</span><br>\n";
dolibarr_set_const($db, GETPOST("nom$i"), GETPOST("value$i"), 'chaine', 0, '', $conf->entity);
}
}
else
if ($action == 'create')
{
setEventMessages($langs->trans("DirectDebitOrderCreated", $bprev->getNomUrl(1)), null);
// $conf->global->PRELEVEMENT_CODE_BANQUE and $conf->global->PRELEVEMENT_CODE_GUICHET should be empty
$bprev = new BonPrelevement($db);
$executiondate = dol_mktime(0, 0, 0, GETPOST('remonth'), (GETPOST('reday')+$conf->global->PRELEVEMENT_ADDDAYS), GETPOST('reyear'));
$result = $bprev->create($conf->global->PRELEVEMENT_CODE_BANQUE, $conf->global->PRELEVEMENT_CODE_GUICHET, $mode, $format, $executiondate);
if ($result < 0)
{
setEventMessages($bprev->error, $bprev->errors, 'errors');
}
elseif ($result == 0)
{
$mesg=$langs->trans("NoInvoiceCouldBeWithdrawed", $format);
setEventMessages($mesg, null, 'errors');
$mesg.='<br>'."\n";
foreach($bprev->invoice_in_error as $key => $val)
{
$mesg.='<span class="warning">'.$val."</span><br>\n";
}
}
else
{
setEventMessages($langs->trans("DirectDebitOrderCreated", $bprev->getNomUrl(1)), null);
}
}
}

View File

@ -11,7 +11,7 @@
* Copyright (C) 2016 Bahfir abbes <dolipar@dolipar.org>
* Copyright (C) 2017 ATM Consulting <support@atm-consulting.fr>
* Copyright (C) 2017-2019 Nicolas ZABOURI <info@inovea-conseil.com>
* Copyright (C) 2017 Rui Strecht <rui.strecht@aliartalentos.com>
* Copyright (C) 2017 Rui Strecht <rui.strecht@aliartalentos.com>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018 Josep Lluís Amador <joseplluis@lliuretic.cat>
*
@ -53,6 +53,7 @@ abstract class CommonObject
/**
* @var string Error string
* @see $errors
*/
public $error;

View File

@ -2594,7 +2594,7 @@ class Form
}
$opt.= "</option>\n";
$optJson = array('key'=>$outkey, 'value'=>$outref, 'label'=>$outval, 'label2'=>$outlabel, 'desc'=>$outdesc, 'type'=>$outtype, 'price_ht'=>$outprice_ht, 'price_ttc'=>$outprice_ttc, 'pricebasetype'=>$outpricebasetype, 'tva_tx'=>$outtva_tx, 'qty'=>$outqty, 'discount'=>$outdiscount, 'duration_value'=>$outdurationvalue, 'duration_unit'=>$outdurationunit);
$optJson = array('key'=>$outkey, 'value'=>$outref, 'label'=>$outval, 'label2'=>$outlabel, 'desc'=>$outdesc, 'type'=>$outtype, 'price_ht'=>price2num($outprice_ht), 'price_ttc'=>price2num($outprice_ttc), 'pricebasetype'=>$outpricebasetype, 'tva_tx'=>$outtva_tx, 'qty'=>$outqty, 'discount'=>$outdiscount, 'duration_value'=>$outdurationvalue, 'duration_unit'=>$outdurationunit);
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps

View File

@ -422,7 +422,8 @@ class Menubase
$this->position='';
$this->url='http://dummy';
$this->target='';
$this->titre='Specimen menu';
$this->titre='Specimen menu'; // deprecated
$this->title='Specimen menu';
$this->langs='';
$this->level='';
$this->leftmenu='';

View File

@ -185,7 +185,7 @@ function dolWebsiteOutput($content)
global $db, $langs, $conf, $user;
global $dolibarr_main_url_root, $dolibarr_main_data_root;
dol_syslog("dolWebsiteOutput start (USEDOLIBARRSERVER=".(defined('USEDOLIBARRSERVER')?'1':'')." (USEDOLIBARREDITOR=".(defined('USEDOLIBARREDITOR')?'1':'').')');
dol_syslog("dolWebsiteOutput start (USEDOLIBARRSERVER=".(defined('USEDOLIBARRSERVER')?'1':'')." USEDOLIBARREDITOR=".(defined('USEDOLIBARREDITOR')?'1':'').')');
// Define $urlwithroot
$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));

View File

@ -1938,7 +1938,8 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
$menu->type=$this->menu[$key]['type'];
$menu->mainmenu=isset($this->menu[$key]['mainmenu'])?$this->menu[$key]['mainmenu']:(isset($menu->fk_mainmenu)?$menu->fk_mainmenu:'');
$menu->leftmenu=isset($this->menu[$key]['leftmenu'])?$this->menu[$key]['leftmenu']:'';
$menu->titre=$this->menu[$key]['titre'];
$menu->titre=$this->menu[$key]['titre']; // deprecated
$menu->title=$this->menu[$key]['titre'];
$menu->url=$this->menu[$key]['url'];
$menu->langs=$this->menu[$key]['langs'];
$menu->position=$this->menu[$key]['position'];

View File

@ -24,7 +24,7 @@
* $backtopage URL to come back to from discount modification pages
*/
$classname = get_class($object);
$objclassname = get_class($object);
$isInvoice = in_array($object->element, array('facture', 'invoice', 'facture_fourn', 'invoice_supplier'));
$isNewObject = empty($object->id) && empty($object->rowid);
@ -53,11 +53,11 @@ if($isNewObject) print ' ('.$addrelativediscount.')';
// Is there is commercial discount or down payment available ?
if ($absolute_discount > 0) {
if ($cannotApplyDiscount || ! $isInvoice || $isNewObject || $object->statut > $classname::STATUS_DRAFT || $object->type == $classname::TYPE_CREDIT_NOTE || $object->type == $classname::TYPE_DEPOSIT) {
if ($cannotApplyDiscount || ! $isInvoice || $isNewObject || $object->statut > $objclassname::STATUS_DRAFT || $object->type == $objclassname::TYPE_CREDIT_NOTE || $object->type == $objclassname::TYPE_DEPOSIT) {
$translationKey = ! empty($discount_type) ? 'HasAbsoluteDiscountFromSupplier' : 'CompanyHasAbsoluteDiscount';
$text = $langs->trans($translationKey, price($absolute_discount), $langs->transnoentities("Currency" . $conf->currency)).'.';
if ($isInvoice && ! $isNewObject && $object->statut > $classname::STATUS_DRAFT && $object->type != $classname::TYPE_CREDIT_NOTE && $object->type != $classname::TYPE_DEPOSIT) {
if ($isInvoice && ! $isNewObject && $object->statut > $objclassname::STATUS_DRAFT && $object->type != $objclassname::TYPE_CREDIT_NOTE && $object->type != $objclassname::TYPE_DEPOSIT) {
$text = $form->textwithpicto($text, $langs->trans('AbsoluteDiscountUse'));
}
@ -77,11 +77,11 @@ if ($absolute_discount > 0) {
if ($absolute_creditnote > 0) {
// If validated, we show link "add credit note to payment"
if ($cannotApplyDiscount || ! $isInvoice || $isNewObject || $object->statut != $classname::STATUS_VALIDATED || $object->type == $classname::TYPE_CREDIT_NOTE) {
if ($cannotApplyDiscount || ! $isInvoice || $isNewObject || $object->statut != $objclassname::STATUS_VALIDATED || $object->type == $objclassname::TYPE_CREDIT_NOTE) {
$translationKey = ! empty($discount_type) ? 'HasCreditNoteFromSupplier' : 'CompanyHasCreditNote';
$text = $langs->trans($translationKey, price($absolute_creditnote), $langs->transnoentities("Currency" . $conf->currency)) . '.';
if ($isInvoice && ! $isNewObject && $object->statut == $classname::STATUS_DRAFT && $object->type != $classname::TYPE_DEPOSIT) {
if ($isInvoice && ! $isNewObject && $object->statut == $objclassname::STATUS_DRAFT && $object->type != $objclassname::TYPE_DEPOSIT) {
$text = $form->textwithpicto($text, $langs->trans('CreditNoteDepositUse'));
}
@ -101,7 +101,7 @@ if($absolute_discount <= 0 && $absolute_creditnote <= 0) {
$translationKey = ! empty($discount_type) ? 'HasNoAbsoluteDiscountFromSupplier' : 'CompanyHasNoAbsoluteDiscount';
print '<br>'.$langs->trans($translationKey).'.';
if ($isInvoice && $object->statut == $classname::STATUS_DRAFT && $object->type != $classname::TYPE_CREDIT_NOTE && $object->type != $classname::TYPE_DEPOSIT) {
if ($isInvoice && $object->statut == $objclassname::STATUS_DRAFT && $object->type != $objclassname::TYPE_CREDIT_NOTE && $object->type != $objclassname::TYPE_DEPOSIT) {
print ' (' . $addabsolutediscount . ')';
}
}

View File

@ -467,7 +467,8 @@ if (empty($reshook))
elseif ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->expedition->supprimer)
{
$result = $object->delete();
$also_update_stock = (GETPOST('alsoUpdateStock', 'alpha') ? 1 : 0);
$result = $object->delete(0, $also_update_stock);
if ($result > 0)
{
header("Location: ".DOL_URL_ROOT.'/expedition/index.php');
@ -1642,7 +1643,26 @@ elseif ($id || $ref)
// Confirm deleteion
if ($action == 'delete')
{
$formconfirm=$form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id, $langs->trans('DeleteSending'), $langs->trans("ConfirmDeleteSending", $object->ref), 'confirm_delete', '', 0, 1);
$formquestion = array();
if ($object->statut == Expedition::STATUS_CLOSED && !empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE)) {
$formquestion = array(
array(
'label' => $langs->trans('ShipmentIncrementStockOnDelete'),
'name' => 'alsoUpdateStock',
'type' => 'checkbox',
'value' => 0
),
);
}
$formconfirm=$form->formconfirm(
$_SERVER['PHP_SELF'].'?id='.$object->id,
$langs->trans('DeleteSending'),
$langs->trans("ConfirmDeleteSending", $object->ref),
'confirm_delete',
$formquestion,
0,
1
);
}
// Confirmation validation

View File

@ -1149,10 +1149,11 @@ class Expedition extends CommonObject
* Delete shipment.
* Warning, do not delete a shipment if a delivery is linked to (with table llx_element_element)
*
* @param int $notrigger Disable triggers
* @return int >0 if OK, 0 if deletion done but failed to delete files, <0 if KO
* @param int $notrigger Disable triggers
* @param bool $also_update_stock true if the stock should be increased back (false by default)
* @return int >0 if OK, 0 if deletion done but failed to delete files, <0 if KO
*/
public function delete($notrigger = 0)
public function delete($notrigger = 0, $also_update_stock = false)
{
global $conf, $langs, $user;
@ -1184,7 +1185,9 @@ class Expedition extends CommonObject
}
// Stock control
if (! $error && $conf->stock->enabled && $conf->global->STOCK_CALCULATE_ON_SHIPMENT && $this->statut > self::STATUS_DRAFT)
if (! $error && $conf->stock->enabled &&
(($conf->global->STOCK_CALCULATE_ON_SHIPMENT && $this->statut > self::STATUS_DRAFT) ||
($conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE && $this->statut == self::STATUS_CLOSED && $also_update_stock)))
{
require_once DOL_DOCUMENT_ROOT."/product/stock/class/mouvementstock.class.php";

View File

@ -129,7 +129,7 @@ if ($action == 'add') {
if (! $error) {
$object->id_origin = $id;
$object->titre = GETPOST('titre', 'alpha');
$object->title = GETPOST('titre', 'alpha');
$object->description = GETPOST('description', 'alpha');
$object->socid = GETPOST('socid', 'alpha');
$object->fk_project = GETPOST('projectid', 'int');
@ -773,7 +773,7 @@ $date_next_execution = (GETPOST('remonth') ? dol_mktime(
/*
* List mode
*/
$sql = "SELECT f.rowid as fich_rec, s.nom as name, s.rowid as socid, f.rowid as facid, f.titre,";
$sql = "SELECT f.rowid as fich_rec, s.nom as name, s.rowid as socid, f.rowid as facid, f.titre as title,";
$sql.= " f.duree, f.fk_contrat, f.fk_projet as fk_project, f.frequency, f.nb_gen_done, f.nb_gen_max,";
$sql.= " f.date_last_gen, f.date_when, f.datec";
@ -844,7 +844,7 @@ $date_next_execution = (GETPOST('remonth') ? dol_mktime(
print '<tr class="oddeven">';
print '<td><a href="'.$_SERVER['PHP_SELF'].'?id='.$objp->fich_rec.'">';
print img_object($langs->trans("ShowIntervention"), "intervention").' '.$objp->titre;
print img_object($langs->trans("ShowIntervention"), "intervention").' '.$objp->title;
print "</a></td>\n";
if ($objp->socid) {
$companystatic->id=$objp->socid;

View File

@ -1538,7 +1538,7 @@ class CommandeFournisseur extends CommonOrder
$desc=trim($desc);
// Check parameters
if ($qty < 1 && ! $fk_product)
if ($qty < 0 && ! $fk_product)
{
$this->error=$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Product"));
return -1;

View File

@ -430,8 +430,8 @@ class ProductFournisseur extends Product
$sql .= " " . $newnpr . ",";
$sql .= $conf->entity . ",";
$sql .= $delivery_time_days . ",";
$sql .= (empty($supplier_reputation) ? 'NULL' : "'" . $this->db->escape($supplier_reputation) . "'");
$sql .= (empty($barcode) ? 'NULL' : "'" . $this->db->escape($barcode) . "'");
$sql .= (empty($supplier_reputation) ? 'NULL' : "'" . $this->db->escape($supplier_reputation) . "'") . ",";
$sql .= (empty($barcode) ? 'NULL' : "'" . $this->db->escape($barcode) . "'") . ",";
$sql .= (empty($fk_barcode_type) ? 'NULL' : "'" . $this->db->escape($fk_barcode_type) . "'");
$sql .= ")";
@ -462,7 +462,8 @@ class ProductFournisseur extends Product
if (empty($error)) {
$this->db->commit();
return $idinserted;
$this->product_fourn_price_id = $idinserted;
return $this->product_fourn_price_id;
} else {
$this->db->rollback();
return -1;

View File

@ -494,11 +494,35 @@ if ($id > 0 || ! empty($ref)) {
$sql = "SELECT l.rowid, l.fk_product, l.subprice, l.remise_percent, l.ref AS sref, SUM(l.qty) as qty,";
$sql .= " p.ref, p.label, p.tobatch, p.fk_default_warehouse";
// Enable hooks to alter the SQL query (SELECT)
$parameters = array();
$reshook = $hookmanager->executeHooks(
'printFieldListSelect',
$parameters,
$object,
$action
);
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
$sql .= $hookmanager->resPrint;
$sql .= " FROM " . MAIN_DB_PREFIX . "commande_fournisseurdet as l";
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON l.fk_product=p.rowid";
$sql .= " WHERE l.fk_commande = " . $object->id;
if (empty($conf->global->STOCK_SUPPORTS_SERVICES))
$sql .= " AND l.product_type = 0";
// Enable hooks to alter the SQL query (WHERE)
$parameters = array();
$reshook = $hookmanager->executeHooks(
'printFieldListWhere',
$parameters,
$object,
$action
);
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
$sql .= $hookmanager->resPrint;
$sql .= " GROUP BY p.ref, p.label, p.tobatch, l.rowid, l.fk_product, l.subprice, l.remise_percent, p.fk_default_warehouse"; // Calculation of amount dispatched is done per fk_product so we must group by fk_product
$sql .= " ORDER BY p.ref, p.label";
@ -528,7 +552,19 @@ if ($id > 0 || ! empty($ref)) {
print '<td class="right">' . $langs->trans("QtyDispatchedShort") . '</td>';
print '<td class="right">' . $langs->trans("QtyToDispatchShort") . '</td>';
print '<td width="32"></td>';
print '<td class="right">' . $langs->trans("Warehouse") . '</td>';
print '<td align="right">' . $langs->trans("Warehouse") . '</td>';
// Enable hooks to append additional columns
$parameters = array();
$reshook = $hookmanager->executeHooks(
'printFieldListTitle',
$parameters,
$object,
$action
);
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
print $hookmanager->resPrint;
print "</tr>\n";
}
@ -611,6 +647,23 @@ if ($id > 0 || ! empty($ref)) {
//print img_picto($langs->trans('AddDispatchBatchLine'), 'split.png', 'onClick="addDispatchLine(' . $i . ',\'' . $type . '\')"');
print '</td>'; // Dispatch column
print '<td></td>'; // Warehouse column
// Enable hooks to append additional columns
$parameters = array(
'is_information_row' => true, // allows hook to distinguish between the
// rows with information and the rows with
// dispatch form input
'objp' => $objp
);
$reshook = $hookmanager->executeHooks(
'printFieldListValue',
$parameters,
$object,
$action
);
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
print $hookmanager->resPrint;
print '</tr>';
print '<tr class="oddeven" name="' . $type . $suffix . '">';
@ -651,6 +704,23 @@ if ($id > 0 || ! empty($ref)) {
//print img_picto($langs->trans('AddStockLocationLine'), 'split.png', 'onClick="addDispatchLine(' . $i . ',\'' . $type . '\')"');
print '</td>'; // Dispatch column
print '<td></td>'; // Warehouse column
// Enable hooks to append additional columns
$parameters = array(
'is_information_row' => true, // allows hook to distinguish between the
// rows with information and the rows with
// dispatch form input
'objp' => $objp
);
$reshook = $hookmanager->executeHooks(
'printFieldListValue',
$parameters,
$object,
$action
);
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
print $hookmanager->resPrint;
print '</tr>';
print '<tr class="oddeven" name="' . $type . $suffix . '">';
@ -702,6 +772,19 @@ if ($id > 0 || ! empty($ref)) {
}
print "</td>\n";
// Enable hooks to append additional columns
$parameters = array(
'is_information_row' => false // this is a dispatch form row
);
$reshook = $hookmanager->executeHooks(
'printFieldListValue',
$parameters,
$object,
$action
);
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
print $hookmanager->resPrint;
print "</tr>\n";
}
}

View File

@ -75,6 +75,7 @@ if (GETPOST('cancel', 'alpha')) { $action='list'; $massaction=''; }
if (! GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
$parameters=array();
$reshook=$hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
@ -129,6 +130,11 @@ $massactionbutton=$form->selectMassAction('', $arrayofmassactions);
$sql = "SELECT p.rowid, p.label, p.ref, p.fk_product_type, p.entity,";
$sql.= " ppf.fk_soc, ppf.ref_fourn, ppf.price as price, ppf.quantity as qty, ppf.unitprice,";
$sql.= " s.rowid as socid, s.nom as name";
// Add fields to SELECT from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object, $action);
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
$sql .= $hookmanager->resPrint;
$sql.= " FROM ".MAIN_DB_PREFIX."product as p";
if ($catid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON cp.fk_product = p.rowid";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as ppf ON p.rowid = ppf.fk_product";
@ -159,6 +165,12 @@ if ($fourn_id > 0)
$sql .= " AND ppf.fk_soc = ".$fourn_id;
}
// Add WHERE filters from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters);
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
$sql .= $hookmanager->resPrint;
$sql .= $db->order($sortfield, $sortorder);
// Count total nb of records without orderby and limit
@ -243,6 +255,11 @@ if ($resql)
print '<td></td>';
print '<td></td>';
print '<td></td>';
// add filters from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action);
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
print $hookmanager->resPrint;
print '<td class="liste_titre maxwidthsearch">';
$searchpicto=$form->showFilterButtons();
print $searchpicto;
@ -258,6 +275,11 @@ if ($resql)
print_liste_field_titre("BuyingPrice", $_SERVER["PHP_SELF"], "ppf.price", $param, "", '', $sortfield, $sortorder, 'right ');
print_liste_field_titre("QtyMin", $_SERVER["PHP_SELF"], "ppf.quantity", $param, "", '', $sortfield, $sortorder, 'right ');
print_liste_field_titre("UnitPrice", $_SERVER["PHP_SELF"], "ppf.unitprice", $param, "", '', $sortfield, $sortorder, 'right ');
// add header cells from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action);
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
print $hookmanager->resPrint;
print_liste_field_titre('', $_SERVER["PHP_SELF"]);
print "</tr>\n";
@ -293,6 +315,12 @@ if ($resql)
print '<td class="right">'.(isset($objp->unitprice) ? price($objp->unitprice) : '').'</td>';
// add additional columns from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $objp, $action);
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
print $hookmanager->resPrint;
print '<td class="right"></td>';
print "</tr>\n";

View File

@ -144,9 +144,11 @@ class Escpos {
/**
* @var PrintConnector
* @CHANGE
*/
private $connector;
protected $connector;
// private $connector;
/**
* @var AbstractCapabilityProfile
*/

View File

@ -28,6 +28,10 @@
-- Note: fields with type BLOB/TEXT can't have default value.
-- Missing in v10
ALTER TABLE llx_account_bookkeeping ADD COLUMN date_export datetime DEFAULT NULL;
create table llx_entrepot_extrafields
(
rowid integer AUTO_INCREMENT PRIMARY KEY,

View File

@ -265,7 +265,7 @@ AccountingJournals=Accounting journals
AccountingJournal=Accounting journal
NewAccountingJournal=New accounting journal
ShowAccoutingJournal=Show accounting journal
Nature=Nature
NatureOfJournal=Nature of Journal
AccountingJournalType1=Miscellaneous operations
AccountingJournalType2=Sales
AccountingJournalType3=Purchases

View File

@ -574,7 +574,7 @@ Module510Name=Salaries
Module510Desc=Record and track employee payments
Module520Name=Loans
Module520Desc=Management of loans
Module600Name=Notifications
Module600Name=Notifications on business event
Module600Desc=Send email notifications triggered by a business event: per user (setup defined on each user), per third-party contacts (setup defined on each third party) or by specific emails
Module600Long=Note that this module sends emails in real-time when a specific business event occurs. If you are looking for a feature to send email reminders for agenda events, go into the setup of module Agenda.
Module610Name=Product Variants
@ -1221,13 +1221,14 @@ SuhosinSessionEncrypt=Session storage encrypted by Suhosin
ConditionIsCurrently=Condition is currently %s
YouUseBestDriver=You use driver %s which is the best driver currently available.
YouDoNotUseBestDriver=You use driver %s but driver %s is recommended.
NbOfProductIsLowerThanNoPb=You have only %s products/services in the database. This does not require any particular optimization.
NbOfObjectIsLowerThanNoPb=You have only %s %s in the database. This does not require any particular optimization.
SearchOptim=Search optimization
YouHaveXProductUseSearchOptim=You have %s products in the database. You should add the constant PRODUCT_DONOTSEARCH_ANYWHERE to 1 in Home-Setup-Other. Limit the search to the beginning of strings which makes it possible for the database to use indexes and you should get an immediate response.
YouHaveXObjectUseSearchOptim=You have %s %s in the database. You should add the constant %s to 1 in Home-Setup-Other. Limit the search to the beginning of strings which makes it possible for the database to use indexes and you should get an immediate response.
YouHaveXObjectAndSearchOptimOn=You have %s %s in the database and constant %s is set to 1 in Home-Setup-Other.
BrowserIsOK=You are using the %s web browser. This browser is ok for security and performance.
BrowserIsKO=You are using the %s web browser. This browser is known to be a bad choice for security, performance and reliability. We recommend using Firefox, Chrome, Opera or Safari.
XDebugInstalled=XDebug is loaded.
XCacheInstalled=XCache is loaded.
PHPModuleLoaded=PHP component %s is loaded
PreloadOPCode=Preloaded OPCode is used
AddRefInList=Display Customer/Vendor ref. info list (select list or combobox) and most of hyperlink.<br>Third Parties will appear with a name format of "CC12345 - SC45678 - The Big Company corp." instead of "The Big Company corp".
AddAdressInList=Display Customer/Vendor adress info list (select list or combobox)<br>Third Parties will appear with a name format of "The Big Company corp. - 21 jump street 123456 Big town - USA" instead of "The Big Company corp".
AskForPreferredShippingMethod=Ask for preferred shipping method for Third Parties.
@ -1735,9 +1736,9 @@ ExpenseReportsRulesSetup=Setup of module Expense Reports - Rules
ExpenseReportNumberingModules=Expense reports numbering module
NoModueToManageStockIncrease=No module able to manage automatic stock increase has been activated. Stock increase will be done on manual input only.
YouMayFindNotificationsFeaturesIntoModuleNotification=You may find options for email notifications by enabling and configuring the module "Notification".
ListOfNotificationsPerUser=List of notifications per user*
ListOfNotificationsPerUserOrContact=List of notifications (events) available per user* or per contact**
ListOfFixedNotifications=List of Fixed Notifications
ListOfNotificationsPerUser=List of automatic notifications per user*
ListOfNotificationsPerUserOrContact=List of possible automatic notifications (on business event) available per user* or per contact**
ListOfFixedNotifications=List of automatic fixed notifications
GoOntoUserCardToAddMore=Go to the tab "Notifications" of a user to add or remove notifications for users
GoOntoContactCardToAddMore=Go on the tab "Notifications" of a third party to add or remove notifications for contacts/addresses
Threshold=Threshold
@ -1912,7 +1913,7 @@ LogsLinesNumber=Number of lines to show on logs tab
UseDebugBar=Use the debug bar
DEBUGBAR_LOGS_LINES_NUMBER=Number of last log lines to keep in console
WarningValueHigherSlowsDramaticalyOutput=Warning, higher values slows dramaticaly output
DebugBarModuleActivated=Module debugbar is activated and slows dramaticaly the interface
ModuleActivated=Module %s is activated and slows the interface
EXPORTS_SHARE_MODELS=Export models are share with everybody
ExportSetup=Setup of module Export
InstanceUniqueID=Unique ID of the instance

View File

@ -60,6 +60,8 @@ NoProductToShipFoundIntoStock=Aucun produit à expédier n'a été trouver dans
WeightVolShort=Poids/vol.
ValidateOrderFirstBeforeShipment=Vous devez d'abord valider la commande pour pouvoir créer une expédition.
ShipmentIncrementStockOnDelete=Remettre en stock les éléments de cette expédition
# Sending methods
# ModelDocument
DocumentModelTyphon=Modèle de bon de réception/livraison complet (logo…)

32
htdocs/opcachepreload.php Normal file
View File

@ -0,0 +1,32 @@
<?php
/* Copyright (C) 2019 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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 <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/opcachepreload.php
* \ingroup core
* \brief File that preload PHP files. Used for performance purposes if PHP >= 7.4
*/
// Preload some PHP files.
// WARNING: They won't be reloaded until you restart the Web/PHP server, event if you modify the files.
$files = array(); /* An array of files you want to preload */
foreach ($files as $file) {
opcache_compile_file($file);
}

View File

@ -26,26 +26,28 @@ require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php";
require_once DOL_DOCUMENT_ROOT."/core/lib/files.lib.php";
// Load translation files required by the page
$langs->load("opensurvey");
// Security check
if (!$user->rights->opensurvey->read) accessforbidden();
/*
* View
*/
$hookmanager = new HookManager($db);
// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array
$hookmanager->initHooks(array('opensurveyindex'));
// Load translation files required by the page
$langs->load("opensurvey");
/*
* View
*/
llxHeader();
$nbsondages=0;
$sql='SELECT COUNT(*) as nb FROM '.MAIN_DB_PREFIX.'opensurvey_sondage';
$sql = 'SELECT COUNT(*) as nb';
$sql.= ' FROM '.MAIN_DB_PREFIX.'opensurvey_sondage';
$sql.= ' WHERE entity IN ('.getEntity('survey').')';
$resql=$db->query($sql);
if ($resql)
{
@ -54,27 +56,16 @@ if ($resql)
}
else dol_print_error($db, '');
llxHeader();
print load_fiche_titre($langs->trans("OpenSurveyArea"));
print '<div class="fichecenter"><div class="fichethirdleft">';
$nbsondages=0;
$sql='SELECT COUNT(*) as nb FROM '.MAIN_DB_PREFIX.'opensurvey_sondage';
$resql=$db->query($sql);
if ($resql)
{
$obj=$db->fetch_object($resql);
$nbsondages=$obj->nb;
}
else dol_print_error($db, '');
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("OpenSurveyArea").'</td></tr>';
print "<tr ".$bc[0].">";
print '<tr class="oddeven">';
print '<td>'.$langs->trans("NbOfSurveys").'</td><td class="right"><a href="list.php">'.$nbsondages.'</a></td>';
print "</tr>";
//print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td class="right">';
@ -82,8 +73,7 @@ print "</tr>";
//print '</td></tr>';
print '</table>';
print '</div></div></div>';
print '</div></div>';
$parameters = array('user' => $user);
$reshook = $hookmanager->executeHooks('dashboardOpenSurvey', $parameters, $object); // Note that $action and $object may have been modified by hook

View File

@ -1711,20 +1711,18 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
}
print '</td></tr>';
// Update all child soc
print '<tr><td width="15%">';
print $langs->trans('ForceUpdateChildPriceSoc');
print '</td>';
print '<td>';
print '<input type="checkbox" name="updatechildprice" value="1">';
print '</td>';
print '</tr>';
print '</table>';
dol_fiche_end();
print '<div class="center">';
// Update all child soc
print '<div class="marginbottomonly">';
print '<input type="checkbox" name="updatechildprice" value="1"> ';
print $langs->trans('ForceUpdateChildPriceSoc');
print '</div>';
print '<input type="submit" class="button" value="' . $langs->trans("Save") . '">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<input type="submit" class="button" name="cancel" value="' . $langs->trans("Cancel") . '">';
@ -1804,10 +1802,8 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
// Update all child soc
print '<tr><td>';
print $langs->trans('ForceUpdateChildPriceSoc');
print '</td>';
print '<td>';
print '<input type="checkbox" name="updatechildprice" value="1">';
print '</td>';
print '</tr>';
@ -1816,6 +1812,11 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
dol_fiche_end();
print '<div class="center">';
print '<div class="marginbottomonly">';
print '<input type="checkbox" name="updatechildprice" value="1"> ';
print $langs->trans('ForceUpdateChildPriceSoc');
print "</div>";
print '<input type="submit" class="button" value="' . $langs->trans("Save") . '">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<input type="submit" class="button" name="cancel" value="' . $langs->trans("Cancel") . '">';
@ -2162,7 +2163,7 @@ if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
// Action
if ($user->rights->produit->supprimer || $user->rights->service->supprimer)
{
print '<td class="right">';
print '<td class="right nowraponall">';
print '<a href="' . $_SERVER["PHP_SELF"] . '?action=showlog_customer_price&amp;id=' . $object->id . '&amp;socid=' . $line->fk_soc . '">';
print img_info($langs->trans('PriceByCustomerLog'));
print '</a>';

View File

@ -546,7 +546,6 @@ class Projects extends DolibarrApi
// phpcs:enable
$object = parent::_cleanObjectDatas($object);
unset($object->titre);
unset($object->datec);
unset($object->datem);
unset($object->barcode_type);

View File

@ -74,12 +74,9 @@ class Project extends CommonObject
/**
* @var string
* @deprecated
* @see $title
*/
public $titre;
public $title;
public $date_start;
public $date_end;
public $date_close;
@ -440,7 +437,7 @@ class Project extends CommonObject
$sql = "SELECT rowid, ref, title, description, public, datec, opp_amount, budget_amount,";
$sql.= " tms, dateo, datee, date_close, fk_soc, fk_user_creat, fk_user_modif, fk_user_close, fk_statut, fk_opp_status, opp_percent,";
$sql.= " note_private, note_public, model_pdf, bill_time";
$sql.= " note_private, note_public, model_pdf, bill_time, entity";
$sql.= " FROM " . MAIN_DB_PREFIX . "projet";
if (! empty($id))
{
@ -465,7 +462,6 @@ class Project extends CommonObject
$this->id = $obj->rowid;
$this->ref = $obj->ref;
$this->title = $obj->title;
$this->titre = $obj->title; // TODO deprecated
$this->description = $obj->description;
$this->date_c = $this->db->jdate($obj->datec);
$this->datec = $this->db->jdate($obj->datec); // TODO deprecated
@ -488,6 +484,7 @@ class Project extends CommonObject
$this->budget_amount = $obj->budget_amount;
$this->modelpdf = $obj->model_pdf;
$this->bill_time = (int) $obj->bill_time;
$this->entity = $obj->entity;
$this->db->free($resql);
@ -509,49 +506,6 @@ class Project extends CommonObject
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of projects
*
* @param int $socid To filter on a particular third party
* @return array List of projects
*/
public function liste_array($socid = '')
{
// phpcs:enable
global $conf;
$projects = array();
$sql = "SELECT rowid, title";
$sql.= " FROM " . MAIN_DB_PREFIX . "projet";
$sql.= " WHERE entity = " . $conf->entity;
if (! empty($socid)) $sql.= " AND fk_soc = " . $socid;
$resql = $this->db->query($sql);
if ($resql)
{
$nump = $this->db->num_rows($resql);
if ($nump)
{
$i = 0;
while ($i < $nump)
{
$obj = $this->db->fetch_object($resql);
$projects[$obj->rowid] = $obj->title;
$i++;
}
}
return $projects;
}
else
{
print $this->db->lasterror();
}
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Return list of elements for type, linked to a project

View File

@ -21,6 +21,11 @@
* For Paypal test: https://developer.paypal.com/
* For Paybox test: ???
* For Stripe test: Use credit card 4242424242424242 .More example on https://stripe.com/docs/testing
*
* Variants:
* - When option STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION is on, we use the new checkout API
* - When option STRIPE_USE_NEW_CHECKOUT is on, we use the new checkout API
* - If no option set, we use old APIS (charge)
*/
/**
@ -2099,7 +2104,7 @@ if (preg_match('/^dopayment/', $action)) // If we choosed/click on the payment
else
{
?>
// Code for payment with option STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION off and STRIPE_USE_NEW_CHECKOUT off
// Old code for payment with option STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION off and STRIPE_USE_NEW_CHECKOUT off
// Create a Stripe client.
var stripe = Stripe('<?php echo $stripearrayofkeys['publishable_key']; // Defined into config.php ?>');

View File

@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
$langs->load(array("companies", "bills", "propal", "orders"));
$langs->loadLangs(array("companies", "bills", "propal", "orders"));
if (GETPOST('actioncode', 'array'))
{

View File

@ -958,12 +958,13 @@ else
if (empty($duplicate_code_error)) {
$object->code_client = GETPOST('customer_code', 'alpha');
$object->fournisseur = GETPOST('fournisseur')?GETPOST('fournisseur'):$object->fournisseur;
$object->code_fournisseur = GETPOST('supplier_code', 'alpha');
}
else {
setEventMessages($langs->trans('NewCustomerSupplierCodeProposed'), '', 'warnings');
}
$object->code_fournisseur = GETPOST('supplier_code', 'alpha');
$object->address = GETPOST('address', 'alpha');
$object->zip = GETPOST('zipcode', 'alpha');
$object->town = GETPOST('town', 'alpha');

View File

View File

@ -1,109 +0,0 @@
<?php
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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 <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/societe/notify/index.php
* \ingroup notification
* \brief List of done notifications
*/
require '../../main.inc.php';
$langs->loadLangs(array("companies", "banks"));
// S<>curit<69> acc<63>s client
if ($user->societe_id > 0)
{
$action = '';
$socid = $user->societe_id;
}
if ($sortorder == "")
{
$sortorder="ASC";
}
if ($sortfield == "")
{
$sortfield="s.nom";
}
if (empty($page) || $page == -1) { $page = 0 ; }
$offset = $conf->liste_limit * $page ;
$pageprev = $page - 1;
$pagenext = $page + 1;
/*
* View
*/
llxHeader();
$sql = "SELECT s.nom as name, s.rowid as socid, c.lastname, c.firstname, a.label, n.rowid";
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as c,";
$sql.= " ".MAIN_DB_PREFIX."c_action_trigger as a,";
$sql.= " ".MAIN_DB_PREFIX."notify_def as n,";
$sql.= " ".MAIN_DB_PREFIX."societe as s";
$sql.= " WHERE n.fk_contact = c.rowid";
$sql.= " AND a.rowid = n.fk_action";
$sql.= " AND n.fk_soc = s.rowid";
$sql.= " AND s.entity IN (".getEntity('societe').")";
if ($socid > 0) $sql.= " AND s.rowid = " . $user->societe_id;
$sql.= $db->order($sortfield, $sortorder);
$sql.= $db->plimit($conf->liste_limit, $offset);
$result = $db->query($sql);
if ($result)
{
$num = $db->num_rows($result);
$i = 0;
$paramlist='';
print_barre_liste($langs->trans("ListOfNotificationsDone"), $page, $_SERVER["PHP_SELF"], $paramlist, $sortfield, $sortorder, '', $num);
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre("Company", $_SERVER["PHP_SELF"], "s.nom", "", "", 'valign="center"', $sortfield, $sortorder);
print_liste_field_titre("Contact", $_SERVER["PHP_SELF"], "c.lastname", "", "", 'valign="center"', $sortfield, $sortorder);
print_liste_field_titre("Action", $_SERVER["PHP_SELF"], "a.titre", "", "", 'valign="center"', $sortfield, $sortorder);
print "</tr>\n";
while ($i < $num)
{
$obj = $db->fetch_object($result);
print '<tr class="oddeven">';
print "<td><a href=\"card.php?socid=".$obj->socid."\">".$obj->name."</a></td>\n";
print "<td>".dolGetFirstLastname($obj->firstname, $obj->lastname)."</td>\n";
print "<td>".$obj->titre."</td>\n";
print "</tr>\n";
$i++;
}
print "</table>";
$db->free();
}
else
{
dol_print_error($db);
}
// End of page
llxFooter();
$db->close();

View File

@ -286,9 +286,11 @@ class Stripe extends CommonObject
/**
* Get the Stripe payment intent. Create it with confirm=false
* Warning. If a payment was tried and failed, a payment intent was created.
* But if we change someting on object to pay (amount or other), reusing same payment intent is not allowed.
* But if we change something on object to pay (amount or other), reusing same payment intent is not allowed.
* Recommanded solution is to recreate a new payment intent each time we need one (old one will be automatically closed after a delay),
* that's why i comment the part of code to retreive a payment intent with object id (never mind if we cumulate payment intent with old ones that will not be used)
* Note: This is used when option STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION is on when making a payment from the public/payment/newpayment.php page
* but not when using the STRIPE_USE_NEW_CHECKOUT.
*
* @param double $amount Amount
* @param string $currency_code Currency code
@ -307,7 +309,7 @@ class Stripe extends CommonObject
{
global $conf;
dol_syslog("getPaymentIntent");
dol_syslog("getPaymentIntent", LOG_INFO, 1);
$error = 0;
@ -392,7 +394,7 @@ class Stripe extends CommonObject
"payment_method_types" => array("card"),
"description" => $description,
"statement_descriptor" => dol_trunc($tag, 10, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt (company + description)
//"save_payment_method" => true,
"setup_future_usage" => "on_session",
"metadata" => $metadata
);
if (! is_null($customer)) $dataforintent["customer"]=$customer;
@ -479,7 +481,7 @@ class Stripe extends CommonObject
}
}
dol_syslog("getPaymentIntent return error=".$error);
dol_syslog("getPaymentIntent return error=".$error, LOG_INFO, -1);
if (! $error)
{

View File

@ -135,6 +135,7 @@ if (!$user->rights->societe->client->voir && !$socid) {
}
$sql .= ' WHERE t.entity IN (' . getEntity('ticket') . ')';
$sql .= dolSqlDateFilter('datec', 0, 0, $endyear);
if (!$user->rights->societe->client->voir && !$socid) {
$sql .= " AND t.fk_soc = sc.fk_soc AND sc.fk_user = " . $user->id;
}
@ -279,7 +280,7 @@ if (!$user->rights->societe->client->voir && !$socid) {
$sql .= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc";
}
$sql .= ' WHERE t.entity IN (' . getEntity('ticket', 1) . ')';
$sql .= ' WHERE t.entity IN (' . getEntity('ticket') . ')';
$sql .= " AND t.fk_statut=0";
if (!$user->rights->societe->client->voir && !$socid) {
$sql .= " AND t.fk_soc = sc.fk_soc AND sc.fk_user = " . $user->id;

View File

@ -209,10 +209,7 @@ $sql=preg_replace('/, $/', '', $sql);
$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'])) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON (t.fk_soc = s.rowid)";
if ($object->ismultientitymanaged == 1) $sql.= " WHERE t.entity IN (".getEntity($object->element).")";
else $sql.=" WHERE 1 = 1";
$sql.= " WHERE t.entity IN (".getEntity($object->element).")";
foreach($search as $key => $val)
{
if ($key == 'fk_statut')

View File

@ -81,8 +81,12 @@ $fieldstosearchall = array(
'u.firstname'=>"Firstname",
'u.accountancy_code'=>"AccountancyCode",
'u.email'=>"EMail",
'u.note'=>"Note"
'u.note'=>"Note",
);
if (! empty($conf->api->enabled))
{
$fieldstosearchall['u.api_key']="ApiKey";
}
// Definition of fields for list
$arrayfields=array(
@ -93,6 +97,7 @@ $arrayfields=array(
'u.employee'=>array('label'=>$langs->trans("Employee"), 'checked'=>($mode=='employee'?1:0)),
'u.accountancy_code'=>array('label'=>$langs->trans("AccountancyCode"), 'checked'=>0),
'u.email'=>array('label'=>$langs->trans("EMail"), 'checked'=>1),
'u.api_key'=>array('label'=>$langs->trans("ApiKey"), 'checked'=>0, "enabled"=>($conf->api->enabled && $user->admin)),
'u.fk_soc'=>array('label'=>$langs->trans("Company"), 'checked'=>1),
'u.entity'=>array('label'=>$langs->trans("Entity"), 'checked'=>1, 'enabled'=>(! empty($conf->multicompany->enabled) && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE))),
'u.fk_user'=>array('label'=>$langs->trans("HierarchicalResponsible"), 'checked'=>1),
@ -121,10 +126,10 @@ $search_gender=GETPOST('search_gender', 'alpha');
$search_employee=GETPOST('search_employee', 'alpha');
$search_accountancy_code=GETPOST('search_accountancy_code', 'alpha');
$search_email=GETPOST('search_email', 'alpha');
$search_api_key=GETPOST('search_api_key', 'alphanohtml');
$search_statut=GETPOST('search_statut', 'intcomma');
$search_thirdparty=GETPOST('search_thirdparty', 'alpha');
$search_supervisor=GETPOST('search_supervisor', 'intcomma');
$search_previousconn=GETPOST('search_previousconn', 'alpha');
$optioncss = GETPOST('optioncss', 'alpha');
$search_categ = GETPOST("search_categ", 'int');
$catid = GETPOST('catid', 'int');
@ -165,6 +170,7 @@ if (empty($reshook))
$search_statut="";
$search_thirdparty="";
$search_supervisor="";
$search_api_key="";
$search_datelastlogin="";
$search_datepreviouslogin="";
$search_date_creation="";
@ -185,7 +191,7 @@ $user2=new User($db);
$buttonviewhierarchy='<form action="'.DOL_URL_ROOT.'/user/hierarchy.php'.(($search_statut != '' && $search_statut >= 0) ? '?search_statut='.$search_statut : '').'" method="POST"><input type="submit" class="button" style="width:120px" name="viewcal" value="'.dol_escape_htmltag($langs->trans("HierarchicView")).'"></form>';
$sql = "SELECT DISTINCT u.rowid, u.lastname, u.firstname, u.admin, u.fk_soc, u.login, u.email, u.accountancy_code, u.gender, u.employee, u.photo,";
$sql = "SELECT DISTINCT u.rowid, u.lastname, u.firstname, u.admin, u.fk_soc, u.login, u.email, u.api_key, u.accountancy_code, u.gender, u.employee, u.photo,";
$sql.= " u.datelastlogin, u.datepreviouslogin,";
$sql.= " u.ldap_sid, u.statut, u.entity,";
$sql.= " u.tms as date_update, u.datec as date_creation,";
@ -223,6 +229,7 @@ if (is_numeric($search_employee) && $search_employee >= 0) {
}
if ($search_accountancy_code != '') $sql.= natural_search("u.accountancy_code", $search_accountancy_code);
if ($search_email != '') $sql.= natural_search("u.email", $search_email);
if ($search_api_key != '') $sql.= natural_search("u.api_key", $search_api_key);
if ($search_statut != '' && $search_statut >= 0) $sql.= " AND u.statut IN (".$db->escape($search_statut).")";
if ($sall) $sql.= natural_search(array_keys($fieldstosearchall), $sall);
if ($catid > 0) $sql.= " AND cu.fk_categorie = ".$catid;
@ -277,6 +284,7 @@ if ($search_gender != '') $param.="&amp;search_gender=".urlencode($search_gender
if ($search_employee != '') $param.="&amp;search_employee=".urlencode($search_employee);
if ($search_accountancy_code != '') $param.="&amp;search_accountancy_code=".urlencode($search_accountancy_code);
if ($search_email != '') $param.="&amp;search_email=".urlencode($search_email);
if ($search_api_key != '') $param.="&amp;search_api_key=".urlencode($search_api_key);
if ($search_supervisor > 0) $param.="&amp;search_supervisor=".urlencode($search_supervisor);
if ($search_statut != '') $param.="&amp;search_statut=".urlencode($search_statut);
if ($optioncss != '') $param.='&amp;optioncss='.urlencode($optioncss);
@ -359,15 +367,15 @@ print '<table class="tagtable liste'.($moreforfilter?" listwithfilterbefore":"")
print '<tr class="liste_titre_filter">';
if (! empty($arrayfields['u.login']['checked']))
{
print '<td class="liste_titre"><input type="text" name="search_login" size="6" value="'.$search_login.'"></td>';
print '<td class="liste_titre"><input type="text" name="search_login" class="maxwidth50" value="'.$search_login.'"></td>';
}
if (! empty($arrayfields['u.lastname']['checked']))
{
print '<td class="liste_titre"><input type="text" name="search_lastname" size="6" value="'.$search_lastname.'"></td>';
print '<td class="liste_titre"><input type="text" name="search_lastname" class="maxwidth50" value="'.$search_lastname.'"></td>';
}
if (! empty($arrayfields['u.firstname']['checked']))
{
print '<td class="liste_titre"><input type="text" name="search_firstname" size="6" value="'.$search_firstname.'"></td>';
print '<td class="liste_titre"><input type="text" name="search_firstname" class="maxwidth50" value="'.$search_firstname.'"></td>';
}
if (! empty($arrayfields['u.gender']['checked']))
{
@ -384,15 +392,19 @@ if (! empty($arrayfields['u.employee']['checked']))
}
if (! empty($arrayfields['u.accountancy_code']['checked']))
{
print '<td class="liste_titre"><input type="text" name="search_accountancy_code" size="4" value="'.$search_accountancy_code.'"></td>';
print '<td class="liste_titre"><input type="text" name="search_accountancy_code" class="maxwidth50" value="'.$search_accountancy_code.'"></td>';
}
if (! empty($arrayfields['u.email']['checked']))
{
print '<td class="liste_titre"><input type="text" name="search_email" size="6" value="'.$search_email.'"></td>';
print '<td class="liste_titre"><input type="text" name="search_email" class="maxwidth75" value="'.$search_email.'"></td>';
}
if (! empty($arrayfields['u.api_key']['checked']))
{
print '<td class="liste_titre"><input type="text" name="search_api_key" class="maxwidth50" value="'.$search_api_key.'"></td>';
}
if (! empty($arrayfields['u.fk_soc']['checked']))
{
print '<td class="liste_titre"><input type="text" name="search_thirdparty" size="6" value="'.$search_thirdparty.'"></td>';
print '<td class="liste_titre"><input type="text" name="search_thirdparty" class="maxwidth75" value="'.$search_thirdparty.'"></td>';
}
if (! empty($arrayfields['u.entity']['checked']))
{
@ -455,6 +467,7 @@ if (! empty($arrayfields['u.gender']['checked'])) print_liste_field_titr
if (! empty($arrayfields['u.employee']['checked'])) print_liste_field_titre("Employee", $_SERVER['PHP_SELF'], "u.employee", $param, "", "", $sortfield, $sortorder);
if (! empty($arrayfields['u.accountancy_code']['checked'])) print_liste_field_titre("AccountancyCode", $_SERVER['PHP_SELF'], "u.accountancy_code", $param, "", "", $sortfield, $sortorder);
if (! empty($arrayfields['u.email']['checked'])) print_liste_field_titre("EMail", $_SERVER['PHP_SELF'], "u.email", $param, "", "", $sortfield, $sortorder);
if (! empty($arrayfields['u.api_key']['checked'])) print_liste_field_titre("ApiKey", $_SERVER['PHP_SELF'], "u.api_key", $param, "", "", $sortfield, $sortorder);
if (! empty($arrayfields['u.fk_soc']['checked'])) print_liste_field_titre("Company", $_SERVER['PHP_SELF'], "u.fk_soc", $param, "", "", $sortfield, $sortorder);
if (! empty($arrayfields['u.entity']['checked'])) print_liste_field_titre("Entity", $_SERVER['PHP_SELF'], "u.entity", $param, "", "", $sortfield, $sortorder);
if (! empty($arrayfields['u.fk_user']['checked'])) print_liste_field_titre("HierarchicalResponsible", $_SERVER['PHP_SELF'], "u.fk_user", $param, "", "", $sortfield, $sortorder);
@ -542,6 +555,11 @@ while ($i < min($num, $limit))
print '<td>'.$obj->email.'</td>';
if (! $i) $totalarray['nbfield']++;
}
if (! empty($arrayfields['u.api_key']['checked']))
{
print '<td>'.$obj->api_key.'</td>';
if (! $i) $totalarray['nbfield']++;
}
if (! empty($arrayfields['u.fk_soc']['checked']))
{
print "<td>";