Skip to content
This repository has been archived by the owner on Dec 19, 2023. It is now read-only.

Commit

Permalink
Merge pull request #5 from Dolibarr/develop
Browse files Browse the repository at this point in the history
Update fork
  • Loading branch information
TheGivrix committed Nov 20, 2020
2 parents c48129e + 6976471 commit ebd64d5
Show file tree
Hide file tree
Showing 9 changed files with 99 additions and 72 deletions.
1 change: 0 additions & 1 deletion htdocs/contact/class/contact.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1513,7 +1513,6 @@ public function initAsSpecimen()
$this->country_code = 'FR';
$this->country = 'France';
$this->email = 'specimen@specimen.com';
$this->skype = 'tom.hanson';
$this->socialnetworks = array(
'skype' => 'tom.hanson',
);
Expand Down
11 changes: 5 additions & 6 deletions htdocs/core/class/ldap.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -984,14 +984,12 @@ public function getRecords($search, $userDn, $useridentifier, $attributeArray, $
// Define filter
if (!empty($activefilter))
{
if (((string) $activefilter == '1' || (string) $activefilter == 'user') && $this->filter)
{
if (((string) $activefilter == '1' || (string) $activefilter == 'user') && $this->filter) {
$filter = '('.$this->filter.')';
} elseif (((string) $activefilter == 'member') && $this->filter)
{
} elseif (((string) $activefilter == 'member') && $this->filter) {
$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.'=*)';
}
} else {
Expand Down Expand Up @@ -1070,6 +1068,7 @@ public function getRecords($search, $userDn, $useridentifier, $attributeArray, $
*/
public function littleEndian($hex)
{
$result = '';
for ($x = dol_strlen($hex) - 2; $x >= 0; $x = $x - 2) {
$result .= substr($hex, $x, 2);
}
Expand Down
48 changes: 24 additions & 24 deletions htdocs/core/class/rssparser.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -308,11 +308,9 @@ public function parser($urlRSS, $maxNb = 0, $cachedelay = 60, $cachedir = '')
$items = array();

// Save description entries
if ($rss->_format == 'rss')
{
if ($rss->_format == '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->generator)) $this->_generator = (string) $rss->channel->generator;
if (!empty($rss->channel->copyright)) $this->_copyright = (string) $rss->channel->copyright;
Expand All @@ -336,8 +334,7 @@ public function parser($urlRSS, $maxNb = 0, $cachedelay = 60, $cachedir = '')
if (!empty($conf->global->EXTERNALRSS_USE_SIMPLEXML)) $items = $rss->channel->item; // With simplexml
else $items = $rss->items; // With xmlparse
//var_dump($items);exit;
} elseif ($rss->_format == 'atom')
{
} elseif ($rss->_format == 'atom') {
//var_dump($rss);
if (!empty($conf->global->EXTERNALRSS_USE_SIMPLEXML))
{
Expand Down Expand Up @@ -370,15 +367,11 @@ public function parser($urlRSS, $maxNb = 0, $cachedelay = 60, $cachedir = '')
$i = 0;

// Loop on each record
if (is_array($items))
{
foreach ($items as $item)
{
if (is_array($items)) {
foreach ($items as $item) {
//var_dump($item);exit;
if ($rss->_format == 'rss')
{
if (!empty($conf->global->EXTERNALRSS_USE_SIMPLEXML))
{
if ($rss->_format == 'rss') {
if (!empty($conf->global->EXTERNALRSS_USE_SIMPLEXML)) {
$itemLink = (string) $item->link;
$itemTitle = (string) $item->title;
$itemDescription = (string) $item->description;
Expand All @@ -396,17 +389,13 @@ public function parser($urlRSS, $maxNb = 0, $cachedelay = 60, $cachedir = '')

// Loop on each category
$itemCategory = array();
if (is_array($item->category))
{
foreach ($item->category as $cat)
{
if (is_array($item->category)) {
foreach ($item->category as $cat) {
$itemCategory[] = (string) $cat;
}
}
} elseif ($rss->_format == 'atom')
{
if (!empty($conf->global->EXTERNALRSS_USE_SIMPLEXML))
{
} elseif ($rss->_format == 'atom') {
if (!empty($conf->global->EXTERNALRSS_USE_SIMPLEXML)) {
$itemLink = (isset($item['link']) ? (string) $item['link'] : '');
$itemTitle = (string) $item['title'];
$itemDescription = $this->getAtomItemDescription($item);
Expand All @@ -421,7 +410,17 @@ public function parser($urlRSS, $maxNb = 0, $cachedelay = 60, $cachedir = '')
$itemId = (string) $item['id'];
$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
$this->_rssarray[$i] = array(
Expand All @@ -431,7 +430,8 @@ public function parser($urlRSS, $maxNb = 0, $cachedelay = 60, $cachedir = '')
'pubDate'=>$itemPubDate,
'category'=>$itemCategory,
'id'=>$itemId,
'author'=>$itemAuthor);
'author'=>$itemAuthor
);
//var_dump($this->_rssarray);

$i++;
Expand Down
34 changes: 15 additions & 19 deletions htdocs/fichinter/card.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* Copyright (C) 2014-2018 Charlene Benke <charlies@patas-monkey.com>
* Copyright (C) 2015-2016 Abbes Bahfir <bafbes@gmail.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
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -57,8 +58,8 @@

$id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha');
$socid = GETPOST('socid', 'int');
$contratid = GETPOST('contratid', 'int');
$socid = (int) GETPOST('socid', 'int');
$contratid = (int) GETPOST('contratid', 'int');
$action = GETPOST('action', 'alpha');
$cancel = GETPOST('cancel', 'alpha');
$confirm = GETPOST('confirm', 'alpha');
Expand Down Expand Up @@ -175,8 +176,7 @@
} else {
$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);
if ($result >= 0)
{
Expand All @@ -187,8 +187,7 @@
$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))
{
if (!empty($newlang)) {
$outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang($newlang);
}
Expand All @@ -200,14 +199,13 @@
} else {
$mesg = $object->error;
}
} elseif ($action == 'add' && $user->rights->ficheinter->creer)
{
} elseif ($action == 'add' && $user->rights->ficheinter->creer) {
$object->socid = $socid;
$object->duration = GETPOST('duration', 'int');
$object->fk_project = GETPOST('projectid', 'int');
$object->fk_contrat = GETPOST('contratid', 'int');
$object->duration = (int) GETPOST('duration', 'int');
$object->fk_project = (int) GETPOST('projectid', 'int');
$object->fk_contrat = (int) GETPOST('contratid', 'int');
$object->author = $user->id;
$object->description = GETPOST('description', 'restricthtml');
$object->description = GETPOST('description', 'restricthtml');
$object->ref = $ref;
$object->model_pdf = GETPOST('model', 'alpha');
$object->note_private = GETPOST('note_private', 'restricthtml');
Expand Down Expand Up @@ -409,13 +407,12 @@
$mesg = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ThirdParty"));
$action = 'create';
}
} elseif ($action == 'update' && $user->rights->ficheinter->creer)
{
} elseif ($action == 'update' && $user->rights->ficheinter->creer) {
$object->socid = $socid;
$object->fk_project = GETPOST('projectid', 'int');
$object->fk_contrat = GETPOST('contratid', 'int');
$object->fk_project = (int) GETPOST('projectid', 'int');
$object->fk_contrat = (int) GETPOST('contratid', 'int');
$object->author = $user->id;
$object->description = GETPOST('description', 'restricthtml');
$object->description = GETPOST('description', 'restricthtml');
$object->ref = $ref;

$result = $object->update($user);
Expand Down Expand Up @@ -520,8 +517,7 @@
elseif ($action == 'classifybilled' && $user->rights->ficheinter->creer)
{
$result = $object->setStatut(2);
if ($result > 0)
{
if ($result > 0) {
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
exit;
} else {
Expand Down
25 changes: 20 additions & 5 deletions htdocs/fichinter/class/fichinter.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,10 @@ class Fichinter extends CommonObject
*/
protected $table_ref_field = 'ref';

public $socid; // Id client
/**
* @var int Thirdparty Id
*/
public $socid;

public $author;

Expand All @@ -118,7 +121,14 @@ class Fichinter extends CommonObject
*/
public $datem;

/**
* @var int duration
*/
public $duration;

/**
* @var int status
*/
public $statut = 0; // 0=draft, 1=validated, 2=invoiced, 3=Terminate

/**
Expand All @@ -127,17 +137,23 @@ class Fichinter extends CommonObject
public $description;

/**
* @var int ID
* @var int Contract ID
*/
public $fk_contrat = 0;

/**
* @var int ID
* @var int Project ID
*/
public $fk_project = 0;

/**
* @var array extraparams
*/
public $extraparams = array();

/**
* @var array lines
*/
public $lines = array();

/**
Expand Down Expand Up @@ -328,8 +344,7 @@ public function create($user, $notrigger = 0)
// End call triggers
}

if (!$error)
{
if (!$error) {
$this->db->commit();
return $this->id;
} else {
Expand Down
19 changes: 18 additions & 1 deletion htdocs/fichinter/class/fichinterrec.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,21 +53,38 @@ class FichinterRec extends Fichinter
*/
public $picto = 'intervention';

/**
* @var string title
*/
public $title;
public $number;
public $date;
public $amount;
public $remise;
public $tva;
public $total;
public $db_table;

/**
* @var int Proposal Id
*/
public $propalid;

public $date_last_gen;
public $date_when;

/**
* @var int number of generation done
*/
public $nb_gen_done;

/**
* @var int number of maximum generation
*/
public $nb_gen_max;

/**
* int rank
*/
public $rang;
public $special_code;

Expand Down
2 changes: 1 addition & 1 deletion htdocs/product/list.php
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@
} else {
$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);
}
}
Expand Down
11 changes: 6 additions & 5 deletions htdocs/product/price.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* Copyright (C) 2015 Alexandre Spangaro <aspangaro@open-dsi.fr>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* 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>
*
* This program is free software; you can redistribute it and/or modify
Expand Down Expand Up @@ -49,7 +49,9 @@
// Load translation files required by the page
$langs->loadLangs(array('products', 'bills', 'companies', 'other'));

$mesg = ''; $error = 0; $errors = array();
$mesg = '';
$error = 0;
$errors = array();

$id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha');
Expand Down Expand Up @@ -474,16 +476,15 @@
}
}

if ($action == 'delete_all_price_by_qty')
{
if ($action == 'delete_all_price_by_qty') {
$priceid = GETPOST('priceid', 'int');
if (!empty($rowid)) {
$sql = "DELETE FROM ".MAIN_DB_PREFIX."product_price_by_qty";
$sql .= " WHERE fk_product_price = ".$priceid;

$result = $db->query($sql);
} else {
setEventMessages(('delete_price_by_qty'.$langs->transnoentities(MissingIds)), null, 'errors');
setEventMessages(('delete_price_by_qty'.$langs->transnoentities('MissingIds')), null, 'errors');
}
}

Expand Down
20 changes: 10 additions & 10 deletions htdocs/product/stock/card.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,18 +93,18 @@
// Ajout entrepot
if ($action == 'add' && $user->rights->stock->creer)
{
$object->ref = GETPOST("ref");
$object->fk_parent = GETPOST("fk_parent");
$object->label = GETPOST("libelle");
$object->description = GETPOST("desc");
$object->ref = (string) GETPOST("ref", "alpha");
$object->fk_parent = (int) GETPOST("fk_parent", "int");
$object->label = (string) GETPOST("libelle", "alpha");
$object->description = (string) GETPOST("desc", "alpha");
$object->statut = GETPOST("statut");
$object->lieu = GETPOST("lieu");
$object->address = GETPOST("address");
$object->zip = GETPOST("zipcode");
$object->town = GETPOST("town");
$object->lieu = (string) GETPOST("lieu", "alpha");
$object->address = (string) GETPOST("address", "alpha");
$object->zip = (string) GETPOST("zipcode", "alpha");
$object->town = (string) GETPOST("town", "alpha");
$object->country_id = GETPOST("country_id");
$object->phone = GETPOST("phone");
$object->fax = GETPOST("fax");
$object->phone = (string) GETPOST("phone", "alpha");
$object->fax = (string) GETPOST("fax", "alpha");

if (!empty($object->label)) {
// Fill array 'array_options' with data from add form
Expand Down

0 comments on commit ebd64d5

Please sign in to comment.