Skip to content

Commit

Permalink
Merge branch '7.0' of git@github.com:Dolibarr/dolibarr.git into develop
Browse files Browse the repository at this point in the history
Conflicts:
	htdocs/core/class/extrafields.class.php
  • Loading branch information
eldy committed Feb 4, 2018
2 parents aff6bce + 5a60921 commit 0cc6654
Show file tree
Hide file tree
Showing 17 changed files with 526 additions and 43 deletions.
8 changes: 7 additions & 1 deletion htdocs/api/admin/explorer.php
Expand Up @@ -87,7 +87,13 @@
$part = 'compta/facture';
$obj = 'facture';
}
if (empty($conf->$module->enabled)) $enabled=false;
if ($module == 'ficheinter') {
$obj = 'fichinter';
$part = 'fichinter';
$module='fichinter';
}

if (empty($conf->$module->enabled)) $enabled=false;

if ($enabled)
{
Expand Down
8 changes: 7 additions & 1 deletion htdocs/api/index.php
Expand Up @@ -145,6 +145,7 @@
$modulenameforenabled = $module;
if ($module == 'propale') { $modulenameforenabled='propal'; }
if ($module == 'supplierproposal') { $modulenameforenabled='supplier_proposal'; }
if ($module == 'ficheinter') { $modulenameforenabled='ficheinter'; }

dol_syslog("Found module file ".$file." - module=".$module." - modulenameforenabled=".$modulenameforenabled." - moduledirforclass=".$moduledirforclass);

Expand Down Expand Up @@ -217,7 +218,7 @@
$moduledirforclass = getModuleDirForApiClass($module);

// Load a dedicated API file
dol_syslog("Load a dedicated API file moduledirforclass=".$moduledirforclass);
dol_syslog("Load a dedicated API file module=".$module." moduledirforclass=".$moduledirforclass);

$tmpmodule = $module;
if ($tmpmodule != 'api')
Expand All @@ -229,6 +230,11 @@
$classfile = 'supplier_orders';
if ($module == 'supplierinvoices')
$classfile = 'supplier_invoices';
if ($module == 'ficheinter')
$classfile = 'interventions';
if ($module == 'interventions')
$classfile = 'interventions';

$dir_part_file = dol_buildpath('/' . $moduledirforclass . '/class/api_' . $classfile . '.class.php', 0, 2);

$classname = ucwords($module);
Expand Down
1 change: 1 addition & 0 deletions htdocs/comm/action/class/actioncomm.class.php
Expand Up @@ -1633,6 +1633,7 @@ public function sendEmailsReminder()

if (empty($conf->global->AGENDA_REMINDER_EMAIL))
{
$langs->load("agenda");
$this->output = $langs->trans('EventRemindersByEmailNotEnabled', $langs->transnoentitiesnoconv("Agenda"));
return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion htdocs/commande/class/api_orders.class.php
Expand Up @@ -472,7 +472,7 @@ function delete($id)
/**
* Validate an order
*
* If you get a bad value for param notrigger check that ou provide this in body
* If you get a bad value for param notrigger check, provide this in body
* {
* "idwarehouse": 0,
* "notrigger": 0
Expand Down
14 changes: 5 additions & 9 deletions htdocs/compta/bank/bankentries_list.php
Expand Up @@ -387,7 +387,7 @@
// Add $param from extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';


$options = array();

if ($id > 0 || ! empty($ref))
{
Expand All @@ -398,7 +398,6 @@
// Load bank groups
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/bankcateg.class.php';
$bankcateg = new BankCateg($db);
$options = array();

foreach ($bankcateg->fetchAll() as $bankcategory) {
$options[$bankcategory->id] = $bankcategory->label;
Expand Down Expand Up @@ -531,7 +530,6 @@
$resql = $db->query($sql);
if ($resql)
{
$var=True;
$num = $db->num_rows($resql);

$arrayofselected=is_array($toselect)?$toselect:array();
Expand Down Expand Up @@ -569,14 +567,12 @@
// Form to reconcile
if ($user->rights->banque->consolidate && $action == 'reconcile')
{
// print '<table class="noborder" width="100%">';
// print '<tr '.$bcnd[false].'>';
// print '<td>';
print '<div class="valignmiddle inline-block" style="padding-right: 20px;">';
print '<strong>'.$langs->trans("InputReceiptNumber").'</strong>: ';
print '<input class="flat" id="num_releve" name="num_releve" type="text" value="'.(GETPOST('num_releve')?GETPOST('num_releve'):'').'" size="10">'; // The only default value is value we just entered
print '</div>';
if ($options) {
if (is_array($options) && count($options))
{
print $langs->trans("EventualyAddCategory").': ';
print Form::selectarray('cat', $options, GETPOST('cat'), 1);
}
Expand Down Expand Up @@ -629,7 +625,6 @@
';
}
print '<br><br>';
// print '</td></tr></table>';
}

// Form to add a transaction with no invoice
Expand Down Expand Up @@ -663,7 +658,8 @@
print '<tr>';
print '<td>';
print '<input name="label" class="flat minwidth200" type="text" value="'.GETPOST("label","alpha").'">';
if (is_array($options) && count($options)) {
if (is_array($options) && count($options))
{
print '<br>'.$langs->trans("Rubrique").': ';
print Form::selectarray('cat1', $options, GETPOST('cat1'), 1);
}
Expand Down
26 changes: 25 additions & 1 deletion htdocs/contrat/card.php
Expand Up @@ -3,7 +3,7 @@
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2014 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2010-2015 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2010-2017 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014-2016 Ferran Marcet <fmarcet@2byte.es>
Expand Down Expand Up @@ -781,6 +781,30 @@
else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->contrat->creer)
{
$result = $object->validate($user);

if ($result > 0)
{
// Define output language
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
{
$outputlangs = $langs;
$newlang = '';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang = GETPOST('lang_id','aZ09');
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
if (! empty($newlang)) {
$outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang($newlang);
}
$model=$object->modelpdf;
$ret = $object->fetch($id); // Reload to get new records

$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
}
}
else
{
setEventMessages($object->error, $object->errors, 'errors');
}
}

else if ($action == 'reopen' && $user->rights->contrat->creer)
Expand Down
23 changes: 14 additions & 9 deletions htdocs/core/class/commonobject.class.php
Expand Up @@ -1273,22 +1273,27 @@ function fetch_origin()
}

/**
* Load object from specific field
*
* @param string $table Table element or element line
* @param string $field Field selected
* @param string $key Import key
* @return int <0 if KO, >0 if OK
*/
function fetchObjectFrom($table,$field,$key)
* Load object from specific field
*
* @param string $table Table element or element line
* @param string $field Field selected
* @param string $key Import key
* @param string $element Element name
* @return int <0 if KO, >0 if OK
*/
function fetchObjectFrom($table, $field, $key, $element = null)
{
global $conf;

$result=false;

$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX.$table;
$sql.= " WHERE ".$field." = '".$key."'";
$sql.= " AND entity = ".$conf->entity;
if (! empty($element)) {
$sql.= " AND entity IN (".getEntity($element).")";
} else {
$sql.= " AND entity = ".$conf->entity;
}

dol_syslog(get_class($this).'::fetchObjectFrom', LOG_DEBUG);
$resql = $this->db->query($sql);
Expand Down
9 changes: 5 additions & 4 deletions htdocs/core/class/notify.class.php
Expand Up @@ -404,13 +404,13 @@ function send($notifcode, $object)
break;
case 'FICHINTER_ADD_CONTACT':
$link='/fichinter/card.php?id='.$object->id;
$dir_output = $conf->facture->dir_output;
$dir_output = $conf->ficheinter->dir_output;
$object_type = 'ficheinter';
$mesg = $langs->transnoentitiesnoconv("EMailTextInterventionAddedContact",$object->ref);
break;
case 'FICHINTER_VALIDATE':
$link='/fichinter/card.php?id='.$object->id;
$dir_output = $conf->facture->dir_output;
$dir_output = $conf->ficheinter->dir_output;
$object_type = 'ficheinter';
$mesg = $langs->transnoentitiesnoconv("EMailTextInterventionValidated",$object->ref);
break;
Expand Down Expand Up @@ -664,8 +664,9 @@ function send($notifcode, $object)
}
dol_syslog("Replace the __SUPERVISOREMAIL__ key into recipient email string with ".$newval);
$sendto = preg_replace('/__SUPERVISOREMAIL__/', $newval, $sendto);
$sendto = preg_replace('/^[\s,]+/','',$sendto); // Clean start of string
$sendto = preg_replace('/[\s,]+$/','',$sendto); // Clean end of string
$sendto = preg_replace('/,\s*,/', ',', $sendto); // in some case you can have $sendto like "email, __SUPERVISOREMAIL__ , otheremail" then you have "email, , othermail" and it's not valid
$sendto = preg_replace('/^[\s,]+/', '', $sendto); // Clean start of string
$sendto = preg_replace('/[\s,]+$/', '', $sendto); // Clean end of string
}

if ($sendto)
Expand Down
3 changes: 3 additions & 0 deletions htdocs/core/lib/functions2.lib.php
Expand Up @@ -2258,6 +2258,9 @@ function getModuleDirForApiClass($module)
elseif ($module == 'users') {
$moduledirforclass = 'user';
}
elseif ($module == 'ficheinter' || $module == 'interventions') {
$moduledirforclass = 'fichinter';
}

return $moduledirforclass;
}
Expand Down

0 comments on commit 0cc6654

Please sign in to comment.