Skip to content

Commit

Permalink
Merge branch '5.0' of git@github.com:Dolibarr/dolibarr.git into develop
Browse files Browse the repository at this point in the history
Conflicts:
	htdocs/adherents/class/adherent.class.php
	htdocs/filefunc.inc.php
  • Loading branch information
eldy committed Mar 19, 2017
2 parents 42898cd + 5871d59 commit 4831fb4
Show file tree
Hide file tree
Showing 31 changed files with 319 additions and 197 deletions.
35 changes: 4 additions & 31 deletions htdocs/accountancy/admin/categories_list.php
Expand Up @@ -628,12 +628,6 @@
if ($fieldlist[$field]=='delay') { $valuetoshow=$langs->trans("NoticePeriod"); }
if ($fieldlist[$field]=='newbymonth') { $valuetoshow=$langs->trans("NewByMonth"); }

if ($id == 2) // Special cas for state page
{
if ($fieldlist[$field]=='region_id') { $valuetoshow=' '; $showfield=1; }
if ($fieldlist[$field]=='region') { $valuetoshow=$langs->trans("Country").'/'.$langs->trans("Region"); $showfield=1; }
}

if ($valuetoshow != '')
{
print '<td align="'.$align.'">';
Expand Down Expand Up @@ -675,36 +669,15 @@

if (empty($reshook))
{
if ($tabname[$id] == MAIN_DB_PREFIX.'c_email_templates' && $action == 'edit')
{
fieldList($fieldlist,$obj,$tabname[$id],'hide');
}
else
{
fieldList($fieldlist,$obj,$tabname[$id],'add');
}
fieldList($fieldlist,$obj,$tabname[$id],'add');
}

print '<td colspan="4" align="right">';
if ($tabname[$id] != MAIN_DB_PREFIX.'c_email_templates' || $action != 'edit')
{
print '<input type="submit" class="button" name="actionadd" value="'.$langs->trans("Add").'">';
}
print '<input type="submit" class="button" name="actionadd" value="'.$langs->trans("Add").'">';
print '</td>';
print "</tr>";

if ($tabname[$id] == MAIN_DB_PREFIX.'c_email_templates')
{
print '<tr><td colspan="8">* '.$langs->trans("AvailableVariables").": ";
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
$formmail=new FormMail($db);
$tmp=$formmail->getAvailableSubstitKey('form');
print implode(', ', $tmp);
print '</td></tr>';
}

$colspan=count($fieldlist)+3;
if ($id == 4) $colspan++;

if (! empty($alabelisused)) // If there is one label among fields, we show legend of *
{
Expand Down Expand Up @@ -1175,7 +1148,7 @@
function fieldList($fieldlist, $obj='', $tabname='', $context='')
{
global $conf,$langs,$db;
global $form;
global $form, $mysoc;
global $region_id;
global $elementList,$sourceList,$localtax_typeList;
global $bc;
Expand All @@ -1197,7 +1170,7 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='')
} // For state page, we do not show the country input (we link to region, not country)
print '<td>';
$fieldname='country';
print $form->select_country((! empty($obj->country_code)?$obj->country_code:(! empty($obj->country)?$obj->country:'')), $fieldname, '', 28, 'maxwidth200 maxwidthonsmartphone');
print $form->select_country((! empty($obj->country_code)?$obj->country_code:(! empty($obj->country)?$obj->country:$mysoc->country_code)), $fieldname, '', 28, 'maxwidth200 maxwidthonsmartphone');
print '</td>';
}
elseif ($fieldlist[$field] == 'country_id')
Expand Down
69 changes: 35 additions & 34 deletions htdocs/adherents/class/adherent.class.php
Expand Up @@ -4,7 +4,7 @@
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2009-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2009-2017 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2014-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
Expand Down Expand Up @@ -496,7 +496,7 @@ function update($user,$notrigger=0,$nosyncuser=0,$nosyncuserpass=0,$nosyncthirdp
if ($this->pass != $this->pass_indatabase && $this->pass != $this->pass_indatabase_crypted)
{
$isencrypted = empty($conf->global->DATABASE_PWD_ENCRYPTED)?0:1;

// If password to set differs from the one found into database
$result=$this->setPassword($user,$this->pass,$isencrypted,$notrigger,$nosyncuserpass);
if (! $nbrowsaffected) $nbrowsaffected++;
Expand Down Expand Up @@ -862,7 +862,7 @@ function setPassword($user, $password='', $isencrypted=0, $notrigger=0, $nosyncu
$this->pass=$password;
$this->pass_indatabase=$password_indatabase;
$this->pass_indatabase_crypted=$password_crypted;

if ($this->user_id && ! $nosyncuser)
{
require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
Expand Down Expand Up @@ -1122,7 +1122,7 @@ function fetch($rowid,$ref='',$fk_soc='',$ref_ext='')
$this->pass = $obj->pass;
$this->pass_indatabase = $obj->pass;
$this->pass_indatabase_crypted = $obj->pass_crypted;

$this->state_id = $obj->state_id;
$this->state_code = $obj->state_id?$obj->state_code:'';
$this->state = $obj->state_id?$obj->state:'';
Expand Down Expand Up @@ -1160,7 +1160,7 @@ function fetch($rowid,$ref='',$fk_soc='',$ref_ext='')

$this->user_id = $obj->user_id;
$this->user_login = $obj->user_login;

$this->model_pdf = $obj->model_pdf;

// Retreive all extrafield for thirdparty
Expand Down Expand Up @@ -1456,7 +1456,7 @@ function add_to_abo()
if (! empty($conf->global->ADHERENT_USE_MAILMAN) && ! empty($conf->mailmanspip->enabled))
{
$result=$mailmanspip->add_to_mailman($this);

if ($result < 0)
{
if (! empty($mailmanspip->error)) $this->errors[]=$mailmanspip->error;
Expand Down Expand Up @@ -1815,10 +1815,10 @@ function load_board($user)
public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
{
global $conf,$langs;

$langs->load("orders");
if (! dol_strlen($modele)) {

if (! dol_strlen($modele)) {

$modele = 'standard';

Expand All @@ -1830,11 +1830,11 @@ public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedes
}

$modelpath = "core/modules/member/doc/";

return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
}


/**
* Initialise an instance with random values.
* Used to build previews or test instances.
Expand Down Expand Up @@ -1924,27 +1924,28 @@ function _load_ldap_info()
$this->fullname=$this->getFullName($langs);

// Member
if ($this->fullname && ! empty($conf->global->LDAP_MEMBER_FIELD_FULLNAME)) $info[$conf->global->LDAP_MEMBER_FIELD_FULLNAME] = $this->fullname;
if ($this->lastname && ! empty($conf->global->LDAP_MEMBER_FIELD_NAME)) $info[$conf->global->LDAP_MEMBER_FIELD_NAME] = $this->lastname;
if ($this->firstname && ! empty($conf->global->LDAP_MEMBER_FIELD_FIRSTNAME)) $info[$conf->global->LDAP_MEMBER_FIELD_FIRSTNAME] = $this->firstname;
if ($this->login && ! empty($conf->global->LDAP_MEMBER_FIELD_LOGIN)) $info[$conf->global->LDAP_MEMBER_FIELD_LOGIN] = $this->login;
if ($this->pass && ! empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD)) $info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD] = $this->pass; // this->pass = mot de passe non crypte
if ($this->poste && ! empty($conf->global->LDAP_MEMBER_FIELD_TITLE)) $info[$conf->global->LDAP_MEMBER_FIELD_TITLE] = $this->poste;
if ($this->address && ! empty($conf->global->LDAP_MEMBER_FIELD_ADDRESS)) $info[$conf->global->LDAP_MEMBER_FIELD_ADDRESS] = $this->address;
if ($this->zip && ! empty($conf->global->LDAP_MEMBER_FIELD_ZIP)) $info[$conf->global->LDAP_MEMBER_FIELD_ZIP] = $this->zip;
if ($this->town && ! empty($conf->global->LDAP_MEMBER_FIELD_TOWN)) $info[$conf->global->LDAP_MEMBER_FIELD_TOWN] = $this->town;
if ($this->country_code && ! empty($conf->global->LDAP_MEMBER_FIELD_COUNTRY)) $info[$conf->global->LDAP_MEMBER_FIELD_COUNTRY] = $this->country_code;
if ($this->email && ! empty($conf->global->LDAP_MEMBER_FIELD_MAIL)) $info[$conf->global->LDAP_MEMBER_FIELD_MAIL] = $this->email;
if ($this->skype && ! empty($conf->global->LDAP_MEMBER_FIELD_SKYPE)) $info[$conf->global->LDAP_MEMBER_FIELD_SKYPE] = $this->skype;
if ($this->phone && ! empty($conf->global->LDAP_MEMBER_FIELD_PHONE)) $info[$conf->global->LDAP_MEMBER_FIELD_PHONE] = $this->phone;
if ($this->phone_perso && ! empty($conf->global->LDAP_MEMBER_FIELD_PHONE_PERSO)) $info[$conf->global->LDAP_MEMBER_FIELD_PHONE_PERSO] = $this->phone_perso;
if ($this->phone_mobile && ! empty($conf->global->LDAP_MEMBER_FIELD_MOBILE)) $info[$conf->global->LDAP_MEMBER_FIELD_MOBILE] = $this->phone_mobile;
if ($this->fax && ! empty($conf->global->LDAP_MEMBER_FIELD_FAX)) $info[$conf->global->LDAP_MEMBER_FIELD_FAX] = $this->fax;
if ($this->note_private && ! empty($conf->global->LDAP_MEMBER_FIELD_DESCRIPTION)) $info[$conf->global->LDAP_MEMBER_FIELD_DESCRIPTION] = $this->note_private;
if ($this->note_public && ! empty($conf->global->LDAP_MEMBER_FIELD_NOTE_PUBLIC)) $info[$conf->global->LDAP_MEMBER_FIELD_NOTE_PUBLIC] = $this->note_public;
if ($this->birth && ! empty($conf->global->LDAP_MEMBER_FIELD_BIRTHDATE)) $info[$conf->global->LDAP_MEMBER_FIELD_BIRTHDATE] = dol_print_date($this->birth,'dayhourldap');
if (isset($this->statut) && ! empty($conf->global->LDAP_FIELD_MEMBER_STATUS)) $info[$conf->global->LDAP_FIELD_MEMBER_STATUS] = $this->statut;
if ($this->datefin && ! empty($conf->global->LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION)) $info[$conf->global->LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION] = dol_print_date($this->datefin,'dayhourldap');
if ($this->fullname && ! empty($conf->global->LDAP_MEMBER_FIELD_FULLNAME)) $info[$conf->global->LDAP_MEMBER_FIELD_FULLNAME] = $this->fullname;
if ($this->lastname && ! empty($conf->global->LDAP_MEMBER_FIELD_NAME)) $info[$conf->global->LDAP_MEMBER_FIELD_NAME] = $this->lastname;
if ($this->firstname && ! empty($conf->global->LDAP_MEMBER_FIELD_FIRSTNAME)) $info[$conf->global->LDAP_MEMBER_FIELD_FIRSTNAME] = $this->firstname;
if ($this->login && ! empty($conf->global->LDAP_MEMBER_FIELD_LOGIN)) $info[$conf->global->LDAP_MEMBER_FIELD_LOGIN] = $this->login;
if ($this->pass && ! empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD)) $info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD] = $this->pass; // this->pass = mot de passe non crypte
if ($this->pass && ! empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED)) $info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED] = dol_hash($this->pass, 4); // md5 for OpenLdap TODO add type of encryption
if ($this->poste && ! empty($conf->global->LDAP_MEMBER_FIELD_TITLE)) $info[$conf->global->LDAP_MEMBER_FIELD_TITLE] = $this->poste;
if ($this->address && ! empty($conf->global->LDAP_MEMBER_FIELD_ADDRESS)) $info[$conf->global->LDAP_MEMBER_FIELD_ADDRESS] = $this->address;
if ($this->zip && ! empty($conf->global->LDAP_MEMBER_FIELD_ZIP)) $info[$conf->global->LDAP_MEMBER_FIELD_ZIP] = $this->zip;
if ($this->town && ! empty($conf->global->LDAP_MEMBER_FIELD_TOWN)) $info[$conf->global->LDAP_MEMBER_FIELD_TOWN] = $this->town;
if ($this->country_code && ! empty($conf->global->LDAP_MEMBER_FIELD_COUNTRY)) $info[$conf->global->LDAP_MEMBER_FIELD_COUNTRY] = $this->country_code;
if ($this->email && ! empty($conf->global->LDAP_MEMBER_FIELD_MAIL)) $info[$conf->global->LDAP_MEMBER_FIELD_MAIL] = $this->email;
if ($this->skype && ! empty($conf->global->LDAP_MEMBER_FIELD_SKYPE)) $info[$conf->global->LDAP_MEMBER_FIELD_SKYPE] = $this->skype;
if ($this->phone && ! empty($conf->global->LDAP_MEMBER_FIELD_PHONE)) $info[$conf->global->LDAP_MEMBER_FIELD_PHONE] = $this->phone;
if ($this->phone_perso && ! empty($conf->global->LDAP_MEMBER_FIELD_PHONE_PERSO)) $info[$conf->global->LDAP_MEMBER_FIELD_PHONE_PERSO] = $this->phone_perso;
if ($this->phone_mobile && ! empty($conf->global->LDAP_MEMBER_FIELD_MOBILE)) $info[$conf->global->LDAP_MEMBER_FIELD_MOBILE] = $this->phone_mobile;
if ($this->fax && ! empty($conf->global->LDAP_MEMBER_FIELD_FAX)) $info[$conf->global->LDAP_MEMBER_FIELD_FAX] = $this->fax;
if ($this->note_private && ! empty($conf->global->LDAP_MEMBER_FIELD_DESCRIPTION)) $info[$conf->global->LDAP_MEMBER_FIELD_DESCRIPTION] = $this->note_private;
if ($this->note_public && ! empty($conf->global->LDAP_MEMBER_FIELD_NOTE_PUBLIC)) $info[$conf->global->LDAP_MEMBER_FIELD_NOTE_PUBLIC] = $this->note_public;
if ($this->birth && ! empty($conf->global->LDAP_MEMBER_FIELD_BIRTHDATE)) $info[$conf->global->LDAP_MEMBER_FIELD_BIRTHDATE] = dol_print_date($this->birth,'dayhourldap');
if (isset($this->statut) && ! empty($conf->global->LDAP_FIELD_MEMBER_STATUS)) $info[$conf->global->LDAP_FIELD_MEMBER_STATUS] = $this->statut;
if ($this->datefin && ! empty($conf->global->LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION)) $info[$conf->global->LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION] = dol_print_date($this->datefin,'dayhourldap');

// Subscriptions
if ($this->first_subscription_date && ! empty($conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_DATE)) $info[$conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_DATE] = dol_print_date($this->first_subscription_date,'dayhourldap');
Expand Down Expand Up @@ -2078,7 +2079,7 @@ public static function replaceThirdparty($db, $origin_id, $dest_id)

/**
* Return if a member is late (subscription late) or not
*
*
* @return boolean True if late, False if not late
*/
public function hasDelay()
Expand Down
45 changes: 42 additions & 3 deletions htdocs/categories/class/api_categories.class.php
Expand Up @@ -248,6 +248,7 @@ function getListForItem($sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0,
if( ! count($obj_ret)) {
throw new RestException(404, 'No category found');
}

return $obj_ret;
}

Expand Down Expand Up @@ -351,9 +352,47 @@ function _cleanObjectDatas($object) {

$object = parent::_cleanObjectDatas($object);

// Remove the subscriptions because they are handled as a subresource.
//unset($object->subscriptions);

// Remove fields not relevent to categories
unset($object->country);
unset($object->country_id);
unset($object->country_code);
unset($object->total_ht);
unset($object->total_ht);
unset($object->total_localtax1);
unset($object->total_localtax2);
unset($object->total_ttc);
unset($object->total_tva);
unset($object->lines);
unset($object->fk_incoterms);
unset($object->libelle_incoterms);
unset($object->location_incoterms);
unset($object->civility_id);
unset($object->name);
unset($object->lastname);
unset($object->firstname);
unset($object->shipping_method_id);
unset($object->fk_delivery_address);
unset($object->cond_reglement);
unset($object->cond_reglement_id);
unset($object->mode_reglement_id);
unset($object->barcode_type_coder);
unset($object->barcode_type_label);
unset($object->barcode_type_code);
unset($object->barcode_type);
unset($object->canvas);
unset($object->cats);
unset($object->motherof);
unset($object->context);
unset($object->socid);
unset($object->thirdparty);
unset($object->contact);
unset($object->contact_id);
unset($object->user);
unset($object->fk_account);
unset($object->fk_project);
unset($object->note);
unset($object->statut);

return $object;
}

Expand Down
2 changes: 1 addition & 1 deletion htdocs/categories/class/api_deprecated_category.class.php
Expand Up @@ -291,7 +291,7 @@ function getListCategoryCustomer($sortfield = "s.rowid", $sortorder = 'ASC', $li
* @url GET /customer/{cusid}/categories
*/
function getListCustomerCategories($cusid, $sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0) {
return $this->getListForItem('customer', $sortfield, $sortorder, $limit, $page, $cusid);
return $this->getListForItem($sortfield, $sortorder, $limit, $page, 'customer', $cusid);
}

/**
Expand Down
3 changes: 2 additions & 1 deletion htdocs/commande/card.php
Expand Up @@ -64,6 +64,7 @@
$langs->load('deliveries');
$langs->load('sendings');
$langs->load('products');
$langs->load('other');
if (!empty($conf->incoterm->enabled)) $langs->load('incoterm');
if (! empty($conf->margin->enabled)) $langs->load('margins');
if (! empty($conf->productbatch->enabled)) $langs->load("productbatch");
Expand Down Expand Up @@ -2054,7 +2055,7 @@
print '<input type="submit" class="button" value="' . $langs->trans('Modify') . '">';
print '</form>';
} else {
print $object->date ? dol_print_date($object->date, 'daytext') : '&nbsp;';
print $object->date ? dol_print_date($object->date, 'day') : '&nbsp;';
if ($object->hasDelay() && empty($object->date_livraison)) {
print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning");
}
Expand Down
2 changes: 2 additions & 0 deletions htdocs/commande/info.php
Expand Up @@ -53,6 +53,8 @@
* View
*/

$form = new Form($db);

llxHeader('',$langs->trans('Order'),'EN:Customers_Orders|FR:Commandes_Clients|ES:Pedidos de clientes');

$object->fetch_thirdparty();
Expand Down
4 changes: 2 additions & 2 deletions htdocs/commande/orderstoinvoice.php
Expand Up @@ -5,7 +5,7 @@
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2012 Andreu Bisquerra Gaya <jove@bisquerra.com>
* Copyright (C) 2012 David Rodriguez Martinez <davidrm146@gmail.com>
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012-2017 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Ferran Marcet <fmarcet@2byte.es>
*
* This program is free software; you can redistribute it and/or modify
Expand Down Expand Up @@ -122,7 +122,7 @@
}
if (isset($_POST['orders_to_invoice']))
{
$orders_id = GETPOST('orders_to_invoice','',1);
$orders_id = GETPOST('orders_to_invoice','',2);
$nn = count($orders_id);
$ii = 0;

Expand Down

0 comments on commit 4831fb4

Please sign in to comment.