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

This commit is contained in:
Laurent Destailleur 2017-03-19 14:27:12 +01:00
commit b169f93abc
33 changed files with 349 additions and 201 deletions

View File

@ -628,12 +628,6 @@ if ($id)
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.'">';
@ -675,36 +669,15 @@ if ($id)
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 *
{
@ -1175,7 +1148,7 @@ $db->close();
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;
@ -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')

View File

@ -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>
@ -496,7 +496,7 @@ class Adherent extends CommonObject
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++;
@ -862,7 +862,7 @@ class Adherent extends CommonObject
$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';
@ -1122,7 +1122,7 @@ class Adherent extends CommonObject
$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:'';
@ -1160,7 +1160,7 @@ class Adherent extends CommonObject
$this->user_id = $obj->user_id;
$this->user_login = $obj->user_login;
$this->model_pdf = $obj->model_pdf;
// Retreive all extrafield for thirdparty
@ -1456,7 +1456,7 @@ class Adherent extends CommonObject
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;
@ -1815,10 +1815,10 @@ class Adherent extends CommonObject
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';
@ -1830,11 +1830,11 @@ class Adherent extends CommonObject
}
$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.
@ -1924,27 +1924,28 @@ class Adherent extends CommonObject
$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');
@ -2078,7 +2079,7 @@ class Adherent extends CommonObject
/**
* Return if a member is late (subscription late) or not
*
*
* @return boolean True if late, False if not late
*/
public function hasDelay()

View File

@ -248,6 +248,7 @@ class Categories extends DolibarrApi
if( ! count($obj_ret)) {
throw new RestException(404, 'No category found');
}
return $obj_ret;
}
@ -351,9 +352,47 @@ class Categories extends DolibarrApi
$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;
}

View File

@ -291,7 +291,7 @@ class CategoryApi extends DolibarrApi
* @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);
}
/**

View File

@ -64,6 +64,7 @@ $langs->load('propal');
$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");
@ -2054,7 +2055,7 @@ if ($action == 'create' && $user->rights->commande->creer)
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");
}

View File

@ -53,6 +53,8 @@ if (! $object->fetch($id, $ref) > 0)
* View
*/
$form = new Form($db);
llxHeader('',$langs->trans('Order'),'EN:Customers_Orders|FR:Commandes_Clients|ES:Pedidos de clientes');
$object->fetch_thirdparty();

View File

@ -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
@ -122,7 +122,7 @@ if (($action == 'create' || $action == 'add') && !$error)
}
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;

View File

