Merge branch 'develop' of https://github.com/Dolibarr/dolibarr into develop
This commit is contained in:
commit
aa5dfb3cf9
1
.github/CODEOWNERS
vendored
Normal file
1
.github/CODEOWNERS
vendored
Normal file
@ -0,0 +1 @@
|
||||
htdocs/takepos @andreubisquerra
|
||||
36
.github/CONTRIBUTING.md
vendored
36
.github/CONTRIBUTING.md
vendored
@ -38,7 +38,7 @@ We officially support versions N, N − 1 and N − 2 for N the latest version a
|
||||
Choose your base branch accordingly.
|
||||
|
||||
### General rules
|
||||
Please don't edit the ChangeLog file. File will be generated from your commit messages during release process by the project manager.
|
||||
Please don't edit the ChangeLog file. File will be generated from all commit messages during release process by the project manager.
|
||||
|
||||
### <a name="commits"></a>Commits
|
||||
Use clear commit messages with the following structure:
|
||||
@ -56,13 +56,15 @@ You can add it to your git configuration using:
|
||||
git config --local commit.template .gitmessage
|
||||
```
|
||||
|
||||
where
|
||||
|
||||
#### Keyword
|
||||
In uppercase if you want to have the log comment appears into the generated ChangeLog file.
|
||||
|
||||
The keyword can be ommitted if your commit does not fit in any of the following categories:
|
||||
- Fix: for a bug fix
|
||||
- Close: for closing a referenced feature request
|
||||
- New: for an unreferenced new feature (Opening a feature request and using close is prefered)
|
||||
- Fix/FIX: for a bug fix
|
||||
- New/NEW: for an unreferenced new feature (Opening a feature request and using close is prefered)
|
||||
- Close/CLOSE: for closing a referenced feature request
|
||||
|
||||
#### Issuenum
|
||||
If your commit fixes a referenced bug or feature request.
|
||||
@ -85,14 +87,14 @@ This section can span multiple lines.
|
||||
|
||||
Try to keep lines under 120 characters.
|
||||
|
||||
#### Samples
|
||||
#### Examples
|
||||
<pre>
|
||||
FIX|Fix #456 Short description (where #456 is number of bug fix, if it exists. In upper case to appear into ChangeLog)
|
||||
or
|
||||
CLOSE|Close #456 Short description (where #456 is number of feature request, if it exists. In upper case to appear into ChangeLog)
|
||||
or
|
||||
NEW|New Short description (In upper case to appear into ChangeLog, use this if you add a feature not tracked, otherwise use CLOSE #456)
|
||||
or
|
||||
CLOSE|Close #456 Short description (where #456 is number of feature request, if it exists. In upper case to appear into ChangeLog)
|
||||
or
|
||||
Short description (when the commit is not introducing feature nor closing a bug)
|
||||
|
||||
Long description (Can span accross multiple lines).
|
||||
@ -104,13 +106,22 @@ When submitting a pull request, use same rule as [Commits](#commits) for the mes
|
||||
If your pull request only contains one commit, GitHub will be smart enough to fill it for you.
|
||||
Otherwise, please be a bit verbose about what you're providing.
|
||||
|
||||
Your Pull Request must pass the Continuous Integration checks.
|
||||
Your Pull Request (PR) must pass the Continuous Integration checks.
|
||||
Also, some code changes need a prior approbation:
|
||||
|
||||
* if you want to include a new external library (into htdocs/includes directory), please ask before to the project manager (@eldy) to see if such a library can be accepted.
|
||||
|
||||
* if you add a new table, you must first create a page on http://wiki.dolibarr.org/index.php/Category:Table_SQL (copy an existing page changing its name to see it into this index page). Than ask the project manager (@eldy) if the new data model you plan to add can be accepted as you suggest.
|
||||
|
||||
Once a PR has been submitted, you may need to wait for its integration. It is common that the project leader let the PR open for a long delay to allow
|
||||
every developer discuss about the PR.
|
||||
If your PR has errors reported by the Continuous Integration Platform, it means your PR is not valid and nothing will be done with it. It will be kept open to allow developers to fix this, or it may be closed several month later.
|
||||
If the PR is valid, and is kept open for a long time, a tag will also be added on the PR to describe the status of your PR.
|
||||
By putting your mouse on the tag, you will get a full explanation of the tag/status that explain why your PR has not been integrated yet.
|
||||
Around 95% of submitted PR are reviewed and tagged. Even if this is one of the most important ratio in Open Source world, don't expect the core team
|
||||
to reach the 100%. With the increasing popularity of Dolibarr, this ratio will probably decrease in future.
|
||||
|
||||
|
||||
### Resources
|
||||
[Developer documentation](http://wiki.dolibarr.org/index.php/Developer_documentation)
|
||||
|
||||
@ -120,9 +131,12 @@ The source language (en_US) is maintained in the repository. See the [Code](#cod
|
||||
|
||||
All other translations are managed online at [Transifex](https://www.transifex.com/dolibarr-association/dolibarr/).
|
||||
|
||||
Join an existing translation team or create your own and translate into the interface.
|
||||
Translations done on transifex are available in the next major release.
|
||||
|
||||
Note: Sometimes, the source text (english) is modified. In such a case, the translation is reset. Transifex assume that if the original source
|
||||
has changed, the translation is surely no more correct so must be done again. But old translation is not lost and you can use the tab "History"
|
||||
to retreive all old translation of a source text, and restore the translation in one click with no need to retranslate it if there is no need to.
|
||||
|
||||
Your translations will be available in the next major release.
|
||||
|
||||
### Resources
|
||||
[Translator documentation](http://wiki.dolibarr.org/index.php/Translator_documentation)
|
||||
@ -131,5 +145,5 @@ Documentation
|
||||
-------------
|
||||
The project's documentation is maintained on the [Wiki](http://wiki.dolibarr.org/index.php).
|
||||
|
||||
*Note*: to help prevent spam, you need to create an account before being able to edit.
|
||||
*Note*: to help prevent spam, you need to create an account before being able to edit. Everybody is welcome to contribute to its content.
|
||||
|
||||
|
||||
@ -60,7 +60,6 @@ matrix:
|
||||
fast_finish: true
|
||||
allow_failures:
|
||||
- php: nightly
|
||||
- php: '7.3'
|
||||
# We exclude some combinations not usefull to save Travis CPU
|
||||
exclude:
|
||||
- php: '5.5'
|
||||
@ -71,6 +70,8 @@ matrix:
|
||||
env: DB=mariadb
|
||||
- php: '7.1'
|
||||
env: DB=mariadb
|
||||
- php: '7.2'
|
||||
env: DB=mariadb
|
||||
- php: '5.5'
|
||||
env: DB=postgresql
|
||||
- php: '5.6'
|
||||
@ -79,7 +80,7 @@ matrix:
|
||||
env: DB=postgresql
|
||||
- php: '7.1'
|
||||
env: DB=postgresql
|
||||
- php: '7.3'
|
||||
- php: '7.2'
|
||||
env: DB=postgresql
|
||||
- php: nightly
|
||||
env: DB=postgresql
|
||||
|
||||
@ -361,12 +361,12 @@ if ($nboftargetok) {
|
||||
}
|
||||
if (! $BUILD || $BUILD eq '0-rc') # For a major version
|
||||
{
|
||||
print 'cd ~/git/dolibarr_'.$MAJOR.'.'.$MINOR.'; git log `git rev-list --boundary '.$MAJOR.'.'.$MINOR.'..origin/develop | grep ^- | cut -c2- | head -n 1`.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e \'^FIX\|NEW\' | sort -u | sed \'s/FIXED:/FIX:/g\' | sed \'s/FIXED :/FIX:/g\' | sed \'s/FIX :/FIX:/g\' | sed \'s/FIX /FIX: /g\' | sed \'s/NEW :/NEW:/g\' | sed \'s/NEW /NEW: /g\' > /tmp/aaa';
|
||||
print 'cd ~/git/dolibarr_'.$MAJOR.'.'.$MINOR.'; git log `git rev-list --boundary '.$MAJOR.'.'.$MINOR.'..origin/develop | grep ^- | cut -c2- | head -n 1`.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e \'^FIX\|NEW\|CLOSE\' | sort -u | sed \'s/FIXED:/FIX:/g\' | sed \'s/FIXED :/FIX:/g\' | sed \'s/FIX :/FIX:/g\' | sed \'s/FIX /FIX: /g\' | sed \'s/CLOSE/NEW/g\' | sed \'s/NEW :/NEW:/g\' | sed \'s/NEW /NEW: /g\' > /tmp/aaa';
|
||||
}
|
||||
else # For a maintenance release
|
||||
{
|
||||
#print 'cd ~/git/dolibarr_'.$MAJOR.'.'.$MINOR.'; git log '.$MAJOR.'.'.$MINOR.'.'.($BUILD-1).'.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e \'^FIX\|NEW\' | sort -u | sed \'s/FIXED:/FIX:/g\' | sed \'s/FIXED :/FIX:/g\' | sed \'s/FIX :/FIX:/g\' | sed \'s/FIX /FIX: /g\' | sed \'s/NEW :/NEW:/g\' | sed \'s/NEW /NEW: /g\' > /tmp/aaa';
|
||||
print 'cd ~/git/dolibarr_'.$MAJOR.'.'.$MINOR.'; git log '.$MAJOR.'.'.$MINOR.'.'.($BUILD-1).'.. | grep -v "Merge branch" | grep -v "Merge pull" | grep "^ " | sed -e "s/^[0-9a-z]* *//" | grep -e \'^FIX\|NEW\' | sort -u | sed \'s/FIXED:/FIX:/g\' | sed \'s/FIXED :/FIX:/g\' | sed \'s/FIX :/FIX:/g\' | sed \'s/FIX /FIX: /g\' | sed \'s/NEW :/NEW:/g\' | sed \'s/NEW /NEW: /g\' > /tmp/aaa';
|
||||
#print 'cd ~/git/dolibarr_'.$MAJOR.'.'.$MINOR.'; git log '.$MAJOR.'.'.$MINOR.'.'.($BUILD-1).'.. --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -e \'^FIX\|NEW\' | sort -u | sed \'s/FIXED:/FIX:/g\' | sed \'s/FIXED :/FIX:/g\' | sed \'s/FIX :/FIX:/g\' | sed \'s/FIX /FIX: /g\' | sed \'s/CLOSE/NEW/g\'| sed \'s/NEW :/NEW:/g\' | sed \'s/NEW /NEW: /g\' > /tmp/aaa';
|
||||
print 'cd ~/git/dolibarr_'.$MAJOR.'.'.$MINOR.'; git log '.$MAJOR.'.'.$MINOR.'.'.($BUILD-1).'.. | grep -v "Merge branch" | grep -v "Merge pull" | grep "^ " | sed -e "s/^[0-9a-z]* *//" | grep -e \'^FIX\|NEW\|CLOSE\' | sort -u | sed \'s/FIXED:/FIX:/g\' | sed \'s/FIXED :/FIX:/g\' | sed \'s/FIX :/FIX:/g\' | sed \'s/FIX /FIX: /g\' | sed \'s/CLOSE/NEW/g\' | sed \'s/NEW :/NEW:/g\' | sed \'s/NEW /NEW: /g\' > /tmp/aaa';
|
||||
|
||||
}
|
||||
print "\n";
|
||||
|
||||
@ -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
@ -9,6 +9,10 @@ fi
|
||||
FROM=$1-01-01
|
||||
TO=$1-12-31
|
||||
|
||||
echo "Number of contributors for the year"
|
||||
echo "git log --since $FROM --before $TO | grep ^Author | sort -u -f -i -b | wc -l"
|
||||
git log --since $FROM --before $TO | grep ^Author | sort -u -f -i -b | wc -l
|
||||
|
||||
|
||||
echo "Number of commit for the year"
|
||||
git log --pretty='format:%cd' --date=format:'%Y' | uniq -c | awk '{print "Year: "$2", commits: "$1}' | grep "Year: $1"
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -424,10 +424,10 @@ foreach ($AdherentType as $key => $adhtype)
|
||||
}
|
||||
print '<tr class="liste_total">';
|
||||
print '<td class="liste_total">'.$langs->trans("Total").'</td>';
|
||||
print '<td class="liste_total" class="right">'.$SommeA.' '.$staticmember->LibStatut(-1, $adhtype->subscription, 0, 3).'</td>';
|
||||
print '<td class="liste_total" class="right">'.$SommeB.' '.$staticmember->LibStatut(1, $adhtype->subscription, 0, 3).'</td>';
|
||||
print '<td class="liste_total" class="right">'.$SommeC.' '.$staticmember->LibStatut(1, $adhtype->subscription, $now, 3).'</td>';
|
||||
print '<td class="liste_total" class="right">'.$SommeD.' '.$staticmember->LibStatut(0, $adhtype->subscription, 0, 3).'</td>';
|
||||
print '<td class="liste_total right">'.$SommeA.' '.$staticmember->LibStatut(-1, $adhtype->subscription, 0, 3).'</td>';
|
||||
print '<td class="liste_total right">'.$SommeB.' '.$staticmember->LibStatut(1, $adhtype->subscription, 0, 3).'</td>';
|
||||
print '<td class="liste_total right">'.$SommeC.' '.$staticmember->LibStatut(1, $adhtype->subscription, $now, 3).'</td>';
|
||||
print '<td class="liste_total right">'.$SommeD.' '.$staticmember->LibStatut(0, $adhtype->subscription, 0, 3).'</td>';
|
||||
print '</tr>';
|
||||
|
||||
print "</table>\n";
|
||||
|
||||
@ -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']++;
|
||||
|
||||
@ -88,7 +88,7 @@ $hookmanager->initHooks(array('admin'));
|
||||
// Put here declaration of dictionaries properties
|
||||
|
||||
// Sort order to show dictionary (0 is space). All other dictionaries (added by modules) will be at end of this.
|
||||
$taborder=array(9,0,4,3,2,0,1,8,19,16,27,0,5,11,0,33,34,0,6,0,29,0,7,24,28,17,35,36,0,10,23,12,13,0,14,0,22,20,18,21,0,15,30,0,26,0,25,0);
|
||||
$taborder=array(9,0,4,3,2,0,1,8,19,16,27,0,5,11,0,33,34,0,6,0,29,0,7,24,28,17,35,36,0,10,23,12,13,0,14,0,22,20,18,21,0,15,30,0,26,37,0,25,0);
|
||||
|
||||
// Name of SQL tables of dictionaries
|
||||
$tabname=array();
|
||||
@ -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,6 +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_units";
|
||||
|
||||
// Dictionary labels
|
||||
$tablib=array();
|
||||
@ -156,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";
|
||||
@ -167,6 +168,7 @@ $tablib[33]= "DictionaryDepartment";
|
||||
$tablib[34]= "DictionaryFunction";
|
||||
$tablib[35]= "DictionaryExpenseTaxCat";
|
||||
$tablib[36]= "DictionaryExpenseTaxRange";
|
||||
$tablib[37]= "DictionaryMeasuringUnits";
|
||||
|
||||
// Requests to extract data
|
||||
$tabsql=array();
|
||||
@ -195,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";
|
||||
@ -206,6 +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.scale, r.active FROM ".MAIN_DB_PREFIX."c_units r";
|
||||
|
||||
// Criteria to sort dictionaries
|
||||
$tabsqlsort=array();
|
||||
@ -234,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";
|
||||
@ -245,6 +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.scale ASC, r.code ASC";
|
||||
|
||||
// Nom des champs en resultat de select pour affichage du dictionnaire
|
||||
$tabfield=array();
|
||||
@ -273,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";
|
||||
@ -284,6 +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,scale";
|
||||
|
||||
// Nom des champs d'edition pour modification d'un enregistrement
|
||||
$tabfieldvalue=array();
|
||||
@ -312,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";
|
||||
@ -323,6 +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,scale";
|
||||
|
||||
// Nom des champs dans la table pour insertion d'un enregistrement
|
||||
$tabfieldinsert=array();
|
||||
@ -351,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";
|
||||
@ -362,6 +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,scale";
|
||||
|
||||
// Nom du rowid si le champ n'est pas de type autoincrement
|
||||
// Example: "" if id field is "rowid" and has autoincrement on
|
||||
@ -392,7 +399,7 @@ $tabrowid[22]= "rowid";
|
||||
$tabrowid[23]= "";
|
||||
$tabrowid[24]= "";
|
||||
$tabrowid[25]= "";
|
||||
$tabrowid[26]= "";
|
||||
//$tabrowid[26]= "";
|
||||
$tabrowid[27]= "id";
|
||||
$tabrowid[28]= "";
|
||||
$tabrowid[29]= "";
|
||||
@ -403,6 +410,7 @@ $tabrowid[33]= "rowid";
|
||||
$tabrowid[34]= "rowid";
|
||||
$tabrowid[35]= "";
|
||||
$tabrowid[36]= "";
|
||||
$tabrowid[37]= "";
|
||||
|
||||
// Condition to show dictionary in setup page
|
||||
$tabcond=array();
|
||||
@ -431,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);
|
||||
@ -442,6 +450,7 @@ $tabcond[33]= ! empty($conf->hrm->enabled);
|
||||
$tabcond[34]= ! empty($conf->hrm->enabled);
|
||||
$tabcond[35]= ! empty($conf->expensereport->enabled);
|
||||
$tabcond[36]= ! empty($conf->expensereport->enabled);
|
||||
$tabcond[37]= ! empty($conf->product->enabled);
|
||||
|
||||
// List of help for fields
|
||||
$tabhelp=array();
|
||||
@ -470,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"));
|
||||
@ -481,6 +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('code'=>$langs->trans("EnterAnyCode"));
|
||||
|
||||
// List of check for fields (NOT USED YET)
|
||||
$tabfieldcheck=array();
|
||||
@ -509,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();
|
||||
@ -520,6 +530,7 @@ $tabfieldcheck[33] = array();
|
||||
$tabfieldcheck[34] = array();
|
||||
$tabfieldcheck[35]= array();
|
||||
$tabfieldcheck[36]= array();
|
||||
$tabfieldcheck[37]= array();
|
||||
|
||||
// Complete all arrays with entries found into modules
|
||||
complete_dictionary_with_modules($taborder, $tabname, $tablib, $tabsql, $tabsqlsort, $tabfield, $tabfieldvalue, $tabfieldinsert, $tabrowid, $tabcond, $tabhelp, $tabfieldcheck);
|
||||
@ -1583,6 +1594,12 @@ if ($id)
|
||||
{
|
||||
$valuetoshow = $langs->trans($valuetoshow);
|
||||
}
|
||||
elseif ($fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'c_units')
|
||||
{
|
||||
$langs->load('other');
|
||||
$key = $langs->trans($obj->label);
|
||||
$valuetoshow = ($obj->label && $key != strtoupper($obj->label) ? $key : $obj->{$fieldlist[$field]});
|
||||
}
|
||||
|
||||
$class='tddict';
|
||||
if ($fieldlist[$field] == 'note' && $id == 10) $class.=' tdoverflowmax200';
|
||||
|
||||
@ -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
|
||||
{
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -96,7 +97,7 @@ class ICal
|
||||
* Translate Calendar
|
||||
*
|
||||
* @param string $uri Url
|
||||
* @return array
|
||||
* @return array|string
|
||||
*/
|
||||
function parse($uri)
|
||||
{
|
||||
@ -363,9 +364,9 @@ class ICal
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
|
||||
/**
|
||||
* Return sorted eventlist as array or false if calenar is empty
|
||||
* Return sorted eventlist as array or false if calendar is empty
|
||||
*
|
||||
* @return array
|
||||
* @return array|false
|
||||
*/
|
||||
function get_sort_event_list()
|
||||
{
|
||||
@ -398,7 +399,7 @@ class ICal
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
|
||||
/**
|
||||
* Return eventlist array (not sort eventlist array)
|
||||
* Return eventlist array (not sorted eventlist array)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
@ -422,7 +423,7 @@ class ICal
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
|
||||
/**
|
||||
* Return to do array (not sort to do array)
|
||||
* Return to do array (not sorted todo array)
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2014 Cedric GROSS <c.gross@kreiz-it.fr>
|
||||
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2018-2019 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -740,7 +740,7 @@ $db->close();
|
||||
/**
|
||||
* Show event line of a particular day for a user
|
||||
*
|
||||
* @param string $username Login
|
||||
* @param User $username Login
|
||||
* @param int $day Day
|
||||
* @param int $month Month
|
||||
* @param int $year Year
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2014 Cedric GROSS <c.gross@kreiz-it.fr>
|
||||
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2018-2019 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -888,7 +888,7 @@ $db->close();
|
||||
/**
|
||||
* Show event line of a particular day for a user
|
||||
*
|
||||
* @param string $username Login
|
||||
* @param User $username Login
|
||||
* @param int $day Day
|
||||
* @param int $month Month
|
||||
* @param int $year Year
|
||||
|
||||
@ -1,492 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* 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/comm/address.php
|
||||
* \ingroup societe
|
||||
* \brief Tab address of thirdparty
|
||||
*/
|
||||
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/societe/class/address.class.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('companies', 'commercial'));
|
||||
|
||||
$id = GETPOST('id', 'int');
|
||||
$action = GETPOST('action', 'alpha');
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
$backtopage = GETPOST('backtopage', 'alpha');
|
||||
$origin = GETPOST('origin', 'alpha');
|
||||
$originid = GETPOST('originid', 'int');
|
||||
$socid = GETPOST('socid', 'int');
|
||||
if (! $socid && ($action != 'create' && $action != 'add' && $action != 'update')) accessforbidden();
|
||||
|
||||
// Security check
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'societe', $socid);
|
||||
|
||||
$object = new Address($db);
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
// Cancel
|
||||
if (GETPOST('cancel', 'alpha') && ! empty($backtopage))
|
||||
{
|
||||
header("Location: ".$backtopage);
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($action == 'add' || $action == 'update')
|
||||
{
|
||||
$object->socid = $socid;
|
||||
$object->label = ($_POST["label"]!=$langs->trans('RequiredField')?$_POST["label"]:'');
|
||||
$object->name = ($_POST["name"]!=$langs->trans('RequiredField')?$_POST["name"]:'');
|
||||
$object->address = $_POST["address"];
|
||||
$object->zip = $_POST["zipcode"];
|
||||
$object->town = $_POST["town"];
|
||||
$object->country_id = $_POST["country_id"];
|
||||
$object->phone = $_POST["phone"];
|
||||
$object->fax = $_POST["fax"];
|
||||
$object->note = $_POST["note"];
|
||||
|
||||
// Add new address
|
||||
if ($action == 'add')
|
||||
{
|
||||
$result = $object->create($socid, $user);
|
||||
|
||||
if ($result >= 0)
|
||||
{
|
||||
if (! empty($backtopage))
|
||||
{
|
||||
header("Location: ".$backtopage);
|
||||
exit;
|
||||
}
|
||||
elseif ($origin == 'commande')
|
||||
{
|
||||
header("Location: ../commande/contact.php?action=editdelivery_adress&socid=".$socid."&id=".$originid);
|
||||
exit;
|
||||
}
|
||||
elseif ($origin == 'propal')
|
||||
{
|
||||
header("Location: ../comm/propal/contact.php?action=editdelivery_adress&socid=".$socid."&id=".$originid);
|
||||
exit;
|
||||
}
|
||||
elseif ($origin == 'shipment')
|
||||
{
|
||||
header("Location: ../expedition/card.php?id=".$originid);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
header("Location: ".$_SERVER['PHP_SELF']."?socid=".$socid);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$action='create';
|
||||
}
|
||||
}
|
||||
|
||||
// Update address
|
||||
elseif ($action == 'update')
|
||||
{
|
||||
$result = $object->update($id, $socid, $user);
|
||||
|
||||
if ($result >= 0)
|
||||
{
|
||||
if (! empty($backtopage))
|
||||
{
|
||||
header("Location: ".$backtopage);
|
||||
exit;
|
||||
}
|
||||
elseif ($origin == 'commande')
|
||||
{
|
||||
header("Location: ../commande/contact.php?id=".$originid);
|
||||
exit;
|
||||
}
|
||||
elseif ($origin == 'propal')
|
||||
{
|
||||
header("Location: ../comm/propal/contact.php?id=".$originid);
|
||||
exit;
|
||||
}
|
||||
elseif ($origin == 'shipment')
|
||||
{
|
||||
header("Location: ../expedition/card.php?id=".$originid);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
header("Location: ".$_SERVER['PHP_SELF']."?socid=".$socid);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$reload = 0;
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$action= "edit";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
elseif ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->societe->supprimer)
|
||||
{
|
||||
$result = $object->delete($id, $socid);
|
||||
|
||||
if ($result == 0)
|
||||
{
|
||||
header("Location: ".$_SERVER['PHP_SELF']."?socid=".$socid);
|
||||
exit ;
|
||||
}
|
||||
else
|
||||
{
|
||||
$reload = 0;
|
||||
$action='';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
llxHeader();
|
||||
|
||||
$form = new Form($db);
|
||||
$formcompany = new FormCompany($db);
|
||||
$countrynotdefined=$langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')';
|
||||
|
||||
if ($action == 'create')
|
||||
{
|
||||
if ($user->rights->societe->creer)
|
||||
{
|
||||
/*
|
||||
* Creation
|
||||
*/
|
||||
|
||||
if ($_POST["label"] && $_POST["name"])
|
||||
{
|
||||
$object->socid = $socid;
|
||||
$object->label = $_POST["label"];
|
||||
$object->name = $_POST["name"];
|
||||
$object->address = $_POST["address"];
|
||||
$object->zip = $_POST["zipcode"];
|
||||
$object->town = $_POST["town"];
|
||||
$object->phone = $_POST["phone"];
|
||||
$object->fax = $_POST["fax"];
|
||||
$object->note = $_POST["note"];
|
||||
}
|
||||
|
||||
// On positionne country_id, country_code and label of the chosen country
|
||||
$object->country_id = (GETPOST('country_id', 'int') ? GETPOST('country_id', 'int') : $mysoc->country_id);
|
||||
if ($object->country_id)
|
||||
{
|
||||
$tmparray=getCountry($object->country_id, 'all');
|
||||
$object->country_code = $tmparray['code'];
|
||||
$object->country = $tmparray['label'];
|
||||
}
|
||||
|
||||
print load_fiche_titre($langs->trans("AddAddress"));
|
||||
|
||||
print "<br>\n";
|
||||
|
||||
// If javascript enabled, we add interactivity on mandatory fields
|
||||
if ($conf->use_javascript_ajax)
|
||||
{
|
||||
print "\n".'<script type="text/javascript" language="javascript">';
|
||||
print '$(document).ready(function () {
|
||||
$("#label").focus(function() {
|
||||
hideMessage("label","'.$langs->trans('RequiredField').'");
|
||||
});
|
||||
$("#label").blur(function() {
|
||||
displayMessage("label","'.$langs->trans('RequiredField').'");
|
||||
});
|
||||
$("#name").focus(function() {
|
||||
hideMessage("name","'.$langs->trans('RequiredField').'");
|
||||
});
|
||||
$("#name").blur(function() {
|
||||
displayMessage("name","'.$langs->trans('RequiredField').'");
|
||||
});
|
||||
displayMessage("label","'.$langs->trans('RequiredField').'");
|
||||
displayMessage("name","'.$langs->trans('RequiredField').'");
|
||||
$("#label").css("color","grey");
|
||||
$("#name").css("color","grey");
|
||||
})';
|
||||
print '</script>'."\n";
|
||||
}
|
||||
|
||||
print '<form action="'.$_SERVER['PHP_SELF'].'" method="POST" name="formsoc">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'"/>';
|
||||
print '<input type="hidden" name="socid" value="'.$socid.'"/>';
|
||||
print '<input type="hidden" name="backtopage" value="'.$backtopage.'"/>';
|
||||
print '<input type="hidden" name="origin" value="'.$origin.'"/>';
|
||||
print '<input type="hidden" name="originid" value="'.$originid.'"/>';
|
||||
print '<input type="hidden" name="action" value="add"/>';
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans('Label').'</td><td><input type="text" size="30" name="label" id="label" value="'.($object->label?$object->label:$langs->trans('RequiredField')).'"></td></tr>';
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans('Name').'</td><td><input type="text" size="30" name="name" id="name" value="'.($object->name?$object->name:$langs->trans('RequiredField')).'"></td></tr>';
|
||||
|
||||
print '<tr><td class="tdtop">'.$langs->trans('Address').'</td><td colspan="3"><textarea name="address" class="quatrevingtpercent" rows="3" wrap="soft">';
|
||||
print $object->address;
|
||||
print '</textarea></td></tr>';
|
||||
|
||||
// Zip
|
||||
print '<tr><td>'.$langs->trans('Zip').'</td><td>';
|
||||
print $formcompany->select_ziptown($object->zip, 'zipcode', array('town','selectcountry_id'), 6);
|
||||
print '</td></tr>';
|
||||
|
||||
// Town
|
||||
print '<tr><td>'.$langs->trans('Town').'</td><td>';
|
||||
print $formcompany->select_ziptown($object->town, 'town', array('zipcode','selectcountry_id'));
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td width="25%">'.$langs->trans('Country').'</td><td colspan="3">';
|
||||
print $form->select_country($object->country_id, 'selectcountry_id');
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans('Phone').'</td><td><input type="text" name="phone" value="'.$object->phone.'"></td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans('Fax').'</td><td><input type="text" name="fax" value="'.$object->fax.'"></td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans('Note').'</td><td colspan="3"><textarea name="note" cols="40" rows="6" wrap="soft">';
|
||||
print $object->note;
|
||||
print '</textarea></td></tr>';
|
||||
|
||||
print '</table>'."\n";
|
||||
|
||||
print '<br><div class="center">';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans('Add').'">';
|
||||
if (! empty($backtopage))
|
||||
{
|
||||
print ' ';
|
||||
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||
}
|
||||
print '</div>'."\n";
|
||||
|
||||
print '</form>'."\n";
|
||||
}
|
||||
}
|
||||
elseif ($action == 'edit')
|
||||
{
|
||||
/*
|
||||
* Fiche societe en mode edition
|
||||
*/
|
||||
|
||||
$societe=new Societe($db);
|
||||
$societe->fetch($socid);
|
||||
$head = societe_prepare_head($societe);
|
||||
|
||||
dol_fiche_head($head, 'card', $societe->name);
|
||||
|
||||
print load_fiche_titre($langs->trans("EditAddress"));
|
||||
print "<br>\n";
|
||||
|
||||
if ($socid)
|
||||
{
|
||||
if ($reload || ! $_POST["name"])
|
||||
{
|
||||
$object->socid = $socid;
|
||||
$object->fetch_address($id);
|
||||
}
|
||||
else
|
||||
{
|
||||
$object->id = $id;
|
||||
$object->socid = $socid;
|
||||
$object->label = $_POST["label"];
|
||||
$object->name = $_POST["name"];
|
||||
$object->address = $_POST["address"];
|
||||
$object->zip = $_POST["zipcode"];
|
||||
$object->town = $_POST["town"];
|
||||
$object->country_id = $_POST["country_id"]?$_POST["country_id"]:$mysoc->country_id;
|
||||
$object->phone = $_POST["phone"];
|
||||
$object->fax = $_POST["fax"];
|
||||
$object->note = $_POST["note"];
|
||||
|
||||
// On positionne country_id, country_code and label of the chosen country
|
||||
if ($object->country_id)
|
||||
{
|
||||
$tmparray=getCountry($object->country_id, 'all');
|
||||
$object->country_code = $tmparray['code'];
|
||||
$object->country = $tmparray['label'];
|
||||
}
|
||||
}
|
||||
|
||||
print '<form action="'.$_SERVER['PHP_SELF'].'?socid='.$object->socid.'" method="POST" name="formsoc">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'"/>';
|
||||
print '<input type="hidden" name="action" value="update"/>';
|
||||
print '<input type="hidden" name="socid" value="'.$object->socid.'"/>';
|
||||
print '<input type="hidden" name="backtopage" value="'.$backtopage.'"/>';
|
||||
print '<input type="hidden" name="origin" value="'.$origin.'"/>';
|
||||
print '<input type="hidden" name="originid" value="'.$originid.'"/>';
|
||||
print '<input type="hidden" name="id" value="'.$object->id.'"/>';
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print '<tr><td>'.$langs->trans('AddressLabel').'</td><td colspan="3"><input type="text" size="40" name="label" value="'.$object->label.'"></td></tr>';
|
||||
print '<tr><td>'.$langs->trans('Name').'</td><td colspan="3"><input type="text" size="40" name="name" value="'.$object->name.'"></td></tr>';
|
||||
|
||||
print '<tr><td class="tdtop">'.$langs->trans('Address').'</td><td colspan="3"><textarea name="address" class="quatrevingtpercent" rows="3" wrap="soft">';
|
||||
print $object->address;
|
||||
print '</textarea></td></tr>';
|
||||
|
||||
// Zip
|
||||
print '<tr><td>'.$langs->trans('Zip').'</td><td>';
|
||||
print $formcompany->select_ziptown($object->zip, 'zipcode', array('town','selectcountry_id'), 6);
|
||||
print '</td></tr>';
|
||||
|
||||
// Town
|
||||
print '<tr><td>'.$langs->trans('Town').'</td><td>';
|
||||
print $formcompany->select_ziptown($object->town, 'town', array('zipcode','selectcountry_id'));
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans('Country').'</td><td colspan="3">';
|
||||
print $form->select_country($object->country_id, 'country_id');
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans('Phone').'</td><td><input type="text" name="phone" value="'.$object->phone.'"></td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans('Fax').'</td><td><input type="text" name="fax" value="'.$object->fax.'"></td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans('Note').'</td><td colspan="3"><textarea name="note" cols="40" rows="6" wrap="soft">';
|
||||
print $object->note;
|
||||
print '</textarea></td></tr>';
|
||||
|
||||
print '</table><br>';
|
||||
|
||||
print '<div class="center">';
|
||||
print '<input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">';
|
||||
print ' ';
|
||||
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
|
||||
print '</div>';
|
||||
|
||||
print '</form>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Fiche societe en mode visu
|
||||
*/
|
||||
|
||||
$result=$object->fetch_lines($socid);
|
||||
if ($result < 0)
|
||||
{
|
||||
dol_print_error($db, $object->error);
|
||||
exit;
|
||||
}
|
||||
|
||||
$societe=new Societe($db);
|
||||
$societe->fetch($object->socid);
|
||||
$head = societe_prepare_head($societe);
|
||||
|
||||
dol_fiche_head($head, 'customer', $societe->name);
|
||||
|
||||
|
||||
// Confirmation delete
|
||||
if ($action == 'delete')
|
||||
{
|
||||
print $form->formconfirm($_SERVER['PHP_SELF']."?socid=".$object->socid."&id=".$id, $langs->trans("DeleteAddress"), $langs->trans("ConfirmDeleteAddress"), "confirm_delete");
|
||||
}
|
||||
|
||||
$nblines = count($object->lines);
|
||||
if ($nblines)
|
||||
{
|
||||
for ($i = 0 ; $i < $nblines ; $i++)
|
||||
{
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print '<tr><td width="20%">'.$langs->trans('AddressLabel').'</td><td colspan="3">'.$object->lines[$i]->label.'</td>';
|
||||
print '<td valign="top" colspan="2" width="50%" rowspan="6">'.$langs->trans('Note').' :<br>'.nl2br($object->lines[$i]->note).'</td></tr>';
|
||||
print '<tr><td width="20%">'.$langs->trans('Name').'</td><td colspan="3">'.$object->lines[$i]->name.'</td></tr>';
|
||||
|
||||
print "<tr><td valign=\"top\">".$langs->trans('Address')."</td><td colspan=\"3\">".nl2br($object->lines[$i]->address)."</td></tr>";
|
||||
|
||||
print '<tr><td width="25%">'.$langs->trans('Zip').'</td><td width="25%">'.$object->lines[$i]->zip."</td></tr>";
|
||||
print '<tr><td width="25%">'.$langs->trans('Town').'</td><td width="25%">'.$object->lines[$i]->town."</td></tr>";
|
||||
|
||||
print '<tr><td>'.$langs->trans('Country').'</td><td colspan="3">'.$object->lines[$i]->country.'</td>';
|
||||
|
||||
print '<tr><td>'.$langs->trans('Phone').'</td><td>'.dol_print_phone($object->lines[$i]->phone, $object->lines[$i]->country_code, 0, $object->socid, 'AC_TEL').'</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans('Fax').'</td><td>'.dol_print_phone($object->lines[$i]->fax, $object->lines[$i]->country_code, 0, $object->socid, 'AC_FAX').'</td></tr>';
|
||||
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
if ($user->rights->societe->creer)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?socid='.$object->socid.'&id='.$object->lines[$i]->id.'&action=edit">'.$langs->trans("Modify").'</a></div>';
|
||||
}
|
||||
|
||||
if ($user->rights->societe->supprimer)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?socid='.$object->socid.'&id='.$object->lines[$i]->id.'&action=delete">'.$langs->trans("Delete").'</a></div>';
|
||||
}
|
||||
|
||||
|
||||
print '</div>';
|
||||
print '<br>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans("None");
|
||||
}
|
||||
print '</div>';
|
||||
|
||||
|
||||
/*
|
||||
* Bouton actions
|
||||
*/
|
||||
|
||||
if ($action == '')
|
||||
{
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
if ($user->rights->societe->creer)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?socid='.$object->socid.'&action=create">'.$langs->trans("Add").'</a></div>';
|
||||
}
|
||||
print '</div>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
$db->close();
|
||||
@ -7,8 +7,9 @@
|
||||
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
|
||||
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
|
||||
* Copyright (C) 2015-2019 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
@ -1327,12 +1328,6 @@ if ($object->id > 0)
|
||||
show_contacts($conf, $langs, $db, $object, $_SERVER["PHP_SELF"].'?socid='.$object->id);
|
||||
}
|
||||
|
||||
// Addresses list
|
||||
if (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) && ! empty($conf->global->MAIN_REPEATADDRESSONEACHTAB))
|
||||
{
|
||||
show_addresses($conf, $langs, $db, $object, $_SERVER["PHP_SELF"].'?socid='.$object->id);
|
||||
}
|
||||
|
||||
if (! empty($conf->global->MAIN_REPEATTASKONEACHTAB))
|
||||
{
|
||||
print load_fiche_titre($langs->trans("ActionsOnCompany"), '', '');
|
||||
|
||||
@ -57,12 +57,13 @@ class Proposals extends DolibarrApi
|
||||
*
|
||||
* Return an array with commercial proposal informations
|
||||
*
|
||||
* @param int $id ID of commercial proposal
|
||||
* @param int $id ID of commercial proposal
|
||||
* @param int $contact_list 0: Returned array of contacts/addresses contains all properties, 1: Return array contains just id
|
||||
* @return array|mixed data without useless information
|
||||
*
|
||||
* @throws RestException
|
||||
*/
|
||||
function get($id)
|
||||
function get($id, $contact_list = 1)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->propal->lire) {
|
||||
throw new RestException(401);
|
||||
@ -77,9 +78,8 @@ class Proposals extends DolibarrApi
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
// Add external contacts ids
|
||||
$this->propal->contacts_ids = $this->propal->liste_contact(-1, 'external', 1);
|
||||
|
||||
// Add external contacts ids.
|
||||
$this->propal->contacts_ids = $this->propal->liste_contact(-1, 'external', $contact_list);
|
||||
$this->propal->fetchObjectLinked();
|
||||
return $this->_cleanObjectDatas($this->propal);
|
||||
}
|
||||
@ -409,6 +409,86 @@ class Proposals extends DolibarrApi
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a contact type of given commercial proposal
|
||||
*
|
||||
* @param int $id Id of commercial proposal 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->propal->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->propal->fetch($id);
|
||||
|
||||
if(!$result) {
|
||||
throw new RestException(404, 'Proposal not found');
|
||||
}
|
||||
|
||||
if (!in_array($type, array('BILLING', 'SHIPPING', 'CUSTOMER'), true)) {
|
||||
throw new RestException(500, 'Availables types: BILLING, SHIPPING OR CUSTOMER');
|
||||
}
|
||||
|
||||
if(!DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
$result = $this->propal->add_contact($contactid, $type, 'external');
|
||||
|
||||
if (!$result) {
|
||||
throw new RestException(500, 'Error when added the contact');
|
||||
}
|
||||
|
||||
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/{rowid}
|
||||
*
|
||||
* @return int
|
||||
* @throws 401
|
||||
* @throws 404
|
||||
* @throws 500
|
||||
*/
|
||||
function deleteContact($id, $rowid)
|
||||
{
|
||||
if(!DolibarrApiAccess::$user->rights->propal->creer) {
|
||||
throw new RestException(401);
|
||||
}
|
||||
|
||||
$result = $this->propal->fetch($id);
|
||||
|
||||
if(!$result) {
|
||||
throw new RestException(404, 'Proposal not found');
|
||||
}
|
||||
|
||||
if(!DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
$result = $this->propal->delete_contact($rowid);
|
||||
|
||||
if (!$result) {
|
||||
throw new RestException(500, 'Error when deleted the contact');
|
||||
}
|
||||
|
||||
return $this->propal;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update commercial proposal general fields (won't touch lines of commercial proposal)
|
||||
*
|
||||
|
||||
@ -56,12 +56,13 @@ class Orders extends DolibarrApi
|
||||
*
|
||||
* Return an array with order informations
|
||||
*
|
||||
* @param int $id ID of order
|
||||
* @param int $id ID of order
|
||||
* @param int $contact_list 0: Returned array of contacts/addresses contains all properties, 1: Return array contains just id
|
||||
* @return array|mixed data without useless information
|
||||
*
|
||||
* @throws RestException
|
||||
*/
|
||||
function get($id)
|
||||
function get($id, $contact_list = 1)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->commande->lire) {
|
||||
throw new RestException(401);
|
||||
@ -77,7 +78,7 @@ class Orders extends DolibarrApi
|
||||
}
|
||||
|
||||
// Add external contacts ids
|
||||
$this->commande->contacts_ids = $this->commande->liste_contact(-1, 'external', 1);
|
||||
$this->commande->contacts_ids = $this->commande->liste_contact(-1, 'external', $contact_list);
|
||||
$this->commande->fetchObjectLinked();
|
||||
return $this->_cleanObjectDatas($this->commande);
|
||||
}
|
||||
@ -398,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)
|
||||
|
||||
@ -727,24 +727,24 @@ if ($resql)
|
||||
if (! empty($arrayfields['s.town']['checked'])) print_liste_field_titre($arrayfields['s.town']['label'], $_SERVER["PHP_SELF"], 's.town', '', $param, '', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['s.zip']['checked'])) print_liste_field_titre($arrayfields['s.zip']['label'], $_SERVER["PHP_SELF"], 's.zip', '', $param, '', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['state.nom']['checked'])) print_liste_field_titre($arrayfields['state.nom']['label'], $_SERVER["PHP_SELF"], "state.nom", "", $param, '', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($arrayfields['country.code_iso']['label'], $_SERVER["PHP_SELF"], "country.code_iso", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['typent.code']['checked'])) print_liste_field_titre($arrayfields['typent.code']['label'], $_SERVER["PHP_SELF"], "typent.code", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['c.date_commande']['checked'])) print_liste_field_titre($arrayfields['c.date_commande']['label'], $_SERVER["PHP_SELF"], 'c.date_commande', '', $param, 'align="center"', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['c.date_delivery']['checked'])) print_liste_field_titre($arrayfields['c.date_delivery']['label'], $_SERVER["PHP_SELF"], 'c.date_livraison', '', $param, 'align="center"', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['c.total_ht']['checked'])) print_liste_field_titre($arrayfields['c.total_ht']['label'], $_SERVER["PHP_SELF"], 'c.total_ht', '', $param, 'class="right"', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['c.total_vat']['checked'])) print_liste_field_titre($arrayfields['c.total_vat']['label'], $_SERVER["PHP_SELF"], 'c.tva', '', $param, 'class="right"', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['c.total_ttc']['checked'])) print_liste_field_titre($arrayfields['c.total_ttc']['label'], $_SERVER["PHP_SELF"], 'c.total_ttc', '', $param, 'class="right"', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($arrayfields['country.code_iso']['label'], $_SERVER["PHP_SELF"], "country.code_iso", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
if (! empty($arrayfields['typent.code']['checked'])) print_liste_field_titre($arrayfields['typent.code']['label'], $_SERVER["PHP_SELF"], "typent.code", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
if (! empty($arrayfields['c.date_commande']['checked'])) print_liste_field_titre($arrayfields['c.date_commande']['label'], $_SERVER["PHP_SELF"], 'c.date_commande', '', $param, '', $sortfield, $sortorder, 'center ');
|
||||
if (! empty($arrayfields['c.date_delivery']['checked'])) print_liste_field_titre($arrayfields['c.date_delivery']['label'], $_SERVER["PHP_SELF"], 'c.date_livraison', '', $param, '', $sortfield, $sortorder, 'center ');
|
||||
if (! empty($arrayfields['c.total_ht']['checked'])) print_liste_field_titre($arrayfields['c.total_ht']['label'], $_SERVER["PHP_SELF"], 'c.total_ht', '', $param, '', $sortfield, $sortorder, 'right ');
|
||||
if (! empty($arrayfields['c.total_vat']['checked'])) print_liste_field_titre($arrayfields['c.total_vat']['label'], $_SERVER["PHP_SELF"], 'c.tva', '', $param, '', $sortfield, $sortorder, 'right ');
|
||||
if (! empty($arrayfields['c.total_ttc']['checked'])) print_liste_field_titre($arrayfields['c.total_ttc']['label'], $_SERVER["PHP_SELF"], 'c.total_ttc', '', $param, '', $sortfield, $sortorder, 'right ');
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
|
||||
// Hook fields
|
||||
$parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder);
|
||||
$reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
if (! empty($arrayfields['c.datec']['checked'])) print_liste_field_titre($arrayfields['c.datec']['label'], $_SERVER["PHP_SELF"], "c.date_creation", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['c.tms']['checked'])) print_liste_field_titre($arrayfields['c.tms']['label'], $_SERVER["PHP_SELF"], "c.tms", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['c.fk_statut']['checked'])) print_liste_field_titre($arrayfields['c.fk_statut']['label'], $_SERVER["PHP_SELF"], "c.fk_statut", "", $param, 'class="right"', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['c.facture']['checked'])) print_liste_field_titre($arrayfields['c.facture']['label'], $_SERVER["PHP_SELF"], 'c.facture', '', $param, 'align="center"', $sortfield, $sortorder, '');
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', $param, 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ');
|
||||
if (! empty($arrayfields['c.datec']['checked'])) print_liste_field_titre($arrayfields['c.datec']['label'], $_SERVER["PHP_SELF"], "c.date_creation", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
|
||||
if (! empty($arrayfields['c.tms']['checked'])) print_liste_field_titre($arrayfields['c.tms']['label'], $_SERVER["PHP_SELF"], "c.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
|
||||
if (! empty($arrayfields['c.fk_statut']['checked'])) print_liste_field_titre($arrayfields['c.fk_statut']['label'], $_SERVER["PHP_SELF"], "c.fk_statut", "", $param, '', $sortfield, $sortorder, 'right ');
|
||||
if (! empty($arrayfields['c.facture']['checked'])) print_liste_field_titre($arrayfields['c.facture']['label'], $_SERVER["PHP_SELF"], 'c.facture', '', $param, '', $sortfield, $sortorder, 'center ');
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'maxwidthsearch center ');
|
||||
print '</tr>'."\n";
|
||||
|
||||
$total=0;
|
||||
|
||||
@ -90,7 +90,7 @@ $entity = GETPOST('entity', 'int')?GETPOST('entity', 'int'):$conf->entity;
|
||||
|
||||
$filesarray=array();
|
||||
$result=false;
|
||||
if(($action=="searchfiles"||$action=="dl" ) && $date_start && $date_stop){
|
||||
if(($action=="searchfiles" || $action=="dl" ) && $date_start && $date_stop) {
|
||||
$wheretail=" '".$db->idate($date_start)."' AND '".$db->idate($date_stop)."'";
|
||||
$sql="SELECT rowid as id, ref as ref,paye as paid, total_ttc, fk_soc, datef as date, 'Invoice' as item FROM ".MAIN_DB_PREFIX."facture";
|
||||
$sql.=" WHERE datef between ".$wheretail;
|
||||
@ -243,7 +243,7 @@ if ($result && $action == "dl")
|
||||
$log='date,type,ref,total,paid,filename,item_id'."\n";
|
||||
$zipname = $dirfortmpfile.'/'.dol_print_date($date_start, 'dayrfc')."-".dol_print_date($date_stop, 'dayrfc').'_export.zip';
|
||||
|
||||
dol_delete_file(name);
|
||||
dol_delete_file($zipname);
|
||||
|
||||
$zip = new ZipArchive;
|
||||
$res = $zip->open($zipname, ZipArchive::OVERWRITE|ZipArchive::CREATE);
|
||||
|
||||
@ -55,12 +55,13 @@ class Invoices extends DolibarrApi
|
||||
*
|
||||
* Return an array with invoice informations
|
||||
*
|
||||
* @param int $id ID of invoice
|
||||
* @param int $id ID of invoice
|
||||
* @param int $contact_list 0:Return array contains all properties, 1:Return array contains just id
|
||||
* @return array|mixed data without useless information
|
||||
*
|
||||
* @throws RestException
|
||||
*/
|
||||
function get($id)
|
||||
function get($id, $contact_list = 1)
|
||||
{
|
||||
if(! DolibarrApiAccess::$user->rights->facture->lire) {
|
||||
throw new RestException(401);
|
||||
@ -82,7 +83,7 @@ class Invoices extends DolibarrApi
|
||||
}
|
||||
|
||||
// Add external contacts ids
|
||||
$this->invoice->contacts_ids = $this->invoice->liste_contact(-1, 'external', 1);
|
||||
$this->invoice->contacts_ids = $this->invoice->liste_contact(-1, 'external', $contact_list);
|
||||
|
||||
$this->invoice->fetchObjectLinked();
|
||||
return $this->_cleanObjectDatas($this->invoice);
|
||||
@ -337,7 +338,7 @@ class Invoices extends DolibarrApi
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
$request_data = (object) $request_data;
|
||||
$updateRes = $this->invoice->updateline(
|
||||
$updateRes = $this->invoice->updateline(
|
||||
$lineid,
|
||||
$request_data->desc,
|
||||
$request_data->subprice,
|
||||
@ -361,7 +362,7 @@ class Invoices extends DolibarrApi
|
||||
$request_data->situation_percent,
|
||||
$request_data->fk_unit,
|
||||
$request_data->multicurrency_subprice
|
||||
);
|
||||
);
|
||||
|
||||
if ($updateRes > 0) {
|
||||
$result = $this->get($id);
|
||||
@ -371,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->invoice->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->invoice->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
$result = $this->invoice->add_contact($contactid, $type, 'external');
|
||||
|
||||
if (!$result) {
|
||||
throw new RestException(500, 'Error when added the contact');
|
||||
}
|
||||
|
||||
return $this->_cleanObjectDatas($this->invoice);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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->invoice->fetch($id);
|
||||
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Invoice not found');
|
||||
}
|
||||
|
||||
if (!DolibarrApi::_checkAccessToResource('invoice', $this->invoice->id)) {
|
||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
$result = $this->invoice->delete_contact($rowid);
|
||||
|
||||
if (!$result) {
|
||||
throw new RestException(500, 'Error when deleted the contact');
|
||||
}
|
||||
|
||||
return $this->_cleanObjectDatas($this->invoice);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes a line of a given invoice
|
||||
|
||||
@ -960,7 +960,7 @@ class FactureRec extends CommonInvoice
|
||||
/**
|
||||
* Return the next date of
|
||||
*
|
||||
* @return timestamp false if KO, timestamp if OK
|
||||
* @return int|false false if KO, timestamp if OK
|
||||
*/
|
||||
function getNextDate()
|
||||
{
|
||||
|
||||
@ -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">';
|
||||
|
||||
@ -9,6 +9,7 @@
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||
* Copyright (C) 2018 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -81,7 +82,7 @@ $search_town=GETPOST('search_town', 'alpha');
|
||||
$search_import_key=GETPOST("search_import_key", "alpha");
|
||||
$search_country=GETPOST("search_country", 'intcomma');
|
||||
|
||||
if ($search_status=='') $search_status=1; // always display activ customer first
|
||||
if ($search_status=='') $search_status=1; // always display active customer first
|
||||
|
||||
$optioncss = GETPOST('optioncss', 'alpha');
|
||||
|
||||
@ -400,15 +401,15 @@ $help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Módulo_Empresas';
|
||||
llxHeader('', $title, $help_url);
|
||||
|
||||
$param='';
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
$param.='&begin='.urlencode($begin).'&view='.urlencode($view).'&userid='.urlencode($userid).'&contactname='.urlencode($sall);
|
||||
$param.='&type='.urlencode($type).'&view='.urlencode($view);
|
||||
if (!empty($search_categ)) $param.='&search_categ='.urlencode($search_categ);
|
||||
if (!empty($search_categ_thirdparty)) $param.='&search_categ_thirdparty='.urlencode($search_categ_thirdparty);
|
||||
if (!empty($search_categ_supplier)) $param.='&search_categ_supplier='.urlencode($search_categ_supplier);
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
$param.='&begin='.urlencode($begin).'&userid='.urlencode($userid).'&contactname='.urlencode($sall);
|
||||
$param.='&type='.urlencode($type).'&view='.urlencode($view);
|
||||
if (!empty($search_categ)) $param.='&search_categ='.urlencode($search_categ);
|
||||
if (!empty($search_categ_thirdparty)) $param.='&search_categ_thirdparty='.urlencode($search_categ_thirdparty);
|
||||
if (!empty($search_categ_supplier)) $param.='&search_categ_supplier='.urlencode($search_categ_supplier);
|
||||
if ($sall != '') $param.='&sall='.urlencode($sall);
|
||||
if ($search_id > 0) $param.= "&search_id=".urlencode($search_id);
|
||||
if ($search_id > 0) $param.= "&search_id=".urlencode($search_id);
|
||||
if ($search_lastname != '') $param.='&search_lastname='.urlencode($search_lastname);
|
||||
if ($search_firstname != '') $param.='&search_firstname='.urlencode($search_firstname);
|
||||
if ($search_societe != '') $param.='&search_societe='.urlencode($search_societe);
|
||||
@ -422,9 +423,9 @@ if ($search_phone_mobile != '') $param.='&search_phone_mobile='.urlencode($s
|
||||
if ($search_fax != '') $param.='&search_fax='.urlencode($search_fax);
|
||||
if ($search_email != '') $param.='&search_email='.urlencode($search_email);
|
||||
if ($search_status != '') $param.='&search_status='.urlencode($search_status);
|
||||
if ($search_priv == '0' || $search_priv == '1') $param.="&search_priv=".urlencode($search_priv);
|
||||
if ($search_import_key != '') $param.='&search_import_key='.urlencode($search_import_key);
|
||||
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
||||
if ($search_priv == '0' || $search_priv == '1') $param.="&search_priv=".urlencode($search_priv);
|
||||
if ($search_import_key != '') $param.='&search_import_key='.urlencode($search_import_key);
|
||||
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
||||
|
||||
// Add $param from extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
|
||||
@ -572,7 +573,7 @@ if (! empty($arrayfields['p.town']['checked']))
|
||||
// Country
|
||||
if (! empty($arrayfields['country.code_iso']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre" align="center">';
|
||||
print '<td class="liste_titre center">';
|
||||
print $form->select_country($search_country, 'search_country', '', 0, 'maxwidth100');
|
||||
print '</td>';
|
||||
}
|
||||
@ -632,7 +633,7 @@ if (! empty($arrayfields['p.thirdparty']['checked']))
|
||||
}
|
||||
if (! empty($arrayfields['p.priv']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre" align="center">';
|
||||
print '<td class="liste_titre center">';
|
||||
$selectarray=array('0'=>$langs->trans("ContactPublic"),'1'=>$langs->trans("ContactPrivate"));
|
||||
print $form->selectarray('search_priv', $selectarray, $search_priv, 1);
|
||||
print '</td>';
|
||||
@ -670,7 +671,7 @@ if (! empty($arrayfields['p.import_key']['checked']))
|
||||
print '</td>';
|
||||
}
|
||||
// Action column
|
||||
print '<td class="liste_titre" align="right">';
|
||||
print '<td class="liste_titre right">';
|
||||
$searchpicto=$form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
@ -697,17 +698,17 @@ if (! empty($arrayfields['p.skype']['checked'])) print_liste_field
|
||||
if (! empty($arrayfields['p.twitter']['checked'])) print_liste_field_titre($arrayfields['p.twitter']['label'], $_SERVER["PHP_SELF"], "p.twitter", $begin, $param, '', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['p.facebook']['checked'])) print_liste_field_titre($arrayfields['p.facebook']['label'], $_SERVER["PHP_SELF"], "p.facebook", $begin, $param, '', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['p.thirdparty']['checked'])) print_liste_field_titre($arrayfields['p.thirdparty']['label'], $_SERVER["PHP_SELF"], "s.nom", $begin, $param, '', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['p.priv']['checked'])) print_liste_field_titre($arrayfields['p.priv']['label'], $_SERVER["PHP_SELF"], "p.priv", $begin, $param, 'align="center"', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['p.priv']['checked'])) print_liste_field_titre($arrayfields['p.priv']['label'], $_SERVER["PHP_SELF"], "p.priv", $begin, $param, '', $sortfield, $sortorder, 'center ');
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
|
||||
// Hook fields
|
||||
$parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder);
|
||||
$reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
if (! empty($arrayfields['p.datec']['checked'])) print_liste_field_titre($arrayfields['p.datec']['label'], $_SERVER["PHP_SELF"], "p.datec", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['p.tms']['checked'])) print_liste_field_titre($arrayfields['p.tms']['label'], $_SERVER["PHP_SELF"], "p.tms", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['p.statut']['checked'])) print_liste_field_titre($arrayfields['p.statut']['label'], $_SERVER["PHP_SELF"], "p.statut", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['p.import_key']['checked'])) print_liste_field_titre($arrayfields['p.import_key']['label'], $_SERVER["PHP_SELF"], "p.import_key", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['p.datec']['checked'])) print_liste_field_titre($arrayfields['p.datec']['label'], $_SERVER["PHP_SELF"], "p.datec", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
|
||||
if (! empty($arrayfields['p.tms']['checked'])) print_liste_field_titre($arrayfields['p.tms']['label'], $_SERVER["PHP_SELF"], "p.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap ');
|
||||
if (! empty($arrayfields['p.statut']['checked'])) print_liste_field_titre($arrayfields['p.statut']['label'], $_SERVER["PHP_SELF"], "p.statut", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
if (! empty($arrayfields['p.import_key']['checked'])) print_liste_field_titre($arrayfields['p.import_key']['label'], $_SERVER["PHP_SELF"], "p.import_key", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ');
|
||||
print "</tr>\n";
|
||||
|
||||
@ -787,7 +788,7 @@ while ($i < min($num, $limit))
|
||||
// Country
|
||||
if (! empty($arrayfields['country.code_iso']['checked']))
|
||||
{
|
||||
print '<td align="center">';
|
||||
print '<td class="center">';
|
||||
$tmparray=getCountry($obj->fk_pays, 'all');
|
||||
print $tmparray['label'];
|
||||
print '</td>';
|
||||
@ -867,7 +868,7 @@ while ($i < min($num, $limit))
|
||||
// Private/Public
|
||||
if (! empty($arrayfields['p.priv']['checked']))
|
||||
{
|
||||
print '<td align="center">'.$contactstatic->LibPubPriv($obj->priv).'</td>';
|
||||
print '<td class="center">'.$contactstatic->LibPubPriv($obj->priv).'</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
@ -880,7 +881,7 @@ while ($i < min($num, $limit))
|
||||
// Date creation
|
||||
if (! empty($arrayfields['p.datec']['checked']))
|
||||
{
|
||||
print '<td align="center">';
|
||||
print '<td class="center">';
|
||||
print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser');
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
@ -888,7 +889,7 @@ while ($i < min($num, $limit))
|
||||
// Date modification
|
||||
if (! empty($arrayfields['p.tms']['checked']))
|
||||
{
|
||||
print '<td align="center">';
|
||||
print '<td class="center">';
|
||||
print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser');
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
@ -896,7 +897,7 @@ while ($i < min($num, $limit))
|
||||
// Status
|
||||
if (! empty($arrayfields['p.statut']['checked']))
|
||||
{
|
||||
print '<td align="center">'.$contactstatic->getLibStatut(3).'</td>';
|
||||
print '<td class="center">'.$contactstatic->getLibStatut(3).'</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
if (! empty($arrayfields['p.import_key']['checked']))
|
||||
@ -908,7 +909,7 @@ while ($i < min($num, $limit))
|
||||
}
|
||||
|
||||
// Action column
|
||||
print '<td class="nowrap" align="center">';
|
||||
print '<td class="nowrap center">';
|
||||
if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
|
||||
{
|
||||
$selected=0;
|
||||
|
||||
433
htdocs/core/class/cunits.class.php
Normal file
433
htdocs/core/class/cunits.class.php
Normal file
@ -0,0 +1,433 @@
|
||||
<?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/cunits.class.php
|
||||
* \ingroup core
|
||||
* \brief This file is CRUD class file (Create/Read/Update/Delete) for c_units dictionary
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Class of dictionary type of thirdparty (used by imports)
|
||||
*/
|
||||
class CUnits // 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 $scale;
|
||||
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 = (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);
|
||||
|
||||
|
||||
|
||||
// Check parameters
|
||||
// Put here code to add control on parameters values
|
||||
|
||||
// Insert request
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."c_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->escape($this->short_label)."'").",";
|
||||
$sql.= " ".(! isset($this->unit_type)?'NULL':"'".$this->db->escape($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_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 $code Code
|
||||
* @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 = '', $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";
|
||||
$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_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_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_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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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);
|
||||
|
||||
|
||||
@ -956,52 +956,6 @@ class FormOther
|
||||
return $out;
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
|
||||
/**
|
||||
* Show form to select address
|
||||
*
|
||||
* @param int $page Page
|
||||
* @param string $selected Id condition pre-selectionne
|
||||
* @param int $socid Id of third party
|
||||
* @param string $htmlname Nom du formulaire select
|
||||
* @param string $origin Origine de l'appel pour pouvoir creer un retour
|
||||
* @param int $originid Id de l'origine
|
||||
* @return void
|
||||
*/
|
||||
function form_address($page, $selected, $socid, $htmlname = 'address_id', $origin = '', $originid = '')
|
||||
{
|
||||
// phpcs:enable
|
||||
global $langs,$conf;
|
||||
global $form;
|
||||
|
||||
if ($htmlname != "none")
|
||||
{
|
||||
print '<form method="post" action="'.$page.'">';
|
||||
print '<input type="hidden" name="action" value="setaddress">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$form->select_address($selected, $socid, $htmlname, 1);
|
||||
print '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$langs->load("companies");
|
||||
print ' <a href='.DOL_URL_ROOT.'/comm/address.php?socid='.$socid.'&action=create&origin='.$origin.'&originid='.$originid.'>'.$langs->trans("AddAddress").'</a>';
|
||||
print '</form>';
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($selected)
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT .'/societe/class/address.class.php';
|
||||
$address=new Address($this->db);
|
||||
$result=$address->fetch_address($selected);
|
||||
print '<a href='.DOL_URL_ROOT.'/comm/address.php?socid='.$address->socid.'&id='.$address->id.'&action=edit&origin='.$origin.'&originid='.$originid.'>'.$address->label.'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print " ";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get array with HTML tabs with boxes of a particular area including personalized choices of user.
|
||||
|
||||
@ -50,8 +50,8 @@ class RssParser
|
||||
private $_rssarray=array();
|
||||
|
||||
// For parsing with xmlparser
|
||||
var $stack = array(); // parser stack
|
||||
var $_CONTENT_CONSTRUCTS = array('content', 'summary', 'info', 'title', 'tagline', 'copyright');
|
||||
public $stack = array(); // parser stack
|
||||
private $_CONTENT_CONSTRUCTS = array('content', 'summary', 'info', 'title', 'tagline', 'copyright');
|
||||
|
||||
|
||||
/**
|
||||
@ -246,7 +246,7 @@ class RssParser
|
||||
$str = file_get_contents($this->_urlRSS, false, $context);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
print 'Error retrieving URL '.$this->urlRSS.' - '.$e->getMessage();
|
||||
print 'Error retrieving URL '.$this->_urlRSS.' - '.$e->getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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');
|
||||
|
||||
@ -1166,109 +1166,18 @@ function show_contacts($conf, $langs, $db, $object, $backtopage = '')
|
||||
return $i;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show html area for list of addresses
|
||||
*
|
||||
* @param Conf $conf Object conf
|
||||
* @param Translate $langs Object langs
|
||||
* @param DoliDB $db Database handler
|
||||
* @param Societe $object Third party object
|
||||
* @param string $backtopage Url to go once address is created
|
||||
* @return void
|
||||
*/
|
||||
function show_addresses($conf, $langs, $db, $object, $backtopage = '')
|
||||
{
|
||||
global $user;
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/societe/class/address.class.php';
|
||||
|
||||
$addressstatic = new Address($db);
|
||||
$num = $addressstatic->fetch_lines($object->id);
|
||||
|
||||
$newcardbutton='';
|
||||
if ($user->rights->societe->creer)
|
||||
{
|
||||
$newcardbutton='<a class="butActionNew" href="'.DOL_URL_ROOT.'/comm/address.php?socid='.$object->id.'&action=create&backtopage='.urlencode($backtopage).'"><span class="valignmiddle">'.$langs->trans("AddAddress").'</span>';
|
||||
$newcardbutton.= '<span class="fa fa-plus-circle valignmiddle"></span>';
|
||||
$newcardbutton.= '</a>';
|
||||
}
|
||||
|
||||
print "\n";
|
||||
print load_fiche_titre($langs->trans("AddressesForCompany"), $newcardbutton, '');
|
||||
|
||||
print "\n".'<table class="noborder" width="100%">'."\n";
|
||||
|
||||
print '<tr class="liste_titre"><td>'.$langs->trans("Label").'</td>';
|
||||
print '<td>'.$langs->trans("CompanyName").'</td>';
|
||||
print '<td>'.$langs->trans("Town").'</td>';
|
||||
print '<td>'.$langs->trans("Country").'</td>';
|
||||
print '<td>'.$langs->trans("Phone").'</td>';
|
||||
print '<td>'.$langs->trans("Fax").'</td>';
|
||||
print "<td> </td>";
|
||||
print "</tr>";
|
||||
|
||||
if ($num > 0)
|
||||
{
|
||||
foreach ($addressstatic->lines as $address)
|
||||
{
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
print '<td>';
|
||||
$addressstatic->id = $address->id;
|
||||
$addressstatic->label = $address->label;
|
||||
print $addressstatic->getNomUrl(1);
|
||||
print '</td>';
|
||||
|
||||
print '<td>'.$address->name.'</td>';
|
||||
|
||||
print '<td>'.$address->town.'</td>';
|
||||
|
||||
$img=picto_from_langcode($address->country_code);
|
||||
print '<td>'.($img?$img.' ':'').$address->country.'</td>';
|
||||
|
||||
// Lien click to dial
|
||||
print '<td>';
|
||||
print dol_print_phone($address->phone, $address->country_code, $address->id, $object->id, 'AC_TEL');
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
print dol_print_phone($address->fax, $address->country_code, $address->id, $object->id, 'AC_FAX');
|
||||
print '</td>';
|
||||
|
||||
if ($user->rights->societe->creer)
|
||||
{
|
||||
print '<td align="right">';
|
||||
print '<a href="'.DOL_URL_ROOT.'/comm/address.php?action=edit&id='.$address->id.'&socid='.$object->id.'&backtopage='.urlencode($backtopage).'">';
|
||||
print img_edit();
|
||||
print '</a></td>';
|
||||
}
|
||||
|
||||
print "</tr>\n";
|
||||
}
|
||||
}
|
||||
//else
|
||||
//{
|
||||
//print '<tr class="oddeven">';
|
||||
//print '<td>'.$langs->trans("NoAddressYetDefined").'</td>';
|
||||
//print "</tr>\n";
|
||||
//}
|
||||
print "\n</table>\n";
|
||||
|
||||
print "<br>\n";
|
||||
|
||||
return $num;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 +1203,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 +1670,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)
|
||||
{
|
||||
|
||||
@ -2636,7 +2636,7 @@ function dol_print_ip($ip, $mode = 0)
|
||||
* Return the IP of remote user.
|
||||
* Take HTTP_X_FORWARDED_FOR (defined when using proxy)
|
||||
* Then HTTP_CLIENT_IP if defined (rare)
|
||||
* Then REMOTE_ADDR (not way to be modified by user but may be wrong if using proxy)
|
||||
* Then REMOTE_ADDR (no way to be modified by user but may be wrong if user is using a proxy)
|
||||
*
|
||||
* @return string Ip of remote user.
|
||||
*/
|
||||
@ -2979,7 +2979,9 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
|
||||
'jabber','skype','twitter','facebook'
|
||||
)
|
||||
)) {
|
||||
$fakey = $pictowithoutext;
|
||||
$fa='fa';
|
||||
if (! empty($conf->global->MAIN_USE_FONT_AWESOME_5)) $fa='fas';
|
||||
$fakey = $pictowithoutext;
|
||||
$facolor = ''; $fasize = '';
|
||||
$marginleftonlyshort = 2;
|
||||
if ($pictowithoutext == 'switch_off') {
|
||||
@ -3074,6 +3076,10 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
|
||||
elseif ($pictowithoutext == 'jabber') {
|
||||
$fakey = 'fa-comment-o';
|
||||
}
|
||||
elseif ($pictowithoutext == 'skype') {
|
||||
$fakey = 'fa-'.$pictowithoutext;
|
||||
if (! empty($conf->global->MAIN_USE_FONT_AWESOME_5)) $fa = 'fab';
|
||||
}
|
||||
elseif ($pictowithoutext == 'split') {
|
||||
$fakey = 'fa-code-fork';
|
||||
}
|
||||
@ -3095,8 +3101,6 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
|
||||
}
|
||||
$moreatt=trim($moreatt);
|
||||
|
||||
$fa='fa';
|
||||
if (! empty($conf->global->MAIN_USE_FONT_AWESOME_5)) $fa='fas';
|
||||
$enabledisablehtml = '<span class="' . $fa . ' ' . $fakey . ($marginleftonlyshort ? ($marginleftonlyshort == 1 ? ' marginleftonlyshort' : ' marginleftonly') : '');
|
||||
$enabledisablehtml .= ' valignmiddle' . ($morecss ? ' ' . $morecss : '') . '" style="' . ($fasize ? ('font-size: ' . $fasize . ';') : '') . ($facolor ? (' color: ' . $facolor . ';') : '') . ($morestyle ? ' ' . $morestyle : '') . '"' . (($notitle || empty($titlealt)) ? '' : ' title="' . dol_escape_htmltag($titlealt) . '"') . ($moreatt ? ' ' . $moreatt : '') . '>';
|
||||
if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
|
||||
|
||||
@ -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)
|
||||
{
|
||||
|
||||
@ -104,7 +104,7 @@ function dol_getImageSize($file, $url = false)
|
||||
* @param int $newHeight Hauteur maximum que dois faire l'image destination (0=keep ratio)
|
||||
* @param int $src_x Position of croping image in source image (not use if mode=0)
|
||||
* @param int $src_y Position of croping image in source image (not use if mode=0)
|
||||
* @return int File name if OK, error message if KO
|
||||
* @return string File name if OK, error message if KO
|
||||
*/
|
||||
function dol_imageResizeOrCrop($file, $mode, $newWidth, $newHeight, $src_x = 0, $src_y = 0)
|
||||
{
|
||||
|
||||
@ -461,7 +461,6 @@ function show_stats_for_company($product, $socid)
|
||||
return $nblines++;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return translation label of a unit key
|
||||
*
|
||||
@ -472,50 +471,24 @@ function show_stats_for_company($product, $socid)
|
||||
*/
|
||||
function measuring_units_string($unit, $measuring_style = '')
|
||||
{
|
||||
global $langs;
|
||||
global $langs, $db;
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/cmeasuringunits.class.php';
|
||||
$measuringUnits= new CMeasuringUnits($db);
|
||||
$result = $measuringUnits->fetchAll('', '', 0, 0, array(
|
||||
't.code' => $unit,
|
||||
't.unit_type' => $measuring_style,
|
||||
't.active' => 1
|
||||
));
|
||||
|
||||
$measuring_units=array();
|
||||
if ($measuring_style == 'weight')
|
||||
{
|
||||
$measuring_units[3] = $langs->transnoentitiesnoconv("WeightUnitton");
|
||||
$measuring_units[0] = $langs->transnoentitiesnoconv("WeightUnitkg");
|
||||
$measuring_units[-3] = $langs->transnoentitiesnoconv("WeightUnitg");
|
||||
$measuring_units[-6] = $langs->transnoentitiesnoconv("WeightUnitmg");
|
||||
$measuring_units[98] = $langs->transnoentitiesnoconv("WeightUnitounce");
|
||||
$measuring_units[99] = $langs->transnoentitiesnoconv("WeightUnitpound");
|
||||
if ($result<0) {
|
||||
return -1;
|
||||
} else {
|
||||
if (is_array($measuringUnits->records) && count($measuringUnits->records)>0) {
|
||||
return $langs->transnoentitiesnoconv($measuringUnits->records[key($measuringUnits->records)]->label);
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
elseif ($measuring_style == 'size')
|
||||
{
|
||||
$measuring_units[0] = $langs->transnoentitiesnoconv("SizeUnitm");
|
||||
$measuring_units[-1] = $langs->transnoentitiesnoconv("SizeUnitdm");
|
||||
$measuring_units[-2] = $langs->transnoentitiesnoconv("SizeUnitcm");
|
||||
$measuring_units[-3] = $langs->transnoentitiesnoconv("SizeUnitmm");
|
||||
$measuring_units[98] = $langs->transnoentitiesnoconv("SizeUnitfoot");
|
||||
$measuring_units[99] = $langs->transnoentitiesnoconv("SizeUnitinch");
|
||||
}
|
||||
elseif ($measuring_style == 'surface')
|
||||
{
|
||||
$measuring_units[0] = $langs->transnoentitiesnoconv("SurfaceUnitm2");
|
||||
$measuring_units[-2] = $langs->transnoentitiesnoconv("SurfaceUnitdm2");
|
||||
$measuring_units[-4] = $langs->transnoentitiesnoconv("SurfaceUnitcm2");
|
||||
$measuring_units[-6] = $langs->transnoentitiesnoconv("SurfaceUnitmm2");
|
||||
$measuring_units[98] = $langs->transnoentitiesnoconv("SurfaceUnitfoot2");
|
||||
$measuring_units[99] = $langs->transnoentitiesnoconv("SurfaceUnitinch2");
|
||||
}
|
||||
elseif ($measuring_style == 'volume')
|
||||
{
|
||||
$measuring_units[0] = $langs->transnoentitiesnoconv("VolumeUnitm3");
|
||||
$measuring_units[-3] = $langs->transnoentitiesnoconv("VolumeUnitdm3");
|
||||
$measuring_units[-6] = $langs->transnoentitiesnoconv("VolumeUnitcm3");
|
||||
$measuring_units[-9] = $langs->transnoentitiesnoconv("VolumeUnitmm3");
|
||||
$measuring_units[88] = $langs->transnoentitiesnoconv("VolumeUnitfoot3");
|
||||
$measuring_units[89] = $langs->transnoentitiesnoconv("VolumeUnitinch3");
|
||||
$measuring_units[97] = $langs->transnoentitiesnoconv("VolumeUnitounce");
|
||||
$measuring_units[98] = $langs->transnoentitiesnoconv("VolumeUnitlitre");
|
||||
$measuring_units[99] = $langs->transnoentitiesnoconv("VolumeUnitgallon");
|
||||
}
|
||||
|
||||
return $measuring_units[$unit];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -86,7 +86,7 @@ function tax_prepare_head(ChargeSociales $object)
|
||||
* @param string $direction 'sell' or 'buy'
|
||||
* @param int $m Month
|
||||
* @param int $q Quarter
|
||||
* @return array Array with details of VATs (per third parties), -1 if no accountancy module, -2 if not yet developped, -3 if error
|
||||
* @return array|int Array with details of VATs (per third parties), -1 if no accountancy module, -2 if not yet developped, -3 if error
|
||||
*/
|
||||
function tax_by_thirdparty($type, $db, $y, $date_start, $date_end, $modetax, $direction, $m = 0, $q = 0)
|
||||
{
|
||||
@ -111,7 +111,7 @@ function tax_by_thirdparty($type, $db, $y, $date_start, $date_end, $modetax, $di
|
||||
$paymentfacturetable='paiement_facture';
|
||||
$invoicefieldref='ref';
|
||||
}
|
||||
if ($direction == 'buy')
|
||||
elseif ($direction == 'buy')
|
||||
{
|
||||
$invoicetable='facture_fourn';
|
||||
$invoicedettable='facture_fourn_det';
|
||||
@ -554,7 +554,7 @@ function tax_by_thirdparty($type, $db, $y, $date_start, $date_end, $modetax, $di
|
||||
* @param int $modetax Not used
|
||||
* @param int $direction 'sell' (customer invoice) or 'buy' (supplier invoices)
|
||||
* @param int $m Month
|
||||
* @return array Array with details of VATs (per rate), -1 if no accountancy module, -2 if not yet developped, -3 if error
|
||||
* @return array|int Array with details of VATs (per rate), -1 if no accountancy module, -2 if not yet developped, -3 if error
|
||||
*/
|
||||
function tax_by_rate($type, $db, $y, $q, $date_start, $date_end, $modetax, $direction, $m = 0)
|
||||
{
|
||||
|
||||
@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
@ -471,6 +471,43 @@ class ImportCsv extends ModeleImports
|
||||
{
|
||||
if (empty($newval)) $newval='0';
|
||||
}
|
||||
elseif ($objimport->array_import_convertvalue[0][$val]['rule']=='fetchidfromcodeunits')
|
||||
{
|
||||
$file=(empty($objimport->array_import_convertvalue[0][$val]['classfile'])?$objimport->array_import_convertvalue[0][$val]['file']:$objimport->array_import_convertvalue[0][$val]['classfile']);
|
||||
$class=$objimport->array_import_convertvalue[0][$val]['class'];
|
||||
$method=$objimport->array_import_convertvalue[0][$val]['method'];
|
||||
$units=$objimport->array_import_convertvalue[0][$val]['units'];
|
||||
if ($this->cacheconvert[$file.'_'.$class.'_'.$method.'_'.$units][$newval] != '')
|
||||
{
|
||||
$newval=$this->cacheconvert[$file.'_'.$class.'_'.$method.'_'.$units][$newval];
|
||||
}
|
||||
else
|
||||
{
|
||||
$resultload = dol_include_once($file);
|
||||
if (empty($resultload))
|
||||
{
|
||||
dol_print_error('', 'Error trying to call file='.$file.', class='.$class.', method='.$method.', units='.$units);
|
||||
break;
|
||||
}
|
||||
$classinstance=new $class($this->db);
|
||||
// Try the fetch from code or ref
|
||||
call_user_func_array(array($classinstance, $method), array('', $units, $newval));
|
||||
$this->cacheconvert[$file.'_'.$class.'_'.$method.'_'.$units][$newval]=$classinstance->code;
|
||||
//print 'We have made a '.$class.'->'.$method.' to get id from code '.$newval.'. ';
|
||||
if ($classinstance->code != '') // id may be 0, it is a found value
|
||||
{
|
||||
$newval=$classinstance->code;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!empty($objimport->array_import_convertvalue[0][$val]['dict'])) $this->errors[$error]['lib']=$langs->trans('ErrorFieldValueNotIn', $key, $newval, 'code', $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$val]['dict']));
|
||||
else $this->errors[$error]['lib']='ErrorFieldValueNotIn';
|
||||
$this->errors[$error]['type']='FOREIGNKEY';
|
||||
$errorforthistable++;
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif ($objimport->array_import_convertvalue[0][$val]['rule']=='getcustomercodeifauto')
|
||||
{
|
||||
if (strtolower($newval) == 'auto')
|
||||
|
||||
@ -498,6 +498,43 @@ class ImportXlsx extends ModeleImports
|
||||
{
|
||||
if (empty($newval)) $newval='0';
|
||||
}
|
||||
elseif ($objimport->array_import_convertvalue[0][$val]['rule']=='fetchidfromcodeunits')
|
||||
{
|
||||
$file=(empty($objimport->array_import_convertvalue[0][$val]['classfile'])?$objimport->array_import_convertvalue[0][$val]['file']:$objimport->array_import_convertvalue[0][$val]['classfile']);
|
||||
$class=$objimport->array_import_convertvalue[0][$val]['class'];
|
||||
$method=$objimport->array_import_convertvalue[0][$val]['method'];
|
||||
$units=$objimport->array_import_convertvalue[0][$val]['units'];
|
||||
if ($this->cacheconvert[$file.'_'.$class.'_'.$method.'_'.$units][$newval] != '')
|
||||
{
|
||||
$newval=$this->cacheconvert[$file.'_'.$class.'_'.$method.'_'.$units][$newval];
|
||||
}
|
||||
else
|
||||
{
|
||||
$resultload = dol_include_once($file);
|
||||
if (empty($resultload))
|
||||
{
|
||||
dol_print_error('', 'Error trying to call file='.$file.', class='.$class.', method='.$method.', units='.$units);
|
||||
break;
|
||||
}
|
||||
$classinstance=new $class($this->db);
|
||||
// Try the fetch from code or ref
|
||||
call_user_func_array(array($classinstance, $method), array('', $units, '', $newval));
|
||||
$this->cacheconvert[$file.'_'.$class.'_'.$method.'_'.$units][$newval]=$classinstance->code;
|
||||
//print 'We have made a '.$class.'->'.$method.' to get id from code '.$newval.'. ';
|
||||
if ($classinstance->code != '') // id may be 0, it is a found value
|
||||
{
|
||||
$newval=$classinstance->code;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!empty($objimport->array_import_convertvalue[0][$val]['dict'])) $this->errors[$error]['lib']=$langs->trans('ErrorFieldValueNotIn', $key, $newval, 'code', $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$val]['dict']));
|
||||
else $this->errors[$error]['lib']='ErrorFieldValueNotIn';
|
||||
$this->errors[$error]['type']='FOREIGNKEY';
|
||||
$errorforthistable++;
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
}
|
||||
elseif ($objimport->array_import_convertvalue[0][$val]['rule']=='getcustomercodeifauto')
|
||||
{
|
||||
if (strtolower($newval) == 'auto')
|
||||
|
||||
@ -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',
|
||||
|
||||
@ -313,8 +313,11 @@ class modProduct extends DolibarrModules
|
||||
'p.note' => "PrivateNote",//private note
|
||||
'p.customcode' => 'CustomCode',
|
||||
'p.price' => "SellingPriceHT",//without tax
|
||||
'p.price_min' => "MinPrice",
|
||||
'p.price_ttc' => "SellingPriceTTC",//with tax
|
||||
'p.price_min_ttc' => "SellingMinPriceTTC",
|
||||
'p.price_base_type' => "PriceBaseType",//price base: with-tax (TTC) or without (HT) tax. Displays accordingly in Product card
|
||||
'p.cost_price' => "CostPrice",
|
||||
'p.tva_tx' => 'VATRate',
|
||||
'p.tosell' => "OnSell*",
|
||||
'p.tobuy' => "OnBuy*",
|
||||
@ -324,12 +327,18 @@ class modProduct extends DolibarrModules
|
||||
'p.accountancy_code_sell' => "ProductAccountancySellCode",
|
||||
'p.accountancy_code_buy' => "ProductAccountancyBuyCode",
|
||||
'p.weight' => "Weight",
|
||||
'p.weight_units' => "WeightUnits",
|
||||
'p.length' => "Length",
|
||||
'p.length_units' => "LengthUnit",
|
||||
'p.width' => "Width",
|
||||
'p.width_units' => "VolumeUnits",
|
||||
'p.height' => "Height",
|
||||
'p.height_units' => "HeightUnit",
|
||||
'p.surface' => "Surface",
|
||||
'p.surface_units' => "SurfaceUnit",
|
||||
'p.volume' => "Volume",
|
||||
'p.finished' => 'Nature'
|
||||
'p.volume_units' => "VolumeUnits",
|
||||
'p.finished' => 'Nature',
|
||||
);
|
||||
if (!empty($conf->stock->enabled)) {//if Stock module enabled
|
||||
$this->import_fields_array[$r] = array_merge($this->import_fields_array[$r], array(
|
||||
@ -338,6 +347,58 @@ class modProduct extends DolibarrModules
|
||||
'p.desiredstock' => 'DesiredStock'//desired stock for replenishment feature
|
||||
));
|
||||
}
|
||||
|
||||
$this->import_convertvalue_array[$r] = array(
|
||||
'p.weight_units' => array(
|
||||
'rule' => 'fetchidfromcodeunits',
|
||||
'classfile' => '/core/class/cmeasuringunits.class.php',
|
||||
'class' => 'CMeasuringUnits',
|
||||
'method' => 'fetch',
|
||||
'units' => 'weight',
|
||||
'dict' => 'DictionaryMeasuringUnits'
|
||||
),
|
||||
'p.length_units' => array(
|
||||
'rule' => 'fetchidfromcodeunits',
|
||||
'classfile' => '/core/class/cmeasuringunits.class.php',
|
||||
'class' => 'CMeasuringUnits',
|
||||
'method' => 'fetch',
|
||||
'units' => 'size',
|
||||
'dict' => 'DictionaryMeasuringUnits'
|
||||
),
|
||||
'p.width_units' => array(
|
||||
'rule' => 'fetchidfromcodeunits',
|
||||
'classfile' => '/core/class/cmeasuringunits.class.php',
|
||||
'class' => 'CMeasuringUnits',
|
||||
'method' => 'fetch',
|
||||
'units' => 'size',
|
||||
'dict' => 'DictionaryMeasuringUnits'
|
||||
),
|
||||
'p.height_units' => array(
|
||||
'rule' => 'fetchidfromcodeunits',
|
||||
'classfile' => '/core/class/cmeasuringunits.class.php',
|
||||
'class' => 'CMeasuringUnits',
|
||||
'method' => 'fetch',
|
||||
'units' => 'size',
|
||||
'dict' => 'DictionaryMeasuringUnits'
|
||||
),
|
||||
'p.surface_units' => array(
|
||||
'rule' => 'fetchidfromcodeunits',
|
||||
'classfile' => '/core/class/cmeasuringunits.class.php',
|
||||
'class' => 'CMeasuringUnits',
|
||||
'method' => 'fetch',
|
||||
'units' => 'surface',
|
||||
'dict' => 'DictionaryMeasuringUnits'
|
||||
),
|
||||
'p.volume_units' => array(
|
||||
'rule' => 'fetchidfromcodeunits',
|
||||
'classfile' => '/core/class/cmeasuringunits.class.php',
|
||||
'class' => 'CMeasuringUnits',
|
||||
'method' => 'fetch',
|
||||
'units' => 'volume',
|
||||
'dict' => 'DictionaryMeasuringUnits'
|
||||
)
|
||||
);
|
||||
|
||||
if (! empty($conf->fournisseur->enabled) || !empty($conf->margin->enabled)) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r], array('p.cost_price'=>'CostPrice'));
|
||||
if (is_object($mysoc) && $mysoc->useNPR()) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r], array('p.recuperableonly'=>'NPR'));
|
||||
if (is_object($mysoc) && $mysoc->useLocalTax(1)) $this->import_fields_array[$r]=array_merge($this->import_fields_array[$r], array('p.localtax1_tx'=>'LT1', 'p.localtax1_type'=>'LT1Type'));
|
||||
@ -370,8 +431,9 @@ class modProduct extends DolibarrModules
|
||||
'p.recuperableonly' => '^[0|1]$',
|
||||
'p.finished' => '^[0|1]$'
|
||||
);
|
||||
|
||||
$import_sample = array(//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'),
|
||||
'p.label' => "Product name in default language",
|
||||
@ -380,7 +442,9 @@ class modProduct extends DolibarrModules
|
||||
'p.note' => "a private note (free text)",
|
||||
'p.customcode' => 'customs code',
|
||||
'p.price' => "price ex-vat eg. 100",
|
||||
'p.price_min' => "price ex-vat eg. 100",
|
||||
'p.price_ttc' => "price inc-vat eg. 110",
|
||||
'p.price_min_ttc' => "price inc-vat eg. 110",
|
||||
'p.price_base_type' => "HT (show/use price excl. tax) / TTC (show/use price incl. tax)",
|
||||
'p.tva_tx' => 'tax rate eg: 10. Must match numerically one of the tax rates defined for your country',
|
||||
'p.tosell' => "0 (not for sale to customer, eg. raw material) / 1 (for sale)",
|
||||
@ -391,11 +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_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_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_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_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_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_units',
|
||||
'p.finished' => '0 (raw material) / 1 (finished goods)'
|
||||
);
|
||||
//clauses copied from import_fields_array
|
||||
@ -409,8 +479,21 @@ class modProduct extends DolibarrModules
|
||||
if (is_object($mysoc) && $mysoc->useLocalTax(1)) $import_sample=array_merge($import_sample, array('p.localtax1_tx'=>'', 'p.localtax1_type'=>''));
|
||||
if (is_object($mysoc) && $mysoc->useLocalTax(2)) $import_sample=array_merge($import_sample, array('p.localtax2_tx'=>'', 'p.localtax2_type'=>''));
|
||||
if (! empty($conf->barcode->enabled)) $import_sample=array_merge($import_sample, array('p.barcode'=>''));
|
||||
if (! empty($conf->global->PRODUCT_USE_UNITS)) $import_sample=array_merge($import_sample, array('p.fk_unit'=>'use a unit of measure from the dictionary. 1/2/3 etc....matches field "rowid" in table "'.MAIN_DB_PREFIX.'c_units"'));
|
||||
if (! empty($conf->global->PRODUCT_USE_UNITS)) {
|
||||
$import_sample = array_merge($import_sample, array(
|
||||
'p.fk_unit' => 'use a unit of measure from the dictionary. G/KG/M2/M3 etc....matches field "code" in table "' . MAIN_DB_PREFIX . 'c_units"'
|
||||
));
|
||||
|
||||
$this->import_convertvalue_array[$r] = array_merge($this->import_convertvalue_array[$r], array(
|
||||
'p.fk_unit' => array(
|
||||
'rule' => 'fetchidfromcodeorlabel',
|
||||
'classfile' => '/core/class/cunits.class.php',
|
||||
'class' => 'CUnits',
|
||||
'method' => 'fetch',
|
||||
'dict' => 'DictionaryUnits'
|
||||
)
|
||||
));
|
||||
}
|
||||
$this->import_examplevalues_array[$r]=array_merge($import_sample, $import_extrafield_sample);
|
||||
$this->import_updatekeys_array[$r] = array('p.ref'=>'Ref');
|
||||
if (! empty($conf->barcode->enabled)) $this->import_updatekeys_array[$r]=array_merge($this->import_updatekeys_array[$r], array('p.barcode'=>'BarCode'));//only show/allow barcode as update key if Barcode module enabled
|
||||
|
||||
@ -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)
|
||||
{
|
||||
$this->errors=$object->errors;
|
||||
if (! empty($object->error)) $this->errors[]=$object->error;
|
||||
$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)
|
||||
{
|
||||
$this->errors=$object->oldcopy->errors;
|
||||
if (! empty($object->oldcopy->error)) $this->errors[]=$object->oldcopy->error;
|
||||
$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)
|
||||
{
|
||||
$this->errors=$object->errors;
|
||||
if (! empty($object->error)) $this->errors[]=$object->error;
|
||||
$return=-1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$return=1;
|
||||
}
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
@ -143,8 +161,8 @@ class InterfaceMailmanSpipsynchro extends DolibarrTriggers
|
||||
// Remove from external tools (mailman, spip, etc...)
|
||||
if ($object->del_to_abo() < 0)
|
||||
{
|
||||
if (! empty($object->error)) $this->error=$object->error;
|
||||
$this->errors=$object->errors;
|
||||
if (! empty($object->error)) $this->errors[]=$object->error;
|
||||
$return=-1;
|
||||
}
|
||||
else
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -862,12 +862,6 @@ if ($object->id > 0)
|
||||
show_contacts($conf, $langs, $db, $object, $_SERVER["PHP_SELF"].'?socid='.$object->id);
|
||||
}
|
||||
|
||||
// Addresses list
|
||||
if (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) && ! empty($conf->global->MAIN_REPEATADDRESSONEACHTAB))
|
||||
{
|
||||
$result=show_addresses($conf, $langs, $db, $object, $_SERVER["PHP_SELF"].'?socid='.$object->id);
|
||||
}
|
||||
|
||||
if (! empty($conf->global->MAIN_REPEATTASKONEACHTAB))
|
||||
{
|
||||
print load_fiche_titre($langs->trans("ActionsOnCompany"), '', '');
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
##
|
||||
## PHPExcel
|
||||
##
|
||||
##
|
||||
## Copyright (c) 2006 - 2013 PHPExcel
|
||||
##
|
||||
## This library is free software; you can redistribute it and/or
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
##
|
||||
## PHPExcel
|
||||
##
|
||||
##
|
||||
## Copyright (c) 2006 - 2013 PHPExcel
|
||||
##
|
||||
## This library is free software; you can redistribute it and/or
|
||||
@ -37,7 +37,7 @@ currencySymbol = kr
|
||||
|
||||
|
||||
##
|
||||
## Excel Error Codes (For future use)
|
||||
## Excel Error Codes (For future use)
|
||||
##
|
||||
NULL = #NUL!
|
||||
DIV0 = #DIVISION/0!
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
##
|
||||
## PHPExcel
|
||||
##
|
||||
##
|
||||
## Copyright (c) 2006 - 2013 PHPExcel
|
||||
##
|
||||
## This library is free software; you can redistribute it and/or
|
||||
@ -36,7 +36,7 @@ currencySymbol = €
|
||||
|
||||
|
||||
##
|
||||
## Excel Error Codes (For future use)
|
||||
## Excel Error Codes (For future use)
|
||||
##
|
||||
NULL = #NULL!
|
||||
DIV0 = #DIV/0!
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
##
|
||||
## PHPExcel
|
||||
##
|
||||
##
|
||||
## Copyright (c) 2006 - 2013 PHPExcel
|
||||
##
|
||||
## This library is free software; you can redistribute it and/or
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
##
|
||||
## PHPExcel
|
||||
##
|
||||
##
|
||||
## Copyright (c) 2006 - 2013 PHPExcel
|
||||
##
|
||||
## This library is free software; you can redistribute it and/or
|
||||
@ -36,7 +36,7 @@ currencySymbol = $ ## I'm surprised that the Excel Documentation suggests $ rath
|
||||
|
||||
|
||||
##
|
||||
## Excel Error Codes (For future use)
|
||||
## Excel Error Codes (For future use)
|
||||
##
|
||||
NULL = #¡NULO!
|
||||
DIV0 = #¡DIV/0!
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
##
|
||||
## PHPExcel
|
||||
##
|
||||
##
|
||||
## Copyright (c) 2006 - 2013 PHPExcel
|
||||
##
|
||||
## This library is free software; you can redistribute it and/or
|
||||
@ -36,7 +36,7 @@ currencySymbol = $ # Symbol not known, should it be a € (Euro)?
|
||||
|
||||
|
||||
##
|
||||
## Excel Error Codes (For future use)
|
||||
## Excel Error Codes (For future use)
|
||||
##
|
||||
NULL = #TYHJÄ!
|
||||
DIV0 = #JAKO/0!
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
##
|
||||
## PHPExcel
|
||||
##
|
||||
##
|
||||
## Copyright (c) 2006 - 2013 PHPExcel
|
||||
##
|
||||
## This library is free software; you can redistribute it and/or
|
||||
@ -36,7 +36,7 @@ currencySymbol = €
|
||||
|
||||
|
||||
##
|
||||
## Excel Error Codes (For future use)
|
||||
## Excel Error Codes (For future use)
|
||||
##
|
||||
NULL = #NUL!
|
||||
DIV0 = #DIV/0!
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
##
|
||||
## PHPExcel
|
||||
##
|
||||
##
|
||||
## Copyright (c) 2006 - 2013 PHPExcel
|
||||
##
|
||||
## This library is free software; you can redistribute it and/or
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
##
|
||||
## PHPExcel
|
||||
##
|
||||
##
|
||||
## Copyright (c) 2006 - 2013 PHPExcel
|
||||
##
|
||||
## This library is free software; you can redistribute it and/or
|
||||
@ -36,7 +36,7 @@ currencySymbol = €
|
||||
|
||||
|
||||
##
|
||||
## Excel Error Codes (For future use)
|
||||
## Excel Error Codes (For future use)
|
||||
##
|
||||
NULL = #NULLO!
|
||||
DIV0 = #DIV/0!
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
##
|
||||
## PHPExcel
|
||||
##
|
||||
##
|
||||
## Copyright (c) 2006 - 2013 PHPExcel
|
||||
##
|
||||
## This library is free software; you can redistribute it and/or
|
||||
@ -36,7 +36,7 @@ currencySymbol = €
|
||||
|
||||
|
||||
##
|
||||
## Excel Error Codes (For future use)
|
||||
## Excel Error Codes (For future use)
|
||||
##
|
||||
NULL = #LEEG!
|
||||
DIV0 = #DEEL/0!
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
##
|
||||
## PHPExcel
|
||||
##
|
||||
##
|
||||
## Copyright (c) 2006 - 2013 PHPExcel
|
||||
##
|
||||
## This library is free software; you can redistribute it and/or
|
||||
@ -36,7 +36,7 @@ currencySymbol = kr
|
||||
|
||||
|
||||
##
|
||||
## Excel Error Codes (For future use)
|
||||
## Excel Error Codes (For future use)
|
||||
##
|
||||
NULL = #NULL!
|
||||
DIV0 = #DIV/0!
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
##
|
||||
## PHPExcel
|
||||
##
|
||||
##
|
||||
## Copyright (c) 2006 - 2013 PHPExcel
|
||||
##
|
||||
## This library is free software; you can redistribute it and/or
|
||||
@ -36,7 +36,7 @@ currencySymbol = zł
|
||||
|
||||
|
||||
##
|
||||
## Excel Error Codes (For future use)
|
||||
## Excel Error Codes (For future use)
|
||||
##
|
||||
NULL = #ZERO!
|
||||
DIV0 = #DZIEL/0!
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
##
|
||||
## PHPExcel
|
||||
##
|
||||
##
|
||||
## Copyright (c) 2006 - 2013 PHPExcel
|
||||
##
|
||||
## This library is free software; you can redistribute it and/or
|
||||
@ -36,7 +36,7 @@ currencySymbol = R$
|
||||
|
||||
|
||||
##
|
||||
## Excel Error Codes (For future use)
|
||||
## Excel Error Codes (For future use)
|
||||
##
|
||||
NULL = #NULO!
|
||||
DIV0 = #DIV/0!
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
##
|
||||
## PHPExcel
|
||||
##
|
||||
##
|
||||
## Copyright (c) 2006 - 2013 PHPExcel
|
||||
##
|
||||
## This library is free software; you can redistribute it and/or
|
||||
@ -36,7 +36,7 @@ currencySymbol = €
|
||||
|
||||
|
||||
##
|
||||
## Excel Error Codes (For future use)
|
||||
## Excel Error Codes (For future use)
|
||||
##
|
||||
NULL = #NULO!
|
||||
DIV0 = #DIV/0!
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
##
|
||||
## PHPExcel
|
||||
##
|
||||
##
|
||||
## Copyright (c) 2006 - 2013 PHPExcel
|
||||
##
|
||||
## This library is free software; you can redistribute it and/or
|
||||
@ -36,7 +36,7 @@ currencySymbol = р
|
||||
|
||||
|
||||
##
|
||||
## Excel Error Codes (For future use)
|
||||
## Excel Error Codes (For future use)
|
||||
##
|
||||
NULL = #ПУСТО!
|
||||
DIV0 = #ДЕЛ/0!
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
##
|
||||
## PHPExcel
|
||||
##
|
||||
##
|
||||
## Copyright (c) 2006 - 2013 PHPExcel
|
||||
##
|
||||
## This library is free software; you can redistribute it and/or
|
||||
@ -36,7 +36,7 @@ currencySymbol = kr
|
||||
|
||||
|
||||
##
|
||||
## Excel Error Codes (For future use)
|
||||
## Excel Error Codes (For future use)
|
||||
##
|
||||
NULL = #Skärning!
|
||||
DIV0 = #Division/0!
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
##
|
||||
## PHPExcel
|
||||
##
|
||||
##
|
||||
## Copyright (c) 2006 - 2013 PHPExcel
|
||||
##
|
||||
## This library is free software; you can redistribute it and/or
|
||||
@ -36,7 +36,7 @@ currencySymbol = YTL
|
||||
|
||||
|
||||
##
|
||||
## Excel Error Codes (For future use)
|
||||
## Excel Error Codes (For future use)
|
||||
##
|
||||
NULL = #BOŞ!
|
||||
DIV0 = #SAYI/0!
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -88,10 +88,77 @@ ALTER TABLE llx_subscription ADD fk_type integer(11);
|
||||
ALTER TABLE llx_bank_url DROP INDEX uk_bank_url;
|
||||
ALTER TABLE llx_bank_url ADD UNIQUE INDEX uk_bank_url (fk_bank, url_id, type);
|
||||
|
||||
|
||||
ALTER TABLE llx_actioncomm ADD COLUMN calling_duration integer;
|
||||
|
||||
|
||||
ALTER TABLE llx_don ADD COLUMN fk_soc integer NULL;
|
||||
|
||||
ALTER TABLE llx_payment_various ADD COLUMN subledger_account varchar(32);
|
||||
ALTER TABLE llx_payment_various ADD COLUMN subledger_account varchar(32);
|
||||
|
||||
|
||||
ALTER TABLE llx_prelevement_facture_demande ADD COLUMN entity integer(11);
|
||||
ALTER TABLE llx_prelevement_facture_demande ADD COLUMN sourcetype varchar(32);
|
||||
ALTER TABLE llx_prelevement_facture_demande ADD COLUMN ext_payment_id varchar(128) NULL;
|
||||
ALTER TABLE llx_prelevement_facture_demande ADD COLUMN ext_payment_site varchar(128) NULL;
|
||||
|
||||
|
||||
-- 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_units ADD UNIQUE uk_c_units_code(code);
|
||||
|
||||
|
||||
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 ('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);
|
||||
|
||||
-- Default Warehouse id for a user
|
||||
ALTER TABLE llx_user ADD COLUMN fk_warehouse INTEGER NULL;
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -20,7 +20,9 @@
|
||||
create table llx_prelevement_facture_demande
|
||||
(
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
entity integer DEFAULT 1 NOT NULL,
|
||||
fk_facture integer NOT NULL,
|
||||
sourcetype varchar(32),
|
||||
amount double(24,8) NOT NULL,
|
||||
date_demande datetime NOT NULL,
|
||||
traite smallint DEFAULT 0,
|
||||
@ -31,6 +33,8 @@ create table llx_prelevement_facture_demande
|
||||
code_banque varchar(128),
|
||||
code_guichet varchar(6),
|
||||
number varchar(255),
|
||||
cle_rib varchar(5)
|
||||
cle_rib varchar(5),
|
||||
ext_payment_id varchar(128),
|
||||
ext_payment_site varchar(128),
|
||||
|
||||
)ENGINE=innodb;
|
||||
|
||||
@ -99,5 +99,6 @@ create table llx_user
|
||||
|
||||
import_key varchar(14), -- import key
|
||||
default_range integer,
|
||||
default_c_exp_tax_cat integer
|
||||
default_c_exp_tax_cat integer,
|
||||
fk_warehouse integer
|
||||
)ENGINE=innodb;
|
||||
|
||||
@ -919,6 +919,7 @@ DictionaryAccountancysystem=Models for chart of accounts
|
||||
DictionaryAccountancyJournal=Accounting journals
|
||||
DictionaryEMailTemplates=Email Templates
|
||||
DictionaryUnits=Units
|
||||
DictionaryMeasuringUnits=Measuring Units
|
||||
DictionaryProspectStatus=Prospect status
|
||||
DictionaryHolidayTypes=Types of leave
|
||||
DictionaryOpportunityStatus=Lead status for project/lead
|
||||
|
||||
@ -64,6 +64,7 @@ AppliedPricesFrom=Applied from
|
||||
SellingPrice=Selling price
|
||||
SellingPriceHT=Selling price (excl. tax)
|
||||
SellingPriceTTC=Selling price (inc. tax)
|
||||
SellingMinPriceTTC=Minimum Selling price (inc. tax)
|
||||
CostPriceDescription=This price field (excl. tax) can be used to store the average amount this product costs to your company. It may be any price you calculate yourself, for example from the average buying price plus average production and distribution cost.
|
||||
CostPriceUsage=This value could be used for margin calculation.
|
||||
SoldAmount=Sold amount
|
||||
|
||||
@ -421,6 +421,20 @@ if (! empty($_SESSION["disablemodules"]))
|
||||
}
|
||||
}
|
||||
|
||||
// Set current modulepart
|
||||
$modulepart = explode("/", $_SERVER["PHP_SELF"]);
|
||||
if(is_array($modulepart) && count($modulepart)>0)
|
||||
{
|
||||
foreach($conf->modules as $module)
|
||||
{
|
||||
if(in_array($module, $modulepart))
|
||||
{
|
||||
$conf->modulepart = $module;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Phase authentication / login
|
||||
*/
|
||||
@ -1321,7 +1335,15 @@ function top_htmlhead($head, $title = '', $disablejs = 0, $disablehead = 0, $arr
|
||||
{
|
||||
foreach($arrayofcss as $cssfile)
|
||||
{
|
||||
print '<!-- Includes CSS added by page -->'."\n".'<link rel="stylesheet" type="text/css" title="default" href="'.dol_buildpath($cssfile, 1);
|
||||
if (preg_match('/^http/i', $cssfile))
|
||||
{
|
||||
$urltofile=$cssfile;
|
||||
}
|
||||
else
|
||||
{
|
||||
$urltofile=dol_buildpath($cssfile, 1);
|
||||
}
|
||||
print '<!-- Includes CSS added by page -->'."\n".'<link rel="stylesheet" type="text/css" title="default" href="'.$urltofile;
|
||||
// We add params only if page is not static, because some web server setup does not return content type text/css if url has parameters and browser cache is not used.
|
||||
if (!preg_match('/\.css$/i', $cssfile)) print $themeparam;
|
||||
print '">'."\n";
|
||||
@ -2126,6 +2148,7 @@ if (! function_exists("llxFooter"))
|
||||
|
||||
?>
|
||||
|
||||
<!-- Disabled. This creates a lot of regression. A better solution is to add a protection on submitted page to avoid action to be done twice.
|
||||
<script type="text/javascript">
|
||||
//Prevent from multiple form sending
|
||||
$(function() {
|
||||
@ -2136,6 +2159,7 @@ if (! function_exists("llxFooter"))
|
||||
});
|
||||
});
|
||||
</script>
|
||||
-->
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
@ -207,18 +207,18 @@ if ($result)
|
||||
print "<table class=\"noborder\" width=\"100%\">";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
if ($agentid > 0)
|
||||
print_liste_field_titre("Customer", $_SERVER["PHP_SELF"], "s.nom", "", $param, '', $sortfield, $sortorder);
|
||||
else
|
||||
print_liste_field_titre("SalesRepresentative", $_SERVER["PHP_SELF"], "u.lastname", "", $param, '', $sortfield, $sortorder);
|
||||
if ($agentid > 0)
|
||||
print_liste_field_titre("Customer", $_SERVER["PHP_SELF"], "s.nom", "", $param, '', $sortfield, $sortorder);
|
||||
else
|
||||
print_liste_field_titre("SalesRepresentative", $_SERVER["PHP_SELF"], "u.lastname", "", $param, '', $sortfield, $sortorder);
|
||||
|
||||
print_liste_field_titre("SellingPrice", $_SERVER["PHP_SELF"], "selling_price", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($labelcostprice, $_SERVER["PHP_SELF"], "buying_price", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Margin", $_SERVER["PHP_SELF"], "marge", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||
if (! empty($conf->global->DISPLAY_MARGIN_RATES))
|
||||
print_liste_field_titre("MarginRate", $_SERVER["PHP_SELF"], "", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||
if (! empty($conf->global->DISPLAY_MARK_RATES))
|
||||
print_liste_field_titre("MarkRate", $_SERVER["PHP_SELF"], "", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("SellingPrice", $_SERVER["PHP_SELF"], "selling_price", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($labelcostprice, $_SERVER["PHP_SELF"], "buying_price", "", $param, ' align="right"', $sortfield, $sortorder);
|
||||
print_liste_field_titre("Margin", $_SERVER["PHP_SELF"], "marge", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||
if (! empty($conf->global->DISPLAY_MARGIN_RATES))
|
||||
print_liste_field_titre("MarginRate", $_SERVER["PHP_SELF"], "", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||
if (! empty($conf->global->DISPLAY_MARK_RATES))
|
||||
print_liste_field_titre("MarkRate", $_SERVER["PHP_SELF"], "", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||
print "</tr>\n";
|
||||
|
||||
$rounding = min($conf->global->MAIN_MAX_DECIMALS_UNIT, $conf->global->MAIN_MAX_DECIMALS_TOT);
|
||||
|
||||
@ -311,31 +311,38 @@ class FormProduct
|
||||
function load_measuring_units($name = 'measuring_units', $measuring_style = '', $default = '0', $adddefault = 0)
|
||||
{
|
||||
//phpcs:enable
|
||||
global $langs,$conf,$mysoc;
|
||||
global $langs, $conf, $mysoc, $db;
|
||||
$langs->load("other");
|
||||
|
||||
$return='';
|
||||
$return = '';
|
||||
|
||||
$measuring_units=array();
|
||||
if ($measuring_style == 'weight') $measuring_units=array(-6=>1,-3=>1,0=>1,3=>1,98=>1,99=>1);
|
||||
elseif ($measuring_style == 'size') $measuring_units=array(-3=>1,-2=>1,-1=>1,0=>1,98=>1,99=>1);
|
||||
elseif ($measuring_style == 'surface') $measuring_units=array(-6=>1,-4=>1,-2=>1,0=>1,98=>1,99=>1);
|
||||
elseif ($measuring_style == 'volume') $measuring_units=array(-9=>1,-6=>1,-3=>1,0=>1,88=>1,89=>1,97=>1,99=>1,/* 98=>1 */); // Liter is not used as already available with dm3
|
||||
$measuring_units = array();
|
||||
|
||||
$return.= '<select class="flat" name="'.$name.'">';
|
||||
if ($adddefault) $return.= '<option value="0">'.$langs->trans("Default").'</option>';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/cmeasuringunits.class.php';
|
||||
$measuringUnits = new CMeasuringUnits($db);
|
||||
$result = $measuringUnits->fetchAll('', '', 0, 0, array(
|
||||
't.unit_type' => $measuring_style,
|
||||
't.active' => 1
|
||||
));
|
||||
if ($result < 0) {
|
||||
dol_print_error($db);
|
||||
return - 1;
|
||||
} else {
|
||||
$return .= '<select class="flat" name="' . $name . '">';
|
||||
if ($adddefault)
|
||||
$return .= '<option value="0">' . $langs->trans("Default") . '</option>';
|
||||
|
||||
foreach ($measuring_units as $key => $value)
|
||||
{
|
||||
$return.= '<option value="'.$key.'"';
|
||||
if ($key == $default)
|
||||
foreach ($measuringUnits->records as $lines)
|
||||
{
|
||||
$return.= ' selected';
|
||||
$return .= '<option value="' . $lines->code . '"';
|
||||
if ($key == $default) {
|
||||
$return .= ' selected';
|
||||
}
|
||||
// $return.= '>'.$value.'</option>';
|
||||
$return .= '>' . $langs->transnoentitiesnoconv($lines->label) . '</option>';
|
||||
}
|
||||
//$return.= '>'.$value.'</option>';
|
||||
$return.= '>'.measuring_units_string($key, $measuring_style).'</option>';
|
||||
$return .= '</select>';
|
||||
}
|
||||
$return.= '</select>';
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
@ -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');
|
||||
|
||||
|
||||
|
||||
@ -108,7 +108,7 @@ $arrayfields=array(
|
||||
'origin'=>array('label'=>$langs->trans("Origin"), 'checked'=>1),
|
||||
'm.value'=>array('label'=>$langs->trans("Qty"), 'checked'=>1),
|
||||
'm.price'=>array('label'=>$langs->trans("UnitPurchaseValue"), 'checked'=>0),
|
||||
//'m.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
|
||||
//'m.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
|
||||
//'m.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500)
|
||||
);
|
||||
|
||||
@ -125,8 +125,8 @@ $usercandelete = (($user->rights->stock->mouvement->supprimer));
|
||||
if (GETPOST('cancel', 'alpha')) { $action='list'; $massaction=''; }
|
||||
if (! GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; }
|
||||
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
||||
@ -228,11 +228,11 @@ if ($action == "correct_stock")
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($product->error, $product->errors, 'errors');
|
||||
$action='correction';
|
||||
}
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($product->error, $product->errors, 'errors');
|
||||
$action='correction';
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error) $action='';
|
||||
@ -256,13 +256,13 @@ if ($action == "transfert_stock" && ! $cancel)
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Product")), null, 'errors');
|
||||
$action='transfert';
|
||||
}
|
||||
if (! GETPOST("nbpiece",'int'))
|
||||
if (! GETPOST("nbpiece", 'int'))
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("NumberOfUnit")), null, 'errors');
|
||||
$error++;
|
||||
$action='transfert';
|
||||
}
|
||||
if ($id == GETPOST("id_entrepot_destination",'int'))
|
||||
if ($id == GETPOST("id_entrepot_destination", 'int'))
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorSrcAndTargetWarehouseMustDiffers"), null, 'errors');
|
||||
$error++;
|
||||
@ -340,7 +340,7 @@ if ($action == "transfert_stock" && ! $cancel)
|
||||
$sellby,
|
||||
$batch,
|
||||
GETPOST('inventorycode', 'alpha')
|
||||
);
|
||||
);
|
||||
// Add stock
|
||||
$result2=$product->correct_stock_batch(
|
||||
$user,
|
||||
@ -353,7 +353,7 @@ if ($action == "transfert_stock" && ! $cancel)
|
||||
$sellby,
|
||||
$batch,
|
||||
GETPOST('inventorycode', 'alpha')
|
||||
);
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -367,7 +367,7 @@ if ($action == "transfert_stock" && ! $cancel)
|
||||
GETPOST("label", 'alpha'),
|
||||
$pricesrc,
|
||||
GETPOST('inventorycode', 'alpha')
|
||||
);
|
||||
);
|
||||
|
||||
// Add stock
|
||||
$result2=$product->correct_stock(
|
||||
@ -378,7 +378,7 @@ if ($action == "transfert_stock" && ! $cancel)
|
||||
GETPOST("label", 'alpha'),
|
||||
$pricedest,
|
||||
GETPOST('inventorycode', 'alpha')
|
||||
);
|
||||
);
|
||||
}
|
||||
if (! $error && $result1 >= 0 && $result2 >= 0)
|
||||
{
|
||||
@ -452,8 +452,8 @@ $sql.= " u.login, u.photo, u.lastname, u.firstname";
|
||||
// Add fields from extrafields
|
||||
foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : '');
|
||||
// Add fields from hooks
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
|
||||
$sql.=$hookmanager->resPrint;
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."entrepot as e,";
|
||||
$sql.= " ".MAIN_DB_PREFIX."product as p,";
|
||||
@ -493,9 +493,9 @@ if ($search_type_mouvement != '' && $search_type_mouvement != '-1') $sql.= natur
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
|
||||
// Add where from hooks
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook
|
||||
$reshook=$hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook
|
||||
$sql.=$hookmanager->resPrint;
|
||||
$sql.= $db->order($sortfield,$sortorder);
|
||||
$sql.= $db->order($sortfield, $sortorder);
|
||||
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||
@ -555,7 +555,7 @@ if ($resql)
|
||||
$texte = $langs->trans("ListOfStockMovements");
|
||||
if ($id) $texte.=' ('.$langs->trans("ForThisWarehouse").')';
|
||||
}
|
||||
llxHeader("",$texte,$help_url);
|
||||
llxHeader("", $texte, $help_url);
|
||||
|
||||
/*
|
||||
* Show tab only if we ask a particular warehouse
|
||||
@ -615,7 +615,7 @@ if ($resql)
|
||||
|
||||
// Value
|
||||
print '<tr><td class="titlefield">'.$langs->trans("EstimatedStockValueShort").'</td><td>';
|
||||
print price((empty($calcproducts['value'])?'0':price2num($calcproducts['value'],'MT')), 0, $langs, 0, -1, -1, $conf->currency);
|
||||
print price((empty($calcproducts['value'])?'0':price2num($calcproducts['value'], 'MT')), 0, $langs, 0, -1, -1, $conf->currency);
|
||||
print "</td></tr>";
|
||||
|
||||
// Last movement
|
||||
@ -737,8 +737,8 @@ if ($resql)
|
||||
print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
||||
if ($id > 0) print '<input type="hidden" name="id" value="'.$id.'">';
|
||||
|
||||
if ($id > 0) print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,$massactionbutton,$num, $nbtotalofrecords, '', 0, '', '', $limit);
|
||||
else print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,$massactionbutton,$num, $nbtotalofrecords, 'title_generic', 0, '', '', $limit);
|
||||
if ($id > 0) print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, '', 0, '', '', $limit);
|
||||
else print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_generic', 0, '', '', $limit);
|
||||
|
||||
if ($sall)
|
||||
{
|
||||
@ -749,7 +749,7 @@ if ($resql)
|
||||
$moreforfilter='';
|
||||
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook
|
||||
$reshook=$hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
|
||||
if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint;
|
||||
else $moreforfilter = $hookmanager->resPrint;
|
||||
|
||||
@ -911,37 +911,53 @@ if ($resql)
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
if (! empty($arrayfields['m.rowid']['checked'])) print_liste_field_titre($arrayfields['m.rowid']['label'], $_SERVER["PHP_SELF"], 'm.rowid', '', $param, '', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['m.datem']['checked'])) print_liste_field_titre($arrayfields['m.datem']['label'], $_SERVER["PHP_SELF"], 'm.datem', '', $param, '', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['p.ref']['checked'])) print_liste_field_titre($arrayfields['p.ref']['label'], $_SERVER["PHP_SELF"], 'p.ref', '', $param, '', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['p.label']['checked'])) print_liste_field_titre($arrayfields['p.label']['label'], $_SERVER["PHP_SELF"], 'p.label', '', $param, '', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['m.batch']['checked'])) print_liste_field_titre($arrayfields['m.batch']['label'], $_SERVER["PHP_SELF"], 'm.batch', '', $param, 'align="center"', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['pl.eatby']['checked'])) print_liste_field_titre($arrayfields['pl.eatby']['label'], $_SERVER["PHP_SELF"], 'pl.eatby', '', $param, 'align="center"', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['pl.sellby']['checked'])) print_liste_field_titre($arrayfields['pl.sellby']['label'], $_SERVER["PHP_SELF"], 'pl.sellby', '', $param,'align="center"', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['e.ref']['checked'])) print_liste_field_titre($arrayfields['e.ref']['label'], $_SERVER["PHP_SELF"], "e.ref", '', $param, "", $sortfield, $sortorder); // We are on a specific warehouse card, no filter on other should be possible
|
||||
if (! empty($arrayfields['m.fk_user_author']['checked'])) print_liste_field_titre($arrayfields['m.fk_user_author']['label'], $_SERVER["PHP_SELF"], "m.fk_user_author", "", $param, "", $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['m.inventorycode']['checked'])) print_liste_field_titre($arrayfields['m.inventorycode']['label'], $_SERVER["PHP_SELF"], "m.inventorycode", "", $param, "", $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['m.label']['checked'])) print_liste_field_titre($arrayfields['m.label']['label'], $_SERVER["PHP_SELF"], "m.label", "", $param, "", $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['m.type_mouvement']['checked'])) print_liste_field_titre($arrayfields['m.type_mouvement']['label'], $_SERVER["PHP_SELF"], "m.type_mouvement", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['origin']['checked'])) print_liste_field_titre($arrayfields['origin']['label'], $_SERVER["PHP_SELF"], "", "", $param, "", $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['m.value']['checked'])) print_liste_field_titre($arrayfields['m.value']['label'], $_SERVER["PHP_SELF"], "m.value", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['m.price']['checked'])) print_liste_field_titre($arrayfields['m.price']['label'], $_SERVER["PHP_SELF"], "m.price", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['m.rowid']['checked']))
|
||||
print_liste_field_titre($arrayfields['m.rowid']['label'], $_SERVER["PHP_SELF"], 'm.rowid', '', $param, '', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['m.datem']['checked']))
|
||||
print_liste_field_titre($arrayfields['m.datem']['label'], $_SERVER["PHP_SELF"], 'm.datem', '', $param, '', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['p.ref']['checked']))
|
||||
print_liste_field_titre($arrayfields['p.ref']['label'], $_SERVER["PHP_SELF"], 'p.ref', '', $param, '', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['p.label']['checked']))
|
||||
print_liste_field_titre($arrayfields['p.label']['label'], $_SERVER["PHP_SELF"], 'p.label', '', $param, '', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['m.batch']['checked']))
|
||||
print_liste_field_titre($arrayfields['m.batch']['label'], $_SERVER["PHP_SELF"], 'm.batch', '', $param, 'align="center"', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['pl.eatby']['checked']))
|
||||
print_liste_field_titre($arrayfields['pl.eatby']['label'], $_SERVER["PHP_SELF"], 'pl.eatby', '', $param, 'align="center"', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['pl.sellby']['checked']))
|
||||
print_liste_field_titre($arrayfields['pl.sellby']['label'], $_SERVER["PHP_SELF"], 'pl.sellby', '', $param, 'align="center"', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['e.ref']['checked']))
|
||||
print_liste_field_titre($arrayfields['e.ref']['label'], $_SERVER["PHP_SELF"], "e.ref", "", $param, "", $sortfield, $sortorder); // We are on a specific warehouse card, no filter on other should be possible
|
||||
if (! empty($arrayfields['m.fk_user_author']['checked']))
|
||||
print_liste_field_titre($arrayfields['m.fk_user_author']['label'], $_SERVER["PHP_SELF"], "m.fk_user_author", "", $param, "", $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['m.inventorycode']['checked']))
|
||||
print_liste_field_titre($arrayfields['m.inventorycode']['label'], $_SERVER["PHP_SELF"], "m.inventorycode", "", $param, "", $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['m.label']['checked']))
|
||||
print_liste_field_titre($arrayfields['m.label']['label'], $_SERVER["PHP_SELF"], "m.label", "", $param, "", $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['m.type_mouvement']['checked']))
|
||||
print_liste_field_titre($arrayfields['m.type_mouvement']['label'], $_SERVER["PHP_SELF"], "m.type_mouvement", "", $param, 'align="center"', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['origin']['checked']))
|
||||
print_liste_field_titre($arrayfields['origin']['label'], $_SERVER["PHP_SELF"], "", "", $param, "", $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['m.value']['checked']))
|
||||
print_liste_field_titre($arrayfields['m.value']['label'], $_SERVER["PHP_SELF"], "m.value", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['m.price']['checked']))
|
||||
print_liste_field_titre($arrayfields['m.price']['label'], $_SERVER["PHP_SELF"], "m.price", "", $param, 'align="right"', $sortfield, $sortorder);
|
||||
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
|
||||
|
||||
// Hook fields
|
||||
$parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder);
|
||||
$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
|
||||
$parameters=array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder);
|
||||
$reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
if (! empty($arrayfields['m.datec']['checked'])) print_liste_field_titre($arrayfields['p.datec']['label'], $_SERVER["PHP_SELF"], "p.datec", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder);
|
||||
if (! empty($arrayfields['m.tms']['checked'])) print_liste_field_titre($arrayfields['p.tms']['label'], $_SERVER["PHP_SELF"], "p.tms", "", $param, 'align="center" class="nowrap"', $sortfield, $sortorder);
|
||||
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', 'align="center"', $sortfield, $sortorder, 'maxwidthsearch ');
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
$arrayofuniqueproduct=array();
|
||||
|
||||
while ($i < min($num,$limit))
|
||||
while ($i < min($num, $limit))
|
||||
{
|
||||
$objp = $db->fetch_object($resql);
|
||||
|
||||
@ -1053,7 +1069,7 @@ if ($resql)
|
||||
if (! empty($arrayfields['m.type_mouvement']['checked']))
|
||||
{
|
||||
// Type of movement
|
||||
switch($objp->type_mouvement){
|
||||
switch($objp->type_mouvement) {
|
||||
case "0":
|
||||
print '<td align="center">'.$langs->trans('StockIncreaseAfterCorrectTransfer').'</td>';
|
||||
break;
|
||||
@ -1119,8 +1135,8 @@ if ($resql)
|
||||
$productidselected=$key;
|
||||
$productlabelselected=$val;
|
||||
}
|
||||
$datebefore=dol_get_first_day($year?$year:strftime("%Y",time()), $month?$month:1, true);
|
||||
$dateafter=dol_get_last_day($year?$year:strftime("%Y",time()), $month?$month:12, true);
|
||||
$datebefore=dol_get_first_day($year?$year:strftime("%Y", time()), $month?$month:1, true);
|
||||
$dateafter=dol_get_last_day($year?$year:strftime("%Y", time()), $month?$month:12, true);
|
||||
$balancebefore=$movement->calculateBalanceForProductBefore($productidselected, $datebefore);
|
||||
$balanceafter=$movement->calculateBalanceForProductBefore($productidselected, $dateafter);
|
||||
|
||||
|
||||
@ -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");
|
||||
|
||||
@ -1047,6 +1047,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
|
||||
{
|
||||
if (in_array($user->id, $contactsofproject)) $userid = $user->id;
|
||||
else $userid = $contactsofproject[0];
|
||||
|
||||
if ($projectstatic->public) $contactsofproject = array();
|
||||
print $form->select_dolusers((GETPOST('userid')?GETPOST('userid'):$userid), 'userid', 0, '', 0, '', $contactsofproject, 0, 0, 0, '', 0, $langs->trans("ResourceNotAssignedToProject"), 'maxwidth200');
|
||||
}
|
||||
|
||||
@ -107,13 +107,14 @@ class FormResource
|
||||
$out.= '<select id="'.$htmlname.'" class="flat minwidth200" name="'.$htmlname.'">'."\n";
|
||||
if ($showempty) $out.= '<option value="-1"> </option>'."\n";
|
||||
|
||||
$num = count($resourcestat->lines);
|
||||
$num = 0;
|
||||
if (is_array($resourcestat->lines)) $num = count($resourcestat->lines);
|
||||
|
||||
//var_dump($resourcestat->lines);
|
||||
$i = 0;
|
||||
if ($num)
|
||||
{
|
||||
while ( $i < $num)
|
||||
while ($i < $num)
|
||||
{
|
||||
$resourceclass=ucfirst($resourcestat->lines[$i]->element);
|
||||
|
||||
|
||||
@ -1,553 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@inodbox.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* 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/societe/class/address.class.php
|
||||
* \ingroup societe
|
||||
* \brief File of class to manage addresses. This class is deprecated.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Class to manage addresses
|
||||
*
|
||||
* @deprecated This class is dedicated to a not supported and deprecated feature.
|
||||
*/
|
||||
class Address
|
||||
{
|
||||
protected $db;
|
||||
|
||||
/**
|
||||
* @var int ID
|
||||
*/
|
||||
public $id;
|
||||
|
||||
public $type;
|
||||
|
||||
/**
|
||||
* @var string Address label
|
||||
*/
|
||||
public $label;
|
||||
|
||||
public $socid;
|
||||
public $name;
|
||||
|
||||
/**
|
||||
* @var string Address
|
||||
*/
|
||||
public $address;
|
||||
|
||||
public $zip;
|
||||
public $town;
|
||||
public $country_id;
|
||||
public $country_code;
|
||||
public $phone;
|
||||
public $fax;
|
||||
public $note;
|
||||
|
||||
/**
|
||||
* Adresses liees a la societe
|
||||
* @var array
|
||||
*/
|
||||
public $lines;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
* @deprecated
|
||||
*/
|
||||
function __construct($db)
|
||||
{
|
||||
$this->db = $db;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create address into database
|
||||
*
|
||||
* @param int $socid Company socid
|
||||
* @param User $user Object user making creation
|
||||
* @return int 0 if OK, < 0 if KO
|
||||
*/
|
||||
function create($socid, $user = '')
|
||||
{
|
||||
global $langs,$conf;
|
||||
|
||||
// Nettoyage parametres
|
||||
$this->name = trim($this->name);
|
||||
$this->label = trim($this->label);
|
||||
|
||||
dol_syslog(get_class($this)."::create label=".$this->label);
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$result = $this->verify();
|
||||
|
||||
if ($result >= 0)
|
||||
{
|
||||
$now=dol_now();
|
||||
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_address (label, fk_soc, name, datec, fk_user_creat) ";
|
||||
$sql .= " VALUES ('".$this->db->escape($this->label)."', '".$socid."', '".$this->db->escape($this->name)."', '".$this->db->idate($now)."', '".$user->id."')";
|
||||
|
||||
$result=$this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."societe_address");
|
||||
|
||||
$ret = $this->update($this->id, $socid, $user);
|
||||
|
||||
if ($ret >= 0)
|
||||
{
|
||||
dol_syslog(get_class($this)."::create success id=".$this->id);
|
||||
$this->db->commit();
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog(get_class($this)."::create echec update");
|
||||
$this->db->rollback();
|
||||
return -3;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
{
|
||||
if ($this->db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS')
|
||||
{
|
||||
|
||||
$this->error=$langs->trans("ErrorCompanyNameAlreadyExists", $this->name);
|
||||
}
|
||||
|
||||
$this->db->rollback();
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->rollback();
|
||||
dol_syslog(get_class($this)."::create echec verify sql=$sql");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Verification lors de la modification de l'adresse
|
||||
*
|
||||
* @return int 0 if OK, <0 if KO
|
||||
*/
|
||||
function verify()
|
||||
{
|
||||
$this->label = trim($this->label);
|
||||
$this->name = trim($this->name);
|
||||
$result = 0;
|
||||
if (!$this->name || !$this->label)
|
||||
{
|
||||
$this->error = "The name of company and the label can not be empty.\n";
|
||||
$result = -2;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Mise a jour des parametres de l'adresse
|
||||
*
|
||||
* @param int $id id address
|
||||
* @param int $socid id third party
|
||||
* @param User $user Utilisateur qui demande la mise a jour
|
||||
* @return int <0 if KO, >=0 if OK
|
||||
*/
|
||||
function update($id, $socid, $user = '')
|
||||
{
|
||||
global $langs;
|
||||
|
||||
// Clean parameters
|
||||
$this->fk_soc = $socid;
|
||||
$this->label = trim($this->label);
|
||||
$this->name = trim($this->name);
|
||||
$this->address = trim($this->address);
|
||||
$this->zip = trim($this->zip);
|
||||
$this->town = trim($this->town);
|
||||
$this->country_id = trim($this->country_id);
|
||||
$this->phone = trim($this->phone);
|
||||
$this->phone = preg_replace("/\s/", "", $this->phone);
|
||||
$this->phone = preg_replace("/\./", "", $this->phone);
|
||||
$this->fax = trim($this->fax);
|
||||
$this->fax = preg_replace("/\s/", "", $this->fax);
|
||||
$this->fax = preg_replace("/\./", "", $this->fax);
|
||||
$this->note = trim($this->note);
|
||||
|
||||
$result = $this->verify(); // Verifie que name et label obligatoire
|
||||
|
||||
if ($result >= 0)
|
||||
{
|
||||
dol_syslog(get_class($this)."::Update verify ok");
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."societe_address";
|
||||
$sql.= " SET label = '" . $this->db->escape($this->label) ."'"; // Champ obligatoire
|
||||
$sql.= ", name = '" . $this->db->escape($this->name) ."'"; // Champ obligatoire
|
||||
$sql.= ", address = ".($this->address?"'".$this->db->escape($this->address)."'":"null");
|
||||
$sql.= ", zip = ".($this->zip?"'".$this->db->escape($this->zip)."'":"null");
|
||||
$sql.= ", town = ".($this->town?"'".$this->db->escape($this->town)."'":"null");
|
||||
$sql.= ", fk_pays = '" . ($this->country_id?$this->db->escape($this->country_id):'0') ."'";
|
||||
$sql.= ", note = ".($this->note?"'".$this->db->escape($this->note)."'":"null");
|
||||
$sql.= ", phone = ".($this->phone?"'".$this->db->escape($this->phone)."'":"null");
|
||||
$sql.= ", fax = ".($this->fax?"'".$this->db->escape($this->fax)."'":"null");
|
||||
if ($user) $sql .= ",fk_user_modif = '".$user->id."'";
|
||||
$sql .= " WHERE fk_soc = '" . $socid ."' AND rowid = '" . $this->db->escape($id) ."'";
|
||||
|
||||
dol_syslog(get_class($this)."::Update", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
dol_syslog(get_class($this)."::Update success");
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($this->db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS')
|
||||
{
|
||||
|
||||
$this->error=$langs->trans("ErrorDuplicateField", $this->name);
|
||||
$result=-1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
$result=-2;
|
||||
}
|
||||
$this->db->rollback();
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
|
||||
/**
|
||||
* Charge depuis la base toutes les adresses d'une societe
|
||||
*
|
||||
* @param int $socid Id de la societe a charger en memoire
|
||||
* @param User $user Objet de l'utilisateur
|
||||
* @return int >0 si ok, <0 si ko
|
||||
*/
|
||||
function fetch_lines($socid, $user = null)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $langs, $conf;
|
||||
|
||||
$sql = 'SELECT rowid, nom as name, client, fournisseur';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'societe';
|
||||
$sql .= ' WHERE rowid = '.$socid;
|
||||
|
||||
$resqlsoc=$this->db->query($sql);
|
||||
if ($resqlsoc)
|
||||
{
|
||||
if ($this->db->num_rows($resqlsoc))
|
||||
{
|
||||
$obj = $this->db->fetch_object($resqlsoc);
|
||||
|
||||
$this->socname = $obj->name;
|
||||
$this->socid = $obj->rowid;
|
||||
$this->id = $obj->rowid;
|
||||
$this->client = $obj->client;
|
||||
$this->fournisseur = $obj->fournisseur;
|
||||
}
|
||||
|
||||
$this->db->free($resqlsoc);
|
||||
|
||||
$this->lines = array();
|
||||
|
||||
// Adresses liees a la societe
|
||||
if ($this->socid)
|
||||
{
|
||||
$sql = 'SELECT a.rowid as id, a.label, a.name, a.address, a.datec as date_creation, a.tms as date_modification, a.fk_soc';
|
||||
$sql .= ', a.zip, a.town, a.note, a.fk_pays as country_id, a.phone, a.fax';
|
||||
$sql .= ', c.code as country_code, c.label as country';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'societe_address as a';
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c ON a.fk_pays = c.rowid';
|
||||
$sql .= ' WHERE a.fk_soc = '.$this->socid;
|
||||
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $this->db->fetch_object($resql);
|
||||
|
||||
$line = new AddressLine($this->db);
|
||||
|
||||
$line->id = $objp->id;
|
||||
$line->date_creation = $this->db->jdate($objp->date_creation);
|
||||
$line->date_modification = $this->db->jdate($objp->date_modification);
|
||||
$line->label = $objp->label;
|
||||
$line->name = $objp->name;
|
||||
$line->address = $objp->address;
|
||||
$line->zip = $objp->zip;
|
||||
$line->town = $objp->town;
|
||||
$line->country_id = $objp->country_id;
|
||||
$line->country_code = $objp->country_id?$objp->country_code:'';
|
||||
$line->country = $objp->country_id?($langs->trans('Country'.$objp->country_code)!='Country'.$objp->country_code?$langs->trans('Country'.$objp->country_code):$objp->country):'';
|
||||
$line->phone = $objp->phone;
|
||||
$line->fax = $objp->fax;
|
||||
$line->note = $objp->note;
|
||||
|
||||
$this->lines[$i] = $line;
|
||||
$i++;
|
||||
}
|
||||
$this->db->free($resql);
|
||||
return $num;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog(get_class($this).'::Fetch Erreur: aucune adresse', LOG_ERR);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog(get_class($this).'::Fetch Erreur: societe inconnue', LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$this->db->error();
|
||||
}
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps
|
||||
/**
|
||||
* Charge depuis la base l'objet adresse
|
||||
*
|
||||
* @param int $id Id de l'adresse a charger en memoire
|
||||
* @param User $user Objet de l'utilisateur
|
||||
* @return int >0 si ok, <0 si ko
|
||||
*/
|
||||
function fetch_address($id, $user = null)
|
||||
{
|
||||
// phpcs:enable
|
||||
global $langs;
|
||||
global $conf;
|
||||
|
||||
$sql = 'SELECT a.rowid, a.fk_soc, a.label, a.name, a.address, a.datec as date_creation, a.tms as date_modification';
|
||||
$sql .= ', a.zip, a.town, a.note, a.fk_pays as country_id, a.phone, a.fax';
|
||||
$sql .= ', c.code as country_code, c.label as country';
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'societe_address as a';
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c ON a.fk_pays = c.rowid';
|
||||
$sql .= ' WHERE a.rowid = '.$id;
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if ($this->db->num_rows($resql))
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
$this->id = $obj->rowid;
|
||||
$this->socid = $obj->fk_soc;
|
||||
|
||||
$this->date_modification = $this->db->jdate($obj->date_modification);
|
||||
$this->date_creation = $this->db->jdate($obj->date_creation);
|
||||
|
||||
$this->label = $obj->label;
|
||||
$this->name = $obj->name;
|
||||
$this->address = $obj->address;
|
||||
$this->zip = $obj->zip;
|
||||
$this->town = $obj->town;
|
||||
|
||||
$this->country_id = $obj->country_id;
|
||||
$this->country_code = $obj->country_id?$obj->country_code:'';
|
||||
$this->country = $obj->country_id?($langs->trans('Country'.$obj->country_code)!='Country'.$obj->country_code?$langs->trans('Country'.$obj->country_code):$obj->country):'';
|
||||
|
||||
$this->phone = $obj->phone;
|
||||
$this->fax = $obj->fax;
|
||||
$this->note = $obj->note;
|
||||
|
||||
$result = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog('Erreur Societe::Fetch aucune adresse avec id='.$this->id.' - '.$sql);
|
||||
$this->error='Erreur Societe::Fetch aucune adresse avec id='.$this->id.' - '.$sql;
|
||||
$result = -2;
|
||||
}
|
||||
|
||||
$this->db->free($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog('Erreur Societe::Fetch echec', LOG_DEBUG);
|
||||
dol_syslog('Erreur Societe::Fetch '.$this->db->error());
|
||||
$this->error=$this->db->error();
|
||||
$result = -3;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Suppression d'une adresse
|
||||
*
|
||||
* @param int $id id de la societe a supprimer
|
||||
* @param int $socid id third party
|
||||
* @return <0 KO >0 OK
|
||||
*/
|
||||
function delete($id, $socid)
|
||||
{
|
||||
dol_syslog("Address::Delete");
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."societe_address";
|
||||
$sql.= " WHERE rowid = ".$id;
|
||||
$sql.= " AND fk_soc = ".$socid;
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
|
||||
if (!$result) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return name of address with link (and eventually picto)
|
||||
* Use $this->id, $this->label, $this->socid
|
||||
*
|
||||
* @param int $withpicto Include picto with link
|
||||
* @param string $option Where the link point to
|
||||
* @return string String with URL
|
||||
*/
|
||||
function getNomUrl($withpicto = 0, $option = '')
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$result='';
|
||||
$label = $langs->trans("ShowAddress").': '.$this->label;
|
||||
|
||||
$link = '<a href="'.DOL_URL_ROOT.'/comm/address.php?id='.$this->id.'&socid='.$this->socid.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
|
||||
$linkend='</a>';
|
||||
|
||||
if ($withpicto) $result.=($link.img_object($langs->trans("ShowAddress").': '.$this->label, 'address', 'class="classfortooltip"').$linkend.' ');
|
||||
$result.=$link.$this->label.$linkend;
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Charge les informations d'ordre info dans l'objet societe
|
||||
*
|
||||
* @param int $id id de la societe a charger
|
||||
* @return void
|
||||
*/
|
||||
function info($id)
|
||||
{
|
||||
$sql = "SELECT s.rowid, s.nom as name, datec as date_creation, tms as date_modification,";
|
||||
$sql.= " fk_user_creat, fk_user_modif";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql.= " WHERE s.rowid = ".$id;
|
||||
|
||||
$result=$this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
if ($this->db->num_rows($result))
|
||||
{
|
||||
$obj = $this->db->fetch_object($result);
|
||||
|
||||
$this->id = $obj->rowid;
|
||||
|
||||
if ($obj->fk_user_creat) {
|
||||
$cuser = new User($this->db);
|
||||
$cuser->fetch($obj->fk_user_creat);
|
||||
$this->user_creation = $cuser;
|
||||
}
|
||||
|
||||
if ($obj->fk_user_modif) {
|
||||
$muser = new User($this->db);
|
||||
$muser->fetch($obj->fk_user_modif);
|
||||
$this->user_modification = $muser;
|
||||
}
|
||||
$this->ref = $obj->name;
|
||||
$this->date_creation = $this->db->jdate($obj->date_creation);
|
||||
$this->date_modification = $this->db->jdate($obj->date_modification);
|
||||
}
|
||||
|
||||
$this->db->free($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Class to manage one address line
|
||||
*/
|
||||
class AddressLine
|
||||
{
|
||||
protected $db;
|
||||
|
||||
/**
|
||||
* @var int ID
|
||||
*/
|
||||
public $id;
|
||||
|
||||
public $date_creation;
|
||||
public $date_modification;
|
||||
|
||||
/**
|
||||
* @var string stock movements label
|
||||
*/
|
||||
public $label;
|
||||
|
||||
public $name;
|
||||
|
||||
/**
|
||||
* @var string Address
|
||||
*/
|
||||
public $address;
|
||||
|
||||
public $zip;
|
||||
public $town;
|
||||
public $country_id;
|
||||
public $country_code;
|
||||
public $country;
|
||||
public $phone;
|
||||
public $fax;
|
||||
public $note;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
function __construct($db)
|
||||
{
|
||||
$this->db = $db;
|
||||
}
|
||||
}
|
||||
@ -61,12 +61,13 @@ class Contacts extends DolibarrApi
|
||||
*
|
||||
* Return an array with contact informations
|
||||
*
|
||||
* @param int $id ID of contact
|
||||
* @param int $id ID of contact
|
||||
* @param int $includecount Count and return also number of elements the contact is used as a link for
|
||||
* @return array|mixed data without useless information
|
||||
*
|
||||
* @throws RestException
|
||||
*/
|
||||
function get($id)
|
||||
function get($id, $includecount = 0)
|
||||
{
|
||||
if (!DolibarrApiAccess::$user->rights->societe->contact->lire)
|
||||
{
|
||||
@ -74,6 +75,7 @@ class Contacts extends DolibarrApi
|
||||
}
|
||||
|
||||
$result = $this->contact->fetch($id);
|
||||
|
||||
if (!$result)
|
||||
{
|
||||
throw new RestException(404, 'Contact not found');
|
||||
@ -84,6 +86,11 @@ class Contacts extends DolibarrApi
|
||||
throw new RestException(401, 'Access not allowed for login ' . DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
if ($includecount)
|
||||
{
|
||||
$this->contact->load_ref_elements();
|
||||
}
|
||||
|
||||
return $this->_cleanObjectDatas($this->contact);
|
||||
}
|
||||
|
||||
@ -96,13 +103,14 @@ class Contacts extends DolibarrApi
|
||||
* @param string $sortorder Sort order
|
||||
* @param int $limit Limit for list
|
||||
* @param int $page Page number
|
||||
* @param string $thirdparty_ids Thirdparty ids to filter contacts of. {@example '1' or '1,2,3'} {@pattern /^[0-9,]*$/i}
|
||||
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')"
|
||||
* @param string $thirdparty_ids Thirdparty ids to filter contacts of. {@example '1' or '1,2,3'} {@pattern /^[0-9,]*$/i}
|
||||
* @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')"
|
||||
* @param int $includecount Count and return also number of elements the contact is used as a link for
|
||||
* @return array Array of contact objects
|
||||
*
|
||||
* @throws RestException
|
||||
*/
|
||||
function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '')
|
||||
function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '', $includecount = 0)
|
||||
{
|
||||
global $db, $conf;
|
||||
|
||||
@ -175,8 +183,13 @@ class Contacts extends DolibarrApi
|
||||
$contact_static = new Contact($db);
|
||||
if ($contact_static->fetch($obj->rowid))
|
||||
{
|
||||
if ($includecount)
|
||||
{
|
||||
$contact_static->load_ref_elements();
|
||||
}
|
||||
$obj_ret[] = $this->_cleanObjectDatas($contact_static);
|
||||
}
|
||||
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -163,12 +163,6 @@ if ($action != 'presend')
|
||||
{
|
||||
$result=show_contacts($conf, $langs, $db, $object, $_SERVER["PHP_SELF"].'?socid='.$object->id);
|
||||
}
|
||||
|
||||
// Addresses list
|
||||
if (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT))
|
||||
{
|
||||
$result=show_addresses($conf, $langs, $db, $object, $_SERVER["PHP_SELF"].'?socid='.$object->id);
|
||||
}
|
||||
}
|
||||
|
||||
// End of page
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2018 PtibogXIV <support@ptibogxiv.net>
|
||||
/* Copyright (C) 2018-2019 Thibault FOUCART <support@ptibogxiv.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
|
||||
@ -185,10 +185,12 @@ class Stripe extends CommonObject
|
||||
}
|
||||
elseif ($createifnotlinkedtostripe)
|
||||
{
|
||||
$ipaddress = getUserRemoteIP();
|
||||
|
||||
$dataforcustomer = array(
|
||||
"email" => $object->email,
|
||||
"description" => $object->name,
|
||||
"metadata" => array('dol_id'=>$object->id, 'dol_version'=>DOL_VERSION, 'dol_entity'=>$conf->entity, 'ipaddress'=>(empty($_SERVER['REMOTE_ADDR'])?'':$_SERVER['REMOTE_ADDR']))
|
||||
"metadata" => array('dol_id'=>$object->id, 'dol_version'=>DOL_VERSION, 'dol_entity'=>$conf->entity, 'ipaddress'=>$ipaddress)
|
||||
);
|
||||
|
||||
$vatcleaned = $object->tva_intra ? $object->tva_intra : null;
|
||||
@ -238,6 +240,133 @@ class Stripe extends CommonObject
|
||||
return $customer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Stripe payment intent
|
||||
*
|
||||
* @param Societe $object Object tp pay on Stripe
|
||||
* @param string $customer Stripe customer ref 'cus_xxxxxxxxxxxxx' via customerStripe()
|
||||
* @param string $key ''=Use common API. If not '', it is the Stripe connect account 'acc_....' to use Stripe connect
|
||||
* @param int $status Status (0=test, 1=live)
|
||||
* @param int $usethirdpartyemailforreceiptemail 1=use thirdparty email fpr receipt
|
||||
* @param int $mode automatic=automatic payment, manual=need confirmation
|
||||
* @return \Stripe\PaymentIntent|null Stripe PaymentIntent or null if not found
|
||||
*/
|
||||
public function getPaymentIntent($object, $customer, $key = null, $status = 0, $usethirdpartyemailforreceiptemail = 0, $mode = 'automatic')
|
||||
{
|
||||
global $conf, $user, $mysoc;
|
||||
|
||||
if (empty($object->id))
|
||||
{
|
||||
dol_syslog("object not loaded");
|
||||
return null;
|
||||
}
|
||||
|
||||
$error = 0;
|
||||
|
||||
if (empty($status)) $service = 'StripeTest';
|
||||
else $service = 'StripeLive';
|
||||
|
||||
$paymentintent = null;
|
||||
|
||||
$sql = "SELECT pi.ext_payment_id, pi.entity, pi.fk_facture, pi.sourcetype, pi.ext_payment_site"; // key_account is cus_....
|
||||
$sql.= " FROM " . MAIN_DB_PREFIX . "prelevement_facture_demande as pi";
|
||||
$sql.= " WHERE pi.fk_facture = " . $object->id;
|
||||
$sql.= " AND pi.sourcetype = '" . $object->element . "'";
|
||||
$sql.= " AND pi.entity IN (".getEntity('societe').")";
|
||||
$sql.= " AND pi.ext_payment_site = '" . $service . "'";
|
||||
|
||||
dol_syslog(get_class($this) . "::customerStripe search stripe customer id for thirdparty id=".$object->id, LOG_DEBUG);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $this->db->num_rows($resql);
|
||||
if ($num)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
$intent = $obj->ext_payment_id;
|
||||
|
||||
dol_syslog(get_class($this) . "::customerStripe found stripe customer key_account = ".$tiers);
|
||||
|
||||
// Force to use the correct API key
|
||||
global $stripearrayofkeysbyenv;
|
||||
\Stripe\Stripe::setApiKey($stripearrayofkeysbyenv[$status]['secret_key']);
|
||||
|
||||
try {
|
||||
if (empty($key)) { // If the Stripe connect account not set, we use common API usage
|
||||
$paymentintent = \Stripe\PaymentIntent::retrieve($intent);
|
||||
} else {
|
||||
$paymentintent = \Stripe\PaymentIntent::retrieve($intent, array("stripe_account" => $key));
|
||||
}
|
||||
}
|
||||
catch(Exception $e)
|
||||
{
|
||||
$this->error = $e->getMessage();
|
||||
}
|
||||
}
|
||||
else //if ($createifnotlinkedtostripe)
|
||||
{
|
||||
$arrayzerounitcurrency=array('BIF', 'CLP', 'DJF', 'GNF', 'JPY', 'KMF', 'KRW', 'MGA', 'PYG', 'RWF', 'VND', 'VUV', 'XAF', 'XOF', 'XPF');
|
||||
if (! in_array($object->multicurrency_code, $arrayzerounitcurrency)) $stripeamount=$object->multicurrency_total_ttc * 100;
|
||||
else $stripeamount = $object->multicurrency_total_ttc;
|
||||
|
||||
$fee = round(($amount * ($conf->global->STRIPE_APPLICATION_FEE_PERCENT / 100) + $conf->global->STRIPE_APPLICATION_FEE) * 100);
|
||||
if ($fee < ($conf->global->STRIPE_APPLICATION_FEE_MINIMAL * 100)) {
|
||||
$fee = round($conf->global->STRIPE_APPLICATION_FEE_MINIMAL * 100);
|
||||
}
|
||||
|
||||
$description=$object->element.$object->ref;
|
||||
|
||||
$dataforintent = array(
|
||||
"amount" => $stripeamount,
|
||||
"currency" => $object->multicurrency_code,
|
||||
"customer" => $customer,
|
||||
"allowed_source_types" => ["card"],
|
||||
"statement_descriptor" => dol_trunc(dol_trunc(dol_string_unaccent($mysoc->name), 8, 'right', 'UTF-8', 1).' '.$description, 22, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt
|
||||
"metadata" => array('dol_type'=>$object->element, 'dol_id'=>$object->id, 'dol_version'=>DOL_VERSION, 'dol_entity'=>$conf->entity, 'ipaddress'=>(empty($_SERVER['REMOTE_ADDR'])?'':$_SERVER['REMOTE_ADDR']))
|
||||
);
|
||||
|
||||
if ($conf->entity!=$conf->global->STRIPECONNECT_PRINCIPAL && $fee>0)
|
||||
{
|
||||
$dataforintent["application_fee"] = $fee;
|
||||
}
|
||||
if ($societe->email && $usethirdpartyemailforreceiptemail)
|
||||
{
|
||||
$dataforintent["receipt_email"] = $societe->email;
|
||||
}
|
||||
|
||||
try {
|
||||
// Force to use the correct API key
|
||||
global $stripearrayofkeysbyenv;
|
||||
\Stripe\Stripe::setApiKey($stripearrayofkeysbyenv[$status]['secret_key']);
|
||||
|
||||
if (empty($key)) { // If the Stripe connect account not set, we use common API usage
|
||||
$paymentintent = \Stripe\PaymentIntent::create($dataforintent, array("idempotency_key" => "$description"));
|
||||
} else {
|
||||
$paymentintent = \Stripe\PaymentIntent::create($dataforintent, array("idempotency_key" => "$description","stripe_account" => $key));
|
||||
}
|
||||
$now=dol_now();
|
||||
$sql = "INSERT INTO " . MAIN_DB_PREFIX . "prelevement_facture_demande (fk_soc, date_demande, fk_user_demande, ext_payment_id, fk_facture, sourcetype, entity, ext_payment_site)";
|
||||
$sql .= " VALUES ('".$object->socid."','".$this->db->idate($now)."', '0', '".$this->db->escape($paymentintent->id)."', ".$object->id.", '".$object->element."', " . $conf->entity . ", '" . $service . "')";
|
||||
$resql = $this->db->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
$this->error = $this->db->lasterror();
|
||||
dol_syslog(get_class($this) . "::PaymentIntent not insert with id=".$paymentintent->id);
|
||||
}
|
||||
}
|
||||
catch(Exception $e)
|
||||
{
|
||||
$this->error = $e->getMessage();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
|
||||
return $paymentintent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Stripe card of a company payment mode (with option to create it on Stripe if not linked yet)
|
||||
*
|
||||
@ -268,7 +397,7 @@ class Stripe extends CommonObject
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
$cardref = $obj->stripe_card_ref;
|
||||
dol_syslog("************* cardref=".$cardref);
|
||||
dol_syslog(get_class($this) . "::cardStripe cardref=".$cardref);
|
||||
if ($cardref)
|
||||
{
|
||||
try {
|
||||
@ -426,7 +555,7 @@ class Stripe extends CommonObject
|
||||
{
|
||||
if (preg_match('/acct_/i', $source))
|
||||
{
|
||||
$charge = \Stripe\Charge::create(array(
|
||||
$charge = \Stripe\Charge::create(array(
|
||||
"amount" => "$stripeamount",
|
||||
"currency" => "$currency",
|
||||
"statement_descriptor" => dol_trunc(dol_trunc(dol_string_unaccent($mysoc->name), 8, 'right', 'UTF-8', 1).' '.$description, 22, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt
|
||||
@ -462,25 +591,25 @@ class Stripe extends CommonObject
|
||||
}
|
||||
|
||||
$paymentarray = array(
|
||||
"amount" => "$stripeamount",
|
||||
"currency" => "$currency",
|
||||
"statement_descriptor" => dol_trunc(dol_trunc(dol_string_unaccent($mysoc->name), 8, 'right', 'UTF-8', 1).' '.$description, 22, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt
|
||||
"description" => "Stripe payment: ".$description,
|
||||
"capture" => $capture,
|
||||
"metadata" => $metadata,
|
||||
"source" => "$source",
|
||||
"customer" => "$customer"
|
||||
);
|
||||
if ($conf->entity!=$conf->global->STRIPECONNECT_PRINCIPAL && $fee>0)
|
||||
{
|
||||
$paymentarray["application_fee"] = $fee;
|
||||
}
|
||||
if ($societe->email && $usethirdpartyemailforreceiptemail)
|
||||
{
|
||||
$paymentarray["receipt_email"] = $societe->email;
|
||||
}
|
||||
"amount" => "$stripeamount",
|
||||
"currency" => "$currency",
|
||||
"statement_descriptor" => dol_trunc(dol_trunc(dol_string_unaccent($mysoc->name), 8, 'right', 'UTF-8', 1).' '.$description, 22, 'right', 'UTF-8', 1), // 22 chars that appears on bank receipt
|
||||
"description" => "Stripe payment: ".$description,
|
||||
"capture" => $capture,
|
||||
"metadata" => $metadata,
|
||||
"source" => "$source",
|
||||
"customer" => "$customer"
|
||||
);
|
||||
if ($conf->entity!=$conf->global->STRIPECONNECT_PRINCIPAL && $fee>0)
|
||||
{
|
||||
$paymentarray["application_fee"] = $fee;
|
||||
}
|
||||
if ($societe->email && $usethirdpartyemailforreceiptemail)
|
||||
{
|
||||
$paymentarray["receipt_email"] = $societe->email;
|
||||
}
|
||||
|
||||
$charge = \Stripe\Charge::create($paymentarray, array("idempotency_key" => "$ref","stripe_account" => "$account"));
|
||||
$charge = \Stripe\Charge::create($paymentarray, array("idempotency_key" => "$ref","stripe_account" => "$account"));
|
||||
}
|
||||
if (isset($charge->id)) {}
|
||||
|
||||
|
||||
@ -13,6 +13,7 @@
|
||||
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2016 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -1814,7 +1815,7 @@ class SupplierProposal extends CommonObject
|
||||
* Upate ProductFournisseur
|
||||
*
|
||||
* @param int $idProductFournPrice id of llx_product_fournisseur_price
|
||||
* @param int $product contain informations to update
|
||||
* @param Product $product contain informations to update
|
||||
* @param User $user Object user
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
|
||||
@ -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);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -1,8 +0,0 @@
|
||||
source 'https://rubygems.org'
|
||||
|
||||
gem 'jekyll', '~> 1.0'
|
||||
gem 'safe_yaml', '~> 1.0.4'
|
||||
gem 'sass', '~> 3.0'
|
||||
gem 'less', '~> 2.5.0'
|
||||
gem 'libv8', '~> 3.16.14.0'
|
||||
gem 'therubyracer'
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user