Merge branch '7.0' of github.com:Dolibarr/dolibarr into fix_comments_on_tasks

This commit is contained in:
ATM-Nicolas 2018-05-22 15:12:24 +02:00
commit f46d514586
69 changed files with 625 additions and 954 deletions

107
ChangeLog
View File

@ -3,6 +3,96 @@ English Dolibarr ChangeLog
--------------------------------------------------------------
***** ChangeLog for 7.0.2 compared to 7.0.1 *****
FIX: #8023
FIX: #8259 can't update contact birthday with REST API
FIX: #8359
FIX: #8389
FIX: #8478 !empty instead of count to avoid warning
FIX: #8488
FIX: #8559 Bug to generate cheque receipt
FIX: #8571
FIX: #8574
FIX: #8580
FIX: #8650
FIX: actioncomm export: type filtering not working
FIX: Add a test to avoid to reset binding by error.
FIX: addline on invoice supplier manage rank on its own if not provided
FIX: Add warning when expense report line not into range
FIX: avoid Error: Call to undefined method mysqli::get_charset()
FIX: avoid focus problem when select2 is in a modal dialog window
FIX: Binding pages must start on fiscal month not calendar month
FIX: button "Classify bill" on supplier order was not visible
FIX: Button receive products not visible
FIX: can bypass the CSRF protection with url with domain inside
FIX: Can't edit option PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY
FIX: commonobject: don't require notnull field if default set
FIX: CommonObject: don't require 'notnull' field if 'default' set
FIX: cron script disabled if module disabled
FIX: CVE-2018-10092
FIX: CVE-2018-10094
FIX: CVE-2018-10095
FIX: CVE-2018-9019
FIX: CWE-89
FIX: Data on income/expense report was always 0
FIX: default addupdatedelete actions: uniformize add/update value checks
FIX: default currency not set on supplier order creation from commercial menu #8459
FIX: delete all product variants of a parent product
FIX: Detail per account not visible when total < 0
FIX: DOL_AUTOSET_COOKIE was not correctly setting value of cookie
FIX: don't print empty date in CommonObject::showOutputField
FIX: dont print empty date in CommonObject::showOutputField
FIX: Draft invoice must be excluded from report
FIX: environment shown on cron card
FIX: Error in ContractLigne not return to Contract
FIX: extrafields price and double were lost during a failed post.
FIX: File name not visible in email preview
FIX: filter/sorting on extrafield on contact list from contact tab
FIX: Initial month on report income/expense per predefined group
FIX: issue #8037
FIX: Issue #8455
FIX: issue #8470
FIX: label in getnomurl projectlist
FIX: limit access of email template page to internal users
FIX: look and feel v7 "back to" for bookkeeping record
FIX: Max nb of generation of recurring invoice should not show warning
FIX: missing english name for object
FIX: Missing include
FIX: missing User object with API REST
FIX: modulebuilder: could not create html fields
FIX: modulebuilder: handle 'price' fieldtype
FIX: multiple creation of same event
FIX: Name of user not visible on journalizing expense report payments
FIX: Not approved holidays must not be visible into timesheet
FIX: Only approved expense report must be journalized
FIX: payment term doc-specific label was not used
FIX: payment term doc-specific label was not used (issue #8414)
FIX: project category is type 6 not 5
FIX: Projet is not prefilled when created from overwiew page
FIX: Related contact printed in societe agenda
FIX: Removed error when no error on accounting setup page
FIX: remove var_dump
FIX: sanitize setup params
FIX: selectForFormsList: entity checked even is object not multi-entity managed
FIX: service creation, right is tested regarding the product type
FIX: some localtaxes errors
FIX: Some report have data when several chart of accounts exists
FIX: sql error using no category
FIX: SQL Injection CWE-89
FIX: Support or multicompany for sheduled jobs
FIX: Test on mandatory status when closing proposal failed
FIX: to allow IRPF not null even if main VAT is null.
FIX: update wrong datetime extrafield
FIX: Use priority to define order of sheduled jobs
FIX: various modulebuilder-related issues
FIX: view of balance before field
FIX: weird password autocompletion in Goocle Chrome (issue #8479)
FIX: weird password autocompletion in Google Chrome (issue #8479)
FIX: When clearing filter, we must not save tmp criterias in session
FIX: With x extrafields, request for multicompany label was done x times
FIX: several XSS
FIX: zip not filtered
***** ChangeLog for 7.0.1 compared to 7.0.0 *****
FIX: #8139 User search does not work if MAIN_USE_OLD_SEARCH_FORM, missing list.php
FIX: #8200
@ -358,7 +448,22 @@ Following changes may create regressions for some external modules, but were nec
***** ChangeLog for 6.0.6 compared to 6.0.6 *****
***** ChangeLog for 6.0.7 compared to 6.0.6 *****
FIX: #8023
FIX: #8259 can't update contact birthday with REST API
FIX: #8478 !empty instead of count to avoid warning
FIX: #8488
FIX: actioncomm export: type filtering not working
FIX: addline on invoice supplier manage rank on its own if not provided
FIX: issue #8037
FIX: label in getnomurl projectlist
FIX: payment term doc-specific label was not used
FIX: payment term doc-specific label was not used (issue #8414)
FIX: project category is type 6 not 5 !!
FIX: some localtaxes errors
FIX: weird password autocompletion in Google Chrome (issue #8479)
***** ChangeLog for 6.0.6 compared to 6.0.5 *****
FIX: #7974 Contract - Invalid reference on the document
FIX: #8139
FIX: #8139 User search does not work if MAIN_USE_OLD_SEARCH_FORM, missing list.php

View File

@ -466,10 +466,12 @@ if ($nboftargetok) {
$ret=`rm -f $BUILDROOT/$PROJECT/build/dolibarr_*.deb`;
$ret=`rm -f $BUILDROOT/$PROJECT/build/dolibarr_*.dsc`;
$ret=`rm -f $BUILDROOT/$PROJECT/build/dolibarr_*.tar.gz`;
$ret=`rm -f $BUILDROOT/$PROJECT/build/dolibarr_*.tar.xz`;
$ret=`rm -f $BUILDROOT/$PROJECT/build/dolibarr-*.deb`;
$ret=`rm -f $BUILDROOT/$PROJECT/build/dolibarr-*.rpm`;
$ret=`rm -f $BUILDROOT/$PROJECT/build/dolibarr-*.tar`;
$ret=`rm -f $BUILDROOT/$PROJECT/build/dolibarr-*.tar.gz`;
$ret=`rm -f $BUILDROOT/$PROJECT/build/dolibarr-*.tar.xz`;
$ret=`rm -f $BUILDROOT/$PROJECT/build/dolibarr-*.tgz`;
$ret=`rm -f $BUILDROOT/$PROJECT/build/dolibarr-*.xz`;
$ret=`rm -f $BUILDROOT/$PROJECT/build/dolibarr-*.zip`;
@ -849,6 +851,8 @@ if ($nboftargetok) {
unlink("$NEWDESTI/${FILENAMEDEB}.changes");
print "Remove target ${FILENAMEDEB}.debian.tar.gz...\n";
unlink("$NEWDESTI/${FILENAMEDEB}.debian.tar.gz");
print "Remove target ${FILENAMEDEB}.debian.tar.xz...\n";
unlink("$NEWDESTI/${FILENAMEDEB}.debian.tar.xz");
print "Remove target ${FILENAMEDEBNATIVE}.orig.tar.gz...\n";
unlink("$NEWDESTI/${FILENAMEDEBNATIVE}.orig.tar.gz");
@ -1024,7 +1028,7 @@ if ($nboftargetok) {
$ret=`mv $BUILDROOT/*_all.deb "$NEWDESTI/"`;
$ret=`mv $BUILDROOT/*.dsc "$NEWDESTI/"`;
$ret=`mv $BUILDROOT/*.orig.tar.gz "$NEWDESTI/"`;
$ret=`mv $BUILDROOT/*.debian.tar.gz "$NEWDESTI/"`;
$ret=`mv $BUILDROOT/*.debian.tar.xz "$NEWDESTI/"`;
$ret=`mv $BUILDROOT/*.changes "$NEWDESTI/"`;
next;
}
@ -1168,7 +1172,7 @@ if ($nboftargetok) {
"$DESTI/package_debian-ubuntu/${FILENAMEDEB}_all.deb"=>'Dolibarr installer for Debian-Ubuntu (DoliDeb)',
"$DESTI/package_debian-ubuntu/${FILENAMEDEB}_amd64.changes"=>'none', # none means it won't be published on SF
"$DESTI/package_debian-ubuntu/${FILENAMEDEB}.dsc"=>'none', # none means it won't be published on SF
"$DESTI/package_debian-ubuntu/${FILENAMEDEB}.debian.tar.gz"=>'none', # none means it won't be published on SF
"$DESTI/package_debian-ubuntu/${FILENAMEDEB}.debian.tar.xz"=>'none', # none means it won't be published on SF
"$DESTI/package_debian-ubuntu/${FILENAMEDEBSHORT}.orig.tar.gz"=>'none', # none means it won't be published on SF
"$DESTI/package_windows/$FILENAMEEXEDOLIWAMP.exe"=>'Dolibarr installer for Windows (DoliWamp)',
"$DESTI/standard/$FILENAMETGZ.tgz"=>'Dolibarr ERP-CRM',
@ -1181,8 +1185,7 @@ if ($nboftargetok) {
"$DESTI/package_debian-ubuntu/${FILENAMEDEB}_all.deb"=>'package_debian-ubuntu',
"$DESTI/package_debian-ubuntu/${FILENAMEDEB}_amd64.changes"=>'package_debian-ubuntu',
"$DESTI/package_debian-ubuntu/${FILENAMEDEB}.dsc"=>'package_debian-ubuntu',
"$DESTI/package_debian-ubuntu/${FILENAMEDEB}.debian.tar.gz"=>'package_debian-ubuntu',
"$DESTI/package_debian-ubuntu/${FILENAMEDEBSHORT}.orig.tar.gz"=>'package_debian-ubuntu',
"$DESTI/package_debian-ubuntu/${FILENAMEDEB}.debian.tar.xz"=>'package_debian-ubuntu',
"$DESTI/package_debian-ubuntu/${FILENAMEDEBSHORT}.orig.tar.gz"=>'package_debian-ubuntu',
"$DESTI/package_windows/$FILENAMEEXEDOLIWAMP.exe"=>'package_windows',
"$DESTI/standard/$FILENAMETGZ.tgz"=>'standard',

View File

@ -176,10 +176,10 @@ $pcgver = $conf->global->CHARTOFACCOUNTS;
$sql = "SELECT aa.rowid, aa.fk_pcg_version, aa.pcg_type, aa.pcg_subtype, aa.account_number, aa.account_parent , aa.label, aa.active, ";
$sql .= " a2.rowid as rowid2, a2.label as label2, a2.account_number as account_number2";
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as aa";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version AND aa.entity = " . $conf->entity;
// Dirty hack wainting that foreign key account_parent is an integer to be compared correctly with rowid
if ($db->type == 'pgsql') $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as a2 ON a2.rowid = CAST(aa.account_parent AS INTEGER)";
else $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as a2 ON a2.rowid = CAST(aa.account_parent AS UNSIGNED)";
if ($db->type == 'pgsql') $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as a2 ON a2.rowid = CAST(aa.account_parent AS INTEGER) AND a2.entity = " . $conf->entity;
else $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as a2 ON a2.rowid = CAST(aa.account_parent AS UNSIGNED) AND a2.entity = " . $conf->entity;
$sql .= " WHERE asy.rowid = " . $pcgver;
if (strlen(trim($search_account))) $sql .= natural_search("aa.account_number", $search_account);

View File

@ -45,7 +45,7 @@ $langs->loadLangs(array("errors","admin","companies","resource","holiday","compt
$action=GETPOST('action','alpha')?GETPOST('action','alpha'):'view';
$confirm=GETPOST('confirm','alpha');
$id=GETPOST('id','int');
$id=31;
$rowid=GETPOST('rowid','alpha');
$code=GETPOST('code','alpha');
@ -58,8 +58,8 @@ $listoffset=GETPOST('listoffset');
$listlimit=GETPOST('listlimit')>0?GETPOST('listlimit'):1000;
$active = 1;
$sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha');
$sortfield = GETPOST("sortfield",'aZ09comma');
$sortorder = GETPOST("sortorder",'aZ09comma');
$page = GETPOST("page",'int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $listlimit * $page ;
@ -84,59 +84,48 @@ $hookmanager->initHooks(array('admin'));
$tabname=array();
$tabname[31]= MAIN_DB_PREFIX."accounting_system";
$tabname[32]= MAIN_DB_PREFIX."c_accounting_category";
// Dictionary labels
$tablib=array();
$tablib[31]= "Pcg_version";
$tablib[32]= "DictionaryAccountancyCategory";
// Requests to extract data
$tabsql=array();
$tabsql[31]= "SELECT s.rowid as rowid, pcg_version, s.label, s.fk_country as country_id, c.code as country_code, c.label as country, s.active FROM ".MAIN_DB_PREFIX."accounting_system as s, ".MAIN_DB_PREFIX."c_country as c WHERE s.fk_country=c.rowid and c.active=1";
$tabsql[32]= "SELECT a.rowid as rowid, a.code as code, a.label, a.range_account, a.sens, a.category_type, a.formula, a.position as position, a.fk_country as country_id, c.code as country_code, c.label as country, a.active FROM ".MAIN_DB_PREFIX."c_accounting_category as a, ".MAIN_DB_PREFIX."c_country as c WHERE a.fk_country=c.rowid and c.active=1";
// Criteria to sort dictionaries
$tabsqlsort=array();
$tabsqlsort[31]="pcg_version ASC";
$tabsqlsort[32]="position ASC";
// Nom des champs en resultat de select pour affichage du dictionnaire
$tabfield=array();
$tabfield[31]= "pcg_version,label,country_id,country";
$tabfield[32]= "code,label,range_account,sens,category_type,formula,position,country_id,country";
// Nom des champs d'edition pour modification d'un enregistrement
$tabfieldvalue=array();
$tabfieldvalue[31]= "pcg_version,label,country";
$tabfieldvalue[32]= "code,label,range_account,sens,category_type,formula,position,country";
// Nom des champs dans la table pour insertion d'un enregistrement
$tabfieldinsert=array();
$tabfieldinsert[31]= "pcg_version,label,fk_country";
$tabfieldinsert[32]= "code,label,range_account,sens,category_type,formula,position,fk_country";
// Nom du rowid si le champ n'est pas de type autoincrement
// Example: "" if id field is "rowid" and has autoincrement on
// "nameoffield" if id field is not "rowid" or has not autoincrement on
$tabrowid=array();
$tabrowid[31]= "";
$tabrowid[32]= "";
// Condition to show dictionary in setup page
$tabcond=array();
$tabcond[31]= ! empty($conf->accounting->enabled);
$tabcond[32]= ! empty($conf->accounting->enabled);
// List of help for fields
$tabhelp=array();
$tabhelp[31] = array('pcg_version'=>$langs->trans("EnterAnyCode"));
$tabhelp[32] = array('code'=>$langs->trans("EnterAnyCode"));
// List of check for fields (NOT USED YET)
$tabfieldcheck=array();
$tabfieldcheck[31] = array();
$tabfieldcheck[32] = array();
// Define elementList and sourceList (used for dictionary type of contacts "llx_c_type_contact")
@ -484,7 +473,7 @@ print "<br>\n";
// Confirmation de la suppression de la ligne
if ($action == 'delete')
{
print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.$rowid.'&code='.$code.'&id='.$id, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete','',0,1);
print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page?'page='.urlencode($page).'&':'').'sortfield='.urlencode($sortfield).'&sortorder='.urlencode($sortorder).'&rowid='.urlencode($rowid).'&code='.urlencode($code).'&id='.urlencode($id), $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete','',0,1);
}
//var_dump($elementList);
@ -503,24 +492,9 @@ if ($id)
$sql.= " c.rowid = ".$search_country_id;
}
if ($sortfield)
{
// If sort order is "country", we use country_code instead
if ($sortfield == 'country') $sortfield='country_code';
$sql.= " ORDER BY ".$sortfield;
if ($sortorder)
{
$sql.=" ".strtoupper($sortorder);
}
$sql.=", ";
// Clear the required sort criteria for the tabsqlsort to be able to force it with selected value
$tabsqlsort[$id]=preg_replace('/([a-z]+\.)?'.$sortfield.' '.$sortorder.',/i','',$tabsqlsort[$id]);
$tabsqlsort[$id]=preg_replace('/([a-z]+\.)?'.$sortfield.',/i','',$tabsqlsort[$id]);
}
else {
$sql.=" ORDER BY ";
}
$sql.=$tabsqlsort[$id];
// If sort order is "country", we use country_code instead
if ($sortfield == 'country') $sortfield='country_code';
$sql.=$db->order($sortfield,$sortorder);
$sql.=$db->plimit($listlimit+1,$offset);
//print $sql;

View File

@ -88,7 +88,7 @@ $formaccounting = new FormAccounting($db);
llxheader('', $langs->trans('AccountingCategory'));
$linkback = '<a href="'.DOL_URL_ROOT.'/accountancy/admin/categories_list.php?search_country_id='.$mysoc->country_id.'">'.$langs->trans("BackToList").'</a>';
$linkback = '<a href="'.DOL_URL_ROOT.'/accountancy/admin/categories_list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
print load_fiche_titre($langs->trans('AccountingCategory'), $linkback);

View File

@ -54,8 +54,8 @@ $listoffset=GETPOST('listoffset');
$listlimit=GETPOST('listlimit')>0?GETPOST('listlimit'):1000;
$active = 1;
$sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha');
$sortfield = GETPOST("sortfield",'aZ09comma');
$sortorder = GETPOST("sortorder",'aZ09comma');
$page = GETPOST("page",'int');
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
$offset = $listlimit * $page ;
@ -300,7 +300,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes') // delete
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
else { $rowidcol="rowid"; }
$sql = "DELETE from ".$tabname[$id]." WHERE ".$rowidcol." = '".$this->db->escape($rowid)."'";
$sql = "DELETE from ".$tabname[$id]." WHERE ".$rowidcol." = '".$db->escape($rowid)."'";
dol_syslog("delete", LOG_DEBUG);
$result = $db->query($sql);
@ -324,10 +324,10 @@ if ($action == $acts[0])
else { $rowidcol="rowid"; }
if ($rowid) {
$sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE ".$rowidcol." = '".$this->db->escape($rowid)."'";
$sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE ".$rowidcol." = '".$db->escape($rowid)."'";
}
elseif ($code) {
$sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE code = '".$this->db->escape($code)."'";
$sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE code = '".$db->escape($code)."'";
}
$result = $db->query($sql);
@ -344,10 +344,10 @@ if ($action == $acts[1])
else { $rowidcol="rowid"; }
if ($rowid) {
$sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE ".$rowidcol." = '".$this->db->escape($rowid)."'";
$sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE ".$rowidcol." = '".$db->escape($rowid)."'";
}
elseif ($code) {
$sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE code = '".$this->db->escape($code)."'";
$sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE code = '".$db->escape($code)."'";
}
$result = $db->query($sql);
@ -364,10 +364,10 @@ if ($action == 'activate_favorite')
else { $rowidcol="rowid"; }
if ($rowid) {
$sql = "UPDATE ".$tabname[$id]." SET favorite = 1 WHERE ".$rowidcol." = '".$this->db->escape($rowid)."'";
$sql = "UPDATE ".$tabname[$id]." SET favorite = 1 WHERE ".$rowidcol." = '".$db->escape($rowid)."'";
}
elseif ($code) {
$sql = "UPDATE ".$tabname[$id]." SET favorite = 1 WHERE code = '".$this->db->escape($code)."'";
$sql = "UPDATE ".$tabname[$id]." SET favorite = 1 WHERE code = '".$db->escape($code)."'";
}
$result = $db->query($sql);
@ -384,10 +384,10 @@ if ($action == 'disable_favorite')
else { $rowidcol="rowid"; }
if ($rowid) {
$sql = "UPDATE ".$tabname[$id]." SET favorite = 0 WHERE ".$rowidcol." = '".$this->db->escape($rowid)."'";
$sql = "UPDATE ".$tabname[$id]." SET favorite = 0 WHERE ".$rowidcol." = '".$db->escape($rowid)."'";
}
elseif ($code) {
$sql = "UPDATE ".$tabname[$id]." SET favorite = 0 WHERE code = '".$this->db->escape($code)."'";
$sql = "UPDATE ".$tabname[$id]." SET favorite = 0 WHERE code = '".$db->escape($code)."'";
}
$result = $db->query($sql);
@ -437,24 +437,9 @@ if ($id)
$sql.= " (a.fk_country = ".$search_country_id." OR a.fk_country = 0)";
}
if ($sortfield)
{
// If sort order is "country", we use country_code instead
if ($sortfield == 'country') $sortfield='country_code';
$sql.= " ORDER BY ".$sortfield;
if ($sortorder)
{
$sql.=" ".strtoupper($sortorder);
}
$sql.=", ";
// Clear the required sort criteria for the tabsqlsort to be able to force it with selected value
$tabsqlsort[$id]=preg_replace('/([a-z]+\.)?'.$sortfield.' '.$sortorder.',/i','',$tabsqlsort[$id]);
$tabsqlsort[$id]=preg_replace('/([a-z]+\.)?'.$sortfield.',/i','',$tabsqlsort[$id]);
}
else {
$sql.=" ORDER BY ";
}
$sql.=$tabsqlsort[$id];
// If sort order is "country", we use country_code instead
if ($sortfield == 'country') $sortfield='country_code';
$sql.=$db->order($sortfield,$sortorder);
$sql.=$db->plimit($listlimit+1,$offset);
//print $sql;
@ -793,7 +778,7 @@ if ($id)
print '<td class="center">';
if (empty($obj->formula))
{
print '<a href="'.DOL_URL_ROOT.'/accountancy/admin/categories.php?action=display&account_category='.$obj->rowid.'">';
print '<a href="'.DOL_URL_ROOT.'/accountancy/admin/categories.php?action=display&save_lastsearch_values=1&account_category='.$obj->rowid.'">';
print $langs->trans("ListOfAccounts");
print '</a>';
}

View File

@ -36,7 +36,7 @@ $langs->load("accountancy");
$action=GETPOST('action','alpha')?GETPOST('action','alpha'):'view';
$confirm=GETPOST('confirm','alpha');
$id=GETPOST('id','int');
$id=35;
$rowid=GETPOST('rowid','alpha');
$code=GETPOST('code','alpha');
@ -400,24 +400,9 @@ if ($id)
$sql=$tabsql[$id];
$sql.= " WHERE a.entity = ".$conf->entity;
if ($sortfield)
{
// If sort order is "country", we use country_code instead
if ($sortfield == 'country') $sortfield='country_code';
$sql.= " ORDER BY ".$sortfield;
if ($sortorder)
{
$sql.=" ".strtoupper($sortorder);
}
$sql.=", ";
// Clear the required sort criteria for the tabsqlsort to be able to force it with selected value
$tabsqlsort[$id]=preg_replace('/([a-z]+\.)?'.$sortfield.' '.$sortorder.',/i','',$tabsqlsort[$id]);
$tabsqlsort[$id]=preg_replace('/([a-z]+\.)?'.$sortfield.',/i','',$tabsqlsort[$id]);
}
else {
$sql.=" ORDER BY ";
}
$sql.=$tabsqlsort[$id];
// If sort order is "country", we use country_code instead
if ($sortfield == 'country') $sortfield='country_code';
$sql.=$db->order($sortfield,$sortorder);
$sql.=$db->plimit($listlimit+1,$offset);
$fieldlist=explode(',',$tabfield[$id]);

View File

@ -84,7 +84,8 @@ class AccountingAccount extends CommonObject
* @param int $limittocurrentchart 1=Do not load record if it is into another accounting system
* @return int <0 if KO, 0 if not found, Id of record if OK and found
*/
function fetch($rowid = null, $account_number = null, $limittocurrentchart = 0) {
function fetch($rowid = null, $account_number = null, $limittocurrentchart = 0)
{
global $conf;
if ($rowid || $account_number) {
@ -96,10 +97,10 @@ class AccountingAccount extends CommonObject
if ($rowid) {
$sql .= " a.rowid = '" . $rowid . "'";
} elseif ($account_number) {
$sql .= " a.account_number = '" . $account_number . "'";
$sql .= " a.account_number = '" . $this->db->escape($account_number) . "'";
}
if (! empty($limittocurrentchart)) {
$sql .= ' AND a.fk_pcg_version IN (SELECT pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system WHERE rowid=' . $conf->global->CHARTOFACCOUNTS . ')';
$sql .= ' AND a.fk_pcg_version IN (SELECT pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system WHERE rowid=' . $this->db->escape($conf->global->CHARTOFACCOUNTS) . ')';
}
dol_syslog(get_class($this) . "::fetch sql=" . $sql, LOG_DEBUG);
@ -203,7 +204,7 @@ class AccountingAccount extends CommonObject
$sql .= ", " . (empty($this->account_number) ? 'NULL' : "'" . $this->db->escape($this->account_number) . "'");
$sql .= ", " . (empty($this->account_parent) ? 'NULL' : "'" . $this->db->escape($this->account_parent) . "'");
$sql .= ", " . (empty($this->label) ? 'NULL' : "'" . $this->db->escape($this->label) . "'");
$sql .= ", " . (empty($this->account_category) ? 'NULL' : "'" . $this->db->escape($this->account_category) . "'");
$sql .= ", " . (empty($this->account_category) ? '0' : $this->db->escape($this->account_category));
$sql .= ", " . $user->id;
$sql .= ", " . (! isset($this->active) ? 'NULL' : $this->db->escape($this->active));
$sql .= ")";
@ -274,7 +275,7 @@ class AccountingAccount extends CommonObject
$sql .= " , account_number = '" . $this->db->escape($this->account_number) . "'";
$sql .= " , account_parent = '" . $this->db->escape($this->account_parent) . "'";
$sql .= " , label = " . ($this->label ? "'" . $this->db->escape($this->label) . "'" : "null");
$sql .= " , fk_accounting_category = '" . $this->db->escape($this->account_category) . "'";
$sql .= " , fk_accounting_category = " . (empty($this->account_category) ? 0 : $this->db->escape($this->account_category));
$sql .= " , fk_user_modif = " . $user->id;
$sql .= " , active = " . $this->active;
$sql .= " WHERE rowid = " . $this->id;

View File

@ -965,14 +965,14 @@ if (empty($id))
print "<br>\n";
$param = '&id='.$id;
if ($search_country_id > 0) $param.= '&search_country_id='.$search_country_id;
$param = '&id='.urlencode($id);
if ($search_country_id > 0) $param.= '&search_country_id='.urlencode($search_country_id);
if ($search_code != '') $param.= '&search_code='.urlencode($search_country_id);
if ($entity != '') $param.= '&entity=' . (int) $entity;
$paramwithsearch = $param;
if ($sortorder) $paramwithsearch.= '&sortorder='.$sortorder;
if ($sortfield) $paramwithsearch.= '&sortfield='.$sortfield;
if (GETPOST('from')) $paramwithsearch.= '&from='.GETPOST('from','alpha');
if ($sortorder) $paramwithsearch.= '&sortorder='.urlencode($sortorder);
if ($sortfield) $paramwithsearch.= '&sortfield='.urlencode($sortfield);
if (GETPOST('from')) $paramwithsearch.= '&from='.urlencode(GETPOST('from','alpha'));
// Confirmation de la suppression de la ligne
@ -999,10 +999,10 @@ if ($id)
{
// If sort order is "country", we use country_code instead
if ($sortfield == 'country') $sortfield='country_code';
$sql.= " ORDER BY ".$sortfield;
$sql.= " ORDER BY ".$db->escape($sortfield);
if ($sortorder)
{
$sql.=" ".strtoupper($sortorder);
$sql.=" ".strtoupper($db->escape($sortorder));
}
$sql.=", ";
// Clear the required sort criteria for the tabsqlsort to be able to force it with selected value

View File

@ -430,24 +430,9 @@ if ($search_type_template != '' && $search_type_template != '-1') $sql.=natural_
if ($search_lang) $sql.=natural_search('lang', $search_lang);
if ($search_fk_user != '' && $search_fk_user != '-1') $sql.=natural_search('fk_user', $search_fk_user, 2);
if ($search_topic) $sql.=natural_search('topic', $search_topic);
if ($sortfield)
{
// If sort order is "country", we use country_code instead
if ($sortfield == 'country') $sortfield='country_code';
$sql.= " ORDER BY ".$sortfield;
if ($sortorder)
{
$sql.=" ".strtoupper($sortorder);
}
$sql.=", ";
// Clear the required sort criteria for the tabsqlsort to be able to force it with selected value
$tabsqlsort[$id]=preg_replace('/([a-z]+\.)?'.$sortfield.' '.$sortorder.',/i','',$tabsqlsort[$id]);
$tabsqlsort[$id]=preg_replace('/([a-z]+\.)?'.$sortfield.',/i','',$tabsqlsort[$id]);
}
else {
$sql.=" ORDER BY ";
}
$sql.=$tabsqlsort[$id];
// If sort order is "country", we use country_code instead
if ($sortfield == 'country') $sortfield='country_code';
$sql.=$db->order($sortfield,$sortorder);
$sql.=$db->plimit($listlimit+1,$offset);
//print $sql;

View File

@ -72,7 +72,7 @@ print '<br>';
$file_list = array('missing' => array(), 'updated' => array());
// Local file to compare to
$xmlshortfile = GETPOST('xmlshortfile')?GETPOST('xmlshortfile'):'/install/filelist-'.DOL_VERSION.'.xml';
$xmlshortfile = GETPOST('xmlshortfile','alpha')?GETPOST('xmlshortfile','alpha'):'/install/filelist-'.DOL_VERSION.(empty($conf->global->MAIN_FILECHECK_LOCAL_SUFFIX)?'':$conf->global->MAIN_FILECHECK_LOCAL_SUFFIX).'.xml';
$xmlfile = DOL_DOCUMENT_ROOT.$xmlshortfile;
// Remote file to compare to
$xmlremote = GETPOST('xmlremote');
@ -83,8 +83,8 @@ if (empty($xmlremote)) $xmlremote = 'https://www.dolibarr.org/files/stable/signa
// Test if remote test is ok
$enableremotecheck = True;
if (preg_match('/beta|alpha|rc/i', DOL_VERSION) || ! empty($conf->global->MAIN_ALLOW_INTEGRITY_CHECK_ON_UNSTABLE)) $enableremotecheck=False;
$enableremotecheck = true;
if (preg_match('/beta|alpha|rc/i', DOL_VERSION) || ! empty($conf->global->MAIN_ALLOW_INTEGRITY_CHECK_ON_UNSTABLE)) $enableremotecheck=false;
$enableremotecheck = true;
print '<form name="check" action="'.$_SERVER["PHP_SELF"].'">';

View File

@ -419,24 +419,7 @@ if ($id)
{
// Complete requete recherche valeurs avec critere de tri
$sql=$tabsql[$id];
if ($sortfield)
{
// If sort order is "country", we use country_code instead
$sql.= " ORDER BY ".$sortfield;
if ($sortorder)
{
$sql.=" ".strtoupper($sortorder);
}
$sql.=", ";
// Clear the required sort criteria for the tabsqlsort to be able to force it with selected value
$tabsqlsort[$id]=preg_replace('/([a-z]+\.)?'.$sortfield.' '.$sortorder.',/i','',$tabsqlsort[$id]);
$tabsqlsort[$id]=preg_replace('/([a-z]+\.)?'.$sortfield.',/i','',$tabsqlsort[$id]);
}
else {
$sql.=" ORDER BY ";
}
$sql.=$tabsqlsort[$id];
$sql.=$db->order($sortfield,$sortorder);
$sql.=$db->plimit($limit+1, $offset);
//print $sql;

View File

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2007-2008 Jeremie Ollivier <jeremie.o@laposte.net>
* Copyright (C) 2008-2010 Laurent Destailleur <eldy@uers.sourceforge.net>
* Copyright (C) 2018 Juanjo Menent <jmenent@2byte.es>
*
* 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
@ -150,7 +151,8 @@ switch($action)
$obj_facturation->id($ret['rowid']);
$obj_facturation->ref($ret['ref']);
$obj_facturation->stock($ret['reel']);
$obj_facturation->prix($ret['price']);
//$obj_facturation->prix($ret['price']);
$obj_facturation->prix($pu_ht);
$vatrate = $tva_tx;

View File

@ -28,9 +28,9 @@
*/
/**
* \file htdocs/commande/card.php
* \file htdocs/commande/card.php
* \ingroup commande
* \brief Page to show customer order
* \brief Page to show customer order
*/
require '../main.inc.php';
@ -76,6 +76,7 @@ $action = GETPOST('action', 'alpha');
$cancel = GETPOST('cancel', 'alpha');
$confirm = GETPOST('confirm', 'alpha');
$lineid = GETPOST('lineid', 'int');
$projectid = GETPOST('projectid', 'int');
$origin = GETPOST('origin', 'alpha');
$originid = (GETPOST('originid', 'int') ? GETPOST('originid', 'int') : GETPOST('origin_id', 'int')); // For backward compatibility
@ -228,7 +229,7 @@ if (empty($reshook))
// Link to a project
else if ($action == 'classin' && $user->rights->commande->creer)
{
$object->setProject(GETPOST('projectid'));
$object->setProject(GETPOST('projectid','int'));
}
// Add order
@ -259,8 +260,8 @@ if (empty($reshook))
$object->note_private = GETPOST('note_private','none');
$object->note_public = GETPOST('note_public','none');
$object->source = GETPOST('source_id');
$object->fk_project = GETPOST('projectid');
$object->ref_client = GETPOST('ref_client');
$object->fk_project = GETPOST('projectid','int');
$object->ref_client = GETPOST('ref_client','alpha');
$object->modelpdf = GETPOST('model');
$object->cond_reglement_id = GETPOST('cond_reglement_id');
$object->mode_reglement_id = GETPOST('mode_reglement_id');
@ -1389,7 +1390,6 @@ if ($action == 'create' && $user->rights->commande->creer)
if ($socid > 0)
$res = $soc->fetch($socid);
$projectid = 0;
$remise_absolue = 0;
$currency_code = $conf->currency;
@ -1486,7 +1486,6 @@ if ($action == 'create' && $user->rights->commande->creer)
$remise_percent = $soc->remise_percent;
$remise_absolue = 0;
$dateorder = empty($conf->global->MAIN_AUTOFILL_DATE_ORDER)?-1:'';
$projectid = 0;
if (!empty($conf->multicurrency->enabled) && !empty($soc->multicurrency_code)) $currency_code = $soc->multicurrency_code;
@ -1494,7 +1493,6 @@ if ($action == 'create' && $user->rights->commande->creer)
$note_public = $object->getDefaultCreateValueFor('note_public');
}
print '<form name="crea_commande" action="' . $_SERVER["PHP_SELF"] . '" method="POST">';
print '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">';
print '<input type="hidden" name="action" value="add">';

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-2017 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012-2018 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
@ -285,6 +285,13 @@ if (($action == 'create' || $action == 'add') && !$error)
{
$fk_parent_line = 0;
}
// Extrafields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) {
$lines[$i]->fetch_optionals($lines[$i]->rowid);
$array_options = $lines[$i]->array_options;
}
$result = $object->addline(
$desc,
$lines[$i]->subprice,
@ -309,7 +316,8 @@ if (($action == 'create' || $action == 'add') && !$error)
$fk_parent_line,
$lines[$i]->fk_fournprice,
$lines[$i]->pa_ht,
$lines[$i]->label
$lines[$i]->label,
$array_options
);
if ($result > 0)
{

View File

@ -349,7 +349,7 @@ if ($action == 'create')
print '<div class="center">';
print '<input type="submit" class="button" value="'.$langs->trans("Save").'">';
print ' &nbsp; ';
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
print '<input type="button" class="button" value="'.$langs->trans("Cancel").'" onclick="javascript:history.go(-1)">';
print '</div>';
print '</form>';

View File

@ -720,7 +720,6 @@ if (empty($reshook))
$sql.= ' WHERE pf.fk_facture = '.$object->id;
$sql.= ' AND pf.fk_paiement = p.rowid';
$sql.= ' AND p.entity IN (' . getEntity('facture').')';
$sql.= ' ORDER BY p.datep, p.tms';
$resql = $db->query($sql);
if (! $resql) dol_print_error($db);
@ -1444,11 +1443,26 @@ if (empty($reshook))
$object->origin = $origin;
$object->origin_id = $originid;
foreach ($object->lines as &$line)
foreach ($object->lines as $i => &$line)
{
$line->origin = $object->origin;
$line->origin_id = $line->id;
$line->fetch_optionals($line->id);
// Si fk_remise_except defini on vérifie si la réduction à déjà été appliquée
if ($line->fk_remise_except)
{
$discount=new DiscountAbsolute($line->db);
$result=$discount->fetch($line->fk_remise_except);
if ($result > 0)
{
// Check if discount not already affected to another invoice
if ($discount->fk_facture_line > 0)
{
$line->fk_remise_except = 0;
}
}
}
}
}

View File

@ -15,6 +15,7 @@
* Copyright (C) 2013 Cedric Gross <c.gross@kreiz-it.fr>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.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
@ -3979,9 +3980,10 @@ class Facture extends CommonInvoice
* @param int $hidedetails Hide details of lines
* @param int $hidedesc Hide description
* @param int $hideref Hide ref
* @param null|array $moreparams Array to provide more information
* @return int <0 if KO, >0 if OK
*/
public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0, $moreparams=null)
{
global $conf,$langs;
@ -4000,7 +4002,7 @@ class Facture extends CommonInvoice
$modelpath = "core/modules/facture/doc/";
return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams);
}
/**

View File

@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2015-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2018 Juanjo Menent <jmenent@2byte.es>
*
* 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
@ -601,6 +602,13 @@ if ($massaction == 'confirm_createbills')
{
$fk_parent_line = 0;
}
// Extrafields
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) {
$lines[$i]->fetch_optionals($lines[$i]->rowid);
$array_options = $lines[$i]->array_options;
}
$result = $objecttmp->addline(
$desc,
$lines[$i]->subprice,
@ -625,7 +633,8 @@ if ($massaction == 'confirm_createbills')
$fk_parent_line,
$lines[$i]->fk_fournprice,
$lines[$i]->pa_ht,
$lines[$i]->label
$lines[$i]->label,
$array_options
);
if ($result > 0)
{

View File

@ -4847,7 +4847,8 @@ abstract class CommonObject
$type = 'varchar'; // convert varchar(xx) int varchar
$size = $reg[1];
}
elseif (preg_match('/varchar/', $type)) $type = 'varchar'; // convert varchar(xx) int varchar
elseif (preg_match('/varchar/', $type)) $type = 'varchar'; // convert varchar(xx) into varchar
elseif (preg_match('/double/', $type)) $type = 'double'; // convert double(xx) into double
if (is_array($val['arrayofkeyval'])) $type='select';
if (preg_match('/^integer:(.*):(.*)/i', $val['type'], $reg)) $type='link';
@ -4922,7 +4923,6 @@ abstract class CommonObject
}
}
//var_dump($showsize.' '.$size);
if (in_array($type,array('date','datetime')))
{
$tmp=explode(',',$size);

View File

@ -274,6 +274,7 @@ class FormAccounting extends Form
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version";
$sql .= " AND asy.rowid = " . $conf->global->CHARTOFACCOUNTS;
$sql .= " AND aa.active = 1";
$sql .= " AND aa.entity=".$conf->entity;
$sql .= " ORDER BY aa.account_number";
dol_syslog(get_class($this) . "::select_account", LOG_DEBUG);

View File

@ -520,7 +520,7 @@ class FormFile
$modellist=ModelePDFCards::liste_modeles($this->db);
}
}
elseif ($modulepart == 'agenda')
elseif ($modulepart == 'agenda' || $modulepart == 'actions')
{
if (is_array($genallowed)) $modellist=$genallowed;
else
@ -560,7 +560,7 @@ class FormFile
$modellist=ModelePDFUserGroup::liste_modeles($this->db);
}
}
else //if ($modulepart != 'agenda')
else
{
// For normalized standard modules
$file=dol_buildpath('/core/modules/'.$modulepart.'/modules_'.$modulepart.'.php',0);

View File

@ -1468,7 +1468,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
$out.=getTitleFieldOfList($langs->trans("Label"), 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder);
$out.=getTitleFieldOfList($langs->trans("Date"), 0, $_SERVER["PHP_SELF"], 'a.datep,a.id', '', $param, 'align="center"', $sortfield, $sortorder);
$out.=getTitleFieldOfList('');
$out.=getTitleFieldOfList('');
$out.=getTitleFieldOfList($langs->trans("ActionOnContact"), 0, $_SERVER["PHP_SELF"], 'a.fk_contact', '', $param, '', $sortfield, $sortorder);
$out.=getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], 'a.percent', '', $param, 'align="center"', $sortfield, $sortorder);
$out.=getTitleFieldOfList('', 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'maxwidthsearch ');
$out.='</tr>';
@ -1609,7 +1609,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=
$out.='</td>';
// Contact pour cette action
if (! empty($objcon->id) && isset($histo[$key]['contact_id']) && $histo[$key]['contact_id'] > 0)
if (empty($objcon->id) && isset($histo[$key]['contact_id']) && $histo[$key]['contact_id'] > 0)
{
$contactstatic->lastname=$histo[$key]['lastname'];
$contactstatic->firstname=$histo[$key]['firstname'];

View File

@ -578,12 +578,12 @@ function GETPOST($paramname, $check='none', $method=0, $filter=NULL, $options=NU
{
//var_dump($paramname.' - '.$out.' '.$user->default_values[$relativepathstring]['filters'][$paramname]);
// We save search key only if:
// - not empty, or
// - if value is empty and a default value exists that is not empty (it means we did a filter to an empty value when default was not).
// We save search key only if $out not empty that means:
// - posted value not empty, or
// - if posted value is empty and a default value exists that is not empty (it means we did a filter to an empty value when default was not).
//if (! empty($out) || ! empty($user->default_values[$relativepathstring]['filters'][$paramname]))
if (! empty($out))
if ($out != '') // $out = '0' like 'abc' is a search criteria to keep
{
$user->lastsearch_values_tmp[$relativepathstring][$paramname]=$out;
}
@ -4261,7 +4261,8 @@ function get_localtax($vatrate, $local, $thirdparty_buyer="", $thirdparty_seller
if ($local == 2)
{
if (! $mysoc->localtax2_assuj || (string) $vatratecleaned == "0") return 0;
//if (! $mysoc->localtax2_assuj || (string) $vatratecleaned == "0") return 0;
if (! $mysoc->localtax2_assuj) return 0; // If main vat is 0, IRPF may be different than 0.
if ($thirdparty_seller->id == $mysoc->id)
{
if (! $thirdparty_buyer->localtax2_assuj) return 0;

View File

@ -384,7 +384,7 @@ function checkUserAccessToObject($user, $featuresarray, $objectid=0, $tableandsh
if ($feature == 'project') $feature='projet';
if ($feature == 'task') $feature='projet_task';
$check = array('adherent','banque','don','user','usergroup','produit','service','produit|service','categorie','resource'); // Test on entity only (Objects with no link to company)
$check = array('adherent','banque','don','user','usergroup','product','produit','service','produit|service','categorie','resource'); // Test on entity only (Objects with no link to company)
$checksoc = array('societe'); // Test for societe object
$checkother = array('contact','agenda'); // Test on entity and link to third party. Allowed if link is empty (Ex: contacts...).
$checkproject = array('projet','project'); // Test for project object

View File

@ -4,6 +4,7 @@
* Copyright (C) 2012-2015 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
*
* 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
@ -802,7 +803,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
$newmenu->add("/compta/facture/card.php?action=create",$langs->trans("NewBill"),1,$user->rights->facture->creer);
$newmenu->add("/compta/facture/list.php?leftmenu=customers_bills",$langs->trans("List"),1,$user->rights->facture->lire, '', $mainmenu, 'customers_bills_list');
if ($usemenuhider || empty($leftmenu) || preg_match('/customers_bills(|draft|notpaid|paid|canceled)$/', $leftmenu))
if ($usemenuhider || empty($leftmenu) || preg_match('/customers_bills(|_draft|_notpaid|_paid|_canceled)$/', $leftmenu))
{
$newmenu->add("/compta/facture/list.php?leftmenu=customers_bills_draft&amp;search_status=0",$langs->trans("BillShortStatusDraft"),2,$user->rights->facture->lire);
$newmenu->add("/compta/facture/list.php?leftmenu=customers_bills_notpaid&amp;search_status=1",$langs->trans("BillShortStatusNotPaid"),2,$user->rights->facture->lire);
@ -1257,18 +1258,18 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
if (! empty($conf->stock->enabled))
{
$langs->load("stocks");
if (empty($conf->global->MAIN_USE_ADVANCED_PERMS))
{
$newmenu->add("/product/inventory/list.php?leftmenu=stock", $langs->trans("Inventory"), 0, $user->rights->stock->lire, '', $mainmenu, 'stock');
$newmenu->add("/product/inventory/card.php?action=create", $langs->trans("NewInventory"), 1, $user->rights->stock->creer);
$newmenu->add("/product/inventory/list.php", $langs->trans("List"), 1, $user->rights->stock->lire);
}
else
{
$newmenu->add("/product/inventory/list.php?leftmenu=stock", $langs->trans("Inventory"), 0, $user->rights->stock->advance_inventory->read, '', $mainmenu, 'stock');
$newmenu->add("/product/inventory/card.php?action=create", $langs->trans("NewInventory"), 1, $user->rights->stock->advance_inventory->write);
$newmenu->add("/product/inventory/list.php", $langs->trans("List"), 1, $user->rights->stock->advance_inventory->read);
}
if (empty($conf->global->MAIN_USE_ADVANCED_PERMS))
{
$newmenu->add("/product/inventory/list.php?leftmenu=stock", $langs->trans("Inventory"), 0, $user->rights->stock->lire, '', $mainmenu, 'stock');
$newmenu->add("/product/inventory/card.php?action=create", $langs->trans("NewInventory"), 1, $user->rights->stock->creer);
$newmenu->add("/product/inventory/list.php", $langs->trans("List"), 1, $user->rights->stock->lire);
}
else
{
$newmenu->add("/product/inventory/list.php?leftmenu=stock", $langs->trans("Inventory"), 0, $user->rights->stock->inventory_advance->read, '', $mainmenu, 'stock');
$newmenu->add("/product/inventory/card.php?action=create", $langs->trans("NewInventory"), 1, $user->rights->stock->inventory_advance->write);
$newmenu->add("/product/inventory/list.php", $langs->trans("List"), 1, $user->rights->stock->inventory_advance->read);
}
}
}

View File

@ -122,31 +122,31 @@ class modStock extends DolibarrModules
$this->rights[5][0] = 1011;
$this->rights[5][1] = 'inventoryReadPermission'; // Permission label
$this->rights[5][3] = 0; // Permission by default for new user (0/1)
$this->rights[5][4] = 'advance_inventory'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
$this->rights[5][4] = 'inventory_advance'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
$this->rights[5][5] = 'read'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
$this->rights[6][0] = 1012;
$this->rights[6][1] = 'inventoryCreatePermission'; // Permission label
$this->rights[6][3] = 0; // Permission by default for new user (0/1)
$this->rights[6][4] = 'advance_inventory'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
$this->rights[6][4] = 'inventory_advance'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
$this->rights[6][5] = 'create'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
$this->rights[7][0] = 1013;
$this->rights[7][1] = 'inventoryWritePermission'; // Permission label
$this->rights[7][3] = 0; // Permission by default for new user (0/1)
$this->rights[7][4] = 'advance_inventory'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
$this->rights[7][4] = 'inventory_advance'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
$this->rights[7][5] = 'write'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
$this->rights[8][0] = 1014;
$this->rights[8][1] = 'inventoryValidatePermission'; // Permission label
$this->rights[8][3] = 0; // Permission by default for new user (0/1)
$this->rights[8][4] = 'advance_inventory'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
$this->rights[8][4] = 'inventory_advance'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
$this->rights[8][5] = 'validate'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
$this->rights[9][0] = 1015;
$this->rights[9][1] = 'inventoryChangePMPPermission'; // Permission label
$this->rights[9][3] = 0; // Permission by default for new user (0/1)
$this->rights[9][4] = 'advance_inventory'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
$this->rights[9][4] = 'inventory_advance'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
$this->rights[9][5] = 'changePMP'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
}

View File

@ -369,8 +369,8 @@ class Fichinter extends CommonObject
$this->statut = $obj->fk_statut;
$this->duration = $obj->duree;
$this->datec = $this->db->jdate($obj->datec);
$this->datee = $this->db->jdate($obj->dateo);
$this->dateo = $this->db->jdate($obj->datee);
$this->dateo = $this->db->jdate($obj->dateo);
$this->datee = $this->db->jdate($obj->datee);
$this->datet = $this->db->jdate($obj->datet);
$this->datev = $this->db->jdate($obj->datev);
$this->datem = $this->db->jdate($obj->datem);

View File

@ -31,7 +31,7 @@
*/
if (! defined('DOL_APPLICATION_TITLE')) define('DOL_APPLICATION_TITLE','Dolibarr');
if (! defined('DOL_VERSION')) define('DOL_VERSION','7.0.2'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c
if (! defined('DOL_VERSION')) define('DOL_VERSION','7.0.3'); // 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

@ -1402,6 +1402,11 @@ class FactureFournisseur extends CommonInvoice
if (empty($txlocaltax1)) $txlocaltax1=0;
if (empty($txlocaltax2)) $txlocaltax2=0;
if ($rang < 0) {
$rangmax = $this->line_max();
$rang = $rangmax + 1;
}
$localtaxes_type=getLocalTaxesFromRate($txtva, 0, $mysoc, $this->thirdparty);
// Clean vat code

View File

@ -1072,8 +1072,6 @@ if (empty($reshook))
$fk_parent_line = 0;
$num = count($lines);
$productsupplier = new ProductFournisseur($db);
for($i = 0; $i < $num; $i ++)
{
@ -1081,7 +1079,7 @@ if (empty($reshook))
continue;
$label = (! empty($lines[$i]->label) ? $lines[$i]->label : '');
$desc = (! empty($lines[$i]->desc) ? $lines[$i]->desc : $lines[$i]->libelle);
$desc = (! empty($lines[$i]->desc) ? $lines[$i]->desc : $lines[$i]->product_desc);
$product_type = (! empty($lines[$i]->product_type) ? $lines[$i]->product_type : 0);
// Reset fk_parent_line for no child products and special product
@ -1097,43 +1095,57 @@ if (empty($reshook))
$array_option = $lines[$i]->array_options;
}
$result = $productsupplier->find_min_price_product_fournisseur($lines[$i]->fk_product, $lines[$i]->qty, $srcobject->socid);
if ($result>=0)
$ref_supplier = '';
$product_fourn_price_id = 0;
if ($origin == "commande")
{
$tva_tx = $lines[$i]->tva_tx;
if ($origin=="commande")
$productsupplier = new ProductFournisseur($db);
$result = $productsupplier->find_min_price_product_fournisseur($lines[$i]->fk_product, $lines[$i]->qty, $srcobject->socid);
if ($result > 0)
{
$soc=new societe($db);
$soc->fetch($socid);
$tva_tx=get_default_tva($soc, $mysoc, $lines[$i]->fk_product, $productsupplier->product_fourn_price_id);
$ref_supplier = $productsupplier->ref_supplier;
$product_fourn_price_id = $productsupplier->product_fourn_price_id;
}
$result = $object->addline(
$desc,
$lines[$i]->subprice,
$lines[$i]->qty,
$tva_tx,
$lines[$i]->localtax1_tx,
$lines[$i]->localtax2_tx,
$lines[$i]->fk_product > 0 ? $lines[$i]->fk_product : 0,
$productsupplier->product_fourn_price_id,
$productsupplier->ref_supplier,
$lines[$i]->remise_percent,
'HT',
0,
$lines[$i]->product_type,
'',
'',
null,
null,
array(),
$lines[$i]->fk_unit,
0,
$element,
!empty($lines[$i]->id) ? $lines[$i]->id : $lines[$i]->rowid
);
}
else
{
$ref_supplier = $lines[$i]->ref_fourn;
$product_fourn_price_id = 0;
}
$tva_tx = $lines[$i]->tva_tx;
if ($origin=="commande")
{
$soc=new societe($db);
$soc->fetch($socid);
$tva_tx=get_default_tva($soc, $mysoc, $lines[$i]->fk_product, $product_fourn_price_id);
}
$result = $object->addline(
$desc,
$lines[$i]->subprice,
$lines[$i]->qty,
$tva_tx,
$lines[$i]->localtax1_tx,
$lines[$i]->localtax2_tx,
$lines[$i]->fk_product > 0 ? $lines[$i]->fk_product : 0,
$product_fourn_price_id,
$ref_supplier,
$lines[$i]->remise_percent,
'HT',
0,
$lines[$i]->product_type,
'',
'',
null,
null,
array(),
$lines[$i]->fk_unit,
0,
$element,
!empty($lines[$i]->id) ? $lines[$i]->id : $lines[$i]->rowid
);
if ($result < 0) {
$error++;

View File

@ -779,25 +779,27 @@ class Holiday extends CommonObject
/**
* Check a user is not on holiday for a particular timestamp
* Check that a user is not on holiday for a particular timestamp
*
* @param int $fk_user Id user
* @param timestamp $timestamp Time stamp date for a day (YYYY-MM-DD) without hours (= 12:00AM in english and not 12:00PM that is 12:00)
* @param string $status Filter on holiday status. '-1' = no filter.
* @return array array('morning'=> ,'afternoon'=> ), Boolean is true if user is available for day timestamp.
* @see verifDateHolidayCP
*/
function verifDateHolidayForTimestamp($fk_user, $timestamp)
function verifDateHolidayForTimestamp($fk_user, $timestamp, $status='-1')
{
global $langs, $conf;
$isavailablemorning=true;
$isavailableafternoon=true;
$sql = "SELECT cp.rowid, cp.date_debut as date_start, cp.date_fin as date_end, cp.halfday";
$sql = "SELECT cp.rowid, cp.date_debut as date_start, cp.date_fin as date_end, cp.halfday, cp.statut";
$sql.= " FROM ".MAIN_DB_PREFIX."holiday as cp";
$sql.= " WHERE cp.entity IN (".getEntity('holiday').")";
$sql.= " AND cp.fk_user = ".(int) $fk_user;
$sql.= " AND date_debut <= '".$this->db->idate($timestamp)."' AND date_fin >= '".$this->db->idate($timestamp)."'";
$sql.= " AND cp.date_debut <= '".$this->db->idate($timestamp)."' AND cp.date_fin >= '".$this->db->idate($timestamp)."'";
if ($status != '-1') $sql.=" AND cp.statut IN (".$this->db->escape($status).")";
$resql = $this->db->query($sql);
if ($resql)

View File

@ -577,21 +577,21 @@ ALTER TABLE llx_c_email_senderprofile ADD UNIQUE INDEX uk_c_email_senderprofile(
-- Add new chart of account entries
INSERT INTO llx_accounting_system (fk_country, pcg_version, label, active) VALUES ( 67,'PC-MIPYME', 'The PYME accountancy Chile plan', 1);
INSERT INTO llx_accounting_system (fk_country, pcg_version, label, active) VALUES ( 7,'ENG-BASE', 'England plan', 1);
INSERT INTO llx_accounting_system (fk_country, pcg_version, label, active) VALUES ( 49,'SYSCOHADA', 'Plan comptable Ouest-Africain', 1);
INSERT INTO llx_accounting_system (fk_country, pcg_version, label, active) VALUES ( 60,'SYSCOHADA', 'Plan comptable Ouest-Africain', 1);
INSERT INTO llx_accounting_system (fk_country, pcg_version, label, active) VALUES ( 24,'SYSCOHADA', 'Plan comptable Ouest-Africain', 1);
INSERT INTO llx_accounting_system (fk_country, pcg_version, label, active) VALUES ( 65,'SYSCOHADA', 'Plan comptable Ouest-Africain', 1);
INSERT INTO llx_accounting_system (fk_country, pcg_version, label, active) VALUES ( 71,'SYSCOHADA', 'Plan comptable Ouest-Africain', 1);
INSERT INTO llx_accounting_system (fk_country, pcg_version, label, active) VALUES ( 72,'SYSCOHADA', 'Plan comptable Ouest-Africain', 1);
INSERT INTO llx_accounting_system (fk_country, pcg_version, label, active) VALUES ( 21,'SYSCOHADA', 'Plan comptable Ouest-Africain', 1);
INSERT INTO llx_accounting_system (fk_country, pcg_version, label, active) VALUES ( 16,'SYSCOHADA', 'Plan comptable Ouest-Africain', 1);
INSERT INTO llx_accounting_system (fk_country, pcg_version, label, active) VALUES ( 87,'SYSCOHADA', 'Plan comptable Ouest-Africain', 1);
INSERT INTO llx_accounting_system (fk_country, pcg_version, label, active) VALUES (147,'SYSCOHADA', 'Plan comptable Ouest-Africain', 1);
INSERT INTO llx_accounting_system (fk_country, pcg_version, label, active) VALUES (168,'SYSCOHADA', 'Plan comptable Ouest-Africain', 1);
INSERT INTO llx_accounting_system (fk_country, pcg_version, label, active) VALUES ( 73,'SYSCOHADA', 'Plan comptable Ouest-Africain', 1);
INSERT INTO llx_accounting_system (fk_country, pcg_version, label, active) VALUES ( 22,'SYSCOHADA', 'Plan comptable Ouest-Africain', 1);
INSERT INTO llx_accounting_system (fk_country, pcg_version, label, active) VALUES ( 66,'SYSCOHADA', 'Plan comptable Ouest-Africain', 1);
INSERT INTO llx_accounting_system (fk_country, pcg_version, label, active) VALUES ( 15,'SYSCOHADA', 'Plan comptable Ouest-Africain', 1);
INSERT INTO llx_accounting_system (fk_country, pcg_version, label, active) VALUES ( 49,'SYSCOHADA-BJ', 'Plan comptable Ouest-Africain', 1);
INSERT INTO llx_accounting_system (fk_country, pcg_version, label, active) VALUES ( 60,'SYSCOHADA-BF', 'Plan comptable Ouest-Africain', 1);
INSERT INTO llx_accounting_system (fk_country, pcg_version, label, active) VALUES ( 24,'SYSCOHADA-CM', 'Plan comptable Ouest-Africain', 1);
INSERT INTO llx_accounting_system (fk_country, pcg_version, label, active) VALUES ( 65,'SYSCOHADA-CF', 'Plan comptable Ouest-Africain', 1);
INSERT INTO llx_accounting_system (fk_country, pcg_version, label, active) VALUES ( 71,'SYSCOHADA-KM', 'Plan comptable Ouest-Africain', 1);
INSERT INTO llx_accounting_system (fk_country, pcg_version, label, active) VALUES ( 72,'SYSCOHADA-CG', 'Plan comptable Ouest-Africain', 1);
INSERT INTO llx_accounting_system (fk_country, pcg_version, label, active) VALUES ( 21,'SYSCOHADA-CI', 'Plan comptable Ouest-Africain', 1);
INSERT INTO llx_accounting_system (fk_country, pcg_version, label, active) VALUES ( 16,'SYSCOHADA-GA', 'Plan comptable Ouest-Africain', 1);
INSERT INTO llx_accounting_system (fk_country, pcg_version, label, active) VALUES ( 87,'SYSCOHADA-GQ', 'Plan comptable Ouest-Africain', 1);
INSERT INTO llx_accounting_system (fk_country, pcg_version, label, active) VALUES (147,'SYSCOHADA-ML', 'Plan comptable Ouest-Africain', 1);
INSERT INTO llx_accounting_system (fk_country, pcg_version, label, active) VALUES (168,'SYSCOHADA-NE', 'Plan comptable Ouest-Africain', 1);
INSERT INTO llx_accounting_system (fk_country, pcg_version, label, active) VALUES ( 73,'SYSCOHADA-CD', 'Plan comptable Ouest-Africain', 1);
INSERT INTO llx_accounting_system (fk_country, pcg_version, label, active) VALUES ( 22,'SYSCOHADA-SN', 'Plan comptable Ouest-Africain', 1);
INSERT INTO llx_accounting_system (fk_country, pcg_version, label, active) VALUES ( 66,'SYSCOHADA-TD', 'Plan comptable Ouest-Africain', 1);
INSERT INTO llx_accounting_system (fk_country, pcg_version, label, active) VALUES ( 15,'SYSCOHADA-TG', 'Plan comptable Ouest-Africain', 1);
-- Update old chart of account entries

View File

@ -1,12 +0,0 @@
<?xml version="1.0"?>
<ruleset name="Dolibarr (PSR2)">
<description>The PSR2 standard with Dolibarr quirks.</description>
<!-- Include the whole PSR2 standard -->
<rule ref="PSR2">
<!-- Code can be indented with tabs -->
<exclude name="Generic.WhiteSpace.DisallowTabIndent" />
<!-- Dolibarr don't support namespacing (yet) -->
<exclude name="PSR1.Classes.ClassDeclaration.MissingNamespace" />
</rule>
</ruleset>

View File

@ -1,15 +0,0 @@
# Git hooks
Optional [GIT hooks](https://git-scm.com/book/it/v2/Customizing-Git-Git-Hooks) are provided.
These are just wrappers calling composer scripts.
They ensure best practices are followed during module development.
Install:
```sh
composer git_hooks_install
```
Remove:
```sh
composer git_hooks_remove
```

View File

@ -1,2 +0,0 @@
#!/bin/sh
composer git_post_commit

View File

@ -1,2 +0,0 @@
#!/bin/sh
composer git_pre_commit

View File

@ -1,2 +0,0 @@
#!/bin/sh
composer git_pre_push

View File

@ -1,53 +0,0 @@
Source images
=============
Used to generate icons and publication assets.
Icons
-----
### Dolibarr
These resides in the [/img](../../img) directory.
#### Small
Required.
Name must begin by ```object_```.
- Sample: ![object_mymodule.png](../../img/object_mymodule.png) [object_mymodule.png](../../img/object_mymodule.png)
- Size: 14×14 pixels
- Type: PNG
#### Large
Optional.
- Sample: ![mymodule.png](../../img/mymodule.png) [mymodule.png](../../img/mymodule.png)
- Size: 32×32 pixels
- Type: PNG
### Dolistore
Designed to fit a 512×512 icon + publisher branding.
- Size: 704×704
- Type: PNG
Export to 512×512
### Transifex
- Size: 96×96
- Type: PNG
### Others
To be on the safe side, you may also want to generate all popular sizes:
- 16×16
- 32×32
- 48×48
- 64×64
- 128×128
- 256×256
- 512×512

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

View File

@ -1,110 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="110.72372"
height="37.900333"
id="svg3330"
version="1.1"
inkscape:version="0.48.0 r9654"
sodipodi:docname="New document 4">
<defs
id="defs3332" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="3.959798"
inkscape:cx="51.755214"
inkscape:cy="19.316583"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0"
inkscape:window-width="1680"
inkscape:window-height="950"
inkscape:window-x="0"
inkscape:window-y="27"
inkscape:window-maximized="1" />
<metadata
id="metadata3335">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-319.64995,-513.41138)">
<g
id="g5424"
transform="matrix(1.1204236,0,0,1.1204236,378.23897,-788.71491)">
<path
sodipodi:nodetypes="cccccc"
inkscape:connector-curvature="0"
id="rect6744"
d="m -51.39745,1163.0948 85,0 0,29.5252 -85,0 2,-14.7626 z"
style="fill:#f5efbc;fill-opacity:1;stroke:#000000;stroke-width:1.79999995;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dashoffset:0" />
<text
transform="scale(0.90245956,1.1080829)"
sodipodi:linespacing="125%"
id="text6752-6"
y="1071.2108"
x="-15.68348"
style="font-size:24.31293869px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Ubuntu;-inkscape-font-specification:Ubuntu Bold"
xml:space="preserve"><tspan
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:URW Palladio L;-inkscape-font-specification:URW Palladio L Bold"
y="1071.2108"
x="-15.68348"
id="tspan6754-4"
sodipodi:role="line">GFDL</tspan></text>
<path
inkscape:connector-curvature="0"
id="path7064-6"
d="m 19.61576,1166.8577 0,24 0.1875,0 c -0.12127,0.1989 -0.1875,0.4164 -0.1875,0.625 0,2.002 5.8203,3.625 13,3.625 7.1797,0 13,-1.623 13,-3.625 0,-0.2086 -0.0662,-0.4261 -0.1875,-0.625 l 0.1875,0 0,-24 -26,0 z"
style="color:#000000;fill:#f5efbc;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:1.79999995;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
<path
transform="translate(-321.63424,901.70446)"
d="m 367.25,264.98718 c 0,2.00203 -5.8203,3.625 -13,3.625 -7.1797,0 -13,-1.62297 -13,-3.625 0,-2.00203 5.8203,-3.625 13,-3.625 7.1797,0 13,1.62297 13,3.625 z"
sodipodi:ry="3.625"
sodipodi:rx="13"
sodipodi:cy="264.98718"
sodipodi:cx="354.25"
id="path7064"
style="color:#000000;fill:#f5efbc;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:1.79999995;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
sodipodi:type="arc" />
<path
sodipodi:nodetypes="cccccc"
inkscape:connector-curvature="0"
id="path7104"
d="m 45.06778,1167.3815 c -2.44864,5.5993 -9.9067,7.192 -21.52831,5.7955 l 5.7779,9.7599 -6.02275,7.2171 c 7.75095,3.1192 17.18643,1.5723 22.07112,-0.1842 z"
style="fill:#2e439b;fill-opacity:1;stroke:#000000;stroke-width:1.39999986;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
<path
sodipodi:nodetypes="ccscc"
inkscape:connector-curvature="0"
id="path7106"
d="m 34.45935,1165.7653 c -3.4695,-0.1017 -8.01646,0.018 -10.47747,0.7778 1.2102,0.9782 6.11198,1.5627 9.94714,1.2348 3.20297,-0.2738 6.08198,-0.1311 7.93857,-1.1503 -0.70667,-1.1077 -3.93837,-3.3774 -7.91865,-3.2613"
style="fill:none;stroke:#000000;stroke-width:1.39999998;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 5.2 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

View File

@ -1,70 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="14"
height="14"
id="svg2"
version="1.1"
inkscape:version="0.48.3.1 r9886"
sodipodi:docname="object_mymodule.svg"
inkscape:export-filename="/home/raph/Travail/src/zenfusion-modules/img/object_mymodule.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90">
<defs
id="defs4" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="3.959798"
inkscape:cx="24.310822"
inkscape:cy="18.155032"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:window-width="1920"
inkscape:window-height="1021"
inkscape:window-x="1080"
inkscape:window-y="867"
inkscape:window-maximized="1" />
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Calque 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(0,-1038.3622)">
<text
xml:space="preserve"
style="font-size:12.99629784px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:DejaVu Serif;-inkscape-font-specification:DejaVu Serif"
x="0.35272363"
y="1050.0994"
id="text2985"
sodipodi:linespacing="125%"><tspan
sodipodi:role="line"
id="tspan2987"
x="0.35272363"
y="1050.0994">M</tspan></text>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 2.2 KiB

View File

@ -112,7 +112,7 @@ if (empty($reshook))
{
$error=0;
$permissiontoadd = $user->rights->mymodule->create;
$permissiontoadd = $user->rights->mymodule->write;
$permissiontodelete = $user->rights->mymodule->delete;
$backurlforlist = dol_buildpath('/mymodule/myobject_list.php',1);

View File

@ -289,7 +289,7 @@ class Products extends DolibarrApi
}
if ($result < 0) {
throw new RestException(503, 'Error when retrieve category list : '.$categories->error);
throw new RestException(503, 'Error when retrieve category list : '.array_merge(array($categories->error), $categories->errors));
}
return $result;
@ -323,7 +323,7 @@ class Products extends DolibarrApi
}
if ($result < 0) {
throw new RestException(503, 'Error when retrieve prices list : '.$categories->error);
throw new RestException(503, 'Error when retrieve prices list : '.array_merge(array($this->product->error), $this->product->errors));
}
return array(
@ -365,7 +365,7 @@ class Products extends DolibarrApi
}
if ($result < 0) {
throw new RestException(503, 'Error when retrieve prices list : '.$categories->error);
throw new RestException(503, 'Error when retrieve prices list : '.array_merge(array($this->product->error), $this->product->errors));
}
throw new RestException(501, 'Feature not yet available');
@ -400,7 +400,7 @@ class Products extends DolibarrApi
}
if ($result < 0) {
throw new RestException(503, 'Error when retrieve prices list : '.$categories->error);
throw new RestException(503, 'Error when retrieve prices list : '.array_merge(array($this->product->error), $this->product->errors));
}
return array(

View File

@ -1116,7 +1116,7 @@ class Product extends CommonObject
//If it is a parent product, then we remove the association with child products
$prodcomb = new ProductCombination($this->db);
if ($prodcomb->deleteByFkProductParent($id) < 0) {
if ($prodcomb->deleteByFkProductParent($user, $id) < 0) {
$error++;
$this->errors[] = 'Error deleting combinations';
}

View File

@ -42,7 +42,7 @@ if (empty($conf->global->MAIN_USE_ADVANCED_PERMS))
}
else
{
$result = restrictedArea($user, 'stock', $id, '', 'advance_inventory');
$result = restrictedArea($user, 'stock', $id, '', 'inventory_advance');
}
// Initialize technical objects
@ -82,8 +82,8 @@ if (empty($conf->global->MAIN_USE_ADVANCED_PERMS))
}
else
{
$permissiontoadd = $user->rights->stock->advance_inventory->create;
$permissiontodelete = $user->rights->stock->advance_inventory->write;
$permissiontoadd = $user->rights->stock->inventory_advance->create;
$permissiontodelete = $user->rights->stock->inventory_advance->write;
}

View File

@ -78,7 +78,7 @@ if (empty($conf->global->MAIN_USE_ADVANCED_PERMS))
}
else
{
$result = restrictedArea($user, 'stock', $objectid, '', 'advance_inventory');
$result = restrictedArea($user, 'stock', $objectid, '', 'inventory_advance');
}
// Initialize array of search criterias

View File

@ -152,7 +152,7 @@ if (empty($reshook))
$db->begin();
$resql = $object->update($object->id, $user);
if (! $resql)
if (! $resql || $resql < 0)
{
$error++;
setEventMessages($object->error, $object->errors, 'errors');

View File

@ -49,7 +49,8 @@ $projectid=isset($_GET["id"])?$_GET["id"]:$_POST["projectid"];
// Security check
$socid=0;
if ($user->societe_id > 0) $socid=$user->societe_id;
// For external user, no check is done on company because readability is managed by public status of project and assignement.
//if ($user->societe_id > 0) $socid=$user->societe_id;
$result = restrictedArea($user, 'projet', $projectid);
$now=dol_now();
@ -496,7 +497,8 @@ $restrictviewformytask=(empty($conf->global->PROJECT_TIME_SHOW_TASK_NOT_ASSIGNED
$holiday = new Holiday($db);
$isavailable=array();
$isavailablefordayanduser = $holiday->verifDateHolidayForTimestamp($usertoprocess->id, $daytoparse); // $daytoparse is a date with hours = 0
$statusofholidaytocheck = '3';
$isavailablefordayanduser = $holiday->verifDateHolidayForTimestamp($usertoprocess->id, $daytoparse, $statusofholiday); // $daytoparse is a date with hours = 0
$isavailable[$daytoparse]=$isavailablefordayanduser; // in projectLinesPerWeek later, we are using $firstdaytoshow and dol_time_plus_duree to loop on each day
if (count($tasksarray) > 0)

View File

@ -49,7 +49,8 @@ $projectid=isset($_GET["id"])?$_GET["id"]:$_POST["projectid"];
// Security check
$socid=0;
if ($user->societe_id > 0) $socid=$user->societe_id;
// For external user, no check is done on company because readability is managed by public status of project and assignement.
// if ($user->societe_id > 0) $socid=$user->societe_id;
$result = restrictedArea($user, 'projet', $projectid);
$now=dol_now();
@ -503,7 +504,8 @@ for ($i=0;$i<7;$i++)
//print dol_print_date($dayinloopwithouthours, 'dayhour').' ';
//print dol_print_date($dayinloopfromfirstdaytoshow, 'dayhour').'<br>';
$isavailablefordayanduser = $holiday->verifDateHolidayForTimestamp($usertoprocess->id, $dayinloopfromfirstdaytoshow);
$statusofholidaytocheck = '3';
$isavailablefordayanduser = $holiday->verifDateHolidayForTimestamp($usertoprocess->id, $dayinloopfromfirstdaytoshow, $statusofholidaytocheck);
$isavailable[$dayinloopfromfirstdaytoshow]=$isavailablefordayanduser; // in projectLinesPerWeek later, we are using $firstdaytoshow and dol_time_plus_duree to loop on each day
print '<td width="6%" align="center" class="hide'.$i.'">'.dol_print_date($dayinloopfromfirstdaytoshow, '%a').'<br>'.dol_print_date($dayinloopfromfirstdaytoshow, 'dayreduceformat').'</td>';
}

View File

@ -1703,23 +1703,26 @@ class Project extends CommonObject
{
global $conf, $langs;
$mine=0; $socid=$user->societe_id;
$projectsListId = $this->getProjectsAuthorizedForUser($user,$mine?$mine:($user->rights->projet->all->lire?2:0),1,$socid);
// For external user, no check is done on company because readability is managed by public status of project and assignement.
//$socid=$user->societe_id;
if (! $user->rights->projet->all->lire) $projectsListId = $this->getProjectsAuthorizedForUser($user,0,1,$socid);
$sql = "SELECT p.rowid, p.fk_statut as status, p.fk_opp_status, p.datee as datee";
$sql.= " FROM (".MAIN_DB_PREFIX."projet as p";
$sql.= ")";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on p.fk_soc = s.rowid";
if (! $user->rights->societe->client->voir && ! $socid) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON sc.fk_soc = s.rowid";
// For external user, no check is done on company permission because readability is managed by public status of project and assignement.
//if (! $user->rights->societe->client->voir && ! $socid) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON sc.fk_soc = s.rowid";
$sql.= " WHERE p.fk_statut = 1";
$sql.= " AND p.entity IN (".getEntity('project', 0).')';
if ($mine || ! $user->rights->projet->all->lire) $sql.= " AND p.rowid IN (".$projectsListId.")";
if (! $user->rights->projet->all->lire) $sql.= " AND p.rowid IN (".$projectsListId.")";
// No need to check company, as filtering of projects must be done by getProjectsAuthorizedForUser
//if ($socid || ! $user->rights->societe->client->voir) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")";
if ($socid) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")";
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND ((s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id.") OR (s.rowid IS NULL))";
// For external user, no check is done on company permission because readability is managed by public status of project and assignement.
//if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND ((s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id.") OR (s.rowid IS NULL))";
//print $sql;
$resql=$this->db->query($sql);
if ($resql)
{

View File

@ -1829,28 +1829,31 @@ class Task extends CommonObject
{
global $conf, $langs;
$mine=0; $socid=$user->societe_id;
// For external user, no check is done on company because readability is managed by public status of project and assignement.
//$socid=$user->societe_id;
$projectstatic = new Project($this->db);
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,$mine,1,$socid);
$projectsListId = $projectstatic->getProjectsAuthorizedForUser($user,0,1,$socid);
// List of tasks (does not care about permissions. Filtering will be done later)
$sql = "SELECT p.rowid as projectid, p.fk_statut as projectstatus,";
$sql.= " t.rowid as taskid, t.progress as progress, t.fk_statut as status,";
$sql.= " t.dateo as date_start, t.datee as datee";
$sql.= " FROM ".MAIN_DB_PREFIX."projet as p";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on p.fk_soc = s.rowid";
if (! $user->rights->societe->client->voir && ! $socid) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON sc.fk_soc = s.rowid";
//if (! $user->rights->societe->client->voir && ! $socid) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON sc.fk_soc = s.rowid";
$sql.= ", ".MAIN_DB_PREFIX."projet_task as t";
$sql.= " WHERE p.entity IN (".getEntity('project', 0).')';
$sql.= " AND p.fk_statut = 1";
$sql.= " AND t.fk_projet = p.rowid";
$sql.= " AND t.progress < 100"; // tasks to do
if ($mine || ! $user->rights->projet->all->lire) $sql.= " AND p.rowid IN (".$projectsListId.")";
if (! $user->rights->projet->all->lire) $sql.= " AND p.rowid IN (".$projectsListId.")";
// No need to check company, as filtering of projects must be done by getProjectsAuthorizedForUser
//if ($socid || ! $user->rights->societe->client->voir) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")";
if ($socid) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")";
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND ((s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id.") OR (s.rowid IS NULL))";
// No need to check company, as filtering of projects must be done by getProjectsAuthorizedForUser
// if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND ((s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id.") OR (s.rowid IS NULL))";
//print $sql;
$resql=$this->db->query($sql);
if ($resql)

View File

@ -49,6 +49,7 @@ $socid=0;
//if ($user->societe_id > 0) $socid = $user->societe_id; // For external user, no check is done on company because readability is managed by public status of project and assignement.
$result = restrictedArea($user, 'projet', $id,'projet&project');
$hookmanager->initHooks(array('projectcontactcard','globalcard'));
/*
* Actions

View File

@ -146,7 +146,7 @@ $morehtmlref.='</div>';
if (! $user->rights->projet->all->lire)
{
$objectsListId = $object->getProjectsAuthorizedForUser($user,0,0);
$object->next_prev_filter=" rowid in (".(count($objectsListId)?join(',',array_keys($objectsListId)):'0').")";
$object->next_prev_filter=" te.rowid in (".(count($objectsListId)?join(',',array_keys($objectsListId)):'0').")";
}
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);

View File

@ -290,7 +290,10 @@ if ( $resql )
print $langs->trans("OthersNotLinkedToThirdParty");
}
print '</td>';
print '<td align="right"><a href="'.DOL_URL_ROOT.'/projet/list.php?socid='.$obj->socid.'&search_status=1">'.$obj->nb.'</a></td>';
print '<td align="right">';
if ($obj->socid) print '<a href="'.DOL_URL_ROOT.'/projet/list.php?socid='.$obj->socid.'&search_status=1">'.$obj->nb.'</a>';
else print '<a href="'.DOL_URL_ROOT.'/projet/list.php?search_societe='.urlencode('^$').'&search_status=1">'.$obj->nb.'</a>';
print '</td>';
print "</tr>\n";
$i++;

View File

@ -303,6 +303,7 @@ if ($id > 0 || ! empty($ref))
// Project
if (empty($withproject))
{
$result=$projectstatic->fetch($object->fk_project);
$morehtmlref.='<div class="refidno">';
$morehtmlref.=$langs->trans("Project").': ';
$morehtmlref.=$projectstatic->getNomUrl(1);
@ -310,7 +311,11 @@ if ($id > 0 || ! empty($ref))
// Third party
$morehtmlref.=$langs->trans("ThirdParty").': ';
$morehtmlref.=$projectstatic->thirdparty->getNomUrl(1);
if($projectstatic->socid>0) {
$projectstatic->fetch_thirdparty();
$morehtmlref.=$projectstatic->thirdparty->getNomUrl(1);
}
$morehtmlref.='</div>';
}

View File

@ -714,7 +714,7 @@ while ($i < min($num,$limit))
$showlineingray=0;$showproject=1;
print '<td class="center">';
if ($showlineingray) print '<i>';
else print '<a href="'.DOL_URL_ROOT.'/projet/tasks/time.php?id='.$lines[$i]->id.($showproject?'':'&withproject=1').'">';
else print '<a href="'.DOL_URL_ROOT.'/projet/tasks/time.php?id='.$object->id.($showproject?'':'&withproject=1').'">';
if ($obj->duration_effective) print convertSecondToTime($obj->duration_effective,$timespentoutputformat);
else print '--:--';
if ($showlineingray) print '</i>';

View File

@ -568,7 +568,8 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
$contactsoftask=$object->getListContactId('internal');
if (count($contactsoftask)>0)
{
$userid=$contactsoftask[0];
if(in_array($user->id, $contactsoftask)) $userid = $user->id;
else $userid=$contactsoftask[0];
print $form->select_dolusers((GETPOST('userid')?GETPOST('userid'):$userid), 'userid', 0, '', 0, '', $contactsoftask, 0, 0, 0, '', 0, $langs->trans("ResourceNotAssignedToTheTask"), 'maxwidth200');
}
else

View File

@ -60,7 +60,7 @@ $mesg=''; $error=0; $errors=array();
$action = (GETPOST('action','aZ09') ? GETPOST('action','aZ09') : 'view');
$cancel = GETPOST('cancel','alpha');
$backtopage = GETPOST('backtopage','alpha');
$confirm = GETPOST('confirm');
$confirm = GETPOST('confirm','alpha');
$socid = GETPOST('socid','int')?GETPOST('socid','int'):GETPOST('id','int');
if ($user->societe_id) $socid=$user->societe_id;
@ -181,12 +181,12 @@ if (empty($reshook))
// Merge categories
$static_cat = new Categorie($db);
$custcats_ori = $static_cat->containing($soc_origin->id, 'customer', 'id');
$custcats = $static_cat->containing($object->id, 'customer', 'id');
$custcats = array_merge($custcats,$custcats_ori);
$object->setCategories($custcats, 'customer');
$suppcats_ori = $static_cat->containing($soc_origin->id, 'supplier', 'id');
$suppcats = $static_cat->containing($object->id, 'supplier', 'id');
$suppcats = array_merge($suppcats,$suppcats_ori);
@ -1885,7 +1885,9 @@ else
// Capital
print '<tr><td>'.fieldLabel('Capital','capital').'</td>';
print '<td colspan="3"><input type="text" name="capital" id="capital" size="10" value="'.$object->capital.'"> <font class="hideonsmartphone">'.$langs->trans("Currency".$conf->currency).'</font></td></tr>';
print '<td colspan="3"><input type="text" name="capital" id="capital" size="10" value="';
print dol_escape_htmltag(price($object->capital));
print '"> <font class="hideonsmartphone">'.$langs->trans("Currency".$conf->currency).'</font></td></tr>';
// Default language
if (! empty($conf->global->MAIN_MULTILANGS))

View File

@ -67,6 +67,7 @@ $action = GETPOST('action', 'alpha');
$origin = GETPOST('origin', 'alpha');
$originid = GETPOST('originid', 'int');
$confirm = GETPOST('confirm', 'alpha');
$projectid = GETPOST('projectid', 'int');
$lineid = GETPOST('lineid', 'int');
$contactid = GETPOST('contactid','int');
@ -265,7 +266,7 @@ if (empty($reshook))
$object->remise_percent = GETPOST('remise_percent');
$object->remise_absolue = GETPOST('remise_absolue');
$object->socid = GETPOST('socid');
$object->fk_project = GETPOST('projectid');
$object->fk_project = GETPOST('projectid','int');
$object->modelpdf = GETPOST('model');
$object->author = $user->id; // deprecated
$object->note = GETPOST('note','none');
@ -283,7 +284,7 @@ if (empty($reshook))
$object->cond_reglement_id = GETPOST('cond_reglement_id');
$object->mode_reglement_id = GETPOST('mode_reglement_id');
$object->fk_account = GETPOST('fk_account', 'int');
$object->fk_project = GETPOST('projectid');
$object->fk_project = GETPOST('projectid','int');
$object->modelpdf = GETPOST('model');
$object->author = $user->id; // deprecated
$object->note = GETPOST('note','none');
@ -890,7 +891,7 @@ if (empty($reshook))
// Set project
else if ($action == 'classin' && $user->rights->supplier_proposal->creer) {
$object->setProject($_POST['projectid']);
$object->setProject(GETPOST('projectid'),'int');
}
// Delai de livraison
@ -1103,9 +1104,7 @@ if ($action == 'create')
$formproject = new FormProjets($db);
$projectid = 0;
if ($origin == 'project')
$projectid = ($originid ? $originid : 0);
if ($origin == 'project') $projectid = ($originid ? $originid : 0);
print '<tr>';
print '<td>' . $langs->trans("Project") . '</td><td colspan="2">';

View File

@ -275,10 +275,11 @@ class ProductCombination
/**
* Deletes all product combinations of a parent product
*
* @param int $fk_product_parent Rowid of parent product
* @param User $user Object user
* @param int $fk_product_parent Rowid of parent product
* @return int <0 KO >0 OK
*/
public function deleteByFkProductParent($fk_product_parent)
public function deleteByFkProductParent($user, $fk_product_parent)
{
$this->db->begin();
@ -289,11 +290,11 @@ class ProductCombination
$res = $prodstatic->fetch($prodcomb->fk_product_child);
if ($res > 0) {
$res = $prodcomb->delete();
$res = $prodcomb->delete($user);
}
if ($res > 0 && !$prodstatic->isObjectUsed($prodstatic->id)) {
$res = $prodstatic->delete();
$res = $prodstatic->delete($user);
}
if ($res < 0) {

View File

@ -95,7 +95,7 @@ if ($_POST) {
$delete_prev_comb_res = 1;
if (!$donotremove) {
$delete_prev_comb_res = $combination->deleteByFkProductParent($id);
$delete_prev_comb_res = $combination->deleteByFkProductParent($user, $id);
}
//Current combinations will be deleted

View File

@ -0,0 +1,225 @@
<?php
/* Copyright (C) 2018 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* or see http://www.gnu.org/
*/
/**
* \file test/phpunit/AccountingAccount.php
* \ingroup test
* \brief PHPUnit test
* \remarks To run this script as CLI: phpunit filename.php
*/
global $conf,$user,$langs,$db;
//define('TEST_DB_FORCE_TYPE','mysql'); // This is to force using mysql driver
//require_once 'PHPUnit/Autoload.php';
require_once dirname(__FILE__).'/../../htdocs/master.inc.php';
require_once dirname(__FILE__).'/../../htdocs/accountancy/class/accountingaccount.class.php';
if (empty($user->id)) {
print "Load permissions for admin user nb 1\n";
$user->fetch(1);
$user->getrights();
}
$conf->global->MAIN_DISABLE_ALL_MAILS=1;
/**
* Class for PHPUnit tests
*
* @backupGlobals disabled
* @backupStaticAttributes enabled
* @remarks backupGlobals must be disabled to have db,conf,user and lang not erased.
*/
class AccountingAccountTest extends PHPUnit_Framework_TestCase
{
protected $savconf;
protected $savuser;
protected $savlangs;
protected $savdb;
/**
* Constructor
* We save global variables into local variables
*
* @return AccountingAccountTest
*/
function __construct()
{
//$this->sharedFixture
global $conf,$user,$langs,$db;
$this->savconf=$conf;
$this->savuser=$user;
$this->savlangs=$langs;
$this->savdb=$db;
print __METHOD__." db->type=".$db->type." user->id=".$user->id;
//print " - db ".$db->db;
print "\n";
}
// Static methods
public static function setUpBeforeClass()
{
global $conf,$user,$langs,$db;
$db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
if (empty($conf->accounting->enabled)) { print __METHOD__." module accouting must be enabled.\n"; die(); }
print __METHOD__."\n";
}
// tear down after class
public static function tearDownAfterClass()
{
global $conf,$user,$langs,$db;
$db->rollback();
print __METHOD__."\n";
}
/**
* Init phpunit tests
*
* @return void
*/
protected function setUp()
{
global $conf,$user,$langs,$db;
$conf=$this->savconf;
$user=$this->savuser;
$langs=$this->savlangs;
$db=$this->savdb;
print __METHOD__."\n";
//print $db->getVersion()."\n";
}
/**
* End phpunit tests
*
* @return void
*/
protected function tearDown()
{
print __METHOD__."\n";
}
/**
* testAccountingAccountCreate
*
* @return void
*/
public function testAccountingAccountCreate()
{
global $conf,$user,$langs,$db;
$conf=$this->savconf;
$user=$this->savuser;
$langs=$this->savlangs;
$db=$this->savdb;
$localobject=new AccountingAccount($this->savdb);
$localobject->fk_pcg_version = 'PCG99-ABREGE';
$localobject->account_category = 0;
$localobject->pcg_type = 'XXXXX';
$localobject->pcg_subtype = 'XXXXX';
$localobject->account_parent = 0;
$localobject->label = 'Account specimen';
$localobject->active = 0;
$result=$localobject->create($user);
$this->assertLessThan($result, 0);
print __METHOD__." result=".$result."\n";
return $result;
}
/**
* testAccountingAccountFetch
*
* @param int $id Id order
* @return AccountingAccount
*
* @depends testAccountingAccountCreate
* The depends says test is run only if previous is ok
*/
public function testAccountingAccountFetch($id)
{
global $conf,$user,$langs,$db;
$conf=$this->savconf;
$user=$this->savuser;
$langs=$this->savlangs;
$db=$this->savdb;
$localobject=new AccountingAccount($this->savdb);
$result=$localobject->fetch($id);
$this->assertLessThan($result, 0);
print __METHOD__." id=".$id." result=".$result."\n";
return $localobject;
}
/**
* testAccountingAccountUpdate
*
* @param Object $localobject AccountingAccount
* @return AccountingAccount
*
* @depends testAccountingAccountFetch
* The depends says test is run only if previous is ok
*/
public function testAccountingAccountUpdate($localobject)
{
global $conf,$user,$langs,$db;
$conf=$this->savconf;
$user=$this->savuser;
$langs=$this->savlangs;
$db=$this->savdb;
$localobject->label='New label';
$result=$localobject->update($user);
$this->assertLessThan($result, 0);
print __METHOD__." id=".$id." result=".$result."\n";
return $localobject->id;
}
/**
* testAccountingAccountDelete
*
* @param int $id Id of order
* @return void
*
* @depends testAccountingAccountUpdate
* The depends says test is run only if previous is ok
*/
public function testAccountingAccountDelete($id)
{
global $conf,$user,$langs,$db;
$conf=$this->savconf;
$user=$this->savuser;
$langs=$this->savlangs;
$db=$this->savdb;
$localobject=new AccountingAccount($this->savdb);
$result=$localobject->fetch($id);
$result=$localobject->delete($user);
print __METHOD__." id=".$id." result=".$result."\n";
$this->assertLessThan($result, 0);
return $result;
}
}

View File

@ -200,6 +200,9 @@ class AllTests
require_once dirname(__FILE__).'/CategorieTest.php';
$suite->addTestSuite('CategorieTest');
require_once dirname(__FILE__).'/AccountingAccountTest.php';
$suite->addTestSuite('AccountingAccountTest');
require_once dirname(__FILE__).'/RestAPIUserTest.php';
$suite->addTestSuite('RestAPIUserTest');

View File

@ -174,7 +174,7 @@ class CommandeTest extends PHPUnit_Framework_TestCase
* @depends testCommandeFetch
* The depends says test is run only if previous is ok
*/
public function testCommandUpdate($localobject)
public function testCommandeUpdate($localobject)
{
global $conf,$user,$langs,$db;
$conf=$this->savconf;
@ -196,7 +196,7 @@ class CommandeTest extends PHPUnit_Framework_TestCase
* @param Object $localobject Order
* @return Commande
*
* @depends testCommandUpdate
* @depends testCommandeUpdate
* The depends says test is run only if previous is ok
*/
public function testCommandeValid($localobject)