Skip to content
Permalink
Browse files

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

…evelop
  • Loading branch information
eldy committed Dec 9, 2019
2 parents 652e996 + fba2749 commit e8366efeec29d5780888c3ce65e5c6fed6036413
@@ -4,7 +4,7 @@
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018-2019 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
@@ -63,7 +63,7 @@
if ($action == 'validate' && $user->rights->deplacement->creer)
{
$object->fetch($id);
if ($object->statut == 0)
if ($object->statut == Deplacement::STATUS_DRAFT)
{
$result = $object->setStatut(1);
if ($result > 0)
@@ -81,9 +81,9 @@
elseif ($action == 'classifyrefunded' && $user->rights->deplacement->creer)
{
$object->fetch($id);
if ($object->statut == 1)
if ($object->statut == Deplacement::STATUS_VALIDATED)
{
$result = $object->setStatut(2);
$result = $object->setStatut(Deplacement::STATUS_REFUNDED);
if ($result > 0)
{
header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
@@ -116,14 +116,14 @@
{
$error = 0;

$object->date = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
$object->date = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
$object->km = price2num(GETPOST('km', 'alpha'), 'MU'); // Not 'int', it may be a formated amount
$object->type = GETPOST('type', 'alpha');
$object->socid = GETPOST('socid', 'int');
$object->fk_user = GETPOST('fk_user', 'int');
$object->type = GETPOST('type', 'alpha');
$object->socid = (int) GETPOST('socid', 'int');
$object->fk_user = (int) GETPOST('fk_user', 'int');
$object->note_private = GETPOST('note_private', 'alpha');
$object->note_public = GETPOST('note_public', 'alpha');
$object->statut = 0;
$object->statut = Deplacement::STATUS_DRAFT;

if (!$object->date)
{
@@ -178,8 +178,8 @@
$object->date = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
$object->km = price2num(GETPOST('km', 'alpha'), 'MU'); // Not 'int', it may be a formated amount
$object->type = GETPOST('type', 'alpha');
$object->socid = GETPOST('socid', 'int');
$object->fk_user = GETPOST('fk_user', 'int');
$object->socid = (int) GETPOST('socid', 'int');
$object->fk_user = (int) GETPOST('fk_user', 'int');
$object->note_private = GETPOST('note_private', 'alpha');
$object->note_public = GETPOST('note_public', 'alpha');

@@ -523,7 +523,7 @@

print '<div class="tabsAction">';

if ($object->statut < 2) // if not refunded
if ($object->statut < Deplacement::STATUS_REFUNDED) // if not refunded
{
if ($user->rights->deplacement->creer)
{
@@ -535,7 +535,7 @@
}
}

if ($object->statut == 0) // if draft
if ($object->statut == Deplacement::STATUS_DRAFT) // if draft
{
if ($user->rights->deplacement->creer)
{
@@ -547,7 +547,7 @@
}
}

if ($object->statut == 1) // if validated
if ($object->statut == Deplacement::STATUS_VALIDATED) // if validated
{
if ($user->rights->deplacement->creer)
{
@@ -3,6 +3,7 @@
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2009-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2019 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
@@ -81,14 +82,40 @@ class Deplacement extends CommonObject
*/
public $fk_user;

public $km;
/**
* @var string km value formatted
*/
public $km;

/**
* @var int Thirdparty id
*/
public $socid;
public $statut; // 0=draft, 1=validated

/**
* @var int Status 0=draft, 1=validated, 2=Refunded
*/
public $statut;
public $extraparams=array();

public $statuts=array();
public $statuts_short=array();

/**
* Draft status
*/
const STATUS_DRAFT = 0;

/**
* Validated status
*/
const STATUS_VALIDATED = 1;

/**
* Refunded status
*/
const STATUS_REFUNDED = 2;

/**
* Constructor
*
@@ -8135,7 +8135,7 @@ function roundUpToNextMultiple($n, $x = 5)
function dolGetBadge($label, $html = '', $type = 'primary', $mode = '', $url = '', $params = array())
{
$attr = array(
'class'=>'badge badge-status'.(!empty($mode) ? ' badge-'.$mode : '').(!empty($type) ? ' badge-'.$type : '').(empty($params['css']) ? '' : ' '.$params['css'])
'class'=>'badge '.(!empty($mode) ? ' badge-'.$mode : '').(!empty($type) ? ' badge-'.$type : '').(empty($params['css']) ? '' : ' '.$params['css'])
);

if (empty($html)) {
@@ -8156,7 +8156,15 @@ function dolGetBadge($label, $html = '', $type = 'primary', $mode = '', $url = '
// Override attr
if (!empty($params['attr']) && is_array($params['attr'])) {
foreach ($params['attr']as $key => $value) {
$attr[$key] = $value;
if ($key == 'class') {
$attr['class'] .= ' '.$value;
}
elseif ($key == 'classOverride') {
$attr['class'] = $value;
}
else {
$attr[$key] = $value;
}
}
}

@@ -8263,6 +8271,8 @@ function dolGetStatus($statusLabel = '', $statusLabelShort = '', $html = '', $st
elseif (empty($conf->global->MAIN_STATUS_USES_IMAGES) && !empty($displayMode)) {
$statusLabelShort = !empty($statusLabelShort) ? $statusLabelShort : $statusLabel;

$dolGetBadgeParams['attr']['class'] = 'badge-status';

if ($displayMode == 3) {
$return = dolGetBadge($statusLabel, '', $statusType, 'dot', $url, $dolGetBadgeParams);
}
@@ -121,14 +121,14 @@ public function create($user, $notrigger = false)
}

// Clean parameters
if (isset($this->fk_donation)) $this->fk_donation=trim($this->fk_donation);
if (isset($this->fk_donation)) $this->fk_donation = (int) $this->fk_donation;
if (isset($this->amount)) $this->amount=trim($this->amount);
if (isset($this->fk_typepayment)) $this->fk_typepayment=trim($this->fk_typepayment);
if (isset($this->num_payment)) $this->num_payment=trim($this->num_payment);
if (isset($this->note_public)) $this->note_public=trim($this->note_public);
if (isset($this->fk_bank)) $this->fk_bank=trim($this->fk_bank);
if (isset($this->fk_user_creat)) $this->fk_user_creat=trim($this->fk_user_creat);
if (isset($this->fk_user_modif)) $this->fk_user_modif=trim($this->fk_user_modif);
if (isset($this->fk_bank)) $this->fk_bank = (int) $this->fk_bank;
if (isset($this->fk_user_creat)) $this->fk_user_creat = (int) $this->fk_user_creat;
if (isset($this->fk_user_modif)) $this->fk_user_modif = (int) $this->fk_user_modif;

$totalamount = 0;
foreach ($this->amounts as $key => $value) // How payment is dispatch
@@ -275,14 +275,14 @@ public function update($user, $notrigger = 0)

// Clean parameters

if (isset($this->fk_donation)) $this->fk_donation=trim($this->fk_donation);
if (isset($this->fk_donation)) $this->fk_donation = (int) $this->fk_donation;
if (isset($this->amount)) $this->amount=trim($this->amount);
if (isset($this->fk_typepayment)) $this->fk_typepayment=trim($this->fk_typepayment);
if (isset($this->num_payment)) $this->num_payment=trim($this->num_payment);
if (isset($this->note_public)) $this->note_public=trim($this->note_public);
if (isset($this->fk_bank)) $this->fk_bank=trim($this->fk_bank);
if (isset($this->fk_user_creat)) $this->fk_user_creat=trim($this->fk_user_creat);
if (isset($this->fk_user_modif)) $this->fk_user_modif=trim($this->fk_user_modif);
if (isset($this->fk_bank)) $this->fk_bank = (int) $this->fk_bank;
if (isset($this->fk_user_creat)) $this->fk_user_creat = (int) $this->fk_user_creat;
if (isset($this->fk_user_modif)) $this->fk_user_modif = (int) $this->fk_user_modif;

// Check parameters
// Put here code to add control on parameters values
@@ -300,13 +300,16 @@ public function update($user, $notrigger = 0)
$sql.= " fk_bank=".(isset($this->fk_bank)?$this->fk_bank:"null").",";
$sql.= " fk_user_creat=".(isset($this->fk_user_creat)?$this->fk_user_creat:"null").",";
$sql.= " fk_user_modif=".(isset($this->fk_user_modif)?$this->fk_user_modif:"null")."";
$sql.= " WHERE rowid=".$this->id;
$sql.= " WHERE rowid=".(int) $this->id;

$this->db->begin();

dol_syslog(get_class($this)."::update", LOG_DEBUG);
$resql = $this->db->query($sql);
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
if (! $resql) {
$error++;
$this->errors[]="Error ".$this->db->lasterror();
}

if (! $error)
{
@@ -358,7 +361,7 @@ public function delete($user, $notrigger = 0)
if (! $error)
{
$sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_url";
$sql.= " WHERE type='payment_donation' AND url_id=".$this->id;
$sql.= " WHERE type='payment_donation' AND url_id=".(int) $this->id;

dol_syslog(get_class($this)."::delete", LOG_DEBUG);
$resql = $this->db->query($sql);
@@ -372,7 +375,10 @@ public function delete($user, $notrigger = 0)

dol_syslog(get_class($this)."::delete", LOG_DEBUG);
$resql = $this->db->query($sql);
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
if (! $resql) {
$error++;
$this->errors[]="Error ".$this->db->lasterror();
}
}

if (! $error)
@@ -609,7 +615,7 @@ public function addPaymentToBank($user, $mode, $label, $accountid, $emetteur_nom
public function update_fk_bank($id_bank)
{
// phpcs:enable
$sql = "UPDATE ".MAIN_DB_PREFIX."payment_donation SET fk_bank = ".$id_bank." WHERE rowid = ".$this->id;
$sql = "UPDATE ".MAIN_DB_PREFIX."payment_donation SET fk_bank = ".(int) $id_bank." WHERE rowid = ".(int) $this->id;

dol_syslog(get_class($this)."::update_fk_bank", LOG_DEBUG);
$result = $this->db->query($sql);
@@ -52,15 +52,15 @@ create table llx_societe
email varchar(128), --

socialnetworks text DEFAULT NULL, -- json with socialnetworks
skype varchar(255), --
twitter varchar(255), --
facebook varchar(255), --
linkedin varchar(255), --
instagram varchar(255), --
snapchat varchar(255), --
googleplus varchar(255), --
youtube varchar(255), --
whatsapp varchar(255), --
skype varchar(255), -- deprecated
twitter varchar(255), -- deprecated
facebook varchar(255), -- deprecated
linkedin varchar(255), -- deprecated
instagram varchar(255), -- deprecated
snapchat varchar(255), -- deprecated
googleplus varchar(255), -- deprecated
youtube varchar(255), -- deprecated
whatsapp varchar(255), -- deprecated

fk_effectif integer DEFAULT 0, --
fk_typent integer DEFAULT 0, --
@@ -120,7 +120,15 @@ class Mo extends CommonObject
public $qty;
public $fk_warehouse;
public $fk_soc;

/**
* @var string public note
*/
public $note_public;

/**
* @var string private note
*/
public $note_private;

/**
@@ -245,7 +253,7 @@ public function create(User $user, $notrigger = false)
// Insert lines in mrp_production table
if (! $error && $this->fk_bom > 0)
{
include_once DOL_DOCULENT_ROOT.'/bom/class/bom.class.php';
include_once DOL_DOCUMENT_ROOT.'/bom/class/bom.class.php';
$bom = new Bom($this->db);
$bom->fetch($this->fk_bom);
if ($bom->id > 0)
@@ -4,7 +4,7 @@
* Copyright (C) 2006-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2012 J. Fernando Lagrange <fernando@demo-tic.org>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018-2019 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2018 Alexandre Spangaro <aspangaro@open-dsi.fr>
*
* This program is free software; you can redistribute it and/or modify
@@ -567,7 +567,7 @@ function initmorphy()
$morphys["mor"] = $langs->trans("Moral");
if (empty($conf->global->MEMBER_NEWFORM_FORCEMORPHY))
{
print '<tr class="morphy"><td class="titlefield">'.$langs->trans('Nature').' <FONT COLOR="red">*</FONT></td><td>'."\n";
print '<tr class="morphy"><td class="titlefield">'.$langs->trans('MemberNature').' <FONT COLOR="red">*</FONT></td><td>'."\n";
print $form->selectarray("morphy", $morphys, GETPOST('morphy'), 1);
print '</td></tr>'."\n";
}
@@ -82,7 +82,7 @@ protected function getObject($id, $ref = '')
public function assign_values(&$action, $id = 0, $ref = '')
{
// phpcs:enable
global $conf, $langs, $user, $mysoc, $canvas;
global $conf, $langs, $db, $user, $mysoc, $canvas;
global $form, $formadmin, $formcompany;

if ($action == 'add' || $action == 'update') $this->assign_post($action);

0 comments on commit e8366ef

Please sign in to comment.
You can’t perform that action at this time.