Merge pull request #5 from Dolibarr/develop

Update fork
This commit is contained in:
Damien BENOIT 2020-11-20 13:53:43 +01:00 committed by GitHub
commit ebd64d5e57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 99 additions and 72 deletions

View File

@ -1513,7 +1513,6 @@ class Contact extends CommonObject
$this->country_code = 'FR'; $this->country_code = 'FR';
$this->country = 'France'; $this->country = 'France';
$this->email = 'specimen@specimen.com'; $this->email = 'specimen@specimen.com';
$this->skype = 'tom.hanson';
$this->socialnetworks = array( $this->socialnetworks = array(
'skype' => 'tom.hanson', 'skype' => 'tom.hanson',
); );

View File

@ -984,14 +984,12 @@ class Ldap
// Define filter // Define filter
if (!empty($activefilter)) if (!empty($activefilter))
{ {
if (((string) $activefilter == '1' || (string) $activefilter == 'user') && $this->filter) if (((string) $activefilter == '1' || (string) $activefilter == 'user') && $this->filter) {
{
$filter = '('.$this->filter.')'; $filter = '('.$this->filter.')';
} elseif (((string) $activefilter == 'member') && $this->filter) } elseif (((string) $activefilter == 'member') && $this->filter) {
{
$filter = '('.$this->filtermember.')'; $filter = '('.$this->filtermember.')';
} else // If this->filter is empty, make fiter on * (all) } else {
{ // If this->filter is empty, make fiter on * (all)
$filter = '('.$useridentifier.'=*)'; $filter = '('.$useridentifier.'=*)';
} }
} else { } else {
@ -1070,6 +1068,7 @@ class Ldap
*/ */
public function littleEndian($hex) public function littleEndian($hex)
{ {
$result = '';
for ($x = dol_strlen($hex) - 2; $x >= 0; $x = $x - 2) { for ($x = dol_strlen($hex) - 2; $x >= 0; $x = $x - 2) {
$result .= substr($hex, $x, 2); $result .= substr($hex, $x, 2);
} }

View File

@ -308,11 +308,9 @@ class RssParser
$items = array(); $items = array();
// Save description entries // Save description entries
if ($rss->_format == 'rss') if ($rss->_format == 'rss') {
{
//var_dump($rss); //var_dump($rss);
if (!empty($conf->global->EXTERNALRSS_USE_SIMPLEXML)) if (!empty($conf->global->EXTERNALRSS_USE_SIMPLEXML)) {
{
if (!empty($rss->channel->language)) $this->_language = (string) $rss->channel->language; if (!empty($rss->channel->language)) $this->_language = (string) $rss->channel->language;
if (!empty($rss->channel->generator)) $this->_generator = (string) $rss->channel->generator; if (!empty($rss->channel->generator)) $this->_generator = (string) $rss->channel->generator;
if (!empty($rss->channel->copyright)) $this->_copyright = (string) $rss->channel->copyright; if (!empty($rss->channel->copyright)) $this->_copyright = (string) $rss->channel->copyright;
@ -336,8 +334,7 @@ class RssParser
if (!empty($conf->global->EXTERNALRSS_USE_SIMPLEXML)) $items = $rss->channel->item; // With simplexml if (!empty($conf->global->EXTERNALRSS_USE_SIMPLEXML)) $items = $rss->channel->item; // With simplexml
else $items = $rss->items; // With xmlparse else $items = $rss->items; // With xmlparse
//var_dump($items);exit; //var_dump($items);exit;
} elseif ($rss->_format == 'atom') } elseif ($rss->_format == 'atom') {
{
//var_dump($rss); //var_dump($rss);
if (!empty($conf->global->EXTERNALRSS_USE_SIMPLEXML)) if (!empty($conf->global->EXTERNALRSS_USE_SIMPLEXML))
{ {
@ -370,15 +367,11 @@ class RssParser
$i = 0; $i = 0;
// Loop on each record // Loop on each record
if (is_array($items)) if (is_array($items)) {
{ foreach ($items as $item) {
foreach ($items as $item)
{
//var_dump($item);exit; //var_dump($item);exit;
if ($rss->_format == 'rss') if ($rss->_format == 'rss') {
{ if (!empty($conf->global->EXTERNALRSS_USE_SIMPLEXML)) {
if (!empty($conf->global->EXTERNALRSS_USE_SIMPLEXML))
{
$itemLink = (string) $item->link; $itemLink = (string) $item->link;
$itemTitle = (string) $item->title; $itemTitle = (string) $item->title;
$itemDescription = (string) $item->description; $itemDescription = (string) $item->description;
@ -396,17 +389,13 @@ class RssParser
// Loop on each category // Loop on each category
$itemCategory = array(); $itemCategory = array();
if (is_array($item->category)) if (is_array($item->category)) {
{ foreach ($item->category as $cat) {
foreach ($item->category as $cat)
{
$itemCategory[] = (string) $cat; $itemCategory[] = (string) $cat;
} }
} }
} elseif ($rss->_format == 'atom') } elseif ($rss->_format == 'atom') {
{ if (!empty($conf->global->EXTERNALRSS_USE_SIMPLEXML)) {
if (!empty($conf->global->EXTERNALRSS_USE_SIMPLEXML))
{
$itemLink = (isset($item['link']) ? (string) $item['link'] : ''); $itemLink = (isset($item['link']) ? (string) $item['link'] : '');
$itemTitle = (string) $item['title']; $itemTitle = (string) $item['title'];
$itemDescription = $this->getAtomItemDescription($item); $itemDescription = $this->getAtomItemDescription($item);
@ -421,7 +410,17 @@ class RssParser
$itemId = (string) $item['id']; $itemId = (string) $item['id'];
$itemAuthor = (string) ($item['author'] ? $item['author'] : $item['author_name']); $itemAuthor = (string) ($item['author'] ? $item['author'] : $item['author_name']);
} }
} else print 'ErrorBadFeedFormat'; $itemCategory = array();
} else {
$itemCategory = array();
$itemLink = '';
$itemTitle = '';
$itemDescription = '';
$itemPubDate = '';
$itemId = '';
$itemAuthor = '';
print 'ErrorBadFeedFormat';
}
// Add record to result array // Add record to result array
$this->_rssarray[$i] = array( $this->_rssarray[$i] = array(
@ -431,7 +430,8 @@ class RssParser
'pubDate'=>$itemPubDate, 'pubDate'=>$itemPubDate,
'category'=>$itemCategory, 'category'=>$itemCategory,
'id'=>$itemId, 'id'=>$itemId,
'author'=>$itemAuthor); 'author'=>$itemAuthor
);
//var_dump($this->_rssarray); //var_dump($this->_rssarray);
$i++; $i++;

View File

@ -8,6 +8,7 @@
* Copyright (C) 2014-2018 Charlene Benke <charlies@patas-monkey.com> * Copyright (C) 2014-2018 Charlene Benke <charlies@patas-monkey.com>
* Copyright (C) 2015-2016 Abbes Bahfir <bafbes@gmail.com> * Copyright (C) 2015-2016 Abbes Bahfir <bafbes@gmail.com>
* Copyright (C) 2018 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2018 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2020 Frédéric France <frederic.france@netlogic.fr>
* *
* 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
@ -57,8 +58,8 @@ $langs->loadLangs(array('bills', 'companies', 'interventions'));
$id = GETPOST('id', 'int'); $id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha'); $ref = GETPOST('ref', 'alpha');
$socid = GETPOST('socid', 'int'); $socid = (int) GETPOST('socid', 'int');
$contratid = GETPOST('contratid', 'int'); $contratid = (int) GETPOST('contratid', 'int');
$action = GETPOST('action', 'alpha'); $action = GETPOST('action', 'alpha');
$cancel = GETPOST('cancel', 'alpha'); $cancel = GETPOST('cancel', 'alpha');
$confirm = GETPOST('confirm', 'alpha'); $confirm = GETPOST('confirm', 'alpha');
@ -175,8 +176,7 @@ if (empty($reshook))
} else { } else {
$mesg = $object->error; $mesg = $object->error;
} }
} elseif ($action == 'confirm_modify' && $confirm == 'yes' && $user->rights->ficheinter->creer) } elseif ($action == 'confirm_modify' && $confirm == 'yes' && $user->rights->ficheinter->creer) {
{
$result = $object->setDraft($user); $result = $object->setDraft($user);
if ($result >= 0) if ($result >= 0)
{ {
@ -187,8 +187,7 @@ if (empty($reshook))
$newlang = ''; $newlang = '';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09'); 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 ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang;
if (!empty($newlang)) if (!empty($newlang)) {
{
$outputlangs = new Translate("", $conf); $outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang($newlang); $outputlangs->setDefaultLang($newlang);
} }
@ -200,12 +199,11 @@ if (empty($reshook))
} else { } else {
$mesg = $object->error; $mesg = $object->error;
} }
} elseif ($action == 'add' && $user->rights->ficheinter->creer) } elseif ($action == 'add' && $user->rights->ficheinter->creer) {
{
$object->socid = $socid; $object->socid = $socid;
$object->duration = GETPOST('duration', 'int'); $object->duration = (int) GETPOST('duration', 'int');
$object->fk_project = GETPOST('projectid', 'int'); $object->fk_project = (int) GETPOST('projectid', 'int');
$object->fk_contrat = GETPOST('contratid', 'int'); $object->fk_contrat = (int) GETPOST('contratid', 'int');
$object->author = $user->id; $object->author = $user->id;
$object->description = GETPOST('description', 'restricthtml'); $object->description = GETPOST('description', 'restricthtml');
$object->ref = $ref; $object->ref = $ref;
@ -409,11 +407,10 @@ if (empty($reshook))
$mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ThirdParty")); $mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ThirdParty"));
$action = 'create'; $action = 'create';
} }
} elseif ($action == 'update' && $user->rights->ficheinter->creer) } elseif ($action == 'update' && $user->rights->ficheinter->creer) {
{
$object->socid = $socid; $object->socid = $socid;
$object->fk_project = GETPOST('projectid', 'int'); $object->fk_project = (int) GETPOST('projectid', 'int');
$object->fk_contrat = GETPOST('contratid', 'int'); $object->fk_contrat = (int) GETPOST('contratid', 'int');
$object->author = $user->id; $object->author = $user->id;
$object->description = GETPOST('description', 'restricthtml'); $object->description = GETPOST('description', 'restricthtml');
$object->ref = $ref; $object->ref = $ref;
@ -520,8 +517,7 @@ if (empty($reshook))
elseif ($action == 'classifybilled' && $user->rights->ficheinter->creer) elseif ($action == 'classifybilled' && $user->rights->ficheinter->creer)
{ {
$result = $object->setStatut(2); $result = $object->setStatut(2);
if ($result > 0) if ($result > 0) {
{
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
exit; exit;
} else { } else {

View File

@ -95,7 +95,10 @@ class Fichinter extends CommonObject
*/ */
protected $table_ref_field = 'ref'; protected $table_ref_field = 'ref';
public $socid; // Id client /**
* @var int Thirdparty Id
*/
public $socid;
public $author; public $author;
@ -118,7 +121,14 @@ class Fichinter extends CommonObject
*/ */
public $datem; public $datem;
/**
* @var int duration
*/
public $duration; public $duration;
/**
* @var int status
*/
public $statut = 0; // 0=draft, 1=validated, 2=invoiced, 3=Terminate public $statut = 0; // 0=draft, 1=validated, 2=invoiced, 3=Terminate
/** /**
@ -127,17 +137,23 @@ class Fichinter extends CommonObject
public $description; public $description;
/** /**
* @var int ID * @var int Contract ID
*/ */
public $fk_contrat = 0; public $fk_contrat = 0;
/** /**
* @var int ID * @var int Project ID
*/ */
public $fk_project = 0; public $fk_project = 0;
/**
* @var array extraparams
*/
public $extraparams = array(); public $extraparams = array();
/**
* @var array lines
*/
public $lines = array(); public $lines = array();
/** /**
@ -328,8 +344,7 @@ class Fichinter extends CommonObject
// End call triggers // End call triggers
} }
if (!$error) if (!$error) {
{
$this->db->commit(); $this->db->commit();
return $this->id; return $this->id;
} else { } else {

View File

@ -53,6 +53,9 @@ class FichinterRec extends Fichinter
*/ */
public $picto = 'intervention'; public $picto = 'intervention';
/**
* @var string title
*/
public $title; public $title;
public $number; public $number;
public $date; public $date;
@ -60,14 +63,28 @@ class FichinterRec extends Fichinter
public $remise; public $remise;
public $tva; public $tva;
public $total; public $total;
public $db_table;
/**
* @var int Proposal Id
*/
public $propalid; public $propalid;
public $date_last_gen; public $date_last_gen;
public $date_when; public $date_when;
/**
* @var int number of generation done
*/
public $nb_gen_done; public $nb_gen_done;
/**
* @var int number of maximum generation
*/
public $nb_gen_max; public $nb_gen_max;
/**
* int rank
*/
public $rang; public $rang;
public $special_code; public $special_code;

View File

@ -237,7 +237,7 @@ if ($conf->global->PRODUIT_MULTIPRICES) {
} else { } else {
$labelp = $langs->trans("SellingPrice")." ".$i; $labelp = $langs->trans("SellingPrice")." ".$i;
} }
$arrayfields['p.sellprice'.$i] = array('label'=>$labelp, 'checked'=>1, 'enabled'=>$conf->global->PRODUIT_MULTIPRICES, 'position'=>40); $arrayfields['p.sellprice'.$i] = array('label'=>$labelp, 'checked'=>1, 'enabled'=>$conf->global->PRODUIT_MULTIPRICES, 'position'=>floatval('40.'.sprintf('%03s', $i)));
$arraypricelevel[$i] = array($i); $arraypricelevel[$i] = array($i);
} }
} }

View File

@ -11,7 +11,7 @@
* Copyright (C) 2015 Alexandre Spangaro <aspangaro@open-dsi.fr> * Copyright (C) 2015 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es> * Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2018-2020 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com> * Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -49,7 +49,9 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
// Load translation files required by the page // Load translation files required by the page
$langs->loadLangs(array('products', 'bills', 'companies', 'other')); $langs->loadLangs(array('products', 'bills', 'companies', 'other'));
$mesg = ''; $error = 0; $errors = array(); $mesg = '';
$error = 0;
$errors = array();
$id = GETPOST('id', 'int'); $id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha'); $ref = GETPOST('ref', 'alpha');
@ -474,8 +476,7 @@ if (empty($reshook))
} }
} }
if ($action == 'delete_all_price_by_qty') if ($action == 'delete_all_price_by_qty') {
{
$priceid = GETPOST('priceid', 'int'); $priceid = GETPOST('priceid', 'int');
if (!empty($rowid)) { if (!empty($rowid)) {
$sql = "DELETE FROM ".MAIN_DB_PREFIX."product_price_by_qty"; $sql = "DELETE FROM ".MAIN_DB_PREFIX."product_price_by_qty";
@ -483,7 +484,7 @@ if (empty($reshook))
$result = $db->query($sql); $result = $db->query($sql);
} else { } else {
setEventMessages(('delete_price_by_qty'.$langs->transnoentities(MissingIds)), null, 'errors'); setEventMessages(('delete_price_by_qty'.$langs->transnoentities('MissingIds')), null, 'errors');
} }
} }

View File

@ -93,18 +93,18 @@ if (empty($reshook))
// Ajout entrepot // Ajout entrepot
if ($action == 'add' && $user->rights->stock->creer) if ($action == 'add' && $user->rights->stock->creer)
{ {
$object->ref = GETPOST("ref"); $object->ref = (string) GETPOST("ref", "alpha");
$object->fk_parent = GETPOST("fk_parent"); $object->fk_parent = (int) GETPOST("fk_parent", "int");
$object->label = GETPOST("libelle"); $object->label = (string) GETPOST("libelle", "alpha");
$object->description = GETPOST("desc"); $object->description = (string) GETPOST("desc", "alpha");
$object->statut = GETPOST("statut"); $object->statut = GETPOST("statut");
$object->lieu = GETPOST("lieu"); $object->lieu = (string) GETPOST("lieu", "alpha");
$object->address = GETPOST("address"); $object->address = (string) GETPOST("address", "alpha");
$object->zip = GETPOST("zipcode"); $object->zip = (string) GETPOST("zipcode", "alpha");
$object->town = GETPOST("town"); $object->town = (string) GETPOST("town", "alpha");
$object->country_id = GETPOST("country_id"); $object->country_id = GETPOST("country_id");
$object->phone = GETPOST("phone"); $object->phone = (string) GETPOST("phone", "alpha");
$object->fax = GETPOST("fax"); $object->fax = (string) GETPOST("fax", "alpha");
if (!empty($object->label)) { if (!empty($object->label)) {
// Fill array 'array_options' with data from add form // Fill array 'array_options' with data from add form