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

This commit is contained in:
Laurent Destailleur 2019-05-02 13:24:47 +02:00
commit e5777f64f4
12 changed files with 108 additions and 103 deletions

View File

@ -82,7 +82,7 @@ if (! empty($canvas))
} }
// Security check // Security check
$result=restrictedArea($user, 'adherent', $id, '', '', 'fk_soc', 'rowid', $objcanvas); $result=restrictedArea($user, 'adherent', $id, '', '', 'socid', 'rowid', $objcanvas);
if ($id > 0) if ($id > 0)
{ {
@ -163,10 +163,10 @@ if (empty($reshook))
$error=0; $error=0;
if (! $error) if (! $error)
{ {
if ($socid != $object->fk_soc) // If link differs from currently in database if ($socid != $object->socid) // If link differs from currently in database
{ {
$sql ="SELECT rowid FROM ".MAIN_DB_PREFIX."adherent"; $sql ="SELECT rowid FROM ".MAIN_DB_PREFIX."adherent";
$sql.=" WHERE fk_soc = '".$socid."'"; $sql.=" WHERE socid = '".$socid."'";
$sql.=" AND entity = ".$conf->entity; $sql.=" AND entity = ".$conf->entity;
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql)
@ -492,7 +492,7 @@ if (empty($reshook))
//$object->note = $comment; //$object->note = $comment;
$object->morphy = $morphy; $object->morphy = $morphy;
$object->user_id = $userid; $object->user_id = $userid;
$object->fk_soc = $socid; $object->socid = $socid;
$object->public = $public; $object->public = $public;
// Fill array 'array_options' with data from add form // Fill array 'array_options' with data from add form
@ -1333,10 +1333,10 @@ else
if (! empty($conf->societe->enabled)) if (! empty($conf->societe->enabled))
{ {
print '<tr><td>'.$langs->trans("LinkedToDolibarrThirdParty").'</td><td colspan="2" class="valeur">'; print '<tr><td>'.$langs->trans("LinkedToDolibarrThirdParty").'</td><td colspan="2" class="valeur">';
if ($object->fk_soc) if ($object->socid)
{ {
$company=new Societe($db); $company=new Societe($db);
$result=$company->fetch($object->fk_soc); $result=$company->fetch($object->socid);
print $company->getNomUrl(1); print $company->getNomUrl(1);
} }
else else
@ -1421,7 +1421,7 @@ else
$text=$langs->trans("ConfirmCreateLogin").'<br>'; $text=$langs->trans("ConfirmCreateLogin").'<br>';
if (! empty($conf->societe->enabled)) if (! empty($conf->societe->enabled))
{ {
if ($object->fk_soc > 0) $text.=$langs->trans("UserWillBeExternalUser"); if ($object->socid > 0) $text.=$langs->trans("UserWillBeExternalUser");
else $text.=$langs->trans("UserWillBeInternalUser"); else $text.=$langs->trans("UserWillBeInternalUser");
} }
print $form->formconfirm($_SERVER["PHP_SELF"]."?rowid=".$object->id, $langs->trans("CreateDolibarrLogin"), $text, "confirm_create_user", $formquestion, 'yes'); print $form->formconfirm($_SERVER["PHP_SELF"]."?rowid=".$object->id, $langs->trans("CreateDolibarrLogin"), $text, "confirm_create_user", $formquestion, 'yes');
@ -1688,17 +1688,17 @@ else
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<table class="nobordernopadding" cellpadding="0" cellspacing="0">'; print '<table class="nobordernopadding" cellpadding="0" cellspacing="0">';
print '<tr><td>'; print '<tr><td>';
print $form->select_company($object->fk_soc, 'socid', '', 1); print $form->select_company($object->socid, 'socid', '', 1);
print '</td>'; print '</td>';
print '<td class="left"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>'; print '<td class="left"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
print '</tr></table></form>'; print '</tr></table></form>';
} }
else else
{ {
if ($object->fk_soc) if ($object->socid)
{ {
$company=new Societe($db); $company=new Societe($db);
$result=$company->fetch($object->fk_soc); $result=$company->fetch($object->socid);
print $company->getNomUrl(1); print $company->getNomUrl(1);
} }
else else
@ -1848,7 +1848,7 @@ else
} }
// Create third party // Create third party
if (! empty($conf->societe->enabled) && ! $object->fk_soc) if (! empty($conf->societe->enabled) && ! $object->socid)
{ {
if ($user->rights->societe->creer) if ($user->rights->societe->creer)
{ {

View File

@ -10,6 +10,7 @@
* Copyright (C) 2015-2018 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2015-2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr> * Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2016 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2016 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2018-2019 Thibault FOUCART <support@ptibogxiv.net>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -557,7 +558,7 @@ class Adherent extends CommonObject
$sql.= ", gender = ".($this->gender != -1 ? "'".$this->db->escape($this->gender)."'" : "null"); // 'man' or 'woman' $sql.= ", gender = ".($this->gender != -1 ? "'".$this->db->escape($this->gender)."'" : "null"); // 'man' or 'woman'
$sql.= ", login = ".($this->login?"'".$this->db->escape($this->login)."'":"null"); $sql.= ", login = ".($this->login?"'".$this->db->escape($this->login)."'":"null");
$sql.= ", societe = ".($this->societe?"'".$this->db->escape($this->societe)."'":"null"); $sql.= ", societe = ".($this->societe?"'".$this->db->escape($this->societe)."'":"null");
$sql.= ", fk_soc = ".($this->fk_soc > 0?$this->db->escape($this->fk_soc):"null"); $sql.= ", fk_soc = ".($this->socid > 0?$this->db->escape($this->socid):"null");
$sql.= ", address = ".($this->address?"'".$this->db->escape($this->address)."'":"null"); $sql.= ", address = ".($this->address?"'".$this->db->escape($this->address)."'":"null");
$sql.= ", zip = ".($this->zip?"'".$this->db->escape($this->zip)."'":"null"); $sql.= ", zip = ".($this->zip?"'".$this->db->escape($this->zip)."'":"null");
$sql.= ", town = ".($this->town?"'".$this->db->escape($this->town)."'":"null"); $sql.= ", town = ".($this->town?"'".$this->db->escape($this->town)."'":"null");
@ -1223,7 +1224,7 @@ class Adherent extends CommonObject
{ {
global $langs; global $langs;
$sql = "SELECT d.rowid, d.ref_ext, d.civility as civility_id, d.gender, d.firstname, d.lastname, d.societe as company, d.fk_soc, d.statut, d.public, d.address, d.zip, d.town, d.note_private,"; $sql = "SELECT d.rowid, d.ref_ext, d.civility as civility_code, d.gender, d.firstname, d.lastname, d.societe as company, d.fk_soc, d.statut, d.public, d.address, d.zip, d.town, d.note_private,";
$sql.= " d.note_public,"; $sql.= " d.note_public,";
$sql.= " d.email, d.skype, d.twitter, d.facebook, d.linkedin, d.phone, d.phone_perso, d.phone_mobile, d.login, d.pass, d.pass_crypted,"; $sql.= " d.email, d.skype, d.twitter, d.facebook, d.linkedin, d.phone, d.phone_perso, d.phone_mobile, d.login, d.pass, d.pass_crypted,";
$sql.= " d.photo, d.fk_adherent_type, d.morphy, d.entity,"; $sql.= " d.photo, d.fk_adherent_type, d.morphy, d.entity,";
@ -1267,7 +1268,11 @@ class Adherent extends CommonObject
$this->ref = $obj->rowid; $this->ref = $obj->rowid;
$this->id = $obj->rowid; $this->id = $obj->rowid;
$this->ref_ext = $obj->ref_ext; $this->ref_ext = $obj->ref_ext;
$this->civility_id = $obj->civility_id;
$this->civility_id = $obj->civility_code; // Bad. Kept for backard compatibility
$this->civility_code = $obj->civility_code;
$this->civility = $obj->civility_code?($langs->trans("Civility".$obj->civility_code) != ("Civility".$obj->civility_code) ? $langs->trans("Civility".$obj->civility_code) : $obj->civility_code):'';
$this->firstname = $obj->firstname; $this->firstname = $obj->firstname;
$this->lastname = $obj->lastname; $this->lastname = $obj->lastname;
$this->gender = $obj->gender; $this->gender = $obj->gender;

View File

@ -400,7 +400,7 @@ $num = $db->num_rows($result);
$arrayofselected=is_array($toselect)?$toselect:array(); $arrayofselected=is_array($toselect)?$toselect:array();
if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && ($sall != '' || $seearch_cti != '')) if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && ($sall != '' || $search_cti != ''))
{ {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
$id = $obj->rowid; $id = $obj->rowid;

View File

@ -6525,7 +6525,7 @@ abstract class CommonObject
$out .= $extrafields->showOutputField($key, $value); $out .= $extrafields->showOutputField($key, $value);
break; break;
case "edit": case "edit":
$out .= $extrafields->showInputField($key, $value, '', $keysuffix, '', 0, $this->id); $out .= $extrafields->showInputField($key, $value, '', $keysuffix, '', 0, $this->id, $this->table_element);
break; break;
} }

View File

@ -1567,6 +1567,9 @@ class ExtraFields
if ($type == 'date') $out.=' (YYYY-MM-DD)'; if ($type == 'date') $out.=' (YYYY-MM-DD)';
elseif ($type == 'datetime') $out.=' (YYYY-MM-DD HH:MM:SS)'; elseif ($type == 'datetime') $out.=' (YYYY-MM-DD HH:MM:SS)';
*/ */
if (! empty($help)) {
$out .= $form->textwithpicto("", $help);
}
return $out; return $out;
} }

View File

@ -349,7 +349,7 @@ class modProduct extends DolibarrModules
'p.note_public' => "PublicNote",//public note 'p.note_public' => "PublicNote",//public note
'p.note' => "PrivateNote",//private note 'p.note' => "PrivateNote",//private note
'p.customcode' => 'CustomCode', 'p.customcode' => 'CustomCode',
'p.price' => "SellingPriceHT",//without tax 'p.price' => "SellingPriceHT",//without
'p.price_min' => "MinPrice", 'p.price_min' => "MinPrice",
'p.price_ttc' => "SellingPriceTTC",//with tax 'p.price_ttc' => "SellingPriceTTC",//with tax
'p.price_min_ttc' => "SellingMinPriceTTC", 'p.price_min_ttc' => "SellingMinPriceTTC",
@ -519,9 +519,12 @@ class modProduct extends DolibarrModules
if (is_object($mysoc) && $mysoc->useLocalTax(2)) $import_sample=array_merge($import_sample, array('p.localtax2_tx'=>'', 'p.localtax2_type'=>'')); if (is_object($mysoc) && $mysoc->useLocalTax(2)) $import_sample=array_merge($import_sample, array('p.localtax2_tx'=>'', 'p.localtax2_type'=>''));
if (! empty($conf->barcode->enabled)) $import_sample=array_merge($import_sample, array('p.barcode'=>'')); if (! empty($conf->barcode->enabled)) $import_sample=array_merge($import_sample, array('p.barcode'=>''));
if (! empty($conf->global->PRODUCT_USE_UNITS)) { if (! empty($conf->global->PRODUCT_USE_UNITS)) {
$import_sample = array_merge($import_sample, array( $import_sample = array_merge(
$import_sample,
array(
'p.fk_unit' => 'use a unit of measure from the dictionary. G/KG/M2/M3 etc....matches field "code" in table "' . MAIN_DB_PREFIX . 'c_units"' 'p.fk_unit' => 'use a unit of measure from the dictionary. G/KG/M2/M3 etc....matches field "code" in table "' . MAIN_DB_PREFIX . 'c_units"'
)); )
);
$this->import_convertvalue_array[$r] = array_merge($this->import_convertvalue_array[$r], array( $this->import_convertvalue_array[$r] = array_merge($this->import_convertvalue_array[$r], array(
'p.fk_unit' => array( 'p.fk_unit' => array(

View File

@ -137,6 +137,7 @@ if ($nolinesbefore) {
print '<td class="linecolcycleref2 right"></td>'; print '<td class="linecolcycleref2 right"></td>';
} }
if (! empty($usemargins)) if (! empty($usemargins))
{ {
if (!empty($user->rights->margins->creer)) { if (!empty($user->rights->margins->creer)) {
?> ?>
@ -149,9 +150,7 @@ if ($nolinesbefore) {
echo $langs->trans('BuyingPrice'); echo $langs->trans('BuyingPrice');
else else
echo $langs->trans('CostPrice'); echo $langs->trans('CostPrice');
?> echo '</td>';
</td>
<?php
if ($user->rights->margins->creer && ! empty($conf->global->DISPLAY_MARGIN_RATES)) echo '<td class="margininfos linecolmargin2 right"><span class="np_marginRate">'.$langs->trans('MarginRate').'</span></td>'; if ($user->rights->margins->creer && ! empty($conf->global->DISPLAY_MARGIN_RATES)) echo '<td class="margininfos linecolmargin2 right"><span class="np_marginRate">'.$langs->trans('MarginRate').'</span></td>';
if ($user->rights->margins->creer && ! empty($conf->global->DISPLAY_MARK_RATES)) echo '<td class="margininfos linecolmargin2 right"><span class="np_markRate">'.$langs->trans('MarkRate').'</span></td>'; if ($user->rights->margins->creer && ! empty($conf->global->DISPLAY_MARK_RATES)) echo '<td class="margininfos linecolmargin2 right"><span class="np_markRate">'.$langs->trans('MarkRate').'</span></td>';
} }
@ -168,9 +167,7 @@ if ($nolinesbefore) {
// Adds a line numbering column // Adds a line numbering column
if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
$coldisplay++; $coldisplay++;
?> echo '<td class="nobottom linecolnum center"></td>';
<td class="nobottom linecolnum center"></td>
<?php
} }
$coldisplay++; $coldisplay++;
@ -348,14 +345,12 @@ if ($nolinesbefore) {
echo $form->selectyesno('date_end_fill', $line->date_end_fill, 1); echo $form->selectyesno('date_end_fill', $line->date_end_fill, 1);
echo '</div>'; echo '</div>';
} }
?> echo '</td>';
</td>
<?php
if ($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') // We must have same test in printObjectLines if ($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') // We must have same test in printObjectLines
{ {
?>
$coldisplay++; $coldisplay++;
?>
<td class="nobottom linecolresupplier"><input id="fourn_ref" name="fourn_ref" class="flat maxwidth75" value="<?php echo (isset($_POST["fourn_ref"])?GETPOST("fourn_ref", 'alpha', 2):''); ?>"></td> <td class="nobottom linecolresupplier"><input id="fourn_ref" name="fourn_ref" class="flat maxwidth75" value="<?php echo (isset($_POST["fourn_ref"])?GETPOST("fourn_ref", 'alpha', 2):''); ?>"></td>
<?php } ?> <?php } ?>
@ -458,9 +453,7 @@ if ($nolinesbefore) {
if (is_object($objectline)) { if (is_object($objectline)) {
print $objectline->showOptionals($extrafieldsline, 'edit', array('style'=>$bcnd[$var], 'colspan'=>$coldisplay), '', '', empty($conf->global->MAIN_EXTRAFIELDS_IN_ONE_TD)?0:1); print $objectline->showOptionals($extrafieldsline, 'edit', array('style'=>$bcnd[$var], 'colspan'=>$coldisplay), '', '', empty($conf->global->MAIN_EXTRAFIELDS_IN_ONE_TD)?0:1);
} }
?>
<?php
if ((! empty($conf->service->enabled) || ($object->element == 'contrat')) && $dateSelector && GETPOST('type') != '0') // We show date field if required if ((! empty($conf->service->enabled) || ($object->element == 'contrat')) && $dateSelector && GETPOST('type') != '0') // We show date field if required
{ {
?> ?>

View File

@ -626,10 +626,10 @@ class MultiCurrency extends CommonObject
/** /**
* Sync rates from api * Sync rates from api
* *
* @param array $response array of reponse from api to sync dolibarr rates * @param string $key Key to use. Come from $conf->global->MULTICURRENCY_APP_ID.
* @return void * @return void
*/ */
public static function syncRates($response) public static function syncRates($key)
{ {
global $conf, $db, $langs; global $conf, $db, $langs;

View File

@ -35,6 +35,7 @@
require '../main.inc.php'; require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
if (! empty($conf->categorie->enabled)) if (! empty($conf->categorie->enabled))
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';

View File

@ -127,16 +127,16 @@ try {
]); ]);
} }
/** /*
* generatePaymentResponse * generate payment response
* *
* @param object $intent Intent * @param \Stripe\PaymentIntent $intent PaymentIntent
* @return void * @return void
*/ */
function generatePaymentResponse($intent) { function generatePaymentResponse($intent)
if ($intent->status == 'requires_source_action' &&
$intent->next_action->type == 'use_stripe_sdk')
{ {
if ($intent->status == 'requires_source_action' &&
$intent->next_action->type == 'use_stripe_sdk') {
// Tell the client to handle the action // Tell the client to handle the action
echo json_encode([ echo json_encode([
'requires_action' => true, 'requires_action' => true,