@ -91,6 +91,7 @@ $search_dv_end = dol_mktime(0, 0, 0, GETPOST('search_end_dvmonth', 'int'), GETPO
$search_thirdparty=GETPOST("thirdparty",'alpha');
$search_req_nb=GETPOST("req_nb",'alpha');
$search_num_releve=GETPOST("search_num_releve",'alpha');
$search_conciliated=GETPOST("search_conciliated",'int');
$num_releve=GETPOST("num_releve");
$cat=GETPOST("cat");
@ -150,6 +151,7 @@ $arrayfields=array(
'b.credit'=>array('label'=>$langs->trans("Credit"), 'checked'=>1, 'position'=>605),
'balance'=>array('label'=>$langs->trans("Balance"), 'checked'=>1, 'position'=>1000),
'b.num_releve'=>array('label'=>$langs->trans("AccountStatement"), 'checked'=>1, 'position'=>1010),
'b.conciliated'=>array('label'=>$langs->trans("Conciliated"), 'enabled'=> $object->rappro, 'checked'=>($action == 'reconcile'?1:0), 'position'=>1020),
);
// Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
@ -190,6 +192,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP
$search_req_nb='';
$search_thirdparty='';
$search_num_releve='';
$search_conciliated='';
$thirdparty='';
$account="";
@ -444,7 +447,7 @@ else
llxHeader('', $langs->trans("BankTransactions"), '', '', 0, 0, array(), array(), $param);
}
$sql = "SELECT b.rowid, b.dateo as do, b.datev as dv, b.amount, b.label, b.rappro, b.num_releve, b.num_chq,";
$sql = "SELECT b.rowid, b.dateo as do, b.datev as dv, b.amount, b.label, b.rappro as conciliated, b.num_releve, b.num_chq,";
$sql.= " b.fk_account, b.fk_type,";
$sql.= " ba.rowid as bankid, ba.ref as bankref,";
$sql.= " bu.url_id,";
@ -474,6 +477,7 @@ if (dol_strlen($search_dv_end)>0) $sql .= " AND b.datev <= '" . $db->idate($sear
if ($search_ref) $sql.=natural_search("b.rowid", $search_ref);
if ($search_req_nb) $sql.= natural_search("b.num_chq", $search_req_nb);
if ($search_num_releve) $sql.= natural_search("b.num_releve", $search_num_releve);
if ($search_conciliated != '' && $search_conciliated != '-1') $sql.= " AND b.rappro = ".$search_conciliated;
if ($search_thirdparty) $sql.= natural_search("s.nom", $search_thirdparty);
if ($description) $sql.= natural_search("b.label", $description); // Warning some text are just translation keys, not translated strings
if ($bid) $sql.= " AND b.rowid=l.lineid AND l.fk_categ=".$bid;
@ -776,6 +780,7 @@ if ($resql)
if (! empty($arrayfields['b.credit']['checked'])) print_liste_field_titre($arrayfields['b.credit']['label'],$_SERVER['PHP_SELF'],'b.amount','',$param,'align="right"',$sortfield,$sortorder);
if (! empty($arrayfields['balance']['checked'])) print_liste_field_titre($arrayfields['balance']['label'],$_SERVER['PHP_SELF'],'','',$param,'align="right"',$sortfield,$sortorder);
if (! empty($arrayfields['b.num_releve']['checked'])) print_liste_field_titre($arrayfields['b.num_releve']['label'],$_SERVER['PHP_SELF'],'b.num_releve','',$param,'align="center"',$sortfield,$sortorder);
if (! empty($arrayfields['b.conciliated']['checked'])) print_liste_field_titre($arrayfields['b.conciliated']['label'],$_SERVER['PHP_SELF'],'b.rappro','',$param,'align="center"',$sortfield,$sortorder);
// Extra fields
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
{
@ -857,11 +862,18 @@ if ($resql)
print $form->textwithpicto('', $htmltext, 1);
print '</td>';
}
// Numero statement
if (! empty($arrayfields['b.num_releve']['checked']))
{
// Numero statement
print '<td class="liste_titre" align="center"><input type="text" class="flat" name="search_num_releve" value="'.dol_escape_htmltag($search_num_releve).'" size="3"></td>';
}
// Conciliated
if (! empty($arrayfields['b.conciliated']['checked']))
{
print '<td class="liste_titre" align="center">';
print $form->selectyesno('search_conciliated', $search_conciliated, 1, False, 1);
print '</td>';
}
print '<td class="liste_titre" align="middle">';
print '</td>';
print '<td class="liste_titre" align="middle">';
@ -1207,7 +1219,7 @@ if ($resql)
// Transaction reconciliated or edit link
if ($bankaccount->canBeConciliated() > 0)
{
if ($objp->rappro) // If line not conciliated and account can be conciliated
if ($objp->conciliated) // If line not conciliated and account can be conciliated
{
print '<a href="releve.php?num='.$objp->num_releve.'&amp;account='.$objp->bankid.'">'.$objp->num_releve.'</a>';
}
@ -1220,10 +1232,18 @@ if ($resql)
if (! $i) $totalarray['nbfield']++;
}
if (! empty($arrayfields['b.conciliated']['checked']))
{
print '<td class="nowrap" align="center">';
print $objp->conciliated?$langs->trans("Yes"):$langs->trans("No");
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Action edit/delete
print '<td class="nowrap" align="center">';
// Transaction reconciliated or edit link
if ($objp->rappro && $bankaccount->canBeConciliated() > 0) // If line not conciliated and account can be conciliated
if ($objp->conciliated && $bankaccount->canBeConciliated() > 0) // If line not conciliated and account can be conciliated
{
print '<a href="'.DOL_URL_ROOT.'/compta/bank/ligne.php?rowid='.$objp->rowid.'&amp;account='.$objp->bankid.'&amp;page='.$page.'">';
print img_edit();
@ -1243,7 +1263,7 @@ if ($resql)
print img_view();
print '</a>';
}
if ($bankaccount->canBeConciliated() > 0 && empty($objp->rappro))
if ($bankaccount->canBeConciliated() > 0 && empty($objp->conciliated))
{
if ($db->jdate($objp->dv) < ($now - $conf->bank->rappro->warning_delay))
{

View File

@ -496,7 +496,7 @@ class Contrat extends CommonObject
$sql.= " ref_supplier, ref_customer,";
$sql.= " ref_ext,";
$sql.= " fk_user_mise_en_service, date_contrat as datecontrat,";
$sql.= " fk_user_author,";
$sql.= " fk_user_author, fin_validite, date_cloture,";
$sql.= " fk_projet,";
$sql.= " fk_commercial_signature, fk_commercial_suivi,";
$sql.= " note_private, note_public, model_pdf, extraparams";
@ -527,6 +527,10 @@ class Contrat extends CommonObject
$this->date_contrat = $this->db->jdate($result["datecontrat"]);
$this->date_creation = $this->db->jdate($result["datecontrat"]);
$this->fin_validite = $this->db->jdate($result["fin_validite"]);
$this->date_cloture = $this->db->jdate($result["date_cloture"]);
$this->user_author_id = $result["fk_user_author"];
$this->commercial_signature_id = $result["fk_commercial_signature"];

View File

@ -209,7 +209,26 @@ if (! $error && $massaction == 'confirm_presend')
if (count($listofqualifiedinvoice) > 0)
{
$langs->load("commercial");
$from = $user->getFullName($langs) . ' <' . $user->email .'>';
$fromtype = GETPOST('fromtype');
if ($fromtype === 'user') {
$from = $user->getFullName($langs) .' <'.$user->email.'>';
}
elseif ($fromtype === 'company') {
$from = $conf->global->MAIN_INFO_SOCIETE_NOM .' <'.$conf->global->MAIN_INFO_SOCIETE_MAIL.'>';
}
elseif (preg_match('/user_aliases_(\d+)/', $fromtype, $reg)) {
$tmp=explode(',', $user->email_aliases);
$from = trim($tmp[($reg[1] - 1)]);
}
elseif (preg_match('/global_aliases_(\d+)/', $fromtype, $reg)) {
$tmp=explode(',', $conf->global->MAIN_INFO_SOCIETE_MAIL_ALIASES);
$from = trim($tmp[($reg[1] - 1)]);
}
else {
$from = $_POST['fromname'] . ' <' . $_POST['frommail'] .'>';
}
$replyto = $from;
$subject = GETPOST('subject');
$message = GETPOST('message');

View File

@ -157,7 +157,14 @@ class FormProjets
$sql.= " WHERE p.entity IN (".getEntity('project', 1).")";
if ($projectsListId !== false) $sql.= " AND p.rowid IN (".$projectsListId.")";
if ($socid == 0) $sql.= " AND (p.fk_soc=0 OR p.fk_soc IS NULL)";
if ($socid > 0 && empty($conf->global->PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY)) $sql.= " AND (p.fk_soc=".$socid." OR p.fk_soc IS NULL)";
if ($socid > 0)
{
if (empty($conf->global->PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY)) $sql.= " AND (p.fk_soc=".$socid." OR p.fk_soc IS NULL)";
else if ($conf->global->PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY != 'all') // PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY is 'all' or a list of ids separated by coma.
{
$sql.= " AND (p.fk_soc IN (".$socid.", ".$conf->global->PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY.") OR p.fk_soc IS NULL)";
}
}
if (!empty($filterkey)) {
$sql .= ' AND (';
$sql .= ' p.title LIKE "%'.$this->db->escape($filterkey).'%"';

View File

@ -107,27 +107,6 @@ class Interfaces
$nbfile++;
$modName = "Interface".ucfirst($reg[3]);
//print "file=$file - modName=$modName\n";
if (in_array($modName,$modules))
{
$langs->load("errors");
dol_syslog(get_class($this)."::run_triggers action=".$action." ".$langs->trans("ErrorDuplicateTrigger",$modName,"/htdocs/core/triggers/"), LOG_ERR);
continue;
}
else
{
try {
//print 'Todo for '.$modName." : ".$newdir.'/'.$file."\n";
include_once $newdir.'/'.$file;
//print 'Done for '.$modName."\n";
}
catch(Exception $e)
{
dol_syslog('ko for '.$modName." ".$e->getMessage()."\n", LOG_ERROR);
}
}
// Check if trigger file is disabled by name
if (preg_match('/NORUN$/i',$file)) continue;
// Check if trigger file is for a particular module
@ -145,8 +124,28 @@ class Interfaces
continue;
}
$modName = "Interface".ucfirst($reg[3]);
//print "file=$file - modName=$modName\n";
if (in_array($modName,$modules)) // $modules = list of modName already loaded
{
$langs->load("errors");
dol_syslog(get_class($this)."::run_triggers action=".$action." ".$langs->trans("ErrorDuplicateTrigger", $newdir."/".$file, $fullpathfiles[$modName]), LOG_WARNING);
continue;
}
try {
//print 'Todo for '.$modName." : ".$newdir.'/'.$file."\n";
include_once $newdir.'/'.$file;
//print 'Done for '.$modName."\n";
}
catch(Exception $e)
{
dol_syslog('ko for '.$modName." ".$e->getMessage()."\n", LOG_ERR);
}
$modules[$i] = $modName;
$files[$i] = $file;
$fullpathfiles[$modName] = $newdir.'/'.$file;
$orders[$i] = $part1.'_'.$part2.'_'.$part3; // Set sort criteria value
$i++;

View File

@ -1572,7 +1572,8 @@ function dol_most_recent_file($dir,$regexfilter='',$excludefilter=array('(\.meta
function dol_check_secure_access_document($modulepart,$original_file,$entity,$fuser='',$refname='')
{
global $user, $conf, $db;
global $dolibarr_main_data_root;
if (! is_object($fuser)) $fuser=$user;
if (empty($modulepart)) return 'ErrorBadParameter';
@ -2044,7 +2045,6 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu
elseif ($modulepart == 'medias' && !empty($dolibarr_main_data_root))
{
$accessallowed=1;
global $dolibarr_main_data_root;
$original_file=$dolibarr_main_data_root.'/medias/'.$original_file;
}

View File

@ -635,7 +635,7 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr
if (! empty($conf->global->PROJECT_LINES_PERDAY_SHOW_THIRDPARTY))
{
// Thirdparty
print '<td class="nowrap">';
print '<td class="tdoverflowmax100">';
$thirdpartystatic->id=$lines[$i]->socid;
$thirdpartystatic->name=$lines[$i]->thirdparty_name;
print $thirdpartystatic->getNomUrl(1, 'project', 10);
@ -839,10 +839,10 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$
if (! empty($conf->global->PROJECT_LINES_PERWEEK_SHOW_THIRDPARTY))
{
// Thirdparty
print '<td class="nowrap">';
print '<td class="tdoverflowmax100">';
$thirdpartystatic->id=$lines[$i]->thirdparty_id;
$thirdpartystatic->name=$lines[$i]->thirdparty_name;
print $thirdpartystatic->getNomUrl(1, 'project', 10);
print $thirdpartystatic->getNomUrl(1, 'project');
print '</td>';
}

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2008-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2008-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2008-2017 Regis Houssin <regis.houssin@capnetworks.com>
*
* 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
@ -74,7 +74,7 @@ function dol_decode($chain)
* If constant MAIN_SECURITY_SALT is defined, we use it as a salt.
*
* @param string $chain String to hash
* @param int $type Type of hash (0:auto, 1:sha1, 2:sha1+md5, 3:md5). Use 3 here, if hash is not needed for security purpose, for security need, prefer 0.
* @param int $type Type of hash (0:auto, 1:sha1, 2:sha1+md5, 3:md5, 4:md5 for OpenLdap). Use 3 here, if hash is not needed for security purpose, for security need, prefer 0.
* @return string Hash of string
*/
function dol_hash($chain,$type=0)
@ -87,6 +87,7 @@ function dol_hash($chain,$type=0)
if ($type == 1) return sha1($chain);
else if ($type == 2) return sha1(md5($chain));
else if ($type == 3) return md5($chain);
else if ($type == 4) return '{md5}'.base64_encode(mhash(MHASH_MD5,$chain)); // For OpenLdap with md5
else if (! empty($conf->global->MAIN_SECURITY_HASH_ALGO) && $conf->global->MAIN_SECURITY_HASH_ALGO == 'sha1') return sha1($chain);
else if (! empty($conf->global->MAIN_SECURITY_HASH_ALGO) && $conf->global->MAIN_SECURITY_HASH_ALGO == 'sha1md5') return sha1(md5($chain));
@ -343,7 +344,7 @@ function restrictedArea($user, $features, $objectid=0, $tableandshare='', $featu
* This function is also called by restrictedArea
*
* @param User $user User to check
* @param array $featuresarray Features/modules to check. Example: ('user','service')
* @param array $featuresarray Features/modules to check. Example: ('user','service')
* @param int $objectid Object ID if we want to check a particular record (optional) is linked to a owned thirdparty (optional).
* @param string $tableandshare 'TableName&SharedElement' with Tablename is table where object is stored. SharedElement is an optional key to define where to check entity for multicompany modume. Param not used if objectid is null (optional).
* @param string $feature2 Feature to check, second level of permission (optional). Can be or check with 'level1|level2'.
@ -367,7 +368,7 @@ function checkUserAccessToObject($user, $featuresarray, $objectid=0, $tableandsh
// For backward compatibility
if ($feature == 'member') $feature='adherent';
$check = array('adherent','banque','user','usergroup','produit','service','produit|service','categorie'); // Test on entity only (Objects with no link to company)
$checksoc = array('societe'); // Test for societe object
$checkother = array('contact'); // Test on entity and link to societe. Allowed if link is empty (Ex: contacts...).

View File

@ -1425,7 +1425,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
$newmenu->add('/compta/bank/card.php?id='.$objp->rowid,$objp->label,1,$user->rights->banque->lire);
if ($objp->rappro && $objp->courant != Account::TYPE_CASH && empty($objp->clos)) // If not cash account and not closed and can be reconciliate
{
$newmenu->add('/compta/bank/bankentries.php?id='.$objp->rowid,$langs->trans("Conciliate"),2,$user->rights->banque->consolidate);
$newmenu->add('/compta/bank/bankentries.php?action=reconcile&contextpage=banktransactionlist-'.$objp->rowid.'&account='.$objp->rowid.'&id='.$objp->rowid.'&search_conciliated=0',$langs->trans("Conciliate"),2,$user->rights->banque->consolidate);
}
$i++;
}

View File

@ -3,7 +3,7 @@
* Copyright (C) 2005-2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Simon TOSSER <simon@kornog-computing.com>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011-2017 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2014 Cedric GROSS <c.gross@kreiz-it.fr>
@ -1744,10 +1744,10 @@ else if ($id || $ref)
{
$sql = "SELECT obj.rowid, obj.fk_product, obj.label, obj.description, obj.product_type as fk_product_type, obj.qty as qty_asked, obj.date_start, obj.date_end";
$sql.= ", ed.rowid as shipmentline_id, ed.qty as qty_shipped, ed.fk_expedition as expedition_id, ed.fk_origin_line, ed.fk_entrepot";
$sql.= ", e.rowid as shipment_id, e.ref as shipment_ref, e.date_creation, e.date_valid, e.date_delivery, e.date_expedition,";
//if ($conf->livraison_bon->enabled) $sql .= " l.rowid as livraison_id, l.ref as livraison_ref, l.date_delivery, ld.qty as qty_received,";
$sql.= ' p.label as product_label, p.ref, p.fk_product_type, p.rowid as prodid, p.tobatch as product_tobatch';
$sql.= ' p.description as product_desc';
$sql.= ", e.rowid as shipment_id, e.ref as shipment_ref, e.date_creation, e.date_valid, e.date_delivery, e.date_expedition";
//if ($conf->livraison_bon->enabled) $sql .= ", l.rowid as livraison_id, l.ref as livraison_ref, l.date_delivery, ld.qty as qty_received";
$sql.= ', p.label as product_label, p.ref, p.fk_product_type, p.rowid as prodid, p.tobatch as product_tobatch';
$sql.= ', p.description as product_desc';
$sql.= " FROM ".MAIN_DB_PREFIX."expeditiondet as ed";
$sql.= ", ".MAIN_DB_PREFIX."expedition as e";
$sql.= ", ".MAIN_DB_PREFIX.$origin."det as obj";

View File

@ -329,7 +329,7 @@ class Export
$szFilterQuery=" ".$NameField."='".$ValueField."'";
break;
default:
dol_syslog("Error we try to forge an sql export request with a condition on a field with type '".$InfoFieldList[0]."' (defined into module descriptor) but this type is unknown/not supported. It looks like a bug into module descriptor.", LOG_ERROR);
dol_syslog("Error we try to forge an sql export request with a condition on a field with type '".$InfoFieldList[0]."' (defined into module descriptor) but this type is unknown/not supported. It looks like a bug into module descriptor.", LOG_ERR);
}
return $szFilterQuery;

View File

@ -31,7 +31,7 @@
*/
if (! defined('DOL_APPLICATION_TITLE')) define('DOL_APPLICATION_TITLE','Dolibarr');
if (! defined('DOL_VERSION')) define('DOL_VERSION','6.0.0-alpha');
if (! defined('DOL_VERSION')) define('DOL_VERSION','6.0.0-alpha'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c
if (! defined('EURO')) define('EURO',chr(128));

View File

@ -350,10 +350,10 @@ class CommandeFournisseur extends CommonOrder
$line->multicurrency_total_tva = $objp->multicurrency_total_tva;
$line->multicurrency_total_ttc = $objp->multicurrency_total_ttc;
$this->special_code = $objp->special_code;
$this->fk_parent_line = $objp->fk_parent_line;
$line->special_code = $objp->special_code;
$line->fk_parent_line = $objp->fk_parent_line;
$this->rang = $objp->rang;
$line->rang = $objp->rang;
$this->lines[$i] = $line;
@ -1399,7 +1399,7 @@ class CommandeFournisseur extends CommonOrder
if ($prod->fetch($fk_product) > 0)
{
$product_type = $prod->type;
$label = $prod->libelle;
$label = $prod->label;
// We use 'none' instead of $fourn_ref, because fourn_ref may not exists anymore. So we will take the first supplier price ok.
// If we want a dedicated supplier price, we must provide $fk_prod_fourn_price.
@ -1506,7 +1506,6 @@ class CommandeFournisseur extends CommonOrder
$this->line->product_type=$product_type;
$this->line->remise_percent=$remise_percent;
$this->line->subprice=$pu_ht;
$this->line->rang=$this->rang;
$this->line->info_bits=$info_bits;
$this->line->vat_src_code=$vat_src_code;
@ -3099,7 +3098,7 @@ class CommandeFournisseurLigne extends CommonOrderLine
$sql.= " total_ht, total_tva, total_localtax1, total_localtax2, total_ttc, fk_unit,";
$sql.= " fk_multicurrency, multicurrency_code, multicurrency_subprice, multicurrency_total_ht, multicurrency_total_tva, multicurrency_total_ttc";
$sql.= ")";
$sql.= " VALUES (".$this->fk_commande.", '" . $this->db->escape($this->product_label) . "','" . $this->db->escape($this->desc) . "',";
$sql.= " VALUES (".$this->fk_commande.", '" . $this->db->escape($this->label) . "','" . $this->db->escape($this->desc) . "',";
$sql.= " ".($this->date_start?"'".$this->db->idate($this->date_start)."'":"null").",";
$sql.= " ".($this->date_end?"'".$this->db->idate($this->date_end)."'":"null").",";
if ($this->fk_product) { $sql.= $this->fk_product.","; }

View File

@ -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) 2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
*
@ -116,7 +116,7 @@ if (($action == 'create' || $action == 'add') && ! $error) {
$_GET['originid'] = $orders_id[0];
}
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;

View File

@ -255,6 +255,10 @@ ALTER TABLE llx_contrat ADD COLUMN fk_user_modif integer;
UPDATE llx_accounting_account set account_parent = 0 where account_parent = '';
-- VMYSQL4.3 ALTER TABLE llx_product_price MODIFY COLUMN date_price DATETIME NULL;
-- VPGSQL8.2 ALTER TABLE llx_product_price ALTER COLUMN date_price DROP NOT NULL;
ALTER TABLE llx_product_price ALTER COLUMN date_price SET DEFAULT NULL;
ALTER TABLE llx_product_price ADD COLUMN default_vat_code varchar(10) after tva_tx;
ALTER TABLE llx_product_fournisseur_price ADD COLUMN default_vat_code varchar(10) after tva_tx;

View File

@ -401,7 +401,7 @@ LeopardNumRefModelDesc=The code is free. This code can be modified at any time.
ManagingDirectors=Manager(s) name (CEO, director, president...)
MergeOriginThirdparty=Duplicate third party (third party you want to delete)
MergeThirdparties=Merge third parties
ConfirmMergeThirdparties=Are you sure you want to merge this third party into the current one? All linked objects (invoices, orders, ...) will be moved to current third party so you will be able to delete the duplicate one.
ConfirmMergeThirdparties=Are you sure you want to merge this third party into the current one? All linked objects (invoices, orders, ...) will be moved to current third party, then the thirdparty will be deleted.
ThirdpartiesMergeSuccess=Thirdparties have been merged
SaleRepresentativeLogin=Login of sales representative
SaleRepresentativeFirstname=First name of sales representative

View File

@ -184,6 +184,7 @@ ErrorUserNotAssignedToTask=User must be assigned to task to be able to enter tim
ErrorTaskAlreadyAssigned=Task already assigned to user
ErrorModuleFileSeemsToHaveAWrongFormat=The module package seems to have a wrong format.
ErrorFilenameDosNotMatchDolibarrPackageRules=The name of the module package (<strong>%s</strong>) does not match expected name syntax: <strong>%s</strong>
ErrorDuplicateTrigger=Error, duplicate trigger name %s. Already loaded from %s.
# Warnings
WarningPasswordSetWithNoAccount=A password was set for this member. However, no user account was created. So this password is stored but can't be used to login to Dolibarr. It may be used by an external module/interface but if you don't need to define any login nor password for a member, you can disable option "Manage a login for each member" from Member module setup. If you need to manage a login but don't need any password, you can keep this field empty to avoid this warning. Note: Email can also be used as a login if the member is linked to a user.

View File

@ -264,7 +264,7 @@ class Products extends DolibarrApi
*/
function getCategories($id, $sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0) {
$categories = new Categories();
return $categories->getListForItem('product', $sortfield, $sortorder, $limit, $page, $id);
return $categories->getListForItem($sortfield, $sortorder, $limit, $page, 'product', $id);
}
/**

View File

@ -415,11 +415,11 @@ if (! empty($conf->global->PROJECT_LINES_PERDAY_SHOW_THIRDPARTY))
{
print '<td>'.$langs->trans("ThirdParty").'</td>';
}
print '<td align="right">'.$langs->trans("PlannedWorkload").'</td>';
print '<td align="right">'.$langs->trans("ProgressDeclared").'</td>';
print '<td align="right">'.$langs->trans("TimeSpent").'</td>';
if ($usertoprocess->id == $user->id) print '<td align="right">'.$langs->trans("TimeSpentByYou").'</td>';
else print '<td align="right">'.$langs->trans("TimeSpentByUser").'</td>';
print '<td align="right" class="maxwidth100">'.$langs->trans("PlannedWorkload").'</td>';
print '<td align="right" class="maxwidth100">'.$langs->trans("ProgressDeclared").'</td>';
print '<td align="right" class="maxwidth100">'.$langs->trans("TimeSpent").'</td>';
if ($usertoprocess->id == $user->id) print '<td align="right" class="maxwidth100">'.$langs->trans("TimeSpentByYou").'</td>';
else print '<td align="right" class="maxwidth100">'.$langs->trans("TimeSpentByUser").'</td>';
print '<td align="center">'.$langs->trans("HourStart").'</td>';
print '<td align="center" colspan="2">'.$langs->trans("Duration").'</td>';
print '<td align="right">'.$langs->trans("Note").'</td>';

View File

@ -262,7 +262,7 @@ if ($action == 'addtime' && $user->rights->projet->lire)
setEventMessages($langs->trans("RecordSaved"), null, 'mesgs');
// Redirect to avoid submit twice on back
header('Location: '.$_SERVER["PHP_SELF"].($projectid?'?id='.$projectid:'?').($mode?'&mode='.$mode:''));
header('Location: '.$_SERVER["PHP_SELF"].($projectid?'?id='.$projectid:'?').($mode?'&mode='.$mode:'').($day?'&day='.$day:'').($month?'&month='.$month:'').($year?'&year='.$year:''));
exit;
}
}
@ -410,17 +410,17 @@ if (! empty($conf->global->PROJECT_LINES_PERWEEK_SHOW_THIRDPARTY))
{
print '<td>'.$langs->trans("ThirdParty").'</td>';
}
print '<td align="right">'.$langs->trans("PlannedWorkload").'</td>';
print '<td align="right">'.$langs->trans("ProgressDeclared").'</td>';
print '<td align="right">'.$langs->trans("TimeSpent").'</td>';
if ($usertoprocess->id == $user->id) print '<td align="right">'.$langs->trans("TimeSpentByYou").'</td>';
else print '<td align="right">'.$langs->trans("TimeSpentByUser").'</td>';
print '<td align="right" class="maxwidth75">'.$langs->trans("PlannedWorkload").'</td>';
print '<td align="right" class="maxwidth75">'.$langs->trans("ProgressDeclared").'</td>';
print '<td align="right" class="maxwidth75">'.$langs->trans("TimeSpent").'</td>';
if ($usertoprocess->id == $user->id) print '<td align="right" class="maxwidth75">'.$langs->trans("TimeSpentByYou").'</td>';
else print '<td align="right" class="maxwidth75">'.$langs->trans("TimeSpentByUser").'</td>';
$startday=dol_mktime(12, 0, 0, $startdayarray['first_month'], $startdayarray['first_day'], $startdayarray['first_year']);
for($i=0;$i<7;$i++)
{
print '<td width="7%" align="center" class="hide'.$i.'">'.dol_print_date($startday + ($i * 3600 * 24), '%a').'<br>'.dol_print_date($startday + ($i * 3600 * 24), 'dayreduceformat').'</td>';
print '<td width="6%" align="center" class="hide'.$i.'">'.dol_print_date($startday + ($i * 3600 * 24), '%a').'<br>'.dol_print_date($startday + ($i * 3600 * 24), 'dayreduceformat').'</td>';
}
print '<td></td>';
print "</tr>\n";
@ -462,13 +462,13 @@ if (count($tasksarray) > 0)
print '<tr class="liste_total">
<td class="liste_total" colspan="'.$colspan.'" align="right">'.$langs->trans("Total").'</td>
<td class="liste_total hide0" width="7%" align="center"><div id="totalDay[0]">&nbsp;</div></td>
<td class="liste_total hide1" width="7%" align="center"><div id="totalDay[1]">&nbsp;</div></td>
<td class="liste_total hide2" width="7%" align="center"><div id="totalDay[2]">&nbsp;</div></td>
<td class="liste_total hide3" width="7%" align="center"><div id="totalDay[3]">&nbsp;</div></td>
<td class="liste_total hide4" width="7%" align="center"><div id="totalDay[4]">&nbsp;</div></td>
<td class="liste_total hide5" width="7%" align="center"><div id="totalDay[5]">&nbsp;</div></td>
<td class="liste_total hide6" width="7%" align="center"><div id="totalDay[6]">&nbsp;</div></td>
<td class="liste_total hide0" align="center"><div id="totalDay[0]">&nbsp;</div></td>
<td class="liste_total hide1" align="center"><div id="totalDay[1]">&nbsp;</div></td>
<td class="liste_total hide2" align="center"><div id="totalDay[2]">&nbsp;</div></td>
<td class="liste_total hide3" align="center"><div id="totalDay[3]">&nbsp;</div></td>
<td class="liste_total hide4" align="center"><div id="totalDay[4]">&nbsp;</div></td>
<td class="liste_total hide5" align="center"><div id="totalDay[5]">&nbsp;</div></td>
<td class="liste_total hide6" align="center"><div id="totalDay[6]">&nbsp;</div></td>
<td class="liste_total"></td>
</tr>';
}

View File

@ -318,7 +318,7 @@ class Contacts extends DolibarrApi
*/
function getCategories($id, $sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0) {
$categories = new Categories();
return $categories->getListForItem('contact', $sortfield, $sortorder, $limit, $page, $id);
return $categories->getListForItem($sortfield, $sortorder, $limit, $page, 'contact', $id);
}
/**

View File

@ -267,7 +267,7 @@ class Thirdparties extends DolibarrApi
*/
function getCategories($id, $sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0) {
$categories = new Categories();
return $categories->getListForItem('customer', $sortfield, $sortorder, $limit, $page, $id);
return $categories->getListForItem($sortfield, $sortorder, $limit, $page, 'customer', $id);
}
/**

View File

@ -69,8 +69,8 @@ class CompanyBankAccount extends Account
*/
function create(User $user = null, $notrigger=0)
{
$now=dol_now();
$now = dol_now();
$error = 0;
// Correct default_rib to be sure to have always one default
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe_rib where fk_soc = ".$this->socid." AND default_rib = 1";
$result = $this->db->query($sql);
@ -89,7 +89,29 @@ class CompanyBankAccount extends Account
if ($this->db->affected_rows($resql))
{
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."societe_rib");
return 1;
if (! $notrigger)
{
// Call trigger
$result=$this->call_trigger('COMPANY_RIB_CREATE',$user);
if ($result < 0) $error++;
// End call triggers
if(! $error )
{
return 1;
}
else
{
return 0;
}
}
else
{
return 1;
}
}
}
else

View File

@ -123,15 +123,14 @@ if (empty($reshook))
$soc_origin_id = GETPOST('soc_origin', 'int');
$soc_origin = new Societe($db);
if ($soc_origin_id < 1)
if ($soc_origin_id <= 0)
{
$langs->load('errors');
$langs->load('companies');
setEventMessages($langs->trans('ErrorProdIdIsMandatory', $langs->trans('MergeOriginThirdparty')), null, 'errors');
setEventMessages($langs->trans('ErrorThirdPartyIdIsMandatory', $langs->trans('MergeOriginThirdparty')), null, 'errors');
}
else
{
if (!$errors && $soc_origin->fetch($soc_origin_id) < 1)
{
setEventMessages($langs->trans('ErrorRecordNotFound'), null, 'errors');
@ -140,8 +139,44 @@ if (empty($reshook))
if (!$errors)
{
// TODO Move the merge function into class of object.
$db->begin();
// Recopy some data
$object->client = $object->client | $soc_origin->client;
$object->fournisseur = $object->fournisseur | $soc_origin->fournisseur;
$listofproperties=array(
'address', 'zip', 'town', 'state_id', 'country_id', 'phone', 'phone_pro', 'fax', 'email', 'skype', 'url', 'barcode', 'idprof1', 'idprof2', 'idprof3', 'idprof4', 'idprof5', 'idprof6',
'tva_intra', 'effectif_id', 'forme_juridique', 'remise_percent', 'mode_reglement_supplier_id', 'cond_reglement_supplier_id', 'name_bis',
'stcomm_id', 'outstanding_limit', 'price_level', 'parent', 'default_lang', 'ref', 'ref_ext', 'import_key', 'fk_incoterms', 'fk_multicurrency',
'code_client', 'code_fournisseur', 'code_compta', 'code_compta_fournisseur',
'model_pdf', 'fk_projet'
);
foreach ($listofproperties as $property)
{
if (empty($object->$property)) $object->$property = $soc_origin->$property;
}
// Concat some data
$listofproperties=array(
'note_public', 'note_private'
);
foreach ($listofproperties as $property)
{
$object->$property = dol_concatdesc($object->$property, $soc_origin->$property);
}
// Merge extrafields
foreach ($soc_origin->array_options as $key => $val)
{
if (empty($object->array_options[$key])) $object->array_options[$key] = $val;
}
// TODO Merge categories
$object->update($object->id, $user);
// Move links
$objects = array(
'Adherent' => '/adherents/class/adherent.class.php',
'Societe' => '/societe/class/societe.class.php',
@ -159,6 +194,7 @@ if (empty($reshook))
'Fichinter' => '/fichinter/class/fichinter.class.php',
'CommandeFournisseur' => '/fourn/class/fournisseur.commande.class.php',
'FactureFournisseur' => '/fourn/class/fournisseur.facture.class.php',
'SupplierProposal' => '/supplier_proposal/class/supplier_proposal.class.php',
'ProductFournisseur' => '/fourn/class/fournisseur.product.class.php',
'Livraison' => '/livraison/class/livraison.class.php',
'Product' => '/product/class/product.class.php',
@ -451,6 +487,7 @@ if (empty($reshook))
if (empty($object->fournisseur)) $object->code_fournisseur='';
$result = $object->create($user);
if ($result >= 0)
{
if ($object->particulier)

View File

@ -2530,6 +2530,24 @@ class SupplierProposal extends CommonObject
return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
}
/**
* Function used to replace a thirdparty id with another one.
*
* @param DoliDB $db Database handler
* @param int $origin_id Old thirdparty id
* @param int $dest_id New thirdparty id
* @return bool
*/
public static function replaceThirdparty(DoliDB $db, $origin_id, $dest_id)
{
$tables = array(
'supplier_proposal'
);
return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables);
}
}

View File

@ -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) 2005-2016 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2005-2017 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2005 Lionel Cousteix <etm_ltd@tiscali.co.uk>
* Copyright (C) 2011 Herve Prot <herve.prot@symeos.com>
* Copyright (C) 2013-2014 Philippe Grand <philippe.grand@atoo-net.com>
@ -115,21 +115,21 @@ class User extends CommonObject
public $parentof; // To store an array of all parents for all ids.
public $accountancy_code; // Accountancy code in prevision of the complete accountancy module
public $thm; // Average cost of employee - Used for valuation of time spent
public $tjm; // Average cost of employee
public $salary; // Monthly salary - Denormalized value from llx_user_employment
public $salary; // Monthly salary - Denormalized value from llx_user_employment
public $salaryextra; // Monthly salary extra - Denormalized value from llx_user_employment
public $weeklyhours; // Weekly hours - Denormalized value from llx_user_employment
public $color; // Define background color for user in agenda
public $dateemployment; // Define date of employment by company
private $cache_childids;
/**
* Constructor de la classe
*
@ -461,13 +461,13 @@ class User extends CommonObject
if (! $error && ! $notrigger)
{
$this->context = array('audit'=>$langs->trans("PermissionsAdd"));
// Call trigger
$result=$this->call_trigger('USER_MODIFY',$user);
if ($result < 0) { $error++; }
// End call triggers
}
if ($error) {
$this->db->rollback();
return -$error;
@ -570,13 +570,13 @@ class User extends CommonObject
if (! $error && ! $notrigger)
{
$this->context = array('audit'=>$langs->trans("PermissionsDelete"));
// Call trigger
$result=$this->call_trigger('USER_MODIFY',$user);
if ($result < 0) { $error++; }
// End call triggers
}
if ($error) {
$this->db->rollback();
return -$error;
@ -962,7 +962,7 @@ class User extends CommonObject
$sql = "SELECT login FROM ".MAIN_DB_PREFIX."user";
$sql.= " WHERE login ='".$this->db->escape($this->login)."'";
$sql.= " AND entity IN (0,".$this->db->escape($conf->entity).")";
dol_syslog(get_class($this)."::create", LOG_DEBUG);
$resql=$this->db->query($sql);
if ($resql)
@ -995,7 +995,7 @@ class User extends CommonObject
$this->db->rollback();
return -5;
}
// Update minor fields
$result = $this->update($user,1,1);
if ($result < 0)
@ -1015,7 +1015,7 @@ class User extends CommonObject
$entrepot->country_id = $mysoc->country_id;
$entrepot->create($user);
}
if (! $notrigger)
{
// Call trigger
@ -1084,7 +1084,7 @@ class User extends CommonObject
$this->state_id = $contact->state_id;
$this->country_id = $contact->country_id;
$this->employee = 0;
if (empty($login)) $login=strtolower(substr($contact->firstname, 0, 4)) . strtolower(substr($contact->lastname, 0, 4));
$this->login = $login;
@ -1347,7 +1347,7 @@ class User extends CommonObject
$sql.= ", weeklyhours= ".($this->weeklyhours != ''?"'".$this->db->escape($this->weeklyhours)."'":"null");
$sql.= ", entity = '".$this->db->escape($this->entity)."'";
$sql.= " WHERE rowid = ".$this->id;
dol_syslog(get_class($this)."::update", LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql)
@ -1384,7 +1384,7 @@ class User extends CommonObject
if ($this->fk_member > 0 && ! $nosyncmember)
{
dol_syslog(get_class($this)."::update user is linked with a member. We try to update member too.", LOG_DEBUG);
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
// This user is linked with a member, so we also update members informations
@ -1398,9 +1398,9 @@ class User extends CommonObject
$adh->lastname=$this->lastname;
$adh->login=$this->login;
$adh->gender=$this->gender;
$adh->pass=$this->pass;
$adh->societe=(empty($adh->societe) && $this->societe_id ? $this->societe_id : $adh->societe);
$adh->email=$this->email;
@ -1675,7 +1675,7 @@ class User extends CommonObject
$appli=constant('DOL_APPLICATION_TITLE');
if (!empty($conf->global->MAIN_APPLICATION_TITLE)) $appli=$conf->global->MAIN_APPLICATION_TITLE;
$subject = $outputlangs->transnoentitiesnoconv("SubjectNewPassword", $appli);
// Define $urlwithroot
@ -1685,23 +1685,23 @@ class User extends CommonObject
if (! $changelater)
{
$url = $urlwithroot.'/';
$mesg.= $outputlangs->transnoentitiesnoconv("RequestToResetPasswordReceived").".\n";
$mesg.= $outputlangs->transnoentitiesnoconv("NewKeyIs")." :\n\n";
$mesg.= $outputlangs->transnoentitiesnoconv("Login")." = ".$this->login."\n";
$mesg.= $outputlangs->transnoentitiesnoconv("Password")." = ".$password."\n\n";
$mesg.= "\n";
$mesg.= $outputlangs->transnoentitiesnoconv("ClickHereToGoTo", $appli).': '.$url."\n\n";
$mesg.= "--\n";
$mesg.= $user->getFullName($outputlangs); // Username that make then sending
dol_syslog(get_class($this)."::send_password changelater is off, url=".$url);
}
else
{
$url = $urlwithroot.'/user/passwordforgotten.php?action=validatenewpassword&username='.$this->login."&passwordhash=".dol_hash($password);
$mesg.= $outputlangs->transnoentitiesnoconv("RequestToResetPasswordReceived")."\n";
$mesg.= $outputlangs->transnoentitiesnoconv("NewKeyWillBe")." :\n\n";
$mesg.= $outputlangs->transnoentitiesnoconv("Login")." = ".$this->login."\n";
@ -1710,7 +1710,7 @@ class User extends CommonObject
$mesg.= $outputlangs->transnoentitiesnoconv("YouMustClickToChange")." :\n";
$mesg.= $url."\n\n";
$mesg.= $outputlangs->transnoentitiesnoconv("ForgetIfNothing")."\n\n";
dol_syslog(get_class($this)."::send_password changelater is on, url=".$url);
}
@ -1859,7 +1859,7 @@ class User extends CommonObject
{
$this->newgroupid=$group; // deprecated. Remove this.
$this->context = array('audit'=>$langs->trans("UserSetInGroup"), 'newgroupid'=>$group);
// Call trigger
$result=$this->call_trigger('USER_MODIFY',$user);
if ($result < 0) { $error++; }
@ -1914,7 +1914,7 @@ class User extends CommonObject
{
$this->oldgroupid=$group; // deprecated. Remove this.
$this->context = array('audit'=>$langs->trans("UserRemovedFromGroup"), 'oldgroupid'=>$group);
// Call trigger
$result=$this->call_trigger('USER_MODIFY',$user);
if ($result < 0) { $error++; }
@ -1989,7 +1989,7 @@ class User extends CommonObject
$result = '';
$companylink = '';
$link = '';
$label = '<u>' . $langs->trans("User") . '</u>';
$label.= '<div width="100%">';
$label.= '<b>' . $langs->trans('Name') . ':</b> ' . $this->getFullName($langs,'','');
@ -2036,10 +2036,10 @@ class User extends CommonObject
if (! empty($_SESSION["disablemodules"])) $label.= '<br><b>'.$langs->trans("DisabledModules").':</b> <br>'.join(', ',explode(',',$_SESSION["disablemodules"]));
}
if ($option == 'leave') $link.= '<a href="'.DOL_URL_ROOT.'/holiday/list.php?id='.$this->id.'"';
else $link.= '<a href="'.DOL_URL_ROOT.'/user/card.php?id='.$this->id.'"';
$linkclose="";
if (empty($notooltip))
{
@ -2208,13 +2208,14 @@ class User extends CommonObject
$this->fullname=$this->getFullName($langs);
// Champs
if ($this->fullname && ! empty($conf->global->LDAP_FIELD_FULLNAME)) $info[$conf->global->LDAP_FIELD_FULLNAME] = $this->fullname;
if ($this->lastname && ! empty($conf->global->LDAP_FIELD_NAME)) $info[$conf->global->LDAP_FIELD_NAME] = $this->lastname;
if ($this->firstname && ! empty($conf->global->LDAP_FIELD_FIRSTNAME)) $info[$conf->global->LDAP_FIELD_FIRSTNAME] = $this->firstname;
if ($this->login && ! empty($conf->global->LDAP_FIELD_LOGIN)) $info[$conf->global->LDAP_FIELD_LOGIN] = $this->login;
if ($this->login && ! empty($conf->global->LDAP_FIELD_LOGIN_SAMBA)) $info[$conf->global->LDAP_FIELD_LOGIN_SAMBA] = $this->login;
if ($this->pass && ! empty($conf->global->LDAP_FIELD_PASSWORD)) $info[$conf->global->LDAP_FIELD_PASSWORD] = $this->pass; // this->pass = mot de passe non crypte
if ($this->ldap_sid && ! empty($conf->global->LDAP_FIELD_SID)) $info[$conf->global->LDAP_FIELD_SID] = $this->ldap_sid;
if ($this->fullname && ! empty($conf->global->LDAP_FIELD_FULLNAME)) $info[$conf->global->LDAP_FIELD_FULLNAME] = $this->fullname;
if ($this->lastname && ! empty($conf->global->LDAP_FIELD_NAME)) $info[$conf->global->LDAP_FIELD_NAME] = $this->lastname;
if ($this->firstname && ! empty($conf->global->LDAP_FIELD_FIRSTNAME)) $info[$conf->global->LDAP_FIELD_FIRSTNAME] = $this->firstname;
if ($this->login && ! empty($conf->global->LDAP_FIELD_LOGIN)) $info[$conf->global->LDAP_FIELD_LOGIN] = $this->login;
if ($this->login && ! empty($conf->global->LDAP_FIELD_LOGIN_SAMBA)) $info[$conf->global->LDAP_FIELD_LOGIN_SAMBA] = $this->login;
if ($this->pass && ! empty($conf->global->LDAP_FIELD_PASSWORD)) $info[$conf->global->LDAP_FIELD_PASSWORD] = $this->pass; // this->pass = mot de passe non crypte
if ($this->pass && ! empty($conf->global->LDAP_FIELD_PASSWORD_CRYPTED)) $info[$conf->global->LDAP_FIELD_PASSWORD_CRYPTED] = dol_hash($this->pass, 4); // md5 for OpenLdap TODO add type of encryption
if ($this->ldap_sid && ! empty($conf->global->LDAP_FIELD_SID)) $info[$conf->global->LDAP_FIELD_SID] = $this->ldap_sid;
if ($this->societe_id > 0)
{
$soc = new Societe($this->db);
@ -2455,7 +2456,7 @@ class User extends CommonObject
* Return and array with all instanciated first level children users of current user
*
* @return void
* @see getAllChildIds
* @see getAllChildIds
*/
function get_children()
{
@ -2586,7 +2587,7 @@ class User extends CommonObject
foreach($this->users as $key => $val)
{
$result = $this->build_path_from_id_user($key,0); // Process a branch from the root user key (this user has no parent)
if ($result < 0)
if ($result < 0)
{
$this->error='ErrorLoopInHierarchy';
return -1;
@ -2630,7 +2631,7 @@ class User extends CommonObject
function getAllChildIds($addcurrentuser=0)
{
$childids=array();
if (isset($this->cache_childids[$this->id]))
{
$childids = $this->cache_childids[$this->id];
@ -2639,20 +2640,20 @@ class User extends CommonObject
{
// Init this->users
$this->get_full_tree();
$idtoscan=$this->id;
dol_syslog("Build childid for id = ".$idtoscan);
foreach($this->users as $id => $val)
{
//var_dump($val['fullpath']);
if (preg_match('/_'.$idtoscan.'_/', $val['fullpath'])) $childids[$val['id']]=$val['id'];
}
}
}
$this->cache_childids[$this->id] = $childids;
if ($addcurrentuser) $childids[$this->id]=$this->id;
return $childids;
}
@ -2683,7 +2684,7 @@ class User extends CommonObject
$useridfound=array($id_user);
while (! empty($this->parentof[$cursor_user]))
{
if (in_array($this->parentof[$cursor_user], $useridfound))
if (in_array($this->parentof[$cursor_user], $useridfound))
{
dol_syslog("The hierarchy of user has a recursive loop", LOG_WARNING);
return -1; // Should not happen. Protection against looping hierarchy