Merge branch 'develop' into patch-110
This commit is contained in:
commit
04942d3016
@ -1,3 +0,0 @@
|
||||
<?php
|
||||
// Wrapper to include main into htdocs
|
||||
include_once '/home/ldestailleur/git/dolibarr_3.8/htdocs/main.inc.php';
|
||||
@ -1,3 +0,0 @@
|
||||
<?php
|
||||
// Wrapper to include master into htdocs
|
||||
include_once '/home/ldestailleur/git/dolibarr_3.8/htdocs/master.inc.php';
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 360 KiB |
@ -9,8 +9,8 @@
|
||||
# Regis Houssin - regis.houssin@inodbox.com
|
||||
# Laurent Destailleur - eldy@users.sourceforge.net
|
||||
#------------------------------------------------------
|
||||
# Usage: initdemo.sh
|
||||
# usage: initdemo.sh mysqldump_dolibarr_x.x.x.sql database port login pass
|
||||
# Usage: initdemo.sh confirm
|
||||
# usage: initdemo.sh confirm mysqldump_dolibarr_x.x.x.sql database port login pass
|
||||
#------------------------------------------------------
|
||||
|
||||
|
||||
@ -31,11 +31,20 @@ fi
|
||||
|
||||
|
||||
# ----------------------------- command line params
|
||||
dumpfile=$1;
|
||||
base=$2;
|
||||
port=$3;
|
||||
admin=$4;
|
||||
passwd=$5;
|
||||
confirm=$1;
|
||||
dumpfile=$2;
|
||||
base=$3;
|
||||
port=$4;
|
||||
admin=$5;
|
||||
passwd=$6;
|
||||
|
||||
# ----------------------------- check params
|
||||
if [ "x$confirm" != "xconfirm" ]
|
||||
then
|
||||
echo "----- $0 -----"
|
||||
echo "Usage: initdemo.sh confirm [mysqldump_dolibarr_x.x.x.sql database port login pass]"
|
||||
exit
|
||||
fi
|
||||
|
||||
|
||||
# ----------------------------- if no params on command line
|
||||
@ -132,11 +141,14 @@ then
|
||||
exit;;
|
||||
esac
|
||||
|
||||
|
||||
export documentdir=`cat $mydir/../../htdocs/conf/conf.php | grep '^\$dolibarr_main_data_root' | sed -e 's/$dolibarr_main_data_root=//' | sed -e 's/;//' | sed -e "s/'//g" | sed -e 's/"//g' `
|
||||
|
||||
|
||||
# ---------------------------- confirmation
|
||||
DIALOG=${DIALOG=dialog}
|
||||
$DIALOG --title "Init Dolibarr with demo values" --clear \
|
||||
--yesno "Do you confirm ? \n Dump file : '$dumpfile' \n Dump dir : '$mydir' \n Mysql database : '$base' \n Mysql port : '$port' \n Mysql login: '$admin' \n Mysql password : '$passwd'" 15 55
|
||||
--yesno "Do you confirm ? \n Dump file : '$dumpfile' \n Dump dir : '$mydir' \n Document dir : '$documentdir' \n Mysql database : '$base' \n Mysql port : '$port' \n Mysql login: '$admin' \n Mysql password : '$passwd'" 15 55
|
||||
|
||||
case $? in
|
||||
0) echo "Ok, start process...";;
|
||||
@ -165,15 +177,44 @@ export res=$?
|
||||
export documentdir=`cat $mydir/../../htdocs/conf/conf.php | grep '^\$dolibarr_main_data_root' | sed -e 's/$dolibarr_main_data_root=//' | sed -e 's/;//' | sed -e "s/'//g" | sed -e 's/"//g' `
|
||||
if [ "x$documentdir" != "x" ]
|
||||
then
|
||||
$DIALOG --title "Reset document directory tpp" --clear \
|
||||
--inputbox "Delete and recreate document directory $documentdir/:" 16 55 n 2> $fichtemp
|
||||
|
||||
valret=$?
|
||||
|
||||
case $valret in
|
||||
0)
|
||||
rep=`cat $fichtemp`;;
|
||||
1)
|
||||
exit;;
|
||||
255)
|
||||
exit;;
|
||||
esac
|
||||
|
||||
echo "rep=$rep"
|
||||
if [ "x$rep" = "xy" ]; then
|
||||
echo rm -fr "$documentdir/*"
|
||||
rm -fr $documentdir/*
|
||||
fi
|
||||
|
||||
echo cp -pr $mydir/documents_demo/* "$documentdir/"
|
||||
cp -pr $mydir/documents_demo/* "$documentdir/"
|
||||
|
||||
mkdir "$documentdir/doctemplates/" 2>/dev/null
|
||||
echo cp -pr $mydir/../../htdocs/install/doctemplates/* "$documentdir/doctemplates/"
|
||||
cp -pr $mydir/../../htdocs/install/doctemplates/* "$documentdir/doctemplates/"
|
||||
mkdir -p "$documentdir/ecm/Administrative documents"
|
||||
mkdir -p "$documentdir/ecm/Images"
|
||||
|
||||
echo cp -pr $mydir/../../htdocs/install/medias/* "$documentdir/medias/image/"
|
||||
cp -pr $mydir/../../htdocs/install/medias/* "$documentdir/medias/image/"
|
||||
|
||||
mkdir -p "$documentdir/ecm/Administrative documents" 2>/dev/null
|
||||
mkdir -p "$documentdir/ecm/Images" 2>/dev/null
|
||||
rm -f "$documentdir/doctemplates/"*/index.html
|
||||
echo cp -pr $mydir/../../doc/images/* "$documentdir/ecm/Images"
|
||||
cp -pr $mydir/../../doc/images/* "$documentdir/ecm/Images"
|
||||
|
||||
chmod -R u+w "$documentdir/"
|
||||
chown -R www-data "$documentdir/"
|
||||
else
|
||||
echo Detection of documents directory from $mydir failed so demo files were not copied.
|
||||
fi
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -227,7 +227,7 @@ class AccountingJournal extends CommonObject
|
||||
if (! empty($this->code))
|
||||
$label .= '<br><b>'.$langs->trans('Code') . ':</b> ' . $this->code;
|
||||
if (! empty($this->label))
|
||||
$label .= '<br><b>'.$langs->trans('Label') . ':</b> ' . $this->label;
|
||||
$label .= '<br><b>'.$langs->trans('Label') . ':</b> ' . $langs->transnoentities($this->label);
|
||||
if ($moretitle) $label.=' - '.$moretitle;
|
||||
|
||||
$linkclose='';
|
||||
@ -254,7 +254,7 @@ class AccountingJournal extends CommonObject
|
||||
}
|
||||
|
||||
$label_link = $this->code;
|
||||
if ($withlabel) $label_link .= ' - ' . $this->label;
|
||||
if ($withlabel) $label_link .= ' - ' . $langs->transnoentities($this->label);
|
||||
|
||||
$result .= $linkstart;
|
||||
if ($withpicto) $result.=img_object(($notooltip?'':$label), ($this->picto?$this->picto:'generic'), ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1);
|
||||
|
||||
@ -84,8 +84,8 @@ $arrayfields=array(
|
||||
'd.bank'=>array('label'=>$langs->trans("BankAccount"), 'checked'=>1, 'enabled'=>(! empty($conf->banque->enabled))),
|
||||
/*'d.note_public'=>array('label'=>$langs->trans("NotePublic"), 'checked'=>0),
|
||||
'd.note_private'=>array('label'=>$langs->trans("NotePrivate"), 'checked'=>0),*/
|
||||
'd.datedebut'=>array('label'=>$langs->trans("DateSubscription"), 'checked'=>1, 'position'=>100),
|
||||
'd.datefin'=>array('label'=>$langs->trans("EndSubscription"), 'checked'=>1, 'position'=>101),
|
||||
'c.dateadh'=>array('label'=>$langs->trans("DateSubscription"), 'checked'=>1, 'position'=>100),
|
||||
'c.datef'=>array('label'=>$langs->trans("EndSubscription"), 'checked'=>1, 'position'=>101),
|
||||
'd.amount'=>array('label'=>$langs->trans("Amount"), 'checked'=>1, 'position'=>102),
|
||||
'd.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
|
||||
'd.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
|
||||
@ -343,12 +343,12 @@ if (! empty($arrayfields['d.bank']['checked']))
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
if (! empty($arrayfields['d.date_debut']['checked']))
|
||||
if (! empty($arrayfields['c.dateadh']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre"> </td>';
|
||||
}
|
||||
|
||||
if (! empty($arrayfields['d.date_fin']['checked']))
|
||||
if (! empty($arrayfields['c.datef']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre"> </td>';
|
||||
}
|
||||
@ -417,11 +417,11 @@ if (! empty($arrayfields['d.bank']['checked']))
|
||||
{
|
||||
print_liste_field_titre("Account", $_SERVER["PHP_SELF"], "b.fk_account", $pram, "", "", $sortfield, $sortorder);
|
||||
}
|
||||
if (! empty($arrayfields['d.date_debut']['checked']))
|
||||
if (! empty($arrayfields['c.dateadh']['checked']))
|
||||
{
|
||||
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "c.dateadh", $param, "", 'align="center"', $sortfield, $sortorder);
|
||||
}
|
||||
if (! empty($arrayfields['d.date_fin']['checked']))
|
||||
if (! empty($arrayfields['c.datef']['checked']))
|
||||
{
|
||||
print_liste_field_titre("DateEnd", $_SERVER["PHP_SELF"], "c.datef", $param, "", 'align="center"', $sortfield, $sortorder);
|
||||
}
|
||||
@ -527,13 +527,13 @@ while ($i < min($num, $limit))
|
||||
}
|
||||
|
||||
// Date start
|
||||
if (! empty($arrayfields['d.date_start']['checked']))
|
||||
if (! empty($arrayfields['c.dateadh']['checked']))
|
||||
{
|
||||
print '<td align="center">'.dol_print_date($db->jdate($obj->dateadh), 'day')."</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Date end
|
||||
if (! empty($arrayfields['d.date_end']['checked']))
|
||||
if (! empty($arrayfields['c.datef']['checked']))
|
||||
{
|
||||
print '<td align="center">'.dol_print_date($db->jdate($obj->datef), 'day')."</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
|
||||
@ -117,7 +117,7 @@ $tabname[22]= MAIN_DB_PREFIX."c_input_reason";
|
||||
$tabname[23]= MAIN_DB_PREFIX."c_revenuestamp";
|
||||
$tabname[24]= MAIN_DB_PREFIX."c_type_resource";
|
||||
$tabname[25]= MAIN_DB_PREFIX."c_type_container";
|
||||
$tabname[26]= MAIN_DB_PREFIX."c_units";
|
||||
//$tabname[26]= MAIN_DB_PREFIX."c_units";
|
||||
$tabname[27]= MAIN_DB_PREFIX."c_stcomm";
|
||||
$tabname[28]= MAIN_DB_PREFIX."c_holiday_types";
|
||||
$tabname[29]= MAIN_DB_PREFIX."c_lead_status";
|
||||
@ -128,7 +128,7 @@ $tabname[33]= MAIN_DB_PREFIX."c_hrm_department";
|
||||
$tabname[34]= MAIN_DB_PREFIX."c_hrm_function";
|
||||
$tabname[35]= MAIN_DB_PREFIX."c_exp_tax_cat";
|
||||
$tabname[36]= MAIN_DB_PREFIX."c_exp_tax_range";
|
||||
$tabname[37]= MAIN_DB_PREFIX."c_measuring_units";
|
||||
$tabname[37]= MAIN_DB_PREFIX."c_units";
|
||||
|
||||
// Dictionary labels
|
||||
$tablib=array();
|
||||
@ -157,7 +157,7 @@ $tablib[22]= "DictionarySource";
|
||||
$tablib[23]= "DictionaryRevenueStamp";
|
||||
$tablib[24]= "DictionaryResourceType";
|
||||
$tablib[25]= "DictionaryTypeOfContainer";
|
||||
$tablib[26]= "DictionaryUnits";
|
||||
//$tablib[26]= "DictionaryUnits";
|
||||
$tablib[27]= "DictionaryProspectStatus";
|
||||
$tablib[28]= "DictionaryHolidayTypes";
|
||||
$tablib[29]= "DictionaryOpportunityStatus";
|
||||
@ -197,7 +197,7 @@ $tabsql[22]= "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX
|
||||
$tabsql[23]= "SELECT t.rowid as rowid, t.taux, t.revenuestamp_type, c.label as country, c.code as country_code, t.fk_pays as country_id, t.note, t.active, t.accountancy_code_sell, t.accountancy_code_buy FROM ".MAIN_DB_PREFIX."c_revenuestamp as t, ".MAIN_DB_PREFIX."c_country as c WHERE t.fk_pays=c.rowid";
|
||||
$tabsql[24]= "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_type_resource";
|
||||
$tabsql[25]= "SELECT rowid as rowid, code, label, active, module FROM ".MAIN_DB_PREFIX."c_type_container as t WHERE t.entity IN (".getEntity('c_type_container').")";
|
||||
$tabsql[26]= "SELECT rowid as rowid, code, label, short_label, active FROM ".MAIN_DB_PREFIX."c_units";
|
||||
//$tabsql[26]= "SELECT rowid as rowid, code, label, short_label, active FROM ".MAIN_DB_PREFIX."c_units";
|
||||
$tabsql[27]= "SELECT id as rowid, code, libelle, active FROM ".MAIN_DB_PREFIX."c_stcomm";
|
||||
$tabsql[28]= "SELECT h.rowid as rowid, h.code, h.label, h.affect, h.delay, h.newbymonth, h.fk_country as country_id, c.code as country_code, c.label as country, h.active FROM ".MAIN_DB_PREFIX."c_holiday_types as h LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON h.fk_country=c.rowid";
|
||||
$tabsql[29]= "SELECT rowid as rowid, code, label, percent, position, active FROM ".MAIN_DB_PREFIX."c_lead_status";
|
||||
@ -208,7 +208,7 @@ $tabsql[33]= "SELECT rowid, pos, code, label, active FROM ".MAIN_DB_PREFIX."c_hr
|
||||
$tabsql[34]= "SELECT rowid, pos, code, label, c_level, active FROM ".MAIN_DB_PREFIX."c_hrm_function";
|
||||
$tabsql[35]= "SELECT c.rowid, c.label, c.active, c.entity FROM ".MAIN_DB_PREFIX."c_exp_tax_cat c";
|
||||
$tabsql[36]= "SELECT r.rowid, r.fk_c_exp_tax_cat, r.range_ik, r.active, r.entity FROM ".MAIN_DB_PREFIX."c_exp_tax_range r";
|
||||
$tabsql[37]= "SELECT r.rowid, r.code, r.label, r.short_label, r.unit_type, r.active FROM ".MAIN_DB_PREFIX."c_measuring_units r";
|
||||
$tabsql[37]= "SELECT r.rowid, r.code, r.label, r.short_label, r.unit_type, r.scale, r.active FROM ".MAIN_DB_PREFIX."c_units r";
|
||||
|
||||
// Criteria to sort dictionaries
|
||||
$tabsqlsort=array();
|
||||
@ -237,7 +237,7 @@ $tabsqlsort[22]="code ASC, label ASC";
|
||||
$tabsqlsort[23]="country ASC, taux ASC";
|
||||
$tabsqlsort[24]="code ASC, label ASC";
|
||||
$tabsqlsort[25]="t.module ASC, t.code ASC, t.label ASC";
|
||||
$tabsqlsort[26]="code ASC";
|
||||
//$tabsqlsort[26]="code ASC";
|
||||
$tabsqlsort[27]="code ASC";
|
||||
$tabsqlsort[28]="country ASC, code ASC";
|
||||
$tabsqlsort[29]="position ASC";
|
||||
@ -248,7 +248,7 @@ $tabsqlsort[33]="code ASC";
|
||||
$tabsqlsort[34]="code ASC";
|
||||
$tabsqlsort[35]="c.label ASC";
|
||||
$tabsqlsort[36]="r.fk_c_exp_tax_cat ASC, r.range_ik ASC";
|
||||
$tabsqlsort[37]="r.unit_type ASC, r.code ASC";
|
||||
$tabsqlsort[37]="r.unit_type ASC, r.scale ASC, r.code ASC";
|
||||
|
||||
// Nom des champs en resultat de select pour affichage du dictionnaire
|
||||
$tabfield=array();
|
||||
@ -277,7 +277,7 @@ $tabfield[22]= "code,label";
|
||||
$tabfield[23]= "country_id,country,taux,revenuestamp_type,accountancy_code_sell,accountancy_code_buy,note";
|
||||
$tabfield[24]= "code,label";
|
||||
$tabfield[25]= "code,label";
|
||||
$tabfield[26]= "code,label,short_label";
|
||||
//$tabfield[26]= "code,label,short_label";
|
||||
$tabfield[27]= "code,libelle";
|
||||
$tabfield[28]= "code,label,affect,delay,newbymonth,country_id,country";
|
||||
$tabfield[29]= "code,label,percent,position";
|
||||
@ -288,7 +288,7 @@ $tabfield[33]= "code,label";
|
||||
$tabfield[34]= "code,label";
|
||||
$tabfield[35]= "label";
|
||||
$tabfield[36]= "range_ik,fk_c_exp_tax_cat";
|
||||
$tabfield[37]= "code,label,short_label,unit_type";
|
||||
$tabfield[37]= "code,label,short_label,unit_type,scale";
|
||||
|
||||
// Nom des champs d'edition pour modification d'un enregistrement
|
||||
$tabfieldvalue=array();
|
||||
@ -317,7 +317,7 @@ $tabfieldvalue[22]= "code,label";
|
||||
$tabfieldvalue[23]= "country,taux,revenuestamp_type,accountancy_code_sell,accountancy_code_buy,note";
|
||||
$tabfieldvalue[24]= "code,label";
|
||||
$tabfieldvalue[25]= "code,label";
|
||||
$tabfieldvalue[26]= "code,label,short_label";
|
||||
//$tabfieldvalue[26]= "code,label,short_label";
|
||||
$tabfieldvalue[27]= "code,libelle";
|
||||
$tabfieldvalue[28]= "code,label,affect,delay,newbymonth,country";
|
||||
$tabfieldvalue[29]= "code,label,percent,position";
|
||||
@ -328,7 +328,7 @@ $tabfieldvalue[33]= "code,label";
|
||||
$tabfieldvalue[34]= "code,label";
|
||||
$tabfieldvalue[35]= "label";
|
||||
$tabfieldvalue[36]= "range_ik,fk_c_exp_tax_cat";
|
||||
$tabfieldvalue[37]= "code,label,short_label,unit_type";
|
||||
$tabfieldvalue[37]= "code,label,short_label,unit_type,scale";
|
||||
|
||||
// Nom des champs dans la table pour insertion d'un enregistrement
|
||||
$tabfieldinsert=array();
|
||||
@ -357,7 +357,7 @@ $tabfieldinsert[22]= "code,label";
|
||||
$tabfieldinsert[23]= "fk_pays,taux,revenuestamp_type,accountancy_code_sell,accountancy_code_buy,note";
|
||||
$tabfieldinsert[24]= "code,label";
|
||||
$tabfieldinsert[25]= "code,label";
|
||||
$tabfieldinsert[26]= "code,label,short_label";
|
||||
//$tabfieldinsert[26]= "code,label,short_label";
|
||||
$tabfieldinsert[27]= "code,libelle";
|
||||
$tabfieldinsert[28]= "code,label,affect,delay,newbymonth,fk_country";
|
||||
$tabfieldinsert[29]= "code,label,percent,position";
|
||||
@ -368,7 +368,7 @@ $tabfieldinsert[33]= "code,label";
|
||||
$tabfieldinsert[34]= "code,label";
|
||||
$tabfieldinsert[35]= "label";
|
||||
$tabfieldinsert[36]= "range_ik,fk_c_exp_tax_cat";
|
||||
$tabfieldinsert[37]= "code,label,short_label,unit_type";
|
||||
$tabfieldinsert[37]= "code,label,short_label,unit_type,scale";
|
||||
|
||||
// Nom du rowid si le champ n'est pas de type autoincrement
|
||||
// Example: "" if id field is "rowid" and has autoincrement on
|
||||
@ -399,7 +399,7 @@ $tabrowid[22]= "rowid";
|
||||
$tabrowid[23]= "";
|
||||
$tabrowid[24]= "";
|
||||
$tabrowid[25]= "";
|
||||
$tabrowid[26]= "";
|
||||
//$tabrowid[26]= "";
|
||||
$tabrowid[27]= "id";
|
||||
$tabrowid[28]= "";
|
||||
$tabrowid[29]= "";
|
||||
@ -439,7 +439,7 @@ $tabcond[22]= (! empty($conf->commande->enabled) || ! empty($conf->propal->enabl
|
||||
$tabcond[23]= true;
|
||||
$tabcond[24]= ! empty($conf->resource->enabled);
|
||||
$tabcond[25]= ! empty($conf->website->enabled);
|
||||
$tabcond[26]= ! empty($conf->product->enabled);
|
||||
//$tabcond[26]= ! empty($conf->product->enabled);
|
||||
$tabcond[27]= ! empty($conf->societe->enabled);
|
||||
$tabcond[28]= ! empty($conf->holiday->enabled);
|
||||
$tabcond[29]= ! empty($conf->projet->enabled);
|
||||
@ -479,7 +479,7 @@ $tabhelp[22] = array('code'=>$langs->trans("EnterAnyCode"));
|
||||
$tabhelp[23] = array('revenuestamp_type'=>'FixedOfPercent');
|
||||
$tabhelp[24] = array('code'=>$langs->trans("EnterAnyCode"));
|
||||
$tabhelp[25] = array('code'=>$langs->trans('EnterAnyCode'));
|
||||
$tabhelp[26] = array('code'=>$langs->trans("EnterAnyCode"));
|
||||
//$tabhelp[26] = array('code'=>$langs->trans("EnterAnyCode"));
|
||||
$tabhelp[27] = array('code'=>$langs->trans("EnterAnyCode"));
|
||||
$tabhelp[28] = array('affect'=>$langs->trans("FollowedByACounter"),'delay'=>$langs->trans("MinimumNoticePeriod"), 'newbymonth'=>$langs->trans("NbAddedAutomatically"));
|
||||
$tabhelp[29] = array('code'=>$langs->trans("EnterAnyCode"), 'percent'=>$langs->trans("OpportunityPercent"), 'position'=>$langs->trans("PositionIntoComboList"));
|
||||
@ -490,7 +490,7 @@ $tabhelp[33] = array('code'=>$langs->trans("EnterAnyCode"));
|
||||
$tabhelp[34] = array('code'=>$langs->trans("EnterAnyCode"));
|
||||
$tabhelp[35]= array();
|
||||
$tabhelp[36]= array('range_ik'=>$langs->trans('PrevRangeToThisRange'));
|
||||
$tabhelp[37]= array('short_label'=>$langs->trans("EnterAnyCode"));
|
||||
$tabhelp[37]= array('code'=>$langs->trans("EnterAnyCode"));
|
||||
|
||||
// List of check for fields (NOT USED YET)
|
||||
$tabfieldcheck=array();
|
||||
@ -519,7 +519,7 @@ $tabfieldcheck[22] = array();
|
||||
$tabfieldcheck[23] = array();
|
||||
$tabfieldcheck[24] = array();
|
||||
$tabfieldcheck[25] = array();
|
||||
$tabfieldcheck[26] = array();
|
||||
//$tabfieldcheck[26] = array();
|
||||
$tabfieldcheck[27] = array();
|
||||
$tabfieldcheck[28] = array();
|
||||
$tabfieldcheck[29] = array();
|
||||
@ -1594,7 +1594,7 @@ if ($id)
|
||||
{
|
||||
$valuetoshow = $langs->trans($valuetoshow);
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'c_measuring_units')
|
||||
elseif ($fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'c_units')
|
||||
{
|
||||
$langs->load('other');
|
||||
$key = $langs->trans($obj->label);
|
||||
|
||||
@ -144,9 +144,9 @@ if ($action == 'add')
|
||||
}
|
||||
|
||||
$leftmenu=''; $mainmenu='';
|
||||
if (GETPOST('menuId', 'alpha') && ! is_numeric(GETPOST('menuId', 'alpha')))
|
||||
if (GETPOST('menuId', 'alpha', 3) && ! is_numeric(GETPOST('menuId', 'alpha', 3)))
|
||||
{
|
||||
$tmp=explode('&', GETPOST('menuId', 'alpha'));
|
||||
$tmp=explode('&', GETPOST('menuId', 'alpha', 3));
|
||||
foreach($tmp as $s)
|
||||
{
|
||||
if (preg_match('/fk_mainmenu=/', $s))
|
||||
@ -214,9 +214,9 @@ if ($action == 'add')
|
||||
$menu->target=GETPOST('target', 'alpha');
|
||||
$menu->user=GETPOST('user', 'alpha');
|
||||
$menu->mainmenu=GETPOST('propertymainmenu', 'alpha');
|
||||
if (is_numeric(GETPOST('menuId', 'alpha')))
|
||||
if (is_numeric(GETPOST('menuId', 'alpha', 3)))
|
||||
{
|
||||
$menu->fk_menu=GETPOST('menuId', 'alpha');
|
||||
$menu->fk_menu=GETPOST('menuId', 'alpha', 3);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -253,12 +253,24 @@ if ($action == 'delete')
|
||||
print $form->formconfirm("index.php?menu_handler=".$menu_handler."&menuId=".GETPOST('menuId', 'int'), $langs->trans("DeleteMenu"), $langs->trans("ConfirmDeleteMenu", $obj->titre), "confirm_delete");
|
||||
}
|
||||
|
||||
$newcardbutton='';
|
||||
if ($user->admin)
|
||||
{
|
||||
$newcardbutton='<a class="butActionNew" href="'.DOL_URL_ROOT.'/admin/menus/edit.php?menuId=0&action=create&menu_handler='.urlencode($menu_handler).'&backtopage='.urlencode($_SERVER['PHP_SELF']).'"><span class="valignmiddle">'.$langs->trans('New').'</span>';
|
||||
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
|
||||
$newcardbutton.= '</a>';
|
||||
}
|
||||
|
||||
print '<form name="newmenu" class="nocellnopadd" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<input type="hidden" action="change_menu_handler">';
|
||||
print $langs->trans("MenuHandler").': ';
|
||||
$formadmin->select_menu_families($menu_handler.(preg_match('/_menu/', $menu_handler)?'':'_menu'), 'menu_handler', array_merge($dirstandard, $dirsmartphone));
|
||||
print ' <input type="submit" class="button" value="'.$langs->trans("Refresh").'">';
|
||||
|
||||
print '<div class="floatright">';
|
||||
print $newcardbutton;
|
||||
print '</div>';
|
||||
|
||||
print '</form>';
|
||||
|
||||
print '<br>';
|
||||
@ -394,14 +406,6 @@ if ($conf->use_javascript_ajax)
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
|
||||
|
||||
/*
|
||||
* Boutons actions
|
||||
*/
|
||||
print '<div class="tabsAction">';
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/admin/menus/edit.php?menuId=0&action=create&menu_handler='.urlencode($menu_handler).'">'.$langs->trans("NewMenu").'</a>';
|
||||
print '</div>';
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -451,13 +451,13 @@ class Proposals extends DolibarrApi
|
||||
return $this->propal;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Delete a contact type of given commercial proposal
|
||||
*
|
||||
* @param int $id Id of commercial proposal to update
|
||||
* @param int $rowid Row key of the contact in the array contact_ids.
|
||||
*
|
||||
* @url DELETE {id}/contact/{lineid}
|
||||
* @url DELETE {id}/contact/{rowid}
|
||||
*
|
||||
* @return int
|
||||
* @throws 401
|
||||
|
||||
@ -399,6 +399,86 @@ class Orders extends DolibarrApi
|
||||
throw new RestException(405, $this->commande->error);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a contact type of given order
|
||||
*
|
||||
* @param int $id Id of order to update
|
||||
* @param int $contactid Id of contact to add
|
||||
* @param string $type Type of the contact (BILLING, SHIPPING, CUSTOMER)
|
||||
*
|
||||
* @url POST {id}/contact/{contactid}/{type}
|
||||
*
|
||||
* @return int
|
||||
* @throws 401
|
||||
* @throws 404
|
||||
*/
|
||||
function postContact($id, $contactid, $type)
|
||||
{
|
||||
if(!DolibarrApiAccess::$user->rights->commande->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->commande->fetch($id);
|
||||
|
||||
if(!$result) {
|
||||
throw new RestException(404, 'Order not found');
|
||||
}
|
||||
|
||||
if (!in_array($type, array('BILLING', 'SHIPPING', 'CUSTOMER'), true)) {
|
||||
throw new RestException(500, 'Availables types: BILLING, SHIPPING OR CUSTOMER');
|
||||
}
|
||||
|
||||
if(!DolibarrApi::_checkAccessToResource('order', $this->commande->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
$result = $this->commande->add_contact($contactid, $type, 'external');
|
||||
|
||||
if (!$result) {
|
||||
throw new RestException(500, 'Error when added the contact');
|
||||
}
|
||||
|
||||
return $this->commande;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a contact type of given order
|
||||
*
|
||||
* @param int $id Id of order to update
|
||||
* @param int $rowid Row key of the contact in the array contact_ids.
|
||||
*
|
||||
* @url DELETE {id}/contact/{rowid}
|
||||
*
|
||||
* @return int
|
||||
* @throws 401
|
||||
* @throws 404
|
||||
* @throws 500
|
||||
*/
|
||||
function deleteContact($id, $rowid)
|
||||
{
|
||||
if(!DolibarrApiAccess::$user->rights->commande->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->commande->fetch($id);
|
||||
|
||||
if(!$result) {
|
||||
throw new RestException(404, 'Order not found');
|
||||
}
|
||||
|
||||
if(!DolibarrApi::_checkAccessToResource('order', $this->commande->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
$result = $this->commande->delete_contact($rowid);
|
||||
|
||||
if (!$result) {
|
||||
throw new RestException(500, 'Error when deleted the contact');
|
||||
}
|
||||
|
||||
return $this->commande;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update order general fields (won't touch lines of order)
|
||||
|
||||
@ -372,6 +372,86 @@ class Invoices extends DolibarrApi
|
||||
throw new RestException(304, $this->invoice->error);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a contact type of given invoice
|
||||
*
|
||||
* @param int $id Id of invoice to update
|
||||
* @param int $contactid Id of contact to add
|
||||
* @param string $type Type of the contact (BILLING, SHIPPING, CUSTOMER)
|
||||
*
|
||||
* @url POST {id}/contact/{contactid}/{type}
|
||||
*
|
||||
* @return int
|
||||
* @throws 401
|
||||
* @throws 404
|
||||
*/
|
||||
function postContact($id, $contactid, $type)
|
||||
{
|
||||
if(!DolibarrApiAccess::$user->rights->facture->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->facture->fetch($id);
|
||||
|
||||
if(!$result) {
|
||||
throw new RestException(404, 'Invoice not found');
|
||||
}
|
||||
|
||||
if (!in_array($type, array('BILLING', 'SHIPPING', 'CUSTOMER'), true)) {
|
||||
throw new RestException(500, 'Availables types: BILLING, SHIPPING OR CUSTOMER');
|
||||
}
|
||||
|
||||
if(!DolibarrApi::_checkAccessToResource('invoice', $this->facture->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
$result = $this->facture->add_contact($contactid, $type, 'external');
|
||||
|
||||
if (!$result) {
|
||||
throw new RestException(500, 'Error when added the contact');
|
||||
}
|
||||
|
||||
return $this->facture;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a contact type of given invoice
|
||||
*
|
||||
* @param int $id Id of invoice to update
|
||||
* @param int $rowid Row key of the contact in the array contact_ids.
|
||||
*
|
||||
* @url DELETE {id}/contact/{rowid}
|
||||
*
|
||||
* @return int
|
||||
* @throws 401
|
||||
* @throws 404
|
||||
* @throws 500
|
||||
*/
|
||||
function deleteContact($id, $rowid)
|
||||
{
|
||||
if(!DolibarrApiAccess::$user->rights->facture->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->facture->fetch($id);
|
||||
|
||||
if(!$result) {
|
||||
throw new RestException(404, 'Invoice not found');
|
||||
}
|
||||
|
||||
if(!DolibarrApi::_checkAccessToResource('invoice', $this->facture->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
$result = $this->facture->delete_contact($rowid);
|
||||
|
||||
if (!$result) {
|
||||
throw new RestException(500, 'Error when deleted the contact');
|
||||
}
|
||||
|
||||
return $this->facture;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes a line of a given invoice
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2018-2019 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2019 Josep Lluís Amador <joseplluis@lliuretic.cat>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -758,7 +758,7 @@ else
|
||||
|
||||
print "</table>";
|
||||
|
||||
print dol_fiche_end();
|
||||
dol_fiche_end();
|
||||
|
||||
print '<div class="center">';
|
||||
print '<input type="submit" class="button" name="add" value="'.$langs->trans("Add").'">';
|
||||
@ -1093,7 +1093,7 @@ else
|
||||
|
||||
print '</table>';
|
||||
|
||||
print dol_fiche_end();
|
||||
dol_fiche_end();
|
||||
|
||||
print '<div class="center">';
|
||||
print '<input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">';
|
||||
@ -1286,7 +1286,7 @@ else
|
||||
print '</div></div></div>';
|
||||
print '<div style="clear:both"></div>';
|
||||
|
||||
print dol_fiche_end();
|
||||
dol_fiche_end();
|
||||
|
||||
// Barre d'actions
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
@ -1,432 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2007-2011 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/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/core/class/cmeasuringunits.class.php
|
||||
* \ingroup core
|
||||
* \brief This file is CRUD class file (Create/Read/Update/Delete) for c_measuring_units dictionary
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Class of dictionary type of thirdparty (used by imports)
|
||||
*/
|
||||
class CMeasuringUnits // extends CommonObject
|
||||
{
|
||||
/**
|
||||
* @var DoliDB Database handler.
|
||||
*/
|
||||
public $db;
|
||||
|
||||
/**
|
||||
* @var string Error code (or message)
|
||||
*/
|
||||
public $error='';
|
||||
|
||||
/**
|
||||
* @var string[] Error codes (or messages)
|
||||
*/
|
||||
public $errors = array();
|
||||
public $records = array();
|
||||
|
||||
//var $element='ctypent'; //!< Id that identify managed objects
|
||||
//var $table_element='ctypent'; //!< Name of table without prefix where object is stored
|
||||
|
||||
/**
|
||||
* @var int ID
|
||||
*/
|
||||
public $id;
|
||||
|
||||
public $code;
|
||||
public $label;
|
||||
public $short_label;
|
||||
public $unit_type;
|
||||
public $active;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDb $db Database handler
|
||||
*/
|
||||
function __construct($db)
|
||||
{
|
||||
$this->db = $db;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create object into database
|
||||
*
|
||||
* @param User $user User that create
|
||||
* @param int $notrigger 0=launch triggers after, 1=disable triggers
|
||||
* @return int <0 if KO, Id of created object if OK
|
||||
*/
|
||||
function create($user, $notrigger = 0)
|
||||
{
|
||||
global $conf, $langs;
|
||||
$error=0;
|
||||
|
||||
// Clean parameters
|
||||
|
||||
if (isset($this->id)) $this->id=trim($this->id);
|
||||
if (isset($this->code)) $this->code=trim($this->code);
|
||||
if (isset($this->label)) $this->libelle=trim($this->label);
|
||||
if (isset($this->short_label)) $this->libelle=trim($this->short_label);
|
||||
if (isset($this->unit_type)) $this->active=trim($this->unit_type);
|
||||
if (isset($this->active)) $this->active=trim($this->active);
|
||||
|
||||
|
||||
|
||||
// Check parameters
|
||||
// Put here code to add control on parameters values
|
||||
|
||||
// Insert request
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."c_measuring_units(";
|
||||
|
||||
$sql.= "rowid,";
|
||||
$sql.= "code,";
|
||||
$sql.= "label,";
|
||||
$sql.= "short_label,";
|
||||
$sql.= "unit_type";
|
||||
|
||||
|
||||
$sql.= ") VALUES (";
|
||||
|
||||
$sql.= " ".(! isset($this->id)?'NULL':"'".$this->db->escape($this->id)."'").",";
|
||||
$sql.= " ".(! isset($this->code)?'NULL':"'".$this->db->escape($this->code)."'").",";
|
||||
$sql.= " ".(! isset($this->label)?'NULL':"'".$this->db->escape($this->label)."'").",";
|
||||
$sql.= " ".(! isset($this->short_label)?'NULL':"'".$this->db->active($this->short_label)."'").",";
|
||||
$sql.= " ".(! isset($this->unit_type)?'NULL':"'".$this->db->active($this->unit_type)."'");
|
||||
|
||||
$sql.= ")";
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."c_measuring_units");
|
||||
|
||||
if (! $notrigger)
|
||||
{
|
||||
// Uncomment this and change MYOBJECT to your own tag if you
|
||||
// want this action call a trigger.
|
||||
|
||||
//// Call triggers
|
||||
//include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||
//$interface=new Interfaces($this->db);
|
||||
//$result=$interface->run_triggers('MYOBJECT_CREATE',$this,$user,$langs,$conf);
|
||||
//if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||
//// End call triggers
|
||||
}
|
||||
}
|
||||
|
||||
// Commit or rollback
|
||||
if ($error)
|
||||
{
|
||||
foreach($this->errors as $errmsg)
|
||||
{
|
||||
dol_syslog(get_class($this)."::create ".$errmsg, LOG_ERR);
|
||||
$this->error.=($this->error?', '.$errmsg:$errmsg);
|
||||
}
|
||||
$this->db->rollback();
|
||||
return -1*$error;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->commit();
|
||||
return $this->id;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load object in memory from database
|
||||
*
|
||||
* @param int $id Id object
|
||||
* @param string $unit_type unit type
|
||||
* @param string $code Code
|
||||
* @param string $short_label Short Label
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function fetch($id, $unit_type = '', $code = '', $short_label = '')
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$sql = "SELECT";
|
||||
$sql.= " t.rowid,";
|
||||
$sql.= " t.code,";
|
||||
$sql.= " t.label,";
|
||||
$sql.= " t.short_label,";
|
||||
$sql.= " t.unit_type,";
|
||||
$sql.= " t.active";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_measuring_units as t";
|
||||
$sql_where=array();
|
||||
if ($id) $sql_where[]= " t.id = ".$id;
|
||||
if ($unit_type) $sql_where[]= " t.unit_type = '".$this->db->escape($unit_type)."'";
|
||||
if ($code) $sql_where[]= " t.code = '".$this->db->escape($code)."'";
|
||||
if ($short_label) $sql_where[]= " t.short_label = '".$this->db->escape($short_label)."'";
|
||||
|
||||
if (count($sql_where)>0) {
|
||||
$sql.=' WHERE '. implode(' AND ', $sql_where);
|
||||
}
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if ($this->db->num_rows($resql))
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
$this->id = $obj->rowid;
|
||||
$this->code = $obj->code;
|
||||
$this->label = $obj->label;
|
||||
$this->short_label = $obj->short_label;
|
||||
$this->unit_type = $obj->unit_type;
|
||||
$this->active = $obj->active;
|
||||
}
|
||||
$this->db->free($resql);
|
||||
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error="Error ".$this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load list of objects in memory from the database.
|
||||
*
|
||||
* @param string $sortorder Sort Order
|
||||
* @param string $sortfield Sort field
|
||||
* @param int $limit limit
|
||||
* @param int $offset Offset
|
||||
* @param array $filter Filter array. Example array('field'=>'valueforlike', 'customurl'=>...)
|
||||
* @param string $filtermode Filter mode (AND or OR)
|
||||
* @return array|int int <0 if KO, array of pages if OK
|
||||
*/
|
||||
public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND')
|
||||
{
|
||||
global $conf;
|
||||
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
|
||||
$records=array();
|
||||
|
||||
$sql = 'SELECT';
|
||||
$sql.= " t.rowid,";
|
||||
$sql.= " t.code,";
|
||||
$sql.= " t.label,";
|
||||
$sql.= " t.short_label,";
|
||||
$sql.= " t.unit_type,";
|
||||
$sql.= " t.active";
|
||||
$sql .= ' FROM ' . MAIN_DB_PREFIX . 'c_measuring_units as t';
|
||||
// Manage filter
|
||||
$sqlwhere = array();
|
||||
if (count($filter) > 0) {
|
||||
foreach ($filter as $key => $value) {
|
||||
if ($key=='t.rowid' || $key=='t.active') {
|
||||
$sqlwhere[] = $key . '='. $value;
|
||||
}
|
||||
elseif (strpos($key, 'date') !== false) {
|
||||
$sqlwhere[] = $key.' = \''.$this->db->idate($value).'\'';
|
||||
}
|
||||
elseif ($key=='t.unit_type' || $key=='t.code' || $key=='t.short_label') {
|
||||
$sqlwhere[] = $key.' = \''.$this->db->escape($value).'\'';
|
||||
}
|
||||
else {
|
||||
$sqlwhere[] = $key . ' LIKE \'%' . $this->db->escape($value) . '%\'';
|
||||
}
|
||||
}
|
||||
}
|
||||
if (count($sqlwhere) > 0) {
|
||||
$sql .= ' WHERE (' . implode(' '.$filtermode.' ', $sqlwhere).')';
|
||||
}
|
||||
|
||||
if (!empty($sortfield)) {
|
||||
$sql .= $this->db->order($sortfield, $sortorder);
|
||||
}
|
||||
if (!empty($limit)) {
|
||||
$sql .= ' ' . $this->db->plimit($limit, $offset);
|
||||
}
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$this->records=array();
|
||||
$num = $this->db->num_rows($resql);
|
||||
if ($num>0) {
|
||||
while ($obj = $this->db->fetch_object($resql))
|
||||
{
|
||||
$record = new self($this->db);
|
||||
|
||||
$record->id = $obj->rowid;
|
||||
$record->code = $obj->code;
|
||||
$record->label = $obj->label;
|
||||
$record->short_label = $obj->short_label;
|
||||
$record->unit_type = $obj->unit_type;
|
||||
$record->active = $obj->active;
|
||||
$this->records[$record->id] = $record;
|
||||
}
|
||||
}
|
||||
$this->db->free($resql);
|
||||
|
||||
return $this->records;
|
||||
} else {
|
||||
$this->errors[] = 'Error ' . $this->db->lasterror();
|
||||
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
||||
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Update object into database
|
||||
*
|
||||
* @param User $user User that modify
|
||||
* @param int $notrigger 0=launch triggers after, 1=disable triggers
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function update($user = null, $notrigger = 0)
|
||||
{
|
||||
global $conf, $langs;
|
||||
$error=0;
|
||||
|
||||
// Clean parameters
|
||||
if (isset($this->code)) $this->code=trim($this->code);
|
||||
if (isset($this->label)) $this->libelle=trim($this->label);
|
||||
if (isset($this->short_label)) $this->libelle=trim($this->short_label);
|
||||
if (isset($this->unit_type)) $this->libelle=trim($this->unit_type);
|
||||
if (isset($this->active)) $this->active=trim($this->active);
|
||||
|
||||
|
||||
// Check parameters
|
||||
// Put here code to add control on parameters values
|
||||
|
||||
// Update request
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."c_measuring_units SET";
|
||||
$sql.= " code=".(isset($this->code)?"'".$this->db->escape($this->code)."'":"null").",";
|
||||
$sql.= " label=".(isset($this->label)?"'".$this->db->escape($this->label)."'":"null").",";
|
||||
$sql.= " short_label=".(isset($this->short_label)?"'".$this->db->escape($this->short_label)."'":"null").",";
|
||||
$sql.= " unit_type=".(isset($this->unit_type)?"'".$this->db->escape($this->unit_type)."'":"null").",";
|
||||
$sql.= " active=".(isset($this->active)?$this->active:"null");
|
||||
$sql.= " WHERE rowid=".$this->id;
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
dol_syslog(get_class($this)."::update", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
if (! $notrigger)
|
||||
{
|
||||
// Uncomment this and change MYOBJECT to your own tag if you
|
||||
// want this action call a trigger.
|
||||
|
||||
//// Call triggers
|
||||
//include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||
//$interface=new Interfaces($this->db);
|
||||
//$result=$interface->run_triggers('MYOBJECT_MODIFY',$this,$user,$langs,$conf);
|
||||
//if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||
//// End call triggers
|
||||
}
|
||||
}
|
||||
|
||||
// Commit or rollback
|
||||
if ($error)
|
||||
{
|
||||
foreach($this->errors as $errmsg)
|
||||
{
|
||||
dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR);
|
||||
$this->error.=($this->error?', '.$errmsg:$errmsg);
|
||||
}
|
||||
$this->db->rollback();
|
||||
return -1*$error;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Delete object in database
|
||||
*
|
||||
* @param User $user User that delete
|
||||
* @param int $notrigger 0=launch triggers after, 1=disable triggers
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function delete($user, $notrigger = 0)
|
||||
{
|
||||
global $conf, $langs;
|
||||
$error=0;
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."c_measuring_units";
|
||||
$sql.= " WHERE rowid=".$this->id;
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
if (! $notrigger)
|
||||
{
|
||||
// Uncomment this and change MYOBJECT to your own tag if you
|
||||
// want this action call a trigger.
|
||||
|
||||
//// Call triggers
|
||||
//include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||
//$interface=new Interfaces($this->db);
|
||||
//$result=$interface->run_triggers('MYOBJECT_DELETE',$this,$user,$langs,$conf);
|
||||
//if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||
//// End call triggers
|
||||
}
|
||||
}
|
||||
|
||||
// Commit or rollback
|
||||
if ($error)
|
||||
{
|
||||
foreach($this->errors as $errmsg)
|
||||
{
|
||||
dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR);
|
||||
$this->error.=($this->error?', '.$errmsg:$errmsg);
|
||||
}
|
||||
$this->db->rollback();
|
||||
return -1*$error;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -41,6 +41,7 @@ class CUnits // extends CommonObject
|
||||
* @var string[] Error codes (or messages)
|
||||
*/
|
||||
public $errors = array();
|
||||
public $records = array();
|
||||
|
||||
//var $element='ctypent'; //!< Id that identify managed objects
|
||||
//var $table_element='ctypent'; //!< Name of table without prefix where object is stored
|
||||
@ -53,6 +54,8 @@ class CUnits // extends CommonObject
|
||||
public $code;
|
||||
public $label;
|
||||
public $short_label;
|
||||
public $unit_type;
|
||||
public $scale;
|
||||
public $active;
|
||||
|
||||
|
||||
@ -83,10 +86,11 @@ class CUnits // extends CommonObject
|
||||
|
||||
// Clean parameters
|
||||
|
||||
if (isset($this->id)) $this->id=trim($this->id);
|
||||
if (isset($this->id)) $this->id = (int) $this->id;
|
||||
if (isset($this->code)) $this->code=trim($this->code);
|
||||
if (isset($this->label)) $this->libelle=trim($this->label);
|
||||
if (isset($this->short_label)) $this->libelle=trim($this->short_label);
|
||||
if (isset($this->unit_type)) $this->active=trim($this->unit_type);
|
||||
if (isset($this->active)) $this->active=trim($this->active);
|
||||
|
||||
|
||||
@ -100,7 +104,8 @@ class CUnits // extends CommonObject
|
||||
$sql.= "rowid,";
|
||||
$sql.= "code,";
|
||||
$sql.= "label,";
|
||||
$sql.= "short_label";
|
||||
$sql.= "short_label,";
|
||||
$sql.= "unit_type";
|
||||
|
||||
|
||||
$sql.= ") VALUES (";
|
||||
@ -108,7 +113,8 @@ class CUnits // extends CommonObject
|
||||
$sql.= " ".(! isset($this->id)?'NULL':"'".$this->db->escape($this->id)."'").",";
|
||||
$sql.= " ".(! isset($this->code)?'NULL':"'".$this->db->escape($this->code)."'").",";
|
||||
$sql.= " ".(! isset($this->label)?'NULL':"'".$this->db->escape($this->label)."'").",";
|
||||
$sql.= " ".(! isset($this->short_label)?'NULL':"'".$this->db->active($this->short_label)."'");
|
||||
$sql.= " ".(! isset($this->short_label)?'NULL':"'".$this->db->escape($this->short_label)."'").",";
|
||||
$sql.= " ".(! isset($this->unit_type)?'NULL':"'".$this->db->escape($this->unit_type)."'");
|
||||
|
||||
$sql.= ")";
|
||||
|
||||
@ -122,8 +128,8 @@ class CUnits // extends CommonObject
|
||||
{
|
||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."c_units");
|
||||
|
||||
if (! $notrigger)
|
||||
{
|
||||
//if (! $notrigger)
|
||||
//{
|
||||
// Uncomment this and change MYOBJECT to your own tag if you
|
||||
// want this action call a trigger.
|
||||
|
||||
@ -133,7 +139,7 @@ class CUnits // extends CommonObject
|
||||
//$result=$interface->run_triggers('MYOBJECT_CREATE',$this,$user,$langs,$conf);
|
||||
//if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||
//// End call triggers
|
||||
}
|
||||
//}
|
||||
}
|
||||
|
||||
// Commit or rollback
|
||||
@ -160,22 +166,31 @@ class CUnits // extends CommonObject
|
||||
*
|
||||
* @param int $id Id object
|
||||
* @param string $code Code
|
||||
* @param string $short_label Label
|
||||
* @return int <0 if KO, >0 if OK
|
||||
* @param string $short_label Short Label
|
||||
* @param string $unit_type unit type
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function fetch($id, $code = '', $short_label = '')
|
||||
function fetch($id, $code = '', $short_label = '', $unit_type = '')
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$sql = "SELECT";
|
||||
$sql.= " t.rowid,";
|
||||
$sql.= " t.code,";
|
||||
$sql.= " t.label,";
|
||||
$sql.= " t.short_label,";
|
||||
$sql.= " t.unit_type,";
|
||||
$sql.= " t.active";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_units as t";
|
||||
if ($id) $sql.= " WHERE t.rowid = ".$id;
|
||||
elseif ($code) $sql.= " WHERE t.code = '".$this->db->escape($code)."'";
|
||||
elseif ($short_label) $sql.= " WHERE t.short_label = '".$this->db->escape($short_label)."'";
|
||||
$sql_where=array();
|
||||
if ($id) $sql_where[]= " t.id = ".$id;
|
||||
if ($unit_type) $sql_where[]= " t.unit_type = '".$this->db->escape($unit_type)."'";
|
||||
if ($code) $sql_where[]= " t.code = '".$this->db->escape($code)."'";
|
||||
if ($short_label) $sql_where[]= " t.short_label = '".$this->db->escape($short_label)."'";
|
||||
|
||||
if (count($sql_where)>0) {
|
||||
$sql.=' WHERE '. implode(' AND ', $sql_where);
|
||||
}
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
@ -188,6 +203,7 @@ class CUnits // extends CommonObject
|
||||
$this->code = $obj->code;
|
||||
$this->label = $obj->label;
|
||||
$this->short_label = $obj->short_label;
|
||||
$this->unit_type = $obj->unit_type;
|
||||
$this->active = $obj->active;
|
||||
}
|
||||
$this->db->free($resql);
|
||||
@ -202,6 +218,91 @@ class CUnits // extends CommonObject
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load list of objects in memory from the database.
|
||||
*
|
||||
* @param string $sortorder Sort Order
|
||||
* @param string $sortfield Sort field
|
||||
* @param int $limit limit
|
||||
* @param int $offset Offset
|
||||
* @param array $filter Filter array. Example array('field'=>'valueforlike', 'customurl'=>...)
|
||||
* @param string $filtermode Filter mode (AND or OR)
|
||||
* @return array|int int <0 if KO, array of pages if OK
|
||||
*/
|
||||
public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND')
|
||||
{
|
||||
global $conf;
|
||||
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
|
||||
$records=array();
|
||||
|
||||
$sql = 'SELECT';
|
||||
$sql.= " t.rowid,";
|
||||
$sql.= " t.code,";
|
||||
$sql.= " t.label,";
|
||||
$sql.= " t.short_label,";
|
||||
$sql.= " t.unit_type,";
|
||||
$sql.= " t.active";
|
||||
$sql .= ' FROM ' . MAIN_DB_PREFIX . 'c_units as t';
|
||||
// Manage filter
|
||||
$sqlwhere = array();
|
||||
if (count($filter) > 0) {
|
||||
foreach ($filter as $key => $value) {
|
||||
if ($key=='t.rowid' || $key=='t.active') {
|
||||
$sqlwhere[] = $key . '='. $value;
|
||||
}
|
||||
elseif (strpos($key, 'date') !== false) {
|
||||
$sqlwhere[] = $key.' = \''.$this->db->idate($value).'\'';
|
||||
}
|
||||
elseif ($key=='t.unit_type' || $key=='t.code' || $key=='t.short_label') {
|
||||
$sqlwhere[] = $key.' = \''.$this->db->escape($value).'\'';
|
||||
}
|
||||
else {
|
||||
$sqlwhere[] = $key . ' LIKE \'%' . $this->db->escape($value) . '%\'';
|
||||
}
|
||||
}
|
||||
}
|
||||
if (count($sqlwhere) > 0) {
|
||||
$sql .= ' WHERE (' . implode(' '.$filtermode.' ', $sqlwhere).')';
|
||||
}
|
||||
|
||||
if (!empty($sortfield)) {
|
||||
$sql .= $this->db->order($sortfield, $sortorder);
|
||||
}
|
||||
if (!empty($limit)) {
|
||||
$sql .= ' ' . $this->db->plimit($limit, $offset);
|
||||
}
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$this->records=array();
|
||||
$num = $this->db->num_rows($resql);
|
||||
if ($num>0) {
|
||||
while ($obj = $this->db->fetch_object($resql))
|
||||
{
|
||||
$record = new self($this->db);
|
||||
|
||||
$record->id = $obj->rowid;
|
||||
$record->code = $obj->code;
|
||||
$record->label = $obj->label;
|
||||
$record->short_label = $obj->short_label;
|
||||
$record->unit_type = $obj->unit_type;
|
||||
$record->active = $obj->active;
|
||||
$this->records[$record->id] = $record;
|
||||
}
|
||||
}
|
||||
$this->db->free($resql);
|
||||
|
||||
return $this->records;
|
||||
} else {
|
||||
$this->errors[] = 'Error ' . $this->db->lasterror();
|
||||
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
||||
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Update object into database
|
||||
*
|
||||
@ -218,6 +319,7 @@ class CUnits // extends CommonObject
|
||||
if (isset($this->code)) $this->code=trim($this->code);
|
||||
if (isset($this->label)) $this->libelle=trim($this->label);
|
||||
if (isset($this->short_label)) $this->libelle=trim($this->short_label);
|
||||
if (isset($this->unit_type)) $this->libelle=trim($this->unit_type);
|
||||
if (isset($this->active)) $this->active=trim($this->active);
|
||||
|
||||
|
||||
@ -229,6 +331,7 @@ class CUnits // extends CommonObject
|
||||
$sql.= " code=".(isset($this->code)?"'".$this->db->escape($this->code)."'":"null").",";
|
||||
$sql.= " label=".(isset($this->label)?"'".$this->db->escape($this->label)."'":"null").",";
|
||||
$sql.= " short_label=".(isset($this->short_label)?"'".$this->db->escape($this->short_label)."'":"null").",";
|
||||
$sql.= " unit_type=".(isset($this->unit_type)?"'".$this->db->escape($this->unit_type)."'":"null").",";
|
||||
$sql.= " active=".(isset($this->active)?$this->active:"null");
|
||||
$sql.= " WHERE rowid=".$this->id;
|
||||
|
||||
@ -238,10 +341,10 @@ class CUnits // extends CommonObject
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
if (! $notrigger)
|
||||
{
|
||||
//if (! $error)
|
||||
//{
|
||||
// if (! $notrigger)
|
||||
// {
|
||||
// Uncomment this and change MYOBJECT to your own tag if you
|
||||
// want this action call a trigger.
|
||||
|
||||
@ -251,8 +354,8 @@ class CUnits // extends CommonObject
|
||||
//$result=$interface->run_triggers('MYOBJECT_MODIFY',$this,$user,$langs,$conf);
|
||||
//if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||
//// End call triggers
|
||||
}
|
||||
}
|
||||
// }
|
||||
//}
|
||||
|
||||
// Commit or rollback
|
||||
if ($error)
|
||||
@ -294,10 +397,10 @@ class CUnits // extends CommonObject
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); }
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
if (! $notrigger)
|
||||
{
|
||||
//if (! $error)
|
||||
//{
|
||||
// if (! $notrigger)
|
||||
// {
|
||||
// Uncomment this and change MYOBJECT to your own tag if you
|
||||
// want this action call a trigger.
|
||||
|
||||
@ -307,8 +410,8 @@ class CUnits // extends CommonObject
|
||||
//$result=$interface->run_triggers('MYOBJECT_DELETE',$this,$user,$langs,$conf);
|
||||
//if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||
//// End call triggers
|
||||
}
|
||||
}
|
||||
// }
|
||||
//}
|
||||
|
||||
// Commit or rollback
|
||||
if ($error)
|
||||
|
||||
@ -367,6 +367,7 @@ class FormAccounting extends Form
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe";
|
||||
$sql .= " WHERE entity IN (" . getEntity('societe') . ")";
|
||||
$sql .= " ORDER BY code_compta";
|
||||
|
||||
dol_syslog(get_class($this)."::select_auxaccount", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
@ -377,7 +378,7 @@ class FormAccounting extends Form
|
||||
}
|
||||
} else {
|
||||
$this->error = "Error ".$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::select_pcgsubtype ".$this->error, LOG_ERR);
|
||||
dol_syslog(get_class($this)."::select_auxaccount ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
$this->db->free($resql);
|
||||
@ -397,11 +398,31 @@ class FormAccounting extends Form
|
||||
}
|
||||
} else {
|
||||
$this->error = "Error ".$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::select_pcgsubtype ".$this->error, LOG_ERR);
|
||||
dol_syslog(get_class($this)."::select_auxaccount ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
$this->db->free($resql);
|
||||
|
||||
// Auxiliary user account
|
||||
$sql = "SELECT DISTINCT accountancy_code, lastname, firstname ";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."user";
|
||||
$sql .= " WHERE entity IN (" . getEntity('user') . ")";
|
||||
$sql .= " ORDER BY accountancy_code";
|
||||
dol_syslog(get_class($this)."::select_auxaccount", LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
while ($obj = $this->db->fetch_object($resql)) {
|
||||
if (!empty($obj->accountancy_code)) {
|
||||
$aux_account[$obj->accountancy_code] = $obj->accountancy_code.' ('.dolGetFirstLastname($obj->firstname, $obj->lastname).')';
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$this->error = "Error ".$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::select_auxaccount ".$this->error, LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
$this->db->free($resql);
|
||||
|
||||
// Build select
|
||||
$out .= Form::selectarray($htmlname, $aux_account, $selectid, $showempty, 0, 0, '', 0, 0, 0, '', $morecss, 1);
|
||||
|
||||
|
||||
@ -106,7 +106,7 @@ function barcode_print($code, $encoding = "ANY", $scale = 2, $mode = "png")
|
||||
*
|
||||
* @param string $code Code
|
||||
* @param string $encoding Encoding
|
||||
* @return array array('encoding': the encoding which has been used, 'bars': the bars, 'text': text-positioning info)
|
||||
* @return array|false array('encoding': the encoding which has been used, 'bars': the bars, 'text': text-positioning info)
|
||||
*/
|
||||
function barcode_encode($code, $encoding)
|
||||
{
|
||||
@ -236,7 +236,7 @@ function barcode_encode_ean($ean, $encoding = "EAN-13")
|
||||
*
|
||||
* @param string $code Code
|
||||
* @param string $encoding Encoding
|
||||
* @return array array('encoding': the encoding which has been used, 'bars': the bars, 'text': text-positioning info)
|
||||
* @return array|false array('encoding': the encoding which has been used, 'bars': the bars, 'text': text-positioning info)
|
||||
*/
|
||||
function barcode_encode_genbarcode($code, $encoding)
|
||||
{
|
||||
|
||||
@ -488,7 +488,7 @@ function getCountry($searchkey, $withcode = '', $dbtouse = 0, $outputlangs = '',
|
||||
* '1'=Add region name/code/id as needed to output,
|
||||
* @param Translate $outputlangs Langs object for output translation, not fully implemented yet
|
||||
* @param int $entconv 0=Return value without entities and not converted to output charset, 1=Ready for html output
|
||||
* @return mixed String with state code or state name or Array('id','code','label')/Array('id','code','label','region_code','region')
|
||||
* @return string|array String with state code or state name or Array('id','code','label')/Array('id','code','label','region_code','region')
|
||||
*/
|
||||
function getState($id, $withcode = '', $dbtouse = 0, $withregion = 0, $outputlangs = '', $entconv = 1)
|
||||
{
|
||||
@ -715,7 +715,7 @@ function isInEEC($object)
|
||||
* @param string $backtopage Url to go once contact is created
|
||||
* @param int $nocreatelink 1=Hide create project link
|
||||
* @param string $morehtmlright More html on right of title
|
||||
* @return void
|
||||
* @return int
|
||||
*/
|
||||
function show_projects($conf, $langs, $db, $object, $backtopage = '', $nocreatelink = 0, $morehtmlright = '')
|
||||
{
|
||||
@ -843,7 +843,7 @@ function show_projects($conf, $langs, $db, $object, $backtopage = '', $nocreatel
|
||||
* @param DoliDB $db Database handler
|
||||
* @param Societe $object Third party object
|
||||
* @param string $backtopage Url to go once contact is created
|
||||
* @return void
|
||||
* @return int
|
||||
*/
|
||||
function show_contacts($conf, $langs, $db, $object, $backtopage = '')
|
||||
{
|
||||
@ -856,8 +856,8 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '')
|
||||
$sortfield = GETPOST("sortfield", 'alpha');
|
||||
$sortorder = GETPOST("sortorder", 'alpha');
|
||||
$page = GETPOST('page', 'int');
|
||||
$search_status = GETPOST("search_status", 'int');
|
||||
if ($search_status=='') $search_status=1; // always display activ customer first
|
||||
$search_status = GETPOST("search_status", 'int');
|
||||
if ($search_status=='') $search_status=1; // always display active customer first
|
||||
$search_name = GETPOST("search_name", 'alpha');
|
||||
$search_addressphone = GETPOST("search_addressphone", 'alpha');
|
||||
|
||||
@ -1174,7 +1174,7 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '')
|
||||
* @param DoliDB $db Database handler
|
||||
* @param Societe $object Third party object
|
||||
* @param string $backtopage Url to go once address is created
|
||||
* @return void
|
||||
* @return int
|
||||
*/
|
||||
function show_addresses($conf, $langs, $db, $object, $backtopage = '')
|
||||
{
|
||||
@ -1261,14 +1261,14 @@ function show_addresses($conf, $langs, $db, $object, $backtopage = '')
|
||||
/**
|
||||
* Show html area with actions to do
|
||||
*
|
||||
* @param Conf $conf Object conf
|
||||
* @param Translate $langs Object langs
|
||||
* @param DoliDB $db Object db
|
||||
* @param Adherent|Societe $filterobj Object third party or member
|
||||
* @param Contact $objcon Object contact
|
||||
* @param int $noprint Return string but does not output it
|
||||
* @param int $actioncode Filter on actioncode
|
||||
* @return mixed Return html part or void if noprint is 1
|
||||
* @param Conf $conf Object conf
|
||||
* @param Translate $langs Object langs
|
||||
* @param DoliDB $db Object db
|
||||
* @param Adherent|Societe $filterobj Object thirdparty or member
|
||||
* @param Contact $objcon Object contact
|
||||
* @param int $noprint Return string but does not output it
|
||||
* @param int $actioncode Filter on actioncode
|
||||
* @return string|void Return html part or void if noprint is 1
|
||||
*/
|
||||
function show_actions_todo($conf, $langs, $db, $filterobj, $objcon = '', $noprint = 0, $actioncode = '')
|
||||
{
|
||||
@ -1294,7 +1294,7 @@ function show_actions_todo($conf, $langs, $db, $filterobj, $objcon = '', $noprin
|
||||
* @param array $filters Filter on other fields
|
||||
* @param string $sortfield Sort field
|
||||
* @param string $sortorder Sort order
|
||||
* @return mixed Return html part or void if noprint is 1
|
||||
* @return string|void Return html part or void if noprint is 1
|
||||
*/
|
||||
function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprint = 0, $actioncode = '', $donetodo = 'done', $filters = array(), $sortfield = 'a.datep,a.id', $sortorder = 'DESC')
|
||||
{
|
||||
@ -1761,7 +1761,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin
|
||||
* @param Translate $langs Object langs
|
||||
* @param DoliDB $db Database handler
|
||||
* @param Societe $object Third party object
|
||||
* @return void
|
||||
* @return int
|
||||
*/
|
||||
function show_subsidiaries($conf, $langs, $db, $object)
|
||||
{
|
||||
|
||||
@ -27,11 +27,11 @@
|
||||
* Function to return number in text.
|
||||
*
|
||||
*
|
||||
* @param float $num Number to convert
|
||||
* @param Lang $langs Language
|
||||
* @param boolean $currency 0=number to translate | 1=currency to translate
|
||||
* @param boolean $centimes 0=no centimes | 1=centimes to translate
|
||||
* @return string Text of the number
|
||||
* @param float $num Number to convert
|
||||
* @param Translate $langs Language
|
||||
* @param boolean $currency 0=number to translate | 1=currency to translate
|
||||
* @param boolean $centimes 0=no centimes | 1=centimes to translate
|
||||
* @return string|false Text of the number
|
||||
*/
|
||||
function dol_convertToWord($num, $langs, $currency = false, $centimes = false)
|
||||
{
|
||||
|
||||
@ -391,7 +391,9 @@ function print_left_auguria_menu($db, $menu_array_before, $menu_array_after, &$t
|
||||
|
||||
if ($nature)
|
||||
{
|
||||
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy/', $leftmenu)) $newmenu->add('/accountancy/journal/'.$nature.'journal.php?mainmenu=accountancy&leftmenu=accountancy_journal&id_journal='.$objp->rowid, dol_trunc($objp->label, 25), 2, $user->rights->accounting->comptarapport->lire);
|
||||
$langs->load('accountancy');
|
||||
$journallabel=$langs->transnoentities($objp->label); // Labels in this table are set by loading llx_accounting_abc.sql. Label can be 'ACCOUNTING_SELL_JOURNAL', 'InventoryJournal', ...
|
||||
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy/', $leftmenu)) $newmenu->add('/accountancy/journal/'.$nature.'journal.php?mainmenu=accountancy&leftmenu=accountancy_journal&id_journal='.$objp->rowid, $journallabel, 2, $user->rights->accounting->comptarapport->lire);
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
|
||||
@ -61,11 +61,11 @@ class mod_expensereport_sand extends ModeleNumRefExpenseReport
|
||||
*/
|
||||
function info()
|
||||
{
|
||||
global $conf, $langs;
|
||||
global $db, $conf, $langs;
|
||||
|
||||
$langs->load("bills");
|
||||
|
||||
$form = new Form($this->db);
|
||||
$form = new Form($db);
|
||||
|
||||
$texte = $langs->trans('GenericNumRefModelDesc')."<br>\n";
|
||||
$texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
@ -101,9 +101,9 @@ class mod_expensereport_sand extends ModeleNumRefExpenseReport
|
||||
*/
|
||||
function getExample()
|
||||
{
|
||||
global $conf,$langs,$user;
|
||||
global $db, $conf,$langs,$user;
|
||||
|
||||
$exp=new ExpenseReport($this->db);
|
||||
$exp=new ExpenseReport($db);
|
||||
$exp->initAsSpecimen();
|
||||
$exp->fk_user_author = $user->id;
|
||||
|
||||
|
||||
@ -52,11 +52,11 @@ class mod_facture_mercure extends ModeleNumRefFactures
|
||||
*/
|
||||
function info()
|
||||
{
|
||||
global $conf, $langs;
|
||||
global $db, $conf, $langs;
|
||||
|
||||
$langs->load("bills");
|
||||
|
||||
$form = new Form($this->db);
|
||||
$form = new Form($db);
|
||||
|
||||
$texte = $langs->trans('GenericNumRefModelDesc')."<br>\n";
|
||||
$texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
|
||||
@ -62,11 +62,11 @@ class mod_holiday_immaculate extends ModelNumRefHolidays
|
||||
*/
|
||||
function info()
|
||||
{
|
||||
global $conf, $langs;
|
||||
global $db, $conf, $langs;
|
||||
|
||||
$langs->load("bills");
|
||||
|
||||
$form = new Form($this->db);
|
||||
$form = new Form($db);
|
||||
|
||||
$texte = $langs->trans('GenericNumRefModelDesc')."<br>\n";
|
||||
$texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
|
||||
@ -146,9 +146,9 @@ class ModelNumRefHolidays
|
||||
$langs->load("admin");
|
||||
|
||||
if ($this->version == 'development') return $langs->trans("VersionDevelopment");
|
||||
if ($this->version == 'experimental') return $langs->trans("VersionExperimental");
|
||||
if ($this->version == 'dolibarr') return DOL_VERSION;
|
||||
if ($this->version) return $this->version;
|
||||
elseif ($this->version == 'experimental') return $langs->trans("VersionExperimental");
|
||||
elseif ($this->version == 'dolibarr') return DOL_VERSION;
|
||||
elseif ($this->version) return $this->version;
|
||||
return $langs->trans("NotAvailable");
|
||||
}
|
||||
}
|
||||
|
||||
@ -280,7 +280,7 @@ class modAdherent extends DolibarrModules
|
||||
'a.civility'=>"Text",'a.lastname'=>"Text",'a.firstname'=>"Text",'a.login'=>"Text",'a.gender'=>'Text','a.morphy'=>'Text','a.societe'=>'Text','a.address'=>"Text",
|
||||
'a.zip'=>"Text",'a.town'=>"Text",'d.nom'=>"Text",'co.code'=>'Text','co.label'=>"Text",'a.phone'=>"Text",'a.phone_perso'=>"Text",'a.phone_mobile'=>"Text",
|
||||
'a.email'=>"Text",'a.birth'=>"Date",'a.statut'=>"Status",'a.note_public'=>"Text",'a.note_private'=>"Text",'a.datec'=>'Date','a.datevalid'=>'Date',
|
||||
'a.tms'=>'Date','a.datefin'=>'Date','ta.rowid'=>'List:adherent_type:libelle','ta.libelle'=>'Text','c.rowid'=>'Numeric','c.dateadh'=>'Date','c.subscription'=>'Numeric'
|
||||
'a.tms'=>'Date','a.datefin'=>'Date','ta.rowid'=>'List:adherent_type:libelle::member_type','ta.libelle'=>'Text','c.rowid'=>'Numeric','c.dateadh'=>'Date','c.subscription'=>'Numeric'
|
||||
);
|
||||
$this->export_entities_array[$r]=array(
|
||||
'a.rowid'=>'member','a.civility'=>"member",'a.lastname'=>"member",'a.firstname'=>"member",'a.login'=>"member",'a.gender'=>'member','a.morphy'=>'member',
|
||||
|
||||
@ -223,7 +223,7 @@ class modCommande extends DolibarrModules
|
||||
'c.date_commande'=>"Date",'c.date_livraison'=>"Date",'c.amount_ht'=>"Numeric",'c.remise_percent'=>"Numeric",'c.total_ht'=>"Numeric",
|
||||
'c.total_ttc'=>"Numeric",'c.facture'=>"Boolean",'c.fk_statut'=>'Status','c.note_public'=>"Text",'c.date_livraison'=>'Date','pj.ref'=>'Text',
|
||||
'cd.description'=>"Text",'cd.product_type'=>'Boolean','cd.tva_tx'=>"Numeric",'cd.qty'=>"Numeric",'cd.total_ht'=>"Numeric",'cd.total_tva'=>"Numeric",
|
||||
'cd.total_ttc'=>"Numeric",'p.rowid'=>'List:product:ref','p.ref'=>'Text','p.label'=>'Text','d.nom'=>'Text'
|
||||
'cd.total_ttc'=>"Numeric",'p.rowid'=>'List:product:ref::product','p.ref'=>'Text','p.label'=>'Text','d.nom'=>'Text'
|
||||
);
|
||||
$this->export_entities_array[$r]=array(
|
||||
's.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','d.nom'=>'company','co.label'=>'company',
|
||||
|
||||
@ -431,8 +431,8 @@ class modProduct extends DolibarrModules
|
||||
'p.recuperableonly' => '^[0|1]$',
|
||||
'p.finished' => '^[0|1]$'
|
||||
);
|
||||
|
||||
// field order as per structure of table llx_product
|
||||
|
||||
// field order as per structure of table llx_product
|
||||
$import_sample = array(
|
||||
'p.ref' => "PREF123456",
|
||||
'p.datec' => 'formatted as '.dol_print_date(dol_now(), '%Y-%m-%d'),
|
||||
@ -455,17 +455,17 @@ class modProduct extends DolibarrModules
|
||||
'p.accountancy_code_sell' => "",
|
||||
'p.accountancy_code_buy' => "",
|
||||
'p.weight' => "",
|
||||
'p.weight_units' => 'use a unit of measure from the dictionary. g/Kg/T etc....matches field "Short Label" for unit type "weight" in table "' . MAIN_DB_PREFIX . 'c_measuring_units',
|
||||
'p.weight_units' => 'use a unit of measure from the dictionary. g/Kg/T etc....matches field "Short Label" for unit type "weight" in table "' . MAIN_DB_PREFIX . 'c_units',
|
||||
'p.length' => "",
|
||||
'p.length_units' => 'use a unit of measure from the dictionary. m/cm/mm etc....matches field "Short Label" for unit type "size" in table "' . MAIN_DB_PREFIX . 'c_measuring_units',
|
||||
'p.length_units' => 'use a unit of measure from the dictionary. m/cm/mm etc....matches field "Short Label" for unit type "size" in table "' . MAIN_DB_PREFIX . 'c_units',
|
||||
'p.width' => "",
|
||||
'p.width_units' => 'use a unit of measure from the dictionary. m/cm/mm etc....matches field "Short Label" for unit type "size" in table "' . MAIN_DB_PREFIX . 'c_measuring_units',
|
||||
'p.width_units' => 'use a unit of measure from the dictionary. m/cm/mm etc....matches field "Short Label" for unit type "size" in table "' . MAIN_DB_PREFIX . 'c_units',
|
||||
'p.height' => "",
|
||||
'p.height_units' => 'use a unit of measure from the dictionary. m/cm/mm etc....matches field "Short Label" for unit type "size" in table "' . MAIN_DB_PREFIX . 'c_measuring_units',
|
||||
'p.height_units' => 'use a unit of measure from the dictionary. m/cm/mm etc....matches field "Short Label" for unit type "size" in table "' . MAIN_DB_PREFIX . 'c_units',
|
||||
'p.surface' => "",
|
||||
'p.surface_units' => 'use a unit of measure from the dictionary. m2/cm2/mm2 etc....matches field "Short Label" for unit type "surface" in table "' . MAIN_DB_PREFIX . 'c_measuring_units',
|
||||
'p.surface_units' => 'use a unit of measure from the dictionary. m2/cm2/mm2 etc....matches field "Short Label" for unit type "surface" in table "' . MAIN_DB_PREFIX . 'c_units',
|
||||
'p.volume' => "",
|
||||
'p.volume_units' => 'use a unit of measure from the dictionary. m3/cm3/mm3 etc....matches field "Short Label" for unit type "volume" in table "' . MAIN_DB_PREFIX . 'c_measuring_units',
|
||||
'p.volume_units' => 'use a unit of measure from the dictionary. m3/cm3/mm3 etc....matches field "Short Label" for unit type "volume" in table "' . MAIN_DB_PREFIX . 'c_units',
|
||||
'p.finished' => '0 (raw material) / 1 (finished goods)'
|
||||
);
|
||||
//clauses copied from import_fields_array
|
||||
|
||||
@ -217,9 +217,9 @@ class modProjet extends DolibarrModules
|
||||
$this->export_permission[$r]=array(array("projet","export"));
|
||||
$this->export_dependencies_array[$r]=array('projecttask'=>'pt.rowid', 'task_time'=>'ptt.rowid');
|
||||
|
||||
$this->export_TypeFields_array[$r]=array('s.rowid'=>"List:societe:nom",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','s.fk_pays'=>'List:c_country:label',
|
||||
$this->export_TypeFields_array[$r]=array('s.rowid'=>"List:societe:nom::thirdparty",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','s.fk_pays'=>'List:c_country:label',
|
||||
's.phone'=>'Text','s.email'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text',
|
||||
'p.rowid'=>"List:projet:ref",'p.ref'=>"Text",'p.title'=>"Text",'p.datec'=>"Date",'p.dateo'=>"Date",'p.datee'=>"Date",'p.fk_statut'=>'Status','cls.code'=>"Text",'p.opp_percent'=>'Numeric','p.opp_amount'=>'Numeric','p.description'=>"Text",'p.entity'=>'Numeric',
|
||||
'p.rowid'=>"List:projet:ref::project",'p.ref'=>"Text",'p.title'=>"Text",'p.datec'=>"Date",'p.dateo'=>"Date",'p.datee'=>"Date",'p.fk_statut'=>'Status','cls.code'=>"Text",'p.opp_percent'=>'Numeric','p.opp_amount'=>'Numeric','p.description'=>"Text",'p.entity'=>'Numeric',
|
||||
'pt.rowid'=>'Text','pt.label'=>'Text','pt.dateo'=>"Date",'pt.datee'=>"Date",'pt.duration_effective'=>"Duree",'pt.planned_workload'=>"Numeric",'pt.progress'=>"Numeric",'pt.description'=>"Text",
|
||||
'ptt.rowid'=>'Numeric','ptt.task_date'=>'Date','ptt.task_duration'=>"Duree",'ptt.fk_user'=>"List:user:CONCAT(lastname,' ',firstname)",'ptt.note'=>"Text");
|
||||
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','s.fk_pays'=>'company',
|
||||
|
||||
@ -339,7 +339,7 @@ class modSociete extends DolibarrModules
|
||||
$this->export_TypeFields_array[$r]=array(
|
||||
'c.civility'=>"List:c_civility:label:code",'c.lastname'=>'Text','c.firstname'=>'Text','c.poste'=>'Text','c.datec'=>"Date",'c.priv'=>"Boolean",
|
||||
'c.address'=>"Text",'c.zip'=>"Text",'c.town'=>"Text",'d.nom'=>'Text','co.label'=>"List:c_country:label:rowid",'co.code'=>"Text",'c.phone'=>"Text",
|
||||
'c.fax'=>"Text",'c.email'=>"Text",'s.rowid'=>"List:societe:nom",'s.nom'=>"Text",'s.status'=>"Status",'s.code_client'=>"Text",'s.code_fournisseur'=>"Text",
|
||||
'c.fax'=>"Text",'c.email'=>"Text",'s.rowid'=>"List:societe:nom::thirdparty",'s.nom'=>"Text",'s.status'=>"Status",'s.code_client'=>"Text",'s.code_fournisseur'=>"Text",
|
||||
's.client'=>"Text",'s.fournisseur'=>"Text"
|
||||
);
|
||||
$this->export_entities_array[$r]=array(
|
||||
|
||||
@ -148,31 +148,31 @@ class modStock extends DolibarrModules
|
||||
$this->rights[4][4] = 'mouvement';
|
||||
$this->rights[4][5] = 'creer';
|
||||
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL >= 2) {
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
|
||||
{
|
||||
$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] = '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[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] = '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] = 'inventory_advance'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
|
||||
$this->rights[6][5] = 'write'; // 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] = 'inventory_advance'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
|
||||
$this->rights[6][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] = '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[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] = '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] = '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)
|
||||
$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] = '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)
|
||||
}
|
||||
|
||||
// Main menu entries
|
||||
@ -199,7 +199,7 @@ class modStock extends DolibarrModules
|
||||
'p.tms'=>'DateModification','p.pmp'=>'PMPValue','p.cost_price'=>'CostPrice'
|
||||
);
|
||||
$this->export_TypeFields_array[$r]=array(
|
||||
'e.rowid'=>'List:entrepot:ref','e.ref'=>'Text','e.lieu'=>'Text','e.address'=>'Text','e.zip'=>'Text','e.town'=>'Text','p.rowid'=>"List:product:label",
|
||||
'e.rowid'=>'List:entrepot:ref::stock','e.ref'=>'Text','e.lieu'=>'Text','e.address'=>'Text','e.zip'=>'Text','e.town'=>'Text','p.rowid'=>"List:product:label::product",
|
||||
'p.ref'=>"Text",'p.fk_product_type'=>"Text",'p.label'=>"Text",'p.description'=>"Text",'p.note'=>"Text",'p.price'=>"Numeric",'p.tva_tx'=>'Numeric',
|
||||
'p.tosell'=>"Boolean",'p.tobuy'=>"Boolean",'p.duration'=>"Duree",'p.datec'=>'Date','p.tms'=>'Date','p.pmp'=>'Numeric','p.cost_price'=>'Numeric',
|
||||
'ps.reel'=>'Numeric'
|
||||
@ -211,7 +211,7 @@ class modStock extends DolibarrModules
|
||||
'p.datec'=>'product','p.tms'=>'product','p.pmp'=>'product','p.cost_price'=>'product','ps.reel'=>'stock'
|
||||
);
|
||||
$this->export_aggregate_array[$r]=array('ps.reel'=>'SUM'); // TODO Not used yet
|
||||
$this->export_dependencies_array[$r]=array('stock'=>array('p.rowid','e.rowid')); // We must keep this until the aggregate_array is used. To add unique key if we ask a field of a child to avoid the DISTINCT to discard them.
|
||||
$this->export_dependencies_array[$r]=array('stock'=>array('p.rowid','e.rowid')); // We must keep this until the aggregate_array is used. To have a unique key, if we ask a field of a child, to avoid the DISTINCT to discard them.
|
||||
$keyforselect='product'; $keyforelement='product'; $keyforaliasextra='extra';
|
||||
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
|
||||
$this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('ps.reel'=>'Stock'));
|
||||
@ -238,8 +238,8 @@ class modStock extends DolibarrModules
|
||||
'p.tms'=>'DateModification','pb.rowid'=>'Id','pb.batch'=>'Batch','pb.qty'=>'Qty','pl.eatby'=>'EatByDate','pl.sellby'=>'SellByDate'
|
||||
);
|
||||
$this->export_TypeFields_array[$r]=array(
|
||||
'e.rowid'=>'List:entrepot:ref','e.ref'=>'Text','e.lieu'=>'Text','e.description'=>'Text','e.address'=>'Text','e.zip'=>'Text','e.town'=>'Text',
|
||||
'p.rowid'=>"List:product:label",'p.ref'=>"Text",'p.fk_product_type'=>"Text",'p.label'=>"Text",'p.description'=>"Text",'p.note'=>"Text",
|
||||
'e.rowid'=>'List:entrepot:ref::stock','e.ref'=>'Text','e.lieu'=>'Text','e.description'=>'Text','e.address'=>'Text','e.zip'=>'Text','e.town'=>'Text',
|
||||
'p.rowid'=>"List:product:label::product",'p.ref'=>"Text",'p.fk_product_type'=>"Text",'p.label'=>"Text",'p.description'=>"Text",'p.note'=>"Text",
|
||||
'p.price'=>"Numeric",'p.tva_tx'=>'Numeric','p.tosell'=>"Boolean",'p.tobuy'=>"Boolean",'p.duration'=>"Duree",'p.datec'=>'Date','p.tms'=>'Date',
|
||||
'pb.batch'=>'Text','pb.qty'=>'Numeric','pl.eatby'=>'Date','pl.sellby'=>'Date'
|
||||
);
|
||||
@ -276,8 +276,8 @@ class modStock extends DolibarrModules
|
||||
'sm.inventorycode'=>'InventoryCode'
|
||||
);
|
||||
$this->export_TypeFields_array[$r]=array(
|
||||
'e.rowid'=>'List:entrepot:ref','e.ref'=>'Text','e.description'=>'Text','e.lieu'=>'Text','e.address'=>'Text','e.zip'=>'Text','e.town'=>'Text',
|
||||
'p.rowid'=>"List:product:label",'p.ref'=>"Text",'p.fk_product_type'=>"Text",'p.label'=>"Text",'p.description'=>"Text",'p.note'=>"Text",
|
||||
'e.rowid'=>'List:entrepot:ref::stock','e.ref'=>'Text','e.description'=>'Text','e.lieu'=>'Text','e.address'=>'Text','e.zip'=>'Text','e.town'=>'Text',
|
||||
'p.rowid'=>"List:product:label::product",'p.ref'=>"Text",'p.fk_product_type'=>"Text",'p.label'=>"Text",'p.description'=>"Text",'p.note'=>"Text",
|
||||
'p.price'=>"Numeric",'p.tva_tx'=>'Numeric','p.tosell'=>"Boolean",'p.tobuy'=>"Boolean",'p.duration'=>"Duree",'p.datec'=>'Date','p.tms'=>'Date',
|
||||
'sm.rowid'=>'Numeric','sm.value'=>'Numeric','sm.datem'=>'Date','sm.batch'=>'Text','sm.label'=>'Text','sm.inventorycode'=>'Text'
|
||||
);
|
||||
|
||||
@ -61,11 +61,11 @@ class mod_payment_ant extends ModeleNumRefPayments
|
||||
*/
|
||||
function info()
|
||||
{
|
||||
global $conf, $langs;
|
||||
global $db, $conf, $langs;
|
||||
|
||||
$langs->load("bills");
|
||||
|
||||
$form = new Form($this->db);
|
||||
$form = new Form($db);
|
||||
|
||||
$texte = $langs->trans('GenericNumRefModelDesc')."<br>\n";
|
||||
$texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
|
||||
@ -63,12 +63,12 @@ class mod_commande_fournisseur_orchidee extends ModeleNumRefSuppliersOrders
|
||||
*/
|
||||
function info()
|
||||
{
|
||||
global $conf, $langs;
|
||||
global $db, $conf, $langs;
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("bills","admin"));
|
||||
|
||||
$form = new Form($this->db);
|
||||
$form = new Form($db);
|
||||
|
||||
$texte = $langs->trans('GenericNumRefModelDesc')."<br>\n";
|
||||
$texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file ticket/core/modules/ticket/mod_ticket_universal.php
|
||||
* \file htdocs/core/modules/ticket/mod_ticket_universal.php
|
||||
* \ingroup ticket
|
||||
* \brief Fichier contenant la classe du modele de numerotation de reference de projet Universal
|
||||
*/
|
||||
@ -59,12 +59,12 @@ class mod_ticket_universal extends ModeleNumRefTicket
|
||||
*/
|
||||
public function info()
|
||||
{
|
||||
global $conf, $langs;
|
||||
global $db, $conf, $langs;
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("ticket","admin"));
|
||||
|
||||
$form = new Form($this->db);
|
||||
$form = new Form($db);
|
||||
|
||||
$texte = $langs->trans('GenericNumRefModelDesc') . "<br>\n";
|
||||
$texte .= '<form action="' . $_SERVER["PHP_SELF"] . '" method="POST">';
|
||||
|
||||
@ -99,39 +99,57 @@ class InterfaceMailmanSpipsynchro extends DolibarrTriggers
|
||||
}
|
||||
|
||||
// Members
|
||||
elseif ($action == 'MEMBER_VALIDATE' || $action == 'MEMBER_MODIFY')
|
||||
elseif ($action == 'MEMBER_VALIDATE')
|
||||
{
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||
|
||||
$return=0;
|
||||
$return=0;
|
||||
if ($object->add_to_abo() < 0)
|
||||
{
|
||||
if (! empty($object->error)) $this->error=$object->error;
|
||||
$this->errors=$object->errors;
|
||||
$return=-1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$return=1;
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
elseif ($action == 'MEMBER_MODIFY')
|
||||
{
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||
|
||||
$return=0;
|
||||
// Add user into some linked tools (mailman, spip, etc...)
|
||||
if (($object->oldcopy->email != $object->email) || ($object->oldcopy->typeid != $object->typeid)) // TODO Do del/add also if type change
|
||||
{
|
||||
if (is_object($object->oldcopy) && ($object->oldcopy->email != $object->email)) // If email has changed we delete mailman subscription for old email
|
||||
{
|
||||
if ($object->oldcopy->del_to_abo() < 0)
|
||||
{
|
||||
if (! empty($object->oldcopy->error)) $this->error=$object->oldcopy->error;
|
||||
$this->errors=$object->oldcopy->errors;
|
||||
$return=-1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$return=1;
|
||||
}
|
||||
}
|
||||
// We add subscription if new email or new type (new type may means more mailing-list to subscribe)
|
||||
if ($object->add_to_abo() < 0)
|
||||
{
|
||||
if (! empty($object->error)) $this->error=$object->error;
|
||||
$this->errors=$object->errors;
|
||||
$return=-1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$return=1;
|
||||
}
|
||||
}
|
||||
if (($object->oldcopy->email != $object->email) || ($object->oldcopy->typeid != $object->typeid))
|
||||
{
|
||||
if (is_object($object->oldcopy) && (($object->oldcopy->email != $object->email) || ($object->oldcopy->typeid != $object->typeid))) // If email has changed or if list has changed we delete mailman subscription for old email
|
||||
{
|
||||
if ($object->oldcopy->del_to_abo() < 0)
|
||||
{
|
||||
if (! empty($object->oldcopy->error)) $this->error=$object->oldcopy->error;
|
||||
$this->errors=$object->oldcopy->errors;
|
||||
$return=-1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$return=1;
|
||||
}
|
||||
}
|
||||
// We add subscription if new email or new type (new type may means more mailing-list to subscribe)
|
||||
if ($object->add_to_abo() < 0)
|
||||
{
|
||||
if (! empty($object->error)) $this->error=$object->error;
|
||||
$this->errors=$object->errors;
|
||||
$return=-1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$return=1;
|
||||
}
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
@ -422,7 +422,9 @@ class Export
|
||||
// 1 : Nom de la table
|
||||
// 2 : Nom du champ contenant le libelle
|
||||
// 3 : Name of field with key (if it is not "rowid"). Used this field as key for combo list.
|
||||
if (count($InfoFieldList)==4)
|
||||
// 4 : Name of element for getEntity().
|
||||
|
||||
if (! empty($InfoFieldList[3]))
|
||||
$keyList=$InfoFieldList[3];
|
||||
else
|
||||
$keyList='rowid';
|
||||
@ -430,6 +432,9 @@ class Export
|
||||
if ($InfoFieldList[1] == 'c_stcomm') $sql = 'SELECT id as id, '.$keyList.' as rowid, '.$InfoFieldList[2].' as label'.(empty($InfoFieldList[3])?'':', '.$InfoFieldList[3].' as code');
|
||||
if ($InfoFieldList[1] == 'c_country') $sql = 'SELECT '.$keyList.' as rowid, '.$InfoFieldList[2].' as label, code as code';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX .$InfoFieldList[1];
|
||||
if (! empty($InfoFieldList[4])) {
|
||||
$sql.= ' WHERE entity IN ('.getEntity($InfoFieldList[4]).')';
|
||||
}
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
|
||||
@ -1,51 +0,0 @@
|
||||
-- ========================================================================
|
||||
-- Copyright (C) 2001-2002,2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
-- Copyright (C) 2004 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
-- Copyright (C) 2019 Florian Henry <florian.henry@atm-consulitng.fr>
|
||||
-- This program is free software; you can redistribute it and/or modify
|
||||
-- it under the terms of the GNU General Public License as published by
|
||||
-- the Free Software Foundation; either version 2 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/>.
|
||||
--
|
||||
-- ========================================================================
|
||||
|
||||
INSERT INTO llx_c_measuring_units (code, label, short_label, unit_type, active) VALUES ('3','WeightUnitton','T', 'weight', 1);
|
||||
INSERT INTO llx_c_measuring_units (code, label, short_label, unit_type, active) VALUES ('0','WeightUnitkg','Kg', 'weight', 1);
|
||||
INSERT INTO llx_c_measuring_units (code, label, short_label, unit_type, active) VALUES ('-3','WeightUnitg','g', 'weight', 1);
|
||||
INSERT INTO llx_c_measuring_units (code, label, short_label, unit_type, active) VALUES ('-6','WeightUnitmg','g', 'weight', 1);
|
||||
INSERT INTO llx_c_measuring_units (code, label, short_label, unit_type, active) VALUES ('98','WeightUnitounce','Oz', 'weight', 1);
|
||||
INSERT INTO llx_c_measuring_units (code, label, short_label, unit_type, active) VALUES ('99','WeightUnitpound','lb', 'weight', 1);
|
||||
|
||||
INSERT INTO llx_c_measuring_units (code, label, short_label, unit_type, active) VALUES ('0','SizeUnitm','m', 'size', 1);
|
||||
INSERT INTO llx_c_measuring_units (code, label, short_label, unit_type, active) VALUES ('-1','SizeUnitdm','dm', 'size', 1);
|
||||
INSERT INTO llx_c_measuring_units (code, label, short_label, unit_type, active) VALUES ('-2','SizeUnitcm','cm', 'size', 1);
|
||||
INSERT INTO llx_c_measuring_units (code, label, short_label, unit_type, active) VALUES ('-3','SizeUnitmm','mm', 'size', 1);
|
||||
INSERT INTO llx_c_measuring_units (code, label, short_label, unit_type, active) VALUES ('98','SizeUnitfoot','ft', 'size', 1);
|
||||
INSERT INTO llx_c_measuring_units (code, label, short_label, unit_type, active) VALUES ('99','SizeUnitinch','in', 'size', 1);
|
||||
|
||||
INSERT INTO llx_c_measuring_units (code, label, short_label, unit_type, active) VALUES ('0','SurfaceUnitm2','m2', 'surface', 1);
|
||||
INSERT INTO llx_c_measuring_units (code, label, short_label, unit_type, active) VALUES ('-2','SurfaceUnitdm2','dm2', 'surface', 1);
|
||||
INSERT INTO llx_c_measuring_units (code, label, short_label, unit_type, active) VALUES ('-4','SurfaceUnitcm2','cm2', 'surface', 1);
|
||||
INSERT INTO llx_c_measuring_units (code, label, short_label, unit_type, active) VALUES ('-6','SurfaceUnitmm2','mm2', 'surface', 1);
|
||||
INSERT INTO llx_c_measuring_units (code, label, short_label, unit_type, active) VALUES ('98','SurfaceUnitfoot2','ft2', 'surface', 1);
|
||||
INSERT INTO llx_c_measuring_units (code, label, short_label, unit_type, active) VALUES ('99','SurfaceUnitinch2','in2', 'surface', 1);
|
||||
|
||||
|
||||
INSERT INTO llx_c_measuring_units (code, label, short_label, unit_type, active) VALUES ('0','VolumeUnitm3','m3', 'volume', 1);
|
||||
INSERT INTO llx_c_measuring_units (code, label, short_label, unit_type, active) VALUES ('-3','VolumeUnitdm3','dm3', 'volume', 1);
|
||||
INSERT INTO llx_c_measuring_units (code, label, short_label, unit_type, active) VALUES ('-6','VolumeUnitcm3','cm3', 'volume', 1);
|
||||
INSERT INTO llx_c_measuring_units (code, label, short_label, unit_type, active) VALUES ('-9','VolumeUnitmm3','mm3', 'volume', 1);
|
||||
INSERT INTO llx_c_measuring_units (code, label, short_label, unit_type, active) VALUES ('88','VolumeUnitfoot3','ft3', 'volume', 1);
|
||||
INSERT INTO llx_c_measuring_units (code, label, short_label, unit_type, active) VALUES ('89','VolumeUnitinch3','in3', 'volume', 1);
|
||||
INSERT INTO llx_c_measuring_units (code, label, short_label, unit_type, active) VALUES ('97','VolumeUnitounce','Oz', 'volume', 1);
|
||||
INSERT INTO llx_c_measuring_units (code, label, short_label, unit_type, active) VALUES ('98','VolumeUnitlitre','L', 'volume', 1);
|
||||
INSERT INTO llx_c_measuring_units (code, label, short_label, unit_type, active) VALUES ('99','VolumeUnitgallon','gal', 'volume', 1);
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
-- ========================================================================
|
||||
-- Copyright (C) 2001-2002,2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
-- Copyright (C) 2004 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
-- Copyright (C) 2012 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||
-- Copyright (C) 2019 Florian Henry <florian.henry@atm-consulitng.fr>
|
||||
-- This program is free software; you can redistribute it and/or modify
|
||||
-- it under the terms of the GNU General Public License as published by
|
||||
-- the Free Software Foundation; either version 2 of the License, or
|
||||
@ -17,15 +17,46 @@
|
||||
--
|
||||
-- ========================================================================
|
||||
|
||||
INSERT INTO llx_c_units ( code, label, short_label, active) VALUES ('P','piece','p', 1);
|
||||
INSERT INTO llx_c_units ( code, label, short_label, active) VALUES ('SET','set','se', 1);
|
||||
INSERT INTO llx_c_units ( code, label, short_label, active) VALUES ('S','second','s', 1);
|
||||
INSERT INTO llx_c_units ( code, label, short_label, active) VALUES ('H','hour','h', 1);
|
||||
INSERT INTO llx_c_units ( code, label, short_label, active) VALUES ('D','day','d', 1);
|
||||
INSERT INTO llx_c_units ( code, label, short_label, active) VALUES ('KG','kilogram','kg', 1);
|
||||
INSERT INTO llx_c_units ( code, label, short_label, active) VALUES ('G','gram','g', 1);
|
||||
INSERT INTO llx_c_units ( code, label, short_label, active) VALUES ('M','meter','m', 1);
|
||||
INSERT INTO llx_c_units ( code, label, short_label, active) VALUES ('LM','linear meter','lm', 1);
|
||||
INSERT INTO llx_c_units ( code, label, short_label, active) VALUES ('M2','square meter','m2', 1);
|
||||
INSERT INTO llx_c_units ( code, label, short_label, active) VALUES ('M3','cubic meter','m3', 1);
|
||||
INSERT INTO llx_c_units ( code, label, short_label, active) VALUES ('L','liter','l', 1);
|
||||
INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('T', '3','WeightUnitton','T', 'weight', 1);
|
||||
INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('KG', '0','WeightUnitkg','Kg', 'weight', 1);
|
||||
INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('G', '-3','WeightUnitg','g', 'weight', 1);
|
||||
INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('MG','-6','WeightUnitmg','mg', 'weight', 1);
|
||||
INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('OZ','98','WeightUnitounce','Oz', 'weight', 1);
|
||||
INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('LB','99','WeightUnitpound','lb', 'weight', 1);
|
||||
|
||||
INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('M', '0','SizeUnitm','m', 'size', 1);
|
||||
INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('DM','-1','SizeUnitdm','dm', 'size', 1);
|
||||
INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('CM','-2','SizeUnitcm','cm', 'size', 1);
|
||||
INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('MM','-3','SizeUnitmm','mm', 'size', 1);
|
||||
INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('FT','98','SizeUnitfoot','ft', 'size', 1);
|
||||
INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('IN','99','SizeUnitinch','in', 'size', 1);
|
||||
|
||||
INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('M2', '0','SurfaceUnitm2','m2', 'surface', 1);
|
||||
INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('DM2','-2','SurfaceUnitdm2','dm2', 'surface', 1);
|
||||
INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('CM2','-4','SurfaceUnitcm2','cm2', 'surface', 1);
|
||||
INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('MM2','-6','SurfaceUnitmm2','mm2', 'surface', 1);
|
||||
INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('FT2','98','SurfaceUnitfoot2','ft2', 'surface', 1);
|
||||
INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('IN2','99','SurfaceUnitinch2','in2', 'surface', 1);
|
||||
|
||||
|
||||
INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('M3', '0','VolumeUnitm3','m3', 'volume', 1);
|
||||
INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('DM3','-3','VolumeUnitdm3','dm3', 'volume', 1);
|
||||
INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('CM3','-6','VolumeUnitcm3','cm3', 'volume', 1);
|
||||
INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('MM3','-9','VolumeUnitmm3','mm3', 'volume', 1);
|
||||
INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('FT3','88','VolumeUnitfoot3','ft3', 'volume', 1);
|
||||
INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('IN3','89','VolumeUnitinch3','in3', 'volume', 1);
|
||||
INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('OZ3','97','VolumeUnitounce','Oz', 'volume', 1);
|
||||
INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('L', '98','VolumeUnitlitre','L', 'volume', 1);
|
||||
INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('GAL','99','VolumeUnitgallon','gal', 'volume', 1);
|
||||
|
||||
INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('GAL','99','VolumeUnitgallon','gal', 'volume', 1);
|
||||
INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('GAL','99','VolumeUnitgallon','gal', 'volume', 1);
|
||||
INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('GAL','99','VolumeUnitgallon','gal', 'volume', 1);
|
||||
|
||||
INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('P', '0','Piece','p', 'qty', 1);
|
||||
INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('SET', '0','Set','set', 'qty', 1);
|
||||
|
||||
INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('S', '0','second','s', 'time', 1);
|
||||
INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('MI', '60','minute','m', 'time', 1);
|
||||
INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('H', '3600','hour','h', 'time', 1);
|
||||
INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('D','12960000','day','d', 'time', 1);
|
||||
|
||||
@ -101,44 +101,62 @@ ALTER TABLE llx_prelevement_facture_demande ADD COLUMN ext_payment_id varchar(12
|
||||
ALTER TABLE llx_prelevement_facture_demande ADD COLUMN ext_payment_site varchar(128) NULL;
|
||||
|
||||
|
||||
CREATE TABLE llx_c_measuring_units(
|
||||
-- Fix if table exists
|
||||
ALTER TABLE llx_c_units DROP INDEX uk_c_units_code;
|
||||
ALTER TABLE llx_c_units ADD COLUMN scale integer;
|
||||
ALTER TABLE llx_c_units ADD COLUMN unit_type varchar(10);
|
||||
|
||||
-- Create if table dos not exists
|
||||
CREATE TABLE llx_c_units(
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
code varchar(3),
|
||||
scale integer,
|
||||
label varchar(50),
|
||||
short_label varchar(5),
|
||||
unit_type varchar(10),
|
||||
active tinyint DEFAULT 1 NOT NULL
|
||||
) ENGINE=innodb;
|
||||
|
||||
ALTER TABLE llx_c_measuring_units ADD UNIQUE uk_c_measuring_units_code(code,unit_type);
|
||||
ALTER TABLE llx_c_units ADD UNIQUE uk_c_units_code(code);
|
||||
|
||||
INSERT INTO llx_c_measuring_units (code, label, short_label, unit_type, active) VALUES ('3','WeightUnitton','T', 'weight', 1);
|
||||
INSERT INTO llx_c_measuring_units (code, label, short_label, unit_type, active) VALUES ('0','WeightUnitkg','Kg', 'weight', 1);
|
||||
INSERT INTO llx_c_measuring_units (code, label, short_label, unit_type, active) VALUES ('-3','WeightUnitg','g', 'weight', 1);
|
||||
INSERT INTO llx_c_measuring_units (code, label, short_label, unit_type, active) VALUES ('-6','WeightUnitmg','g', 'weight', 1);
|
||||
INSERT INTO llx_c_measuring_units (code, label, short_label, unit_type, active) VALUES ('98','WeightUnitounce','Oz', 'weight', 1);
|
||||
INSERT INTO llx_c_measuring_units (code, label, short_label, unit_type, active) VALUES ('99','WeightUnitpound','lb', 'weight', 1);
|
||||
|
||||
INSERT INTO llx_c_measuring_units (code, label, short_label, unit_type, active) VALUES ('0','SizeUnitm','m', 'size', 1);
|
||||
INSERT INTO llx_c_measuring_units (code, label, short_label, unit_type, active) VALUES ('-1','SizeUnitdm','dm', 'size', 1);
|
||||
INSERT INTO llx_c_measuring_units (code, label, short_label, unit_type, active) VALUES ('-2','SizeUnitcm','cm', 'size', 1);
|
||||
INSERT INTO llx_c_measuring_units (code, label, short_label, unit_type, active) VALUES ('-3','SizeUnitmm','mm', 'size', 1);
|
||||
INSERT INTO llx_c_measuring_units (code, label, short_label, unit_type, active) VALUES ('98','SizeUnitfoot','ft', 'size', 1);
|
||||
INSERT INTO llx_c_measuring_units (code, label, short_label, unit_type, active) VALUES ('99','SizeUnitinch','in', 'size', 1);
|
||||
INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('T', '3','WeightUnitton','T', 'weight', 1);
|
||||
INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('KG', '0','WeightUnitkg','Kg', 'weight', 1);
|
||||
INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('G', '-3','WeightUnitg','g', 'weight', 1);
|
||||
INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('MG','-6','WeightUnitmg','mg', 'weight', 1);
|
||||
INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('OZ','98','WeightUnitounce','Oz', 'weight', 1);
|
||||
INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('LB','99','WeightUnitpound','lb', 'weight', 1);
|
||||
|
||||
INSERT INTO llx_c_measuring_units (code, label, short_label, unit_type, active) VALUES ('0','SurfaceUnitm2','m2', 'surface', 1);
|
||||
INSERT INTO llx_c_measuring_units (code, label, short_label, unit_type, active) VALUES ('-2','SurfaceUnitdm2','dm2', 'surface', 1);
|
||||
INSERT INTO llx_c_measuring_units (code, label, short_label, unit_type, active) VALUES ('-4','SurfaceUnitcm2','cm2', 'surface', 1);
|
||||
INSERT INTO llx_c_measuring_units (code, label, short_label, unit_type, active) VALUES ('-6','SurfaceUnitmm2','mm2', 'surface', 1);
|
||||
INSERT INTO llx_c_measuring_units (code, label, short_label, unit_type, active) VALUES ('98','SurfaceUnitfoot2','ft2', 'surface', 1);
|
||||
INSERT INTO llx_c_measuring_units (code, label, short_label, unit_type, active) VALUES ('99','SurfaceUnitinch2','in2', 'surface', 1);
|
||||
INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('M', '0','SizeUnitm','m', 'size', 1);
|
||||
INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('DM','-1','SizeUnitdm','dm', 'size', 1);
|
||||
INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('CM','-2','SizeUnitcm','cm', 'size', 1);
|
||||
INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('MM','-3','SizeUnitmm','mm', 'size', 1);
|
||||
INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('FT','98','SizeUnitfoot','ft', 'size', 1);
|
||||
INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('IN','99','SizeUnitinch','in', 'size', 1);
|
||||
|
||||
INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('M2', '0','SurfaceUnitm2','m2', 'surface', 1);
|
||||
INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('DM2','-2','SurfaceUnitdm2','dm2', 'surface', 1);
|
||||
INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('CM2','-4','SurfaceUnitcm2','cm2', 'surface', 1);
|
||||
INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('MM2','-6','SurfaceUnitmm2','mm2', 'surface', 1);
|
||||
INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('FT2','98','SurfaceUnitfoot2','ft2', 'surface', 1);
|
||||
INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('IN2','99','SurfaceUnitinch2','in2', 'surface', 1);
|
||||
|
||||
|
||||
INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('M3', '0','VolumeUnitm3','m3', 'volume', 1);
|
||||
INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('DM3','-3','VolumeUnitdm3','dm3', 'volume', 1);
|
||||
INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('CM3','-6','VolumeUnitcm3','cm3', 'volume', 1);
|
||||
INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('MM3','-9','VolumeUnitmm3','mm3', 'volume', 1);
|
||||
INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('FT3','88','VolumeUnitfoot3','ft3', 'volume', 1);
|
||||
INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('IN3','89','VolumeUnitinch3','in3', 'volume', 1);
|
||||
INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('OZ3','97','VolumeUnitounce','Oz', 'volume', 1);
|
||||
INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('L', '98','VolumeUnitlitre','L', 'volume', 1);
|
||||
INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('GAL','99','VolumeUnitgallon','gal', 'volume', 1);
|
||||
|
||||
INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('P', '0','Piece','p', 'qty', 1);
|
||||
INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('SET', '0','Set','set', 'qty', 1);
|
||||
|
||||
INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('S', '0','second','s', 'time', 1);
|
||||
INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('MI', '60','minute','m', 'time', 1);
|
||||
INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('H', '3600','hour','h', 'time', 1);
|
||||
INSERT INTO llx_c_units (code, scale, label, short_label, unit_type, active) VALUES ('D','12960000','day','d', 'time', 1);
|
||||
|
||||
INSERT INTO llx_c_measuring_units (code, label, short_label, unit_type, active) VALUES ('0','VolumeUnitm3','m3', 'volume', 1);
|
||||
INSERT INTO llx_c_measuring_units (code, label, short_label, unit_type, active) VALUES ('-3','VolumeUnitdm3','dm3', 'volume', 1);
|
||||
INSERT INTO llx_c_measuring_units (code, label, short_label, unit_type, active) VALUES ('-6','VolumeUnitcm3','cm3', 'volume', 1);
|
||||
INSERT INTO llx_c_measuring_units (code, label, short_label, unit_type, active) VALUES ('-9','VolumeUnitmm3','mm3', 'volume', 1);
|
||||
INSERT INTO llx_c_measuring_units (code, label, short_label, unit_type, active) VALUES ('88','VolumeUnitfoot3','ft3', 'volume', 1);
|
||||
INSERT INTO llx_c_measuring_units (code, label, short_label, unit_type, active) VALUES ('89','VolumeUnitinch3','in3', 'volume', 1);
|
||||
INSERT INTO llx_c_measuring_units (code, label, short_label, unit_type, active) VALUES ('97','VolumeUnitounce','Oz', 'volume', 1);
|
||||
INSERT INTO llx_c_measuring_units (code, label, short_label, unit_type, active) VALUES ('98','VolumeUnitlitre','L', 'volume', 1);
|
||||
INSERT INTO llx_c_measuring_units (code, label, short_label, unit_type, active) VALUES ('99','VolumeUnitgallon','gal', 'volume', 1);
|
||||
|
||||
@ -1,21 +0,0 @@
|
||||
-- ========================================================================
|
||||
-- Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
-- Copyright (C) 2012 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||
--
|
||||
-- This program is free software; you can redistribute it and/or modify
|
||||
-- it under the terms of the GNU General Public License as published by
|
||||
-- the Free Software Foundation; either version 2 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/>.
|
||||
--
|
||||
-- ========================================================================
|
||||
|
||||
|
||||
ALTER TABLE llx_c_measuring_units ADD UNIQUE uk_c_measuring_units_code(code,unit_type);
|
||||
@ -1,28 +0,0 @@
|
||||
-- ========================================================================
|
||||
-- Copyright (C) 2001-2002,2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
-- Copyright (C) 2004 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
-- Copyright (C) 2012 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||
--
|
||||
-- This program is free software; you can redistribute it and/or modify
|
||||
-- it under the terms of the GNU General Public License as published by
|
||||
-- the Free Software Foundation; either version 2 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/>.
|
||||
--
|
||||
-- ========================================================================
|
||||
|
||||
create table llx_c_measuring_units(
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
code varchar(3),
|
||||
label varchar(50),
|
||||
short_label varchar(5),
|
||||
unit_type varchar(10),
|
||||
active tinyint DEFAULT 1 NOT NULL
|
||||
) ENGINE=innodb;
|
||||
@ -21,7 +21,9 @@
|
||||
create table llx_c_units(
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
code varchar(3),
|
||||
scale integer,
|
||||
label varchar(50),
|
||||
short_label varchar(5),
|
||||
unit_type varchar(10),
|
||||
active tinyint DEFAULT 1 NOT NULL
|
||||
)ENGINE=innodb;
|
||||
) ENGINE=innodb;
|
||||
|
||||
@ -52,6 +52,7 @@ if (! $sortorder) $sortorder="DESC";
|
||||
$backtopage=GETPOST('backtopage', 'alpha');
|
||||
|
||||
// Security check
|
||||
//$result=restrictedArea($user,'stock', $id, 'entrepot&stock');
|
||||
$result=restrictedArea($user, 'stock');
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
|
||||
@ -33,6 +33,7 @@ $id = GETPOST('id', 'int');
|
||||
$ref = GETPOST('ref', 'alpha');
|
||||
|
||||
// Security check
|
||||
//$result=restrictedArea($user,'stock', $id, 'entrepot&stock');
|
||||
$result=restrictedArea($user, 'stock');
|
||||
|
||||
|
||||
|
||||
@ -51,11 +51,15 @@ $result=restrictedArea($user, 'stock');
|
||||
$id=GETPOST('id', 'int');
|
||||
$ref = GETPOST('ref', 'alpha');
|
||||
$msid=GETPOST('msid', 'int');
|
||||
$product_id=GETPOST("product_id");
|
||||
$product_id=GETPOST("product_id", 'int');
|
||||
$action=GETPOST('action', 'aZ09');
|
||||
$cancel=GETPOST('cancel', 'alpha');
|
||||
$contextpage=GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'movementlist';
|
||||
|
||||
// Security check
|
||||
//$result=restrictedArea($user, 'stock', $id, 'entrepot&stock');
|
||||
$result=restrictedArea($user, 'stock');
|
||||
|
||||
$idproduct = GETPOST('idproduct', 'int');
|
||||
$year = GETPOST("year");
|
||||
$month = GETPOST("month");
|
||||
|
||||
@ -147,7 +147,7 @@ function LoadProducts(position, issubcat=false){
|
||||
|
||||
idata=0; //product data counter
|
||||
$.getJSON('./ajax.php?action=getProducts&category='+currentcat, function(data) {
|
||||
while (idata < 30) {
|
||||
while (idata < 30 && ishow < 30) {
|
||||
if (typeof (data[idata]) == "undefined") {
|
||||
$("#prodesc"+ishow).text("");
|
||||
$("#proimg"+ishow).attr("src","");
|
||||
@ -186,7 +186,7 @@ function MoreProducts(moreorless){
|
||||
}
|
||||
idata=30*pageproducts; //product data counter
|
||||
ishow=0; //product to show counter
|
||||
while (idata < 30) {
|
||||
while (idata < (30*pageproducts)+30) {
|
||||
if (typeof (data[idata]) == "undefined") {
|
||||
$("#prodesc"+ishow).text("");
|
||||
$("#proimg"+ishow).attr("src","");
|
||||
@ -268,7 +268,7 @@ function Search2(){
|
||||
$("#prodesc"+i).text(data[parseInt(i)]['label']);
|
||||
$("#proimg"+i).attr("src","genimg/?query=pro&w=55&h=50&id="+data[i]['rowid']);
|
||||
$("#prodiv"+i).data("rowid",data[i]['rowid']);
|
||||
$("#prodiv"+ishow).data("iscat",0);
|
||||
$("#prodiv"+i).data("iscat",0);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -123,7 +123,7 @@ class Website extends CommonObject
|
||||
|
||||
// Clean parameters
|
||||
if (isset($this->entity)) {
|
||||
$this->entity = trim($this->entity);
|
||||
$this->entity = (int) $this->entity;
|
||||
}
|
||||
if (isset($this->ref)) {
|
||||
$this->ref = trim($this->ref);
|
||||
@ -132,7 +132,7 @@ class Website extends CommonObject
|
||||
$this->description = trim($this->description);
|
||||
}
|
||||
if (isset($this->status)) {
|
||||
$this->status = trim($this->status);
|
||||
$this->status = (int) $this->status;
|
||||
}
|
||||
if (empty($this->date_creation)) {
|
||||
$this->date_creation = $now;
|
||||
@ -388,7 +388,7 @@ class Website extends CommonObject
|
||||
// Clean parameters
|
||||
|
||||
if (isset($this->entity)) {
|
||||
$this->entity = trim($this->entity);
|
||||
$this->entity = (int) $this->entity;
|
||||
}
|
||||
if (isset($this->ref)) {
|
||||
$this->ref = trim($this->ref);
|
||||
@ -397,7 +397,7 @@ class Website extends CommonObject
|
||||
$this->description = trim($this->description);
|
||||
}
|
||||
if (isset($this->status)) {
|
||||
$this->status = trim($this->status);
|
||||
$this->status = (int) $this->status;
|
||||
}
|
||||
|
||||
// Check parameters
|
||||
@ -519,7 +519,7 @@ class Website extends CommonObject
|
||||
*/
|
||||
public function createFromClone($user, $fromid, $newref, $newlang = '')
|
||||
{
|
||||
global $hookmanager, $langs;
|
||||
global $conf, $hookmanager, $langs;
|
||||
global $dolibarr_main_data_root;
|
||||
|
||||
$now = dol_now();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user