Merge branch '3.8' into fix_3.8_clone_order

This commit is contained in:
phf 2015-10-28 14:36:31 +01:00
commit 4180862fec
1180 changed files with 10136 additions and 7410 deletions

View File

@ -9,6 +9,74 @@ Upgrading to any other version or any other database system is abolutely require
make a Dolibarr upgrade.
***** ChangeLog for 3.8.1 compared to 3.8.0 *****
FIX: #3521 postgresql migration error
FIX: #3524
FIX: #3529
FIX: #3530
FIX: #3533
FIX: #3533 Load categories language
FIX: #3534
FIX: #3572 Impossible to attach project in order
FIX: #3599 Not saving legal form
FIX: #3606
FIX: #3607 Better categories setting and unsetting
FIX: #3628
FIX: #3630 - Wrong balance report when module salaries and donation disabled
FIX: Add a test to save life when ref of object (invoice ref, order ref, ...) was empty. The was no way to go back to a clean situation, even after vaidating again the object.
FIX: Admin fiche inter page do not take good action
FIX: Always use type send in parameters in showCategories method
FIX: avoid SQL error in getValueFrom common object when all params are not send
FIX: avoid SQL error when no sortfield send to method
FIX: bad link into project box
FIX: Bad title line in project view when using jmobile
FIX: Bad translation key for project "Overview"
FIX: Can create Proposal on close thridparty #3526
FIX: Can't change state on a contact
FIX: Can't change the admin with default setup
FIX: Can't delete thirdparty if there is some discounts
FIX: Can't reopen a canceled invoice.
FIX: Creation of tables or keys must not be done with a random order.
FIX: debian install when module mysqli is not installed.
FIX: Description of tags was mandatory in edit mode but not in create mode. Should not be mandatory.
FIX: display error on extrafields on ficheinter
FIX: Email selector contact must not include inactive contact
FIX: error in SQL due to a previous fix
FIX: Error retrieving customer prices
FIX: Event from ical stream should not be movable into calendar view
FIX: facturestat bad sql when customer view is limited
FIX: Filter on status of thirdparty list and bad encoding of url
FIX: icon into export profile may be not correctly output
FIX: Init into bad var
FIX: Link of project must be cickable if user has permission to read all projects FIX: Missing information into the alt of project picto
FIX: List of project for user that are restrited as sale repreentative to some thirdparties.
FIX: Mass Mailing activity don't display all status
FIX: Missing contracts into list in page of Refering objects of a thirdparty.
FIX: Missing menu entry for list of thirdparties when using auguria menu manager
FIX: Missing validate button if permission are not valid.
FIX: New adherent from, always redirect on entity
FIX: not closing CSS.
FIX: not responsive part for project page
FIX: Only are showing one object linked
FIX: order ref must not be translated
FIX: Payment form for paypal and paybox was not centered.
FIX: Pb into pagination scroll widget FIX: Style of previous-next card when using dolidroid
FIX: Regression on bad use of fk_account showing the bad bank account on PDF.
FIX: Removed warnings
FIX: remove twice same test
FIX: select of project using ajax autocomplete option
FIX: sortder field was missing so manually added values were moved to begin.
FIX: Syntax error in Debian Apache configuration
FIX: The admin flag is mising.
FIX: The filter on thirdparty prices should be visible if there is at least one thirdparty price.
FIX: Thirdparty is missing on card
FIX: update2.php test res befre assign it
FIX: When delete actioncomm also delete actioncomm_resources
FIX: when editing time spent, date of line suggested was a rubbish value
FIX: When filter with empty status, by default get canceled status (-1)
FIX: When update a member login for a member linked to a user, the login of user was not sync (not updated).
FIX: Wizard for restore does not show import command
***** ChangeLog for 3.8 compared to 3.7.* *****
For users:
FIX: #2519
@ -344,7 +412,7 @@ For users:
Use accesskey on form search.
- New: Intervention documents are now available in ECM module.
- New: Add attachments on user card + in ECM module.
- New: Can add __PROJECT_REF__ and __TIHRPARTY_NAME__ into email topic or content template.
- New: Can add __PROJECT_REF__ and __THIRDPARTY_NAME__ into email topic or content template.
- New: [ task #1204 ] add Numering contrat module free (like leopard in product module).
- New: [ task #712 ] Add warning when creating invoice from proposal or order, when there is already one invoice.
- New: Enable supplier price log table.
@ -465,6 +533,12 @@ Dolibarr better:
warehouse module and your Point Of Sale module setup if you use one.
- Replaced USER_UPDATE_SESSION trigger with an updateSession hook may break modules using it.
***** ChangeLog for 3.6.5 compared to 3.6.4 *****
- Fix: [ bug #1776 ] Undefined $deliverycompany variable in pdf_build_address
- Fix: [ bug #1794 ] Error when cloning Proposal gives error in a malformed page
***** ChangeLog for 3.6.4 compared to 3.6.3 *****
- Fix: [ bug #2893 ] Dolibarr error when viewing an invoice after changing invoice mask
***** ChangeLog for 3.6.3 compared to 3.6.2 *****
- Fix: ref_ext was not saved when recording a customer order from web service

View File

@ -40,10 +40,28 @@ enable_install_upgrade_wizard() {
rm -f /var/lib/dolibarr/documents/install.lock
}
php_install() {
if which php5enmod >/dev/null 2>&1 ;then
# php5endmod exists for ubuntu only
echo "Enable php module mysqli with php5enmod"
php5enmod mysqli
fi
}
apache_install() {
webserver=$1
# Enable Apache 2 alias module
if which a2enmod >/dev/null 2>&1 ;then
echo "Enable apache module alias with a2enmod"
a2enmod alias
fi
# Enable dolibarr conf
if which a2enconf >/dev/null 2>&1 ;then
# a2enconf exists for ubuntu only
echo "Enable link for Apache config file with a3enconf"
a2enconf dolibarr
else
if [ -d /etc/$webserver/conf.d ] && [ ! -e /etc/$webserver/conf.d/dolibarr.conf ]; then
@ -88,11 +106,7 @@ case "$1" in
echo This is not a first install
fi
# Apache 2 setup
if which a2enmod >/dev/null 2>&1 ;then
a2enmod alias
fi
php_install
apache_install
lighttpd_install

View File

@ -41,23 +41,21 @@ If you want to build/test package locally:
# Push/declare Dolibarr sources to Launchpad
#----------------------------------
- From Launchpad project (https://launchpad.net/dolibarr), register a series:
Call it 'trunk' or 'beta' or 'stable'
Call it 'trunk' or 'stable'
Use branch (dev):
~eldy/dolibarr/develop
~eldy/dolibarr/beta
~eldy/dolibarr/stable
https://launchpad.net/~eldy/dolibarr/develop
https://launchpad.net/~eldy/dolibarr/stable
or
Use URL pattern (beta or stable):
Use URL pattern (stable):
For stable: http://www.dolibarr.org/files/lastbuild/package_debian-ubuntu/dolibarr_x.z.*.tar.gz
For beta: http://www.dolibarr.org/files/stable/package_debian-ubuntu/dolibarr_x.y.*.tar.gz
- For Dev, you can also add link serie to GIT HEAD.
- For beta and stable, you can init from command line
cd bzr/dolibarr-[beta|stable]
- For stable, you can init from command line
cd bzr/dolibarr-stable
bzr init
bzr add
bzr commit -m "Init"
bzr push lp:~yourlogin/dolibarr/[beta|stable]
bzr push lp:~yourlogin/dolibarr/stable
- List of series are visible here: https://launchpad.net/dolibarr/+series
@ -65,19 +63,19 @@ If you want to build/test package locally:
#----------------------------------
# create local repository
cd bzr
bzr branch lp:~yourlogin/dolibarr/[develop|beta|stable] dolibarr-[dev|beta|stable]
cd dolibarr-[dev|beta|stable]
bzr branch lp:~yourlogin/dolibarr/[develop|stable] dolibarr-[dev|stable]
cd dolibarr-[dev|stable]
# Update
bzr update
-- Update files here. Remove all and overwrite --
-- Update files here: Remove all (except .bzr dir) and overwrite --
bzr status
bzr add *
bzr commit -m "Description of change"
bzr commit -m "Upstream version x.y"
bzr push
# Init debian dir repository into launchpad (when repository for sources does not exist)
#----------------------------------
- Create debian directory and upload it onto bzr branch lp:~yourlogin/+junk/debian-[dev|beta|stable]
- Create debian directory and upload it onto bzr branch lp:~yourlogin/+junk/debian-[dev|stable]
cd bzr
mkdir debian
cd debian
@ -85,25 +83,25 @@ If you want to build/test package locally:
bzr init
bzr add
bzr commit -m "Init control files"
bzr push lp:~yourlogin/+junk/debian-[dev|beta|stable] (put here any branch name or just bzr push if into a known branch)
bzr push lp:~yourlogin/+junk/debian-[dev|stable] (put here any branch name or just bzr push if into a known branch)
- or download it from launchpad bazaar:
cd bzr
bzr branch lp:~yourlogin/+junk/debian-[dev|beta|stable]
bzr branch lp:~yourlogin/+junk/debian-[dev|stable]
# Get debian dir repository from launchpad (when repository for sources already exists)
#----------------------------------
cd bzr
bzr branch lp:~yourlogin/+junk/debian-[dev|beta|stable]
bzr branch lp:~yourlogin/+junk/debian-[dev|stable]
# To update debian dir into launchpad (when repository for sources already exists)
#----------------------------------
cd bzr
bzr branch lp:~yourlogin/+junk/debian-[dev|beta|stable]
cd debian-[dev|beta|stable]
bzr branch lp:~yourlogin/+junk/debian-[dev|stable]
cd debian-[dev|stable]
bzr status
-- Update files here --
-- Update files here: Remove all (except .bzr dir) and overwrite. Restore version into the file changelog --
bzr commit -m "Description of change"
bzr push lp:~yourlogin/+junk/debian-[dev|beta|stable]
bzr push lp:~yourlogin/+junk/debian-[dev|stable]
# Define a recipe into launchpad (a rule to build packages into a PPA)
@ -115,10 +113,6 @@ If you want to build/test package locally:
# bzr-builder format 0.3 deb-version {debupstream}-0~{revno}
lp:dolibarr
merge packaging lp:~yourlogin/+junk/debian-dev
For beta:
# bzr-builder format 0.3 deb-version {debupstream}-1~{revno}
lp:dolibarr/beta
merge packaging lp:~yourlogin/+junk/debian-beta
For stable:
# bzr-builder format 0.3 deb-version {debupstream}-2~{revno}
lp:dolibarr/stable
@ -126,13 +120,12 @@ If you want to build/test package locally:
- Run command
cd bzr
bzr dailydeb dolibarr.recipe working-dir
This will create a directory "working-dir" with dolibarr sources and will add sources from ~yourlogin/+junk/debian-[dev|beta|stable]
This will create a directory "working-dir" with dolibarr sources and will add sources from ~yourlogin/+junk/debian-[dev|stable]
- Test package sources
sudo pbuilder build <working-dir>/<project>_<version>.dsc
List of recipes created
https://code.launchpad.net/~eldy/+recipe/dolibarr-dev
https://code.launchpad.net/~eldy/+recipe/dolibarr-beta
https://code.launchpad.net/~eldy/+recipe/dolibarr-stable
@ -147,9 +140,6 @@ https://code.launchpad.net/~eldy/+recipe/dolibarr-stable
For the development snapshot version:
deb http://ppa.launchpad.net/yourlogin/dolibarr-dev/ubuntu precise main
deb-src http://ppa.launchpad.net/yourlogin/dolibarr-dev/ubuntu precise main
For the beta version:
deb http://ppa.launchpad.net/yourlogin/dolibarr-beta/ubuntu precise main
deb-src http://ppa.launchpad.net/yourlogin/dolibarr-beta/ubuntu precise main
For the stable version:
deb http://ppa.launchpad.net/yourlogin/dolibarr-stable/ubuntu precise main
deb-src http://ppa.launchpad.net/yourlogin/dolibarr-stable/ubuntu precise main

View File

@ -8,7 +8,9 @@ This files describe steps made by Dolibarr packaging team to make a
beta version of Dolibarr, step by step.
- Check all files are commited.
- Update version/info in ChangeLog. To generate a changelog, you can do "git log `git merge-base 3.7.0 origin/develop`.. --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"
- Update version/info in ChangeLog.
To generate a changelog of a major new version x.y.0, you can do "cd ~/git/dolibarr_x.y; git log `git merge-base x-1.y-1.0 origin/develop`.. --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"
To generate a changelog of a maintenance version x.y.z, you can do "cd ~/git/dolibarr_x.y; git log `git merge-base x.y.z-1 origin/develop`.. --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"
- Update version number with x.y.z-w in htdocs/filefunc.inc.php
- Commit all changes.
@ -28,7 +30,9 @@ This files describe steps made by Dolibarr packaging team to make a
complete release of Dolibarr, step by step.
- Check all files are commited.
- Update version/info in ChangeLog. To generate a changelog, you can do "git log `git merge-base 3.7.0 origin/develop`.. --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"
- Update version/info in ChangeLog.
To generate a changelog of a major new version x.y.0, you can do "cd ~/git/dolibarr_x.y; git log `git merge-base x-1.y-1.0 origin/develop`.. --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"
To generate a changelog of a maintenance version x.y.z, you can do "cd ~/git/dolibarr_x.y; git log `git merge-base x.y.z-1 origin/develop`.. --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"
- Update version number with x.y.z in htdocs/filefunc.inc.php
- Commit all changes.

View File

@ -41,7 +41,7 @@
<Char_Desc_45>DoliWamp, Dolibarr ERP/CRM for Windows</Char_Desc_45>
<Char_Desc_80>DoliWamp, the easy to use Dolibarr for Windows to manage your company,foundation</Char_Desc_80>
<Char_Desc_250>DoliWamp is the Dolibarr ERP/CRM for Windows, the easy to use open source software to manage your activity (invoices, customers, suppliers, contracts, agenda, emailings...) and any other things a small or mid-sized business or a foundation needs.</Char_Desc_250>
<Char_Desc_450>DoliWamp is the Dolibarr ERP/CRM autoinstaller for Windows users with no technical knowledge to install Dolibarr and all its prerequisites (Apache, Mysql, PHP) with just one auto-exe file. Dolibarr ERP/CRM is a software built by modules addition (you enable only features you need), to manage small or mid-sized businesses, freelancers or foundations.</Char_Desc_450>
<Char_Desc_450>DoliWamp is the Dolibarr ERP/CRM autoinstaller for Windows users with no technical knowledge to install Dolibarr and all its prerequisites (Apache, Mysql, PHP) with just one auto-exe file. Dolibarr ERP/CRM is a software package built by modules addition (you enable only features you need), to manage small or mid-sized businesses, freelancers or foundations.</Char_Desc_450>
<Char_Desc_2000>DoliWamp is the Dolibarr ERP/CRM for Windows. Dolibarr ERP &amp; CRM is a software built by modules addition (you enable only features you need), to manage small or mid-sized businesses, freelancers or foundations (You can manage or follow contacts, invoices, orders, commercial proposals, products, stock management, agenda, mass emailings, members of a foundation, bank accounts...). Based on a WAMP, MAMP or LAMP server (Apache, Mysql, PHP for all Operating Systems), you can install it as a standalone program or use it from anywhere with any web browser. Dolibarr is an OpenSource project. It differs from other ERP or CRM softwares (like OpenAguila, OpenBravo, OpenERP, Neogia, Compiere, etc) because everything was made to be more simple: Simple to install, Simple to use, Simple to develop.
DoliWamp is the auto-installer for Windows users with no technical knowledge to install Dolibarr ERP/CRM and all its prerequisites (Apache, Mysql, PHP) with just one auto-exe file.</Char_Desc_2000>
</English>

View File

@ -71,7 +71,7 @@
<Char_Desc_45>DoliWamp, Dolibarr ERP/CRM for Windows</Char_Desc_45>
<Char_Desc_80>DoliWamp, the easy to use Dolibarr for Windows to manage your company,foundation</Char_Desc_80>
<Char_Desc_250>DoliWamp is the Dolibarr ERP/CRM for Windows, the easy to use open source software to manage your activity (invoices, customers, suppliers, contracts, agenda, emailings...) and any other things a small or mid-sized business or a foundation needs.</Char_Desc_250>
<Char_Desc_450>DoliWamp is the Dolibarr ERP/CRM autoinstaller for Windows users with no technical knowledge to install Dolibarr and all its prerequisites (Apache, Mysql, PHP) with just one auto-exe file. Dolibarr ERP/CRM is a software built by modules addition (you enable only features you need), to manage small or mid-sized businesses, freelancers or foundations.</Char_Desc_450>
<Char_Desc_450>DoliWamp is the Dolibarr ERP/CRM autoinstaller for Windows users with no technical knowledge to install Dolibarr and all its prerequisites (Apache, Mysql, PHP) with just one auto-exe file. Dolibarr ERP/CRM is a software package built by modules addition (you enable only features you need), to manage small or mid-sized businesses, freelancers or foundations.</Char_Desc_450>
<Char_Desc_2000>DoliWamp is the Dolibarr ERP/CRM for Windows. Dolibarr ERP &amp; CRM is a software built by modules addition (you enable only features you need), to manage small or mid-sized businesses, freelancers or foundations (You can manage or follow contacts, invoices, orders, commercial proposals, products, stock management, agenda, mass emailings, members of a foundation, bank accounts...). Based on a WAMP, MAMP or LAMP server (Apache, Mysql, PHP for all Operating Systems), you can install it as a standalone program or use it from anywhere with any web browser. Dolibarr is an OpenSource project. It differs from other ERP or CRM softwares (like OpenAguila, OpenBravo, OpenERP, Neogia, Compiere, etc) because everything was made to be more simple: Simple to install, Simple to use, Simple to develop.
DoliWamp is the auto-installer for Windows users with no technical knowledge to install Dolibarr ERP/CRM and all its prerequisites (Apache, Mysql, PHP) with just one auto-exe file.</Char_Desc_2000>
</English>

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 102 KiB

File diff suppressed because one or more lines are too long

View File

@ -244,7 +244,7 @@ class Skeleton_Class extends CommonObject
}
if (!empty($sortfield)) {
$sql .= ' ORDER BY ' . $sortfield . ' ' . $sortorder;
$sql .= $this->db->order($sortfield,$sortorder);
}
if (!empty($limit)) {
$sql .= ' ' . $this->db->plimit($limit + 1, $offset);

View File

@ -30,8 +30,9 @@ then
else
for file in `find htdocs/langs/$1/*.lang -type f`
do
echo $file
export basefile=`basename $file | sed -s s/\.lang//g`
echo "tx push --skip -r dolibarr.$basfile -t -l $1 $2 $3 $4"
echo "tx push --skip -r dolibarr.$basefile -t -l $1 $2 $3 $4"
tx push --skip -r dolibarr.$basefile -t -l $1 $2 $3 $4
done
fi

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

View File

@ -200,7 +200,7 @@ if (! empty($conf->paybox->enabled) || ! empty($conf->paypal->enabled))
print '<tr '.$bc[$var].' id="tremail"><td>';
print $langs->trans("MEMBER_PAYONLINE_SENDEMAIL");
print '</td><td align="right">';
print '<input type="text" id="MEMBER_PAYONLINE_SENDEMAIL" name="MEMBER_PAYONLINE_SENDEMAIL" size="24" value="'.(! empty($conf->global->MEMBER_PAYONLINE_SENDEMAIL)?$conf->global->MEMBER_PAYONLINE_SENDEMAIL:'').'">';;
print '<input type="text" id="MEMBER_PAYONLINE_SENDEMAIL" name="MEMBER_PAYONLINE_SENDEMAIL" size="24" value="'.(! empty($conf->global->MEMBER_PAYONLINE_SENDEMAIL)?$conf->global->MEMBER_PAYONLINE_SENDEMAIL:'').'">';
print "</td></tr>\n";
}

View File

@ -326,25 +326,8 @@ if (empty($reshook))
if ($result >= 0 && ! count($object->errors))
{
// Categories association
// First we delete all categories association
$sql = 'DELETE FROM ' . MAIN_DB_PREFIX . 'categorie_member';
$sql .= ' WHERE fk_member = ' . $object->id;
$resql = $db->query($sql);
if (! $resql) dol_print_error($db);
// Then we add the associated categories
$categories = GETPOST('memcats', 'array');
if (! empty($categories))
{
$cat = new Categorie($db);
foreach ($categories as $id_category)
{
$cat->fetch($id_category);
$cat->add_type($object, 'member');
}
}
$object->setCategories($categories);
// Logo/Photo save
$dir= $conf->adherent->dir_output . '/' . get_exdir($object->id,2,0,1,$object,'member').'/photos';
@ -560,15 +543,7 @@ if (empty($reshook))
{
// Categories association
$memcats = GETPOST('memcats', 'array');
if (! empty($memcats))
{
$cat = new Categorie($db);
foreach ($memcats as $id_category)
{
$cat->fetch($id_category);
$cat->add_type($object, 'member');
}
}
$object->setCategories($memcats);
$db->commit();
$rowid=$object->id;
@ -1478,7 +1453,14 @@ else
// Password
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED))
{
print '<tr><td>'.$langs->trans("Password").'</td><td>'.preg_replace('/./i','*',$object->pass).'</td></tr>';
print '<tr><td>'.$langs->trans("Password").'</td><td>'.preg_replace('/./i','*',$object->pass);
if ((! empty($object->pass) || ! empty($object->pass_crypted)) && empty($object->user_id))
{
$langs->load("errors");
$htmltext=$langs->trans("WarningPasswordSetWithNoAccount");
print ' '.$form->textwithpicto('', $htmltext,1,'warning');
}
print '</td></tr>';
}
// Address

View File

@ -540,10 +540,12 @@ class Adherent extends CommonObject
if ($result >= 0)
{
//var_dump($this->user_login);exit;
//var_dump($this->login);exit;
$luser->login=$this->login;
$luser->civility_id=$this->civility_id;
$luser->firstname=$this->firstname;
$luser->lastname=$this->lastname;
$luser->login=$this->user_login;
$luser->pass=$this->pass;
$luser->societe_id=$this->societe;
@ -1957,6 +1959,51 @@ class Adherent extends CommonObject
}
}
/**
* Sets object to supplied categories.
*
* Deletes object from existing categories not supplied.
* Adds it to non existing supplied categories.
* Existing categories are left untouch.
*
* @param int[]|int $categories Category or categories IDs
*/
public function setCategories($categories)
{
// Handle single category
if (!is_array($categories)) {
$categories = array($categories);
}
// Get current categories
require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
$c = new Categorie($this->db);
$existing = $c->containing($this->id, Categorie::TYPE_MEMBER, 'id');
// Diff
if (is_array($existing)) {
$to_del = array_diff($existing, $categories);
$to_add = array_diff($categories, $existing);
} else {
$to_del = array(); // Nothing to delete
$to_add = $categories;
}
// Process
foreach ($to_del as $del) {
if ($c->fetch($del) > 0) {
$c->del_type($this, 'member');
}
}
foreach ($to_add as $add) {
if ($c->fetch($add) > 0) {
$c->add_type($this, 'member');
}
}
return;
}
/**
* Function used to replace a thirdparty id with another one.
*

View File

@ -679,7 +679,16 @@ if ($rowid > 0)
print '<br><br><table class="border" width="100%">';
foreach($extrafields->attribute_label as $key=>$label)
{
$value=(isset($_POST["options_".$key])?$_POST["options_".$key]:(isset($object->array_options['options_'.$key])?$object->array_options['options_'.$key]:''));
if (isset($_POST["options_" . $key])) {
if (is_array($_POST["options_" . $key])) {
// $_POST["options"] is an array but following code expects a comma separated string
$value = implode(",", $_POST["options_" . $key]);
} else {
$value = $_POST["options_" . $key];
}
} else {
$value = $adht->array_options["options_" . $key];
}
print '<tr><td width="30%">'.$label.'</td><td>';
print $extrafields->showInputField($key,$value);
print "</td></tr>\n";

View File

@ -414,9 +414,9 @@ if ($action == 'edit' || $action == 'updateedit')
// Forme juridique
$var=!$var;
print '<tr '.$bc[$var].'><td><label for="legal_form">'.$langs->trans("JuridicalStatus").'</label></td><td>';
print '<tr '.$bc[$var].'><td><label for="forme_juridique_code">'.$langs->trans("JuridicalStatus").'</label></td><td>';
if ($mysoc->country_code) {
print $formcompany->select_juridicalstatus($conf->global->MAIN_INFO_SOCIETE_FORME_JURIDIQUE, $mysoc->country_code, '', 'legal_form');
print $formcompany->select_juridicalstatus($conf->global->MAIN_INFO_SOCIETE_FORME_JURIDIQUE, $mysoc->country_code, '', 'forme_juridique_code');
} else {
print $countrynotdefined;
}

View File

@ -151,7 +151,7 @@ $tabsql[8] = "SELECT t.id as rowid, t.code as code, t.libelle, t.fk_country a
$tabsql[9] = "SELECT c.code_iso as code, c.label, c.unicode, c.active FROM ".MAIN_DB_PREFIX."c_currencies AS c";
$tabsql[10]= "SELECT t.rowid, t.taux, t.localtax1_type, t.localtax1, t.localtax2_type, t.localtax2, c.label as country, c.code as country_code, t.fk_pays as country_id, t.recuperableonly, t.note, t.active, t.accountancy_code_sell, t.accountancy_code_buy FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c WHERE t.fk_pays=c.rowid";
$tabsql[11]= "SELECT t.rowid as rowid, element, source, code, libelle, active FROM ".MAIN_DB_PREFIX."c_type_contact AS t";
$tabsql[12]= "SELECT c.rowid as rowid, c.code, c.sortorder, c.libelle, c.libelle_facture, nbjour, fdm, decalage, active FROM ".MAIN_DB_PREFIX.'c_payment_term AS c';
$tabsql[12]= "SELECT c.rowid as rowid, c.code, c.libelle, c.libelle_facture, c.nbjour, c.fdm, c.decalage, c.active, c.sortorder FROM ".MAIN_DB_PREFIX.'c_payment_term AS c';
$tabsql[13]= "SELECT c.id as rowid, c.code, c.libelle, c.type, c.active, c.accountancy_code FROM ".MAIN_DB_PREFIX."c_paiement AS c";
$tabsql[14]= "SELECT e.rowid as rowid, e.code as code, e.libelle, e.price, e.organization, e.fk_pays as country_id, c.code as country_code, c.label as country, e.active FROM ".MAIN_DB_PREFIX."c_ecotaxe AS e, ".MAIN_DB_PREFIX."c_country as c WHERE e.fk_pays=c.rowid and c.active=1";
$tabsql[15]= "SELECT rowid as rowid, code, label as libelle, width, height, unit, active FROM ".MAIN_DB_PREFIX."c_paper_format";
@ -215,7 +215,7 @@ $tabfield[8] = "code,libelle,country_id,country";
$tabfield[9] = "code,label,unicode";
$tabfield[10]= "country_id,country,taux,recuperableonly,localtax1_type,localtax1,localtax2_type,localtax2,accountancy_code_sell,accountancy_code_buy,note";
$tabfield[11]= "element,source,code,libelle";
$tabfield[12]= "code,libelle,libelle_facture,nbjour,fdm,decalage";
$tabfield[12]= "code,libelle,libelle_facture,nbjour,fdm,decalage,sortorder";
$tabfield[13]= "code,libelle,type,accountancy_code";
$tabfield[14]= "code,libelle,price,organization,country_id,country";
$tabfield[15]= "code,libelle,width,height,unit";
@ -247,7 +247,7 @@ $tabfieldvalue[8] = "code,libelle,country";
$tabfieldvalue[9] = "code,label,unicode";
$tabfieldvalue[10]= "country,taux,recuperableonly,localtax1_type,localtax1,localtax2_type,localtax2,accountancy_code_sell,accountancy_code_buy,note";
$tabfieldvalue[11]= "element,source,code,libelle";
$tabfieldvalue[12]= "code,libelle,libelle_facture,nbjour,fdm,decalage";
$tabfieldvalue[12]= "code,libelle,libelle_facture,nbjour,fdm,decalage,sortorder";
$tabfieldvalue[13]= "code,libelle,type,accountancy_code";
$tabfieldvalue[14]= "code,libelle,price,organization,country";
$tabfieldvalue[15]= "code,libelle,width,height,unit";
@ -279,7 +279,7 @@ $tabfieldinsert[8] = "code,libelle,fk_country";
$tabfieldinsert[9] = "code_iso,label,unicode";
$tabfieldinsert[10]= "fk_pays,taux,recuperableonly,localtax1_type,localtax1,localtax2_type,localtax2,accountancy_code_sell,accountancy_code_buy,note";
$tabfieldinsert[11]= "element,source,code,libelle";
$tabfieldinsert[12]= "code,libelle,libelle_facture,nbjour,fdm,decalage";
$tabfieldinsert[12]= "code,libelle,libelle_facture,nbjour,fdm,decalage,sortorder";
$tabfieldinsert[13]= "code,libelle,type,accountancy_code";
$tabfieldinsert[14]= "code,libelle,price,organization,fk_pays";
$tabfieldinsert[15]= "code,label,width,height,unit";
@ -1595,6 +1595,7 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='')
if ($fieldlist[$field]=='accountancy_code') $size='size="10" ';
if ($fieldlist[$field]=='accountancy_code_sell') $size='size="10" ';
if ($fieldlist[$field]=='accountancy_code_buy') $size='size="10" ';
if ($fieldlist[$field]=='sortorder') $size='size="2" ';
print '<input type="text" '.$size.' class="flat" value="'.(isset($obj->$fieldlist[$field])?$obj->$fieldlist[$field]:'').'" name="'.$fieldlist[$field].'">';
print '</td>';
}

View File

@ -203,7 +203,6 @@ else if ($action == 'set_FICHINTER_FREE_TEXT')
else if ($action == 'set_FICHINTER_DRAFT_WATERMARK')
{
$draft= GETPOST('FICHINTER_DRAFT_WATERMARK','alpha');
$res = dolibarr_set_const($db, "FICHINTER_DRAFT_WATERMARK",trim($draft),'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
@ -544,7 +543,7 @@ print '<input size="50" class="flat" type="text" name="FICHINTER_DRAFT_WATERMARK
print '</td><td align="right">';
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print "</td></tr>\n";
print '</form>';
// print products on fichinter
$var=! $var;
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';

View File

@ -126,7 +126,9 @@ if ($action == 'activate_encryptdbpassconf')
$result = encodedecode_dbpassconf(1);
if ($result > 0)
{
// database value not required
sleep(3); // Don't know why but we need to wait file is completely saved before making the reload. Even with flush and clearstatcache, we need to wait.
// database value not required
//dolibarr_set_const($db, "MAIN_DATABASE_PWD_CONFIG_ENCRYPTED", "1");
header("Location: security.php");
exit;
@ -141,6 +143,8 @@ else if ($action == 'disable_encryptdbpassconf')
$result = encodedecode_dbpassconf(0);
if ($result > 0)
{
sleep(3); // Don't know why but we need to wait file is completely saved before making the reload. Even with flush and clearstatcache, we need to wait.
// database value not required
//dolibarr_del_const($db, "MAIN_DATABASE_PWD_CONFIG_ENCRYPTED",$conf->entity);
header("Location: security.php");

View File

@ -39,6 +39,8 @@ $showpass=GETPOST('showpass');
*/
$label=$db::LABEL;
$type=$db->type;
$help_url='EN:Restores|FR:Restaurations|ES:Restauraciones';
llxHeader('','',$help_url);
@ -91,7 +93,7 @@ print $langs->trans("RestoreDesc3",$dolibarr_main_db_name).'<br><br>';
<fieldset id="exportoptions">
<legend><?php echo $langs->trans("ImportMethod"); ?></legend>
<?php
if ($label == 'MySQL')
if (in_array($type, array('mysql', 'mysqli')))
{
?>
<div class="formelementrow">
@ -100,7 +102,7 @@ print $langs->trans("RestoreDesc3",$dolibarr_main_db_name).'<br><br>';
</div>
<?php
}
else if ($label == 'PostgreSQL')
else if (in_array($type, array('pgsql')))
{
?>
<div class="formelementrow">
@ -123,7 +125,7 @@ print $langs->trans("RestoreDesc3",$dolibarr_main_db_name).'<br><br>';
<div id="div_container_sub_exportoptions">
<?php
if ($label == 'MySQL')
if (in_array($type, array('mysql', 'mysqli')))
{
?>
<fieldset id="mysql_options">
@ -157,7 +159,7 @@ if ($label == 'MySQL')
</fieldset>
<?php
}
else if ($label == 'PostgreSQL')
else if (in_array($type, array('pgsql')))
{
?>
<fieldset id="postgresql_options">

View File

@ -419,7 +419,7 @@ else if ($id || $ref)
// Ref
print '<tr><td width="20%">'.$langs->trans("Ref").'</td>';
print '<td class="valeur">';
print $form->showrefnav($member,'id','','1','rowid','ref','','&type=3');
print $form->showrefnav($member,'id','','1','rowid','ref','','&type='.$type);
print '</td></tr>';
// Login

View File

@ -222,6 +222,8 @@ class Categorie extends CommonObject
$error=0;
dol_syslog(get_class($this).'::create', LOG_DEBUG);
// Clean parameters
$this->label = trim($this->label);
$this->description = trim($this->description);
@ -239,7 +241,6 @@ class Categorie extends CommonObject
$this->db->begin();
dol_syslog(get_class($this).'::create', LOG_DEBUG);
$sql = "INSERT INTO ".MAIN_DB_PREFIX."categorie (";
$sql.= "fk_parent,";
$sql.= " label,";
@ -266,7 +267,6 @@ class Categorie extends CommonObject
$sql.= $conf->entity;
$sql.= ")";
dol_syslog(get_class($this).'::create', LOG_DEBUG);
$res = $this->db->query($sql);
if ($res)
{
@ -1222,7 +1222,7 @@ class Categorie extends CommonObject
* @param string $type Type of category ('customer', 'supplier', 'contact', 'product', 'member'). Old mode
* (0, 1, 2, ...) is deprecated.
* @param string $mode 'object'=Get array of fetched category instances, 'label'=Get array of category
* labels
* labels, 'id'= Get array of category IDs
*
* @return mixed Array of category objects or < 0 if KO
*/
@ -1239,7 +1239,7 @@ class Categorie extends CommonObject
$type = $map_type[$type];
}
$sql = "SELECT ct.fk_categorie, c.label";
$sql = "SELECT ct.fk_categorie, c.label, c.rowid";
$sql .= " FROM " . MAIN_DB_PREFIX . "categorie_" . $this->MAP_CAT_TABLE[$type] . " as ct, " . MAIN_DB_PREFIX . "categorie as c";
$sql .= " WHERE ct.fk_categorie = c.rowid AND ct.fk_" . $this->MAP_CAT_FK[$type] . " = " . $id . " AND c.type = " . $this->MAP_ID[$type];
$sql .= " AND c.entity IN (" . getEntity( 'category', 1 ) . ")";
@ -1249,11 +1249,11 @@ class Categorie extends CommonObject
{
while ($obj = $this->db->fetch_object($res))
{
if ($mode == 'label')
{
if ($mode == 'id') {
$cats[] = $obj->rowid;
} else if ($mode == 'label') {
$cats[] = $obj->label;
}
else {
} else {
$cat = new Categorie($this->db);
$cat->fetch($obj->fk_categorie);
$cats[] = $cat;

View File

@ -323,7 +323,7 @@ if ($action == 'add')
unset($_SESSION['assignedtouser']);
$moreparam='';
if ($user->id != $object->ownerid) $moreparam="usertodo=-1"; // We force to remove filter so created record is visible when going back to per user view.
if ($user->id != $object->userownerid) $moreparam="usertodo=-1"; // We force to remove filter so created record is visible when going back to per user view.
$db->commit();
if (! empty($backtopage))
@ -1303,7 +1303,16 @@ if ($id > 0)
print '<br><br><table class="border" width="100%">';
foreach($extrafields->attribute_label as $key=>$label)
{
$value=(isset($_POST["options_".$key])?$_POST["options_".$key]:(isset($object->array_options['options_'.$key])?$object->array_options['options_'.$key]:''));
if (isset($_POST["options_" . $key])) {
if (is_array($_POST["options_" . $key])) {
// $_POST["options"] is an array but following code expects a comma separated string
$value = implode(",", $_POST["options_" . $key]);
} else {
$value = $_POST["options_" . $key];
}
} else {
$value = $object->array_options["options_" . $key];
}
print '<tr><td width="30%">'.$label.'</td><td>';
print $extrafields->showOutputField($key,$value);
print "</td></tr>\n";

View File

@ -622,7 +622,19 @@ class ActionComm extends CommonObject
$this->error=$this->db->lasterror();
$error++;
}
if (! $error) {
$sql = "DELETE FROM ".MAIN_DB_PREFIX."actioncomm_resources";
$sql.= " WHERE fk_actioncomm=".$this->id;
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
$res=$this->db->query($sql);
if ($res < 0) {
$this->error=$this->db->lasterror();
$error++;
}
}
// Removed extrafields
if (! $error) {
$result=$this->deleteExtraFields();

View File

@ -1210,7 +1210,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
// We decide to choose color of owner of event (event->userownerid is user id of owner, event->userassigned contains all users assigned to event)
if (! empty($cacheusers[$event->userownerid]->color)) $color=$cacheusers[$event->userownerid]->color;
}
else if ($event->type_code == 'ICALEVENT')
else if ($event->type_code == 'ICALEVENT') // Event come from external ical file
{
$numical++;
if (! empty($event->icalname)) {
@ -1220,7 +1220,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
$numicals[dol_string_nospecial($event->icalname)]++;
}
$color=$event->icalcolor;
$cssclass=(! empty($event->icalname)?'family_ext'.md5($event->icalname):'family_other unmovable');
$cssclass=(! empty($event->icalname)?'family_ext'.md5($event->icalname):'family_other');
}
else if ($event->type_code == 'BIRTHDAY')
{
@ -1266,6 +1266,10 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
{
$cssclass.= " unmovable";
}
else if ($event->type_code == 'ICALEVENT')
{
$cssclass.= " unmovable";
}
else if ($event->date_end_in_calendar && date('Ymd',$event->date_start_in_calendar) != date('Ymd',$event->date_end_in_calendar))
{
$tmpyearend = date('Y',$event->date_end_in_calendar);

View File

@ -199,7 +199,7 @@ if ($status == 'todo') { $sql.= " AND ((a.percent >= 0 AND a.percent < 100) OR (
if ($filtert > 0 || $usergroup > 0)
{
$sql.= " AND (";
if ($filtert > 0) $sql.= "ar.fk_element = ".$filtert;
if ($filtert > 0) $sql.= "(ar.fk_element = ".$filtert." OR a.fk_user_action=".$filtert.")";
if ($usergroup > 0) $sql.= ($filtert>0?" OR ":"")." ugu.fk_usergroup = ".$usergroup;
$sql.= ")";
}

View File

@ -1800,7 +1800,7 @@ if ($action == 'create')
// Tableau des substitutions
$formmail->substit['__ASKREF__'] = $object->ref;
$formmail->substit['__SIGNATURE__'] = $user->signature;
$formmail->substit['__THIRPARTY_NAME__'] = $object->thirdparty->name;
$formmail->substit['__THIRDPARTY_NAME__'] = $object->thirdparty->name;
$formmail->substit['__PROJECT_REF__'] = (is_object($object->projet)?$object->projet->ref:'');
$formmail->substit['__CONTACTCIVNAME__'] = '';
$formmail->substit['__PERSONALIZED__'] = '';

View File

@ -1289,12 +1289,12 @@ class AskPriceSupplier extends CommonObject
$soc->fetch($this->socid);
// Define new ref
if (! $error && (preg_match('/^[\(]?PROV/i', $this->ref)))
if (! $error && (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref))) // empty should not happened, but when it occurs, the test save life
{
$num = $this->getNextNumRef($soc);
}
else
{
{
$num = $this->ref;
}
$this->newref = $num;

View File

@ -164,8 +164,7 @@ if ($result)
print '<td align="right" class="nowrap">';
if ($filteremail)
{
if ($obj->sendstatut==-1) print $langs->trans("MailingStatusError").' '.img_error();
if ($obj->sendstatut==1) print $langs->trans("MailingStatusSent").' '.img_picto($langs->trans("MailingStatusSent"),'statut6');
print $email::libStatutDest($obj->sendstatut,2);
}
else
{

View File

@ -128,7 +128,7 @@ if (empty($reshook))
// Action clone object
if ($action == 'confirm_clone' && $confirm == 'yes')
{
if (1 == 0 && ! GETPOST('clone_content') && ! GETPOST('clone_receivers'))
if (! GETPOST('socid', 3))
{
setEventMessage($langs->trans("NoCloneOptionsSpecified"), 'errors');
}
@ -140,7 +140,7 @@ if (empty($reshook))
header("Location: " . $_SERVER['PHP_SELF'] . '?id=' . $result);
exit();
} else {
setEventMessage($object->error, 'errors');
if (count($object->errors) > 0) setEventMessage($object->errors, 'errors');
$action = '';
}
}
@ -2223,7 +2223,7 @@ if ($action == 'create')
}
$arrayofinvoiceforpropal = $object->getInvoiceArrayList();
if ((is_array($arrayofinvoiceforpropal) && count($arrayofinvoiceforpropal) > 0) || ! empty($conf->global->WORKFLOW_PROPAL_CAN_CLASSIFIED_BILLED_WITHOUT_INVOICES))
if ((is_array($arrayofinvoiceforpropal) && count($arrayofinvoiceforpropal) > 0) || empty($conf->global->WORKFLOW_PROPAL_NEED_INVOICE_TO_BE_CLASSIFIED_BILLED))
{
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&amp;action=classifybilled&amp;socid=' . $object->socid . '">' . $langs->trans("ClassifyBilled") . '</a></div>';
}
@ -2367,7 +2367,7 @@ if ($action == 'create')
$formmail->substit['__PROPREF__'] = $object->ref;
$formmail->substit['__SIGNATURE__'] = $user->signature;
$formmail->substit['__REFCLIENT__'] = $object->ref_client;
$formmail->substit['__THIRPARTY_NAME__'] = $object->thirdparty->name;
$formmail->substit['__THIRDPARTY_NAME__'] = $object->thirdparty->name;
$formmail->substit['__PROJECT_REF__'] = (is_object($object->projet)?$object->projet->ref:'');
$formmail->substit['__PERSONALIZED__'] = '';
$formmail->substit['__CONTACTCIVNAME__'] = '';

View File

@ -47,8 +47,9 @@ $result = restrictedArea($user, 'propal', $id);
* View Mode
*/
llxHeader();
$form = new Form($db);
llxHeader();
if ($id > 0 || ! empty($ref))
{
@ -68,10 +69,12 @@ if ($id > 0 || ! empty($ref))
*/
print '<table class="border" width="100%">';
// Ref
print '<tr><td width="25%">'.$langs->trans('Ref').'</td>';
print '<td colspan="5">'.$object->ref.'</td>';
print '</tr>';
$linkback = '<a href="' . DOL_URL_ROOT . '/comm/propal/list.php' . (! empty($socid) ? '?socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
// Ref
print '<tr><td>' . $langs->trans('Ref') . '</td><td colspan="5">';
print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', '');
print '</td></tr>';
// Ref client
print '<tr><td>'.$langs->trans('RefCustomer').'</td>';
@ -144,7 +147,7 @@ if ($id > 0 || ! empty($ref))
print "</table>\n";
// Conversion du PDF en image png si fichier png non existant
if (! file_exists($fileimage) && ! file_exists($fileimagebis))
if ((! file_exists($fileimage) && ! file_exists($fileimagebis)) || (filemtime($fileimage) < filemtime($file)))
{
if (class_exists("Imagick"))
{

View File

@ -462,7 +462,7 @@ class Propal extends CommonObject
$localtaxes_type=getLocalTaxesFromRate($txtva,0,$this->thirdparty,$mysoc);
$tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, '', $localtaxes_type);
$tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $mysoc, $localtaxes_type);
$total_ht = $tabprice[0];
$total_tva = $tabprice[1];
$total_ttc = $tabprice[2];
@ -1063,7 +1063,7 @@ class Propal extends CommonObject
{
global $db, $user,$langs,$conf,$hookmanager;
dol_include_once('/projet/class.project.class.php');
dol_include_once('/projet/class/project.class.php');
$this->context['createfromclone']='createfromclone';
@ -1076,44 +1076,42 @@ class Propal extends CommonObject
foreach($this->lines as $line)
$line->fetch_optionals($line->rowid);
// Load source object
$objFrom = dol_clone($this);
// Load dest object
$clonedObj = clone $this;
$objsoc=new Societe($this->db);
// Change socid if needed
if (! empty($socid) && $socid != $this->socid)
if (! empty($socid) && $socid != $clonedObj->socid)
{
if ($objsoc->fetch($socid) > 0)
{
$this->socid = $objsoc->id;
$this->cond_reglement_id = (! empty($objsoc->cond_reglement_id) ? $objsoc->cond_reglement_id : 0);
$this->mode_reglement_id = (! empty($objsoc->mode_reglement_id) ? $objsoc->mode_reglement_id : 0);
$project = new Project($db);
if($objFrom->fk_project > 0 && $project->fetch($objFrom->fk_project)) {
if($project->socid <= 0) $this->fk_project = $objFrom->fk_project;
else $this->fk_project = '';
$clonedObj->socid = $objsoc->id;
$clonedObj->cond_reglement_id = (! empty($objsoc->cond_reglement_id) ? $objsoc->cond_reglement_id : 0);
$clonedObj->mode_reglement_id = (! empty($objsoc->mode_reglement_id) ? $objsoc->mode_reglement_id : 0);
$clonedObj->fk_delivery_address = '';
$project = new Project($db);
if ($this->fk_project > 0 && $project->fetch($this->fk_project)) {
if ($project->socid <= 0) $clonedObj->fk_project = $this->fk_project;
else $clonedObj->fk_project = '';
} else {
$this->fk_project = '';
$clonedObj->fk_project = '';
}
$this->fk_delivery_address = '';
}
// reset ref_client
$this->ref_client = '';
$clonedObj->ref_client = '';
// TODO Change product price if multi-prices
}
else
{
$objsoc->fetch($this->socid);
$objsoc->fetch($clonedObj->socid);
}
$this->id=0;
$this->statut=self::STATUS_DRAFT;
$clonedObj->id=0;
$clonedObj->statut=self::STATUS_DRAFT;
if (empty($conf->global->PROPALE_ADDON) || ! is_readable(DOL_DOCUMENT_ROOT ."/core/modules/propale/".$conf->global->PROPALE_ADDON.".php"))
{
@ -1122,32 +1120,32 @@ class Propal extends CommonObject
}
// Clear fields
$this->user_author = $user->id;
$this->user_valid = '';
$this->date = $now;
$this->datep = $now; // deprecated
$this->fin_validite = $this->date + ($this->duree_validite * 24 * 3600);
if (empty($conf->global->MAIN_KEEP_REF_CUSTOMER_ON_CLONING)) $this->ref_client = '';
$clonedObj->user_author = $user->id;
$clonedObj->user_valid = '';
$clonedObj->date = $now;
$clonedObj->datep = $now; // deprecated
$clonedObj->fin_validite = $clonedObj->date + ($clonedObj->duree_validite * 24 * 3600);
if (empty($conf->global->MAIN_KEEP_REF_CUSTOMER_ON_CLONING)) $clonedObj->ref_client = '';
// Set ref
require_once DOL_DOCUMENT_ROOT ."/core/modules/propale/".$conf->global->PROPALE_ADDON.'.php';
$obj = $conf->global->PROPALE_ADDON;
$modPropale = new $obj;
$this->ref = $modPropale->getNextValue($objsoc,$this);
$clonedObj->ref = $modPropale->getNextValue($objsoc,$clonedObj);
// Create clone
$result=$this->create($user);
$result=$clonedObj->create($user);
if ($result < 0) $error++;
else
{
// copy internal contacts
if ($this->copy_linked_contact($objFrom, 'internal') < 0)
if ($clonedObj->copy_linked_contact($this, 'internal') < 0)
$error++;
// copy external contacts if same company
elseif ($objFrom->socid == $this->socid)
elseif ($this->socid == $clonedObj->socid)
{
if ($this->copy_linked_contact($objFrom, 'external') < 0)
if ($clonedObj->copy_linked_contact($this, 'external') < 0)
$error++;
}
}
@ -1157,9 +1155,9 @@ class Propal extends CommonObject
// Hook of thirdparty module
if (is_object($hookmanager))
{
$parameters=array('objFrom'=>$objFrom);
$parameters=array('objFrom'=>$this,'clonedObj'=>$clonedObj);
$action='';
$reshook=$hookmanager->executeHooks('createFrom',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
$reshook=$hookmanager->executeHooks('createFrom',$parameters,$clonedObj,$action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) $error++;
}
@ -1175,7 +1173,7 @@ class Propal extends CommonObject
if (! $error)
{
$this->db->commit();
return $this->id;
return $clonedObj->id;
}
else
{
@ -1481,12 +1479,12 @@ class Propal extends CommonObject
$soc->fetch($this->socid);
// Define new ref
if (! $error && (preg_match('/^[\(]?PROV/i', $this->ref)))
if (! $error && (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref))) // empty should not happened, but when it occurs, the test save life
{
$num = $this->getNextNumRef($soc);
}
else
{
{
$num = $this->ref;
}
$this->newref = $num;
@ -2124,26 +2122,26 @@ class Propal extends CommonObject
$this->fetchObjectLinked($id,$this->element);
foreach($this->linkedObjectsIds as $objecttype => $objectid)
{
$numi=count($objectid);
for ($i=0;$i<$numi;$i++)
// Nouveau système du comon object renvoi des rowid et non un id linéaire de 1 à n
// On parcourt donc une liste d'objets en tant qu'objet unique
foreach($objectid as $key => $object)
{
// Cas des factures liees directement
if ($objecttype == 'facture')
{
$linkedInvoices[] = $objectid[$i];
$linkedInvoices[] = $object;
}
// Cas des factures liees par un autre objet (ex: commande)
else
{
$this->fetchObjectLinked($objectid[$i],$objecttype);
$this->fetchObjectLinked($object,$objecttype);
foreach($this->linkedObjectsIds as $subobjecttype => $subobjectid)
{
$numj=count($subobjectid);
for ($j=0;$j<$numj;$j++)
foreach($subobjectid as $subkey => $subobject)
{
if ($subobjecttype == 'facture')
{
$linkedInvoices[] = $subobjectid[$j];
$linkedInvoices[] = $subobject;
}
}
}

View File

@ -48,7 +48,7 @@ class PropaleStats extends Stats
* Constructor
*
* @param DoliDB $db Database handler
* @param int $socid Id third party for filter
* @param int $socid Id third party for filter. This value must be forced during the new to external user company if user is an external user.
* @param int $userid Id user for filter (creation user)
*/
function __construct($db, $socid=0, $userid=0)

View File

@ -468,6 +468,7 @@ if ($resql)
$reshook=$hookmanager->executeHooks('printFieldListSearch',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Status
print '<td class="liste_titre" align="right">';
print $form->selectarray('search_status', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')),$search_status);
print '</td>';

View File

@ -47,6 +47,8 @@ $result=restrictedArea($user,'commande',$id,'');
* View Mode
*/
$form = new Form($db);
llxHeader('',$langs->trans('Order'),'EN:Customers_Orders|FR:Commandes_Clients|ES:Pedidos de clientes');
if ($id > 0 || ! empty($ref))
@ -64,9 +66,12 @@ if ($id > 0 || ! empty($ref))
print '<table class="border" width="100%">';
// Ref
print '<tr><td width="25%">'.$langs->trans("Ref")."</td>";
print '<td colspan="5">'.$object->ref.'</td></tr>';
//$linkback = '<a href="' . DOL_URL_ROOT . '/comm/propal/list.php' . (! empty($socid) ? '?socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
// Ref
print '<tr><td>' . $langs->trans('Ref') . '</td><td colspan="5">';
print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref', '');
print '</td></tr>';
// Ref cde client
print '<tr><td>'.$langs->trans('RefCustomer').'</td>';
@ -142,7 +147,7 @@ if ($id > 0 || ! empty($ref))
print "</table>\n";
// Conversion du PDF en image png si fichier png non existant
if (! file_exists($fileimage) && ! file_exists($fileimagebis))
if ((! file_exists($fileimage) && ! file_exists($fileimagebis)) || (filemtime($fileimage) < filemtime($file)))
{
if (class_exists("Imagick"))
{

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2003-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
* Copyright (C) 2005-2015 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
@ -88,7 +88,7 @@ $extrafields = new ExtraFields($db);
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
// Load object
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not includ_once
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('ordercard','globalcard'));
@ -150,7 +150,7 @@ if (empty($reshook))
// Reopen a closed order
else if ($action == 'reopen' && $user->rights->commande->creer)
{
if ($object->statut == STATUS_CANCELED || $object->statut == Commande::STATUS_CLOSED)
if ($object->statut == Commande::STATUS_CANCELED || $object->statut == Commande::STATUS_CLOSED)
{
$result = $object->set_reopen($user);
if ($result > 0)
@ -165,7 +165,7 @@ if (empty($reshook))
}
}
// Suppression de la commande
// Remove order
else if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->commande->supprimer)
{
$result = $object->delete($user);
@ -1427,6 +1427,8 @@ if ($action == 'create' && $user->rights->commande->creer)
$form->selectInputReason($demand_reason_id, 'demand_reason_id', '', 1);
print '</td></tr>';
// TODO How record was recorded OrderMode (llx_c_input_method)
// Project
if (! empty($conf->projet->enabled) && $socid > 0)
{
@ -1968,7 +1970,7 @@ if ($action == 'create' && $user->rights->commande->creer)
}
print '</td></tr>';
// Source
// Origin
print '<tr><td height="10">';
print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans('Source');
@ -1988,6 +1990,8 @@ if ($action == 'create' && $user->rights->commande->creer)
// print '<a href="'.DOL_URL_ROOT.'/admin/dict.php?id=22&origin=order&originid='.$object->id.'">'.$langs->trans("DictionarySource").'</a>';
print '</td></tr>';
// TODO How record was recorded OrderMode (llx_c_input_method)
// Project
if (! empty($conf->projet->enabled))
{
@ -2405,7 +2409,7 @@ if ($action == 'create' && $user->rights->commande->creer)
$formmail->substit ['__ORDERREF__'] = $object->ref;
$formmail->substit ['__SIGNATURE__'] = $user->signature;
$formmail->substit ['__REFCLIENT__'] = $object->ref_client;
$formmail->substit ['__THIRPARTY_NAME__'] = $object->thirdparty->name;
$formmail->substit ['__THIRDPARTY_NAME__'] = $object->thirdparty->name;
$formmail->substit ['__PROJECT_REF__'] = (is_object($object->projet)?$object->projet->ref:'');
$formmail->substit ['__PERSONALIZED__'] = '';
$formmail->substit ['__CONTACTCIVNAME__'] = '';

View File

@ -263,14 +263,14 @@ class Commande extends CommonOrder
// Protection
if ($this->statut == self::STATUS_VALIDATED)
{
dol_syslog(get_class($this)."::valid no draft status", LOG_WARNING);
dol_syslog(get_class($this)."::valid action abandonned: no draft status", LOG_WARNING);
return 0;
}
if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->creer))
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->order_advance->validate))))
{
$this->error='Permission denied';
$this->error='ErrorPermissionDenied';
dol_syslog(get_class($this)."::valid ".$this->error, LOG_ERR);
return -1;
}
@ -287,7 +287,7 @@ class Commande extends CommonOrder
$result=$soc->set_as_client();
// Define new ref
if (! $error && (preg_match('/^[\(]?PROV/i', $this->ref)))
if (! $error && (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref))) // empty should not happened, but when it occurs, the test save life
{
$num = $this->getNextNumRef($soc);
}
@ -1039,116 +1039,112 @@ class Commande extends CommonOrder
$error=0;
// Signed proposal
if ($object->statut == 2)
$this->date_commande = dol_now();
$this->source = 0;
$num=count($object->lines);
for ($i = 0; $i < $num; $i++)
{
$this->date_commande = dol_now();
$this->source = 0;
$line = new OrderLine($this->db);
$num=count($object->lines);
for ($i = 0; $i < $num; $i++)
{
$line = new OrderLine($this->db);
$line->libelle = $object->lines[$i]->libelle;
$line->label = $object->lines[$i]->label;
$line->desc = $object->lines[$i]->desc;
$line->price = $object->lines[$i]->price;
$line->subprice = $object->lines[$i]->subprice;
$line->tva_tx = $object->lines[$i]->tva_tx;
$line->localtax1_tx = $object->lines[$i]->localtax1_tx;
$line->localtax2_tx = $object->lines[$i]->localtax2_tx;
$line->qty = $object->lines[$i]->qty;
$line->fk_remise_except = $object->lines[$i]->fk_remise_except;
$line->remise_percent = $object->lines[$i]->remise_percent;
$line->fk_product = $object->lines[$i]->fk_product;
$line->info_bits = $object->lines[$i]->info_bits;
$line->product_type = $object->lines[$i]->product_type;
$line->rang = $object->lines[$i]->rang;
$line->special_code = $object->lines[$i]->special_code;
$line->fk_parent_line = $object->lines[$i]->fk_parent_line;
$line->fk_unit = $object->lines[$i]->fk_unit;
$line->libelle = $object->lines[$i]->libelle;
$line->label = $object->lines[$i]->label;
$line->desc = $object->lines[$i]->desc;
$line->price = $object->lines[$i]->price;
$line->subprice = $object->lines[$i]->subprice;
$line->tva_tx = $object->lines[$i]->tva_tx;
$line->localtax1_tx = $object->lines[$i]->localtax1_tx;
$line->localtax2_tx = $object->lines[$i]->localtax2_tx;
$line->qty = $object->lines[$i]->qty;
$line->fk_remise_except = $object->lines[$i]->fk_remise_except;
$line->remise_percent = $object->lines[$i]->remise_percent;
$line->fk_product = $object->lines[$i]->fk_product;
$line->info_bits = $object->lines[$i]->info_bits;
$line->product_type = $object->lines[$i]->product_type;
$line->rang = $object->lines[$i]->rang;
$line->special_code = $object->lines[$i]->special_code;
$line->fk_parent_line = $object->lines[$i]->fk_parent_line;
$line->fk_unit = $object->lines[$i]->fk_unit;
$line->date_start = $object->lines[$i]->date_start;
$line->date_end = $object->lines[$i]->date_end;
$line->date_start = $object->lines[$i]->date_start;
$line->date_end = $object->lines[$i]->date_end;
$line->fk_fournprice = $object->lines[$i]->fk_fournprice;
$marginInfos = getMarginInfos($object->lines[$i]->subprice, $object->lines[$i]->remise_percent, $object->lines[$i]->tva_tx, $object->lines[$i]->localtax1_tx, $object->lines[$i]->localtax2_tx, $object->lines[$i]->fk_fournprice, $object->lines[$i]->pa_ht);
$line->pa_ht = $marginInfos[0];
$line->marge_tx = $marginInfos[1];
$line->marque_tx = $marginInfos[2];
// get extrafields from original line
$object->lines[$i]->fetch_optionals($object->lines[$i]->rowid);
foreach($object->lines[$i]->array_options as $options_key => $value)
$line->array_options[$options_key] = $value;
$this->lines[$i] = $line;
}
$this->socid = $object->socid;
$this->fk_project = $object->fk_project;
$this->cond_reglement_id = $object->cond_reglement_id;
$this->mode_reglement_id = $object->mode_reglement_id;
$this->fk_account = $object->fk_account;
$this->availability_id = $object->availability_id;
$this->demand_reason_id = $object->demand_reason_id;
$this->date_livraison = $object->date_livraison;
$this->shipping_method_id = $object->shipping_method_id;
$this->fk_delivery_address = $object->fk_delivery_address;
$this->contact_id = $object->contactid;
$this->ref_client = $object->ref_client;
$this->note_private = $object->note_private;
$this->note_public = $object->note_public;
$this->origin = $object->element;
$this->origin_id = $object->id;
$line->fk_fournprice = $object->lines[$i]->fk_fournprice;
$marginInfos = getMarginInfos($object->lines[$i]->subprice, $object->lines[$i]->remise_percent, $object->lines[$i]->tva_tx, $object->lines[$i]->localtax1_tx, $object->lines[$i]->localtax2_tx, $object->lines[$i]->fk_fournprice, $object->lines[$i]->pa_ht);
$line->pa_ht = $marginInfos[0];
$line->marge_tx = $marginInfos[1];
$line->marque_tx = $marginInfos[2];
// get extrafields from original line
$object->fetch_optionals($object->id);
$object->lines[$i]->fetch_optionals($object->lines[$i]->rowid);
foreach($object->lines[$i]->array_options as $options_key => $value)
$line->array_options[$options_key] = $value;
$e = new ExtraFields($db);
$element_extrafields = $e->fetch_name_optionals_label($this->element);
$this->lines[$i] = $line;
}
foreach($object->array_options as $options_key => $value) {
if(array_key_exists(str_replace('options_', '', $options_key), $element_extrafields)){
$this->array_options[$options_key] = $value;
}
$this->socid = $object->socid;
$this->fk_project = $object->fk_project;
$this->cond_reglement_id = $object->cond_reglement_id;
$this->mode_reglement_id = $object->mode_reglement_id;
$this->fk_account = $object->fk_account;
$this->availability_id = $object->availability_id;
$this->demand_reason_id = $object->demand_reason_id;
$this->date_livraison = $object->date_livraison;
$this->shipping_method_id = $object->shipping_method_id;
$this->fk_delivery_address = $object->fk_delivery_address;
$this->contact_id = $object->contactid;
$this->ref_client = $object->ref_client;
$this->note_private = $object->note_private;
$this->note_public = $object->note_public;
$this->origin = $object->element;
$this->origin_id = $object->id;
// get extrafields from original line
$object->fetch_optionals($object->id);
$e = new ExtraFields($db);
$element_extrafields = $e->fetch_name_optionals_label($this->element);
foreach($object->array_options as $options_key => $value) {
if(array_key_exists(str_replace('options_', '', $options_key), $element_extrafields)){
$this->array_options[$options_key] = $value;
}
// Possibility to add external linked objects with hooks
$this->linked_objects[$this->origin] = $this->origin_id;
if (is_array($object->other_linked_objects) && ! empty($object->other_linked_objects))
}
// Possibility to add external linked objects with hooks
$this->linked_objects[$this->origin] = $this->origin_id;
if (is_array($object->other_linked_objects) && ! empty($object->other_linked_objects))
{
$this->linked_objects = array_merge($this->linked_objects, $object->other_linked_objects);
}
$ret = $this->create($user);
if ($ret > 0)
{
// Actions hooked (by external module)
$hookmanager->initHooks(array('orderdao'));
$parameters=array('objFrom'=>$object);
$action='';
$reshook=$hookmanager->executeHooks('createFrom',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) $error++;
if (! $error)
{
$this->linked_objects = array_merge($this->linked_objects, $object->other_linked_objects);
}
$ret = $this->create($user);
if ($ret > 0)
{
// Actions hooked (by external module)
$hookmanager->initHooks(array('orderdao'));
$parameters=array('objFrom'=>$object);
$action='';
$reshook=$hookmanager->executeHooks('createFrom',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) $error++;
if (! $error)
// Ne pas passer par la commande provisoire
if ($conf->global->COMMANDE_VALID_AFTER_CLOSE_PROPAL == 1)
{
// Ne pas passer par la commande provisoire
if ($conf->global->COMMANDE_VALID_AFTER_CLOSE_PROPAL == 1)
{
$this->fetch($ret);
$this->valid($user);
}
return $ret;
$this->fetch($ret);
$this->valid($user);
}
else return -1;
return $ret;
}
else return -1;
}
else return 0;
else return -1;
}

View File

@ -48,7 +48,7 @@ class CommandeStats extends Stats
* Constructor
*
* @param DoliDB $db Database handler
* @param int $socid Id third party for filter
* @param int $socid Id third party for filter. This value must be forced during the new to external user company if user is an external user.
* @param string $mode Option ('customer', 'supplier')
* @param int $userid Id user for filter (creation user)
*/

View File

@ -338,7 +338,7 @@ if ($resql)
print '</td>';
print '<td align="right">';
$liststatus=array('0'=>$langs->trans("StatusOrderDraftShort"), '1'=>$langs->trans("StatusOrderValidated"), '2'=>$langs->trans("StatusOrderSentShort"), '3'=>$langs->trans("StatusOrderToBill"), '4'=>$langs->trans("StatusOrderProcessed"), '-1'=>$langs->trans("StatusOrderCanceledShort"));
print $form->selectarray('viewstatut', $liststatus, $viewstatut, 1);
print $form->selectarray('viewstatut', $liststatus, $viewstatut, -4);
print '</td>';
print '<td class="liste_titre" align="right"><input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';

View File

@ -952,7 +952,7 @@ if ($id > 0 || ! empty($ref))
if ($sep > 0) print '&nbsp;'; // If we had at least one line in future
else print $langs->trans("CurrentBalance");
print ' '.$object->currency_code.'</td>';
print '<td align="right" class="nowrap"><b>'.price($solde, 0, $langs, 0, 0, -1, $object->currency_code).'</b></td>';
print '<td align="right" class="nowrap"><b>'.price($total, 0, $langs, 0, 0, -1, $object->currency_code).'</b></td>';
print '<td>&nbsp;</td>';
print '</tr>';
} else {

View File

@ -1737,40 +1737,41 @@ if (empty($reshook))
$result = $object->add_contact($contactid, $_POST["type"], $_POST["source"]);
}
if ($result >= 0) {
header("Location: " . $_SERVER['PHP_SELF'] . "?id=" . $object->id);
exit();
} else {
if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
$langs->load("errors");
setEventMessage($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), 'errors');
if ($result >= 0) {
header("Location: " . $_SERVER['PHP_SELF'] . "?id=" . $object->id);
exit();
} else {
setEventMessage($object->error, 'errors');
if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
$langs->load("errors");
setEventMessage($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), 'errors');
} else {
setEventMessage($object->error, 'errors');
}
}
}
}
// bascule du statut d'un contact
else if ($action == 'swapstatut')
{
if ($object->fetch($id)) {
$result = $object->swapContactStatus(GETPOST('ligne'));
} else {
dol_print_error($db);
// bascule du statut d'un contact
else if ($action == 'swapstatut')
{
if ($object->fetch($id)) {
$result = $object->swapContactStatus(GETPOST('ligne'));
} else {
dol_print_error($db);
}
}
// Efface un contact
else if ($action == 'deletecontact')
{
$object->fetch($id);
$result = $object->delete_contact($lineid);
if ($result >= 0) {
header("Location: " . $_SERVER['PHP_SELF'] . "?id=" . $object->id);
exit();
} else {
dol_print_error($db);
}
}
// Efface un contact
else if ($action == 'deletecontact')
{
$object->fetch($id);
$result = $object->delete_contact($lineid);
if ($result >= 0) {
header("Location: " . $_SERVER['PHP_SELF'] . "?id=" . $object->id);
exit();
} else {
dol_print_error($db);
}
}
@ -1790,17 +1791,16 @@ if (empty($reshook))
$reshook = $hookmanager->executeHooks('insertExtraFields', $parameters, $object, $action); // Note that $action and $object may have been modified by
// some hooks
if (empty($reshook)) {
$result = $object->insertExtraFields();
if ($result < 0) {
$error ++;
}
} else if ($reshook < 0)
$result = $object->insertExtraFields();
if ($result < 0) {
$error ++;
}
if ($error)
$action = 'edit_extras';
}
} else if ($reshook < 0)
$error ++;
}
if ($error)
$action = 'edit_extras';
}
}
@ -1877,7 +1877,7 @@ if ($action == 'create')
$objectsrc->fetch_lines();
$objectsrc->fetch_thirdparty();
$projectid = (! empty($objectsrc->fk_project) ? $objectsrc->fk_project : '');
$projectid = (! empty($projectid) ? $projectid : $objectsrc->fk_project);
$ref_client = (! empty($objectsrc->ref_client) ? $objectsrc->ref_client : '');
$ref_int = (! empty($objectsrc->ref_int) ? $objectsrc->ref_int : '');
@ -2257,9 +2257,6 @@ if ($action == 'create')
// Project
if (! empty($conf->projet->enabled) && $socid > 0)
{
$projectid = GETPOST('projectid')?GETPOST('projectid'):0;
if ($origin == 'project') $projectid = ($originid ? $originid : 0);
$langs->load('projects');
print '<tr><td>' . $langs->trans('Project') . '</td><td colspan="2">';
$numprojet = $formproject->select_projects($soc->id, $projectid, 'projectid', 0);
@ -3857,7 +3854,7 @@ else if ($id > 0 || ! empty($ref))
$formmail->substit['__FACREF__'] = $object->ref;
$formmail->substit['__SIGNATURE__'] = $user->signature;
$formmail->substit['__REFCLIENT__'] = $object->ref_client;
$formmail->substit['__THIRPARTY_NAME__'] = $object->thirdparty->name;
$formmail->substit['__THIRDPARTY_NAME__'] = $object->thirdparty->name;
$formmail->substit['__PROJECT_REF__'] = (is_object($object->projet)?$object->projet->ref:'');
$formmail->substit['__PROJECT_NAME__'] = (is_object($object->projet)?$object->projet->title:'');
$formmail->substit['__PERSONALIZED__'] = '';

View File

@ -66,7 +66,6 @@ llxHeader('',$langs->trans("BillsSetup"));
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
print_fiche_titre($langs->trans("BillsSetup"),$linkback,'title_setup');
print '<br>';
$head = invoice_admin_prepare_head();

View File

@ -67,7 +67,6 @@ llxHeader('',$langs->trans("BillsSetup"));
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
print_fiche_titre($langs->trans("BillsSetup"),$linkback,'title_setup');
print '<br>';
$head = invoice_admin_prepare_head();

View File

@ -29,6 +29,7 @@
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
@ -79,10 +80,21 @@ if ($id > 0 || ! empty($ref))
*/
print '<table class="border" width="100%">';
// Ref
print '<tr><td width="25%">'.$langs->trans('Ref').'</td>';
print '<td colspan="5">'.$object->ref.'</td>';
print '</tr>';
$linkback = '<a href="' . DOL_URL_ROOT . '/compta/facture/list.php' . (! empty($socid) ? '?socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
// Ref
print '<tr><td>' . $langs->trans('Ref') . '</td><td colspan="5">';
$morehtmlref = '';
$discount = new DiscountAbsolute($db);
$result = $discount->fetch(0, $object->id);
if ($result > 0) {
$morehtmlref = ' (' . $langs->trans("CreditNoteConvertedIntoDiscount", $discount->getNomUrl(1, 'discount')) . ')';
}
if ($result < 0) {
dol_print_error('', $discount->error);
}
print $form->showrefnav($object, 'ref', $linkback, 1, 'facnumber', 'ref', $morehtmlref);
print '</td></tr>';
// Ref customer
print '<tr><td>'.$langs->trans('RefCustomer').'</td>';
@ -280,7 +292,7 @@ if ($id > 0 || ! empty($ref))
print "</table>\n";
// Conversion du PDF en image png si fichier png non existant
if (! file_exists($fileimage) && ! file_exists($fileimagebis))
if ((! file_exists($fileimage) && ! file_exists($fileimagebis)) || (filemtime($fileimage) < filemtime($file)))
{
if (class_exists("Imagick"))
{

View File

@ -180,7 +180,7 @@ class Facture extends CommonInvoice
const TYPE_DEPOSIT = 3;
/**
* Proforma invoice
* Proforma invoice (should not be used. a proforma is an order)
*/
const TYPE_PROFORMA = 4;
@ -1827,7 +1827,7 @@ class Facture extends CommonInvoice
{
$num = $force_number;
}
else if (preg_match('/^[\(]?PROV/i', $this->ref))
else if (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref)) // empty should not happened, but when it occurs, the test save life
{
if (! empty($conf->global->FAC_FORCE_DATE_VALIDATION)) // If option enabled, we force invoice date
{

View File

@ -45,7 +45,7 @@ class FactureStats extends Stats
* Constructor
*
* @param DoliDB $db Database handler
* @param int $socid Id third party for filter
* @param int $socid Id third party for filter. This value must be forced during the new to external user company if user is an external user.
* @param string $mode Option ('customer', 'supplier')
* @param int $userid Id user for filter (creation user)
*/
@ -168,7 +168,7 @@ class FactureStats extends Stats
$sql = "SELECT date_format(datef,'%m') as dm, AVG(f.".$this->field.")";
$sql.= " FROM ".$this->from;
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
if (!$user->rights->societe->client->voir && !$this->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE f.datef BETWEEN '".$this->db->idate(dol_get_first_day($year))."' AND '".$this->db->idate(dol_get_last_day($year))."'";
$sql.= " AND ".$this->where;
$sql.= " GROUP BY dm";
@ -188,7 +188,7 @@ class FactureStats extends Stats
$sql = "SELECT date_format(datef,'%Y') as year, COUNT(*) as nb, SUM(f.".$this->field.") as total, AVG(f.".$this->field.") as avg";
$sql.= " FROM ".$this->from;
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
if (!$user->rights->societe->client->voir && !$this->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE ".$this->where;
$sql.= " GROUP BY year";
$sql.= $this->db->order('year','DESC');

View File

@ -69,7 +69,7 @@ $search_refcustomer=GETPOST('search_refcustomer','alpha');
$search_societe=GETPOST('search_societe','alpha');
$search_montant_ht=GETPOST('search_montant_ht','alpha');
$search_montant_ttc=GETPOST('search_montant_ttc','alpha');
$search_status=GETPOST('search_status','alpha');
$search_status=GETPOST('search_status','int');
$sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha');
@ -191,7 +191,7 @@ if ($search_refcustomer) $sql .= natural_search('f.ref_client', $search_refcusto
if ($search_societe) $sql .= natural_search('s.nom', $search_societe);
if ($search_montant_ht != '') $sql.= natural_search('f.total', $search_montant_ht, 1);
if ($search_montant_ttc != '') $sql.= natural_search('f.total_ttc', $search_montant_ttc, 1);
if ($search_status != '') $sql.= " AND f.fk_statut = '".$db->escape($search_status)."'";
if ($search_status != '' && $search_status >= 0) $sql.= " AND f.fk_statut = ".$db->escape($search_status);
if ($month > 0)
{
if ($year > 0 && empty($day))
@ -270,6 +270,7 @@ if ($resql)
if ($search_user > 0) $param.='&search_user=' .$search_user;
if ($search_montant_ht != '') $param.='&search_montant_ht='.$search_montant_ht;
if ($search_montant_ttc != '') $param.='&search_montant_ttc='.$search_montant_ttc;
if ($search_status != '') $param.='&search_status='.$search_status;
print_barre_liste($langs->trans('BillsCustomers').' '.($socid?' '.$soc->name:''),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords,'title_accountancy.png');
$i = 0;

View File

@ -417,6 +417,7 @@ $search_societe = GETPOST("search_societe");
$search_paymentmode = GETPOST("search_paymentmode");
$search_montant_ht = GETPOST("search_montant_ht");
$search_montant_ttc = GETPOST("search_montant_ttc");
$search_status = GETPOST("search_status");
$late = GETPOST("late");
// Do we click on purge search criteria ?
@ -428,6 +429,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both
$search_paymentmode='';
$search_montant_ht='';
$search_montant_ttc='';
$search_status='';
}
$sortfield = GETPOST("sortfield",'alpha');
@ -483,6 +485,7 @@ if ($search_paymentmode) $sql .= " AND f.fk_mode_reglement = ".$search_paymentmo
if ($search_montant_ht) $sql .= " AND f.total = '".$db->escape($search_montant_ht)."'";
if ($search_montant_ttc) $sql .= " AND f.total_ttc = '".$db->escape($search_montant_ttc)."'";
if (GETPOST('sf_ref')) $sql .= " AND f.facnumber LIKE '%".$db->escape(GETPOST('sf_ref'))."%'";
if ($search_status) $sql .= " AND f.fk_statut = ".$search_status;
if ($month > 0)
{
if ($year > 0)
@ -528,6 +531,7 @@ if ($resql)
if ($search_societe) $param.='&amp;search_paymentmode='.urlencode($search_paymentmode);
if ($search_montant_ht) $param.='&amp;search_montant_ht='.urlencode($search_montant_ht);
if ($search_montant_ttc) $param.='&amp;search_montant_ttc='.urlencode($search_montant_ttc);
if ($search_status) $param.='&amp;search_status='.urlencode($search_status);
if ($late) $param.='&amp;late='.urlencode($late);
if ($mode) $param.='&amp;mode='.urlencode($mode);
$urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;

View File

@ -552,7 +552,7 @@ if ($mysoc->tva_assuj == 'franchise') // Non assujeti
* Salaries
*/
if ($conf->salaries->enabled)
if (! empty($conf->salaries->enabled))
{
if ($modecompta == 'CREANCES-DETTES') {
$column = 'p.datev';
@ -626,13 +626,16 @@ if ($conf->salaries->enabled)
* Donation
*/
if ($conf->donation->enabled)
if (! empty($conf->don->enabled))
{
print '<tr><td colspan="4">'.$langs->trans("Donation").'</td></tr>';
$sql = "SELECT p.societe as name, p.firstname, p.lastname, date_format(p.datedon,'%Y-%m') as dm, sum(p.amount) as amount";
$sql.= " FROM ".MAIN_DB_PREFIX."don as p";
$sql.= " WHERE p.entity = ".$conf->entity;
$sql.= " AND fk_statut=2";
if ($modecompta == 'CREANCES-DETTES')
$sql.= " AND fk_statut in (1,2)";
else
$sql.= " AND fk_statut=2";
if (! empty($date_start) && ! empty($date_end))
$sql.= " AND p.datedon >= '".$db->idate($date_start)."' AND p.datedon <= '".$db->idate($date_end)."'";
$sql.= " GROUP BY p.societe, p.firstname, p.lastname, dm";

View File

@ -477,85 +477,93 @@ $reshook=$hookmanager->executeHooks('addStatisticLine',$parameters,$object,$acti
/*
* Salaries
*/
if ($modecompta == 'CREANCES-DETTES') {
$column = 'p.datev';
} else {
$column = 'p.datep';
}
$subtotal_ht = 0;
$subtotal_ttc = 0;
$sql = "SELECT p.label as nom, date_format($column,'%Y-%m') as dm, sum(p.amount) as amount";
$sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as p";
$sql.= " WHERE p.entity = ".$conf->entity;
$sql.= " GROUP BY p.label, dm";
dol_syslog("get social salaries payments");
$result=$db->query($sql);
if ($result)
if (! empty($conf->salaries->enabled))
{
$num = $db->num_rows($result);
$var=false;
$i = 0;
if ($num)
{
while ($i < $num)
{
$obj = $db->fetch_object($result);
if (! isset($decaiss[$obj->dm])) $decaiss[$obj->dm]=0;
$decaiss[$obj->dm] += $obj->amount;
if (! isset($decaiss_ttc[$obj->dm])) $decaiss_ttc[$obj->dm]=0;
$decaiss_ttc[$obj->dm] += $obj->amount;
$i++;
}
}
}
else
{
dol_print_error($db);
if ($modecompta == 'CREANCES-DETTES') {
$column = 'p.datev';
} else {
$column = 'p.datep';
}
$subtotal_ht = 0;
$subtotal_ttc = 0;
$sql = "SELECT p.label as nom, date_format($column,'%Y-%m') as dm, sum(p.amount) as amount";
$sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as p";
$sql.= " WHERE p.entity = ".$conf->entity;
$sql.= " GROUP BY p.label, dm";
dol_syslog("get social salaries payments");
$result=$db->query($sql);
if ($result)
{
$num = $db->num_rows($result);
$var=false;
$i = 0;
if ($num)
{
while ($i < $num)
{
$obj = $db->fetch_object($result);
if (! isset($decaiss[$obj->dm])) $decaiss[$obj->dm]=0;
$decaiss[$obj->dm] += $obj->amount;
if (! isset($decaiss_ttc[$obj->dm])) $decaiss_ttc[$obj->dm]=0;
$decaiss_ttc[$obj->dm] += $obj->amount;
$i++;
}
}
}
else
{
dol_print_error($db);
}
}
/*
* get dunning paiement
*/
$subtotal_ht = 0;
$subtotal_ttc = 0;
$sql = "SELECT p.societe as nom, p.firstname, p.lastname, date_format(p.datedon,'%Y-%m') as dm, sum(p.amount) as amount";
$sql.= " FROM ".MAIN_DB_PREFIX."don as p";
$sql.= " WHERE p.entity = ".$conf->entity;
$sql.= " AND fk_statut=2";
$sql.= " GROUP BY p.societe, p.firstname, p.lastname, dm";
dol_syslog("get social salaries payments");
$result=$db->query($sql);
if ($result)
* Donation get dunning paiement
*/
if (! empty($conf->don->enabled))
{
$num = $db->num_rows($result);
$var=false;
$i = 0;
if ($num)
{
while ($i < $num)
{
$obj = $db->fetch_object($result);
if (! isset($encaiss[$obj->dm])) $encaiss[$obj->dm]=0;
$encaiss[$obj->dm] += $obj->amount;
if (! isset($encaiss_ttc[$obj->dm])) $encaiss_ttc[$obj->dm]=0;
$encaiss_ttc[$obj->dm] += $obj->amount;
$i++;
}
}
}
else
{
dol_print_error($db);
$subtotal_ht = 0;
$subtotal_ttc = 0;
$sql = "SELECT p.societe as nom, p.firstname, p.lastname, date_format(p.datedon,'%Y-%m') as dm, sum(p.amount) as amount";
$sql.= " FROM ".MAIN_DB_PREFIX."don as p";
$sql.= " WHERE p.entity = ".$conf->entity;
if ($modecompta == 'CREANCES-DETTES')
$sql.= " AND fk_statut in (1,2)";
else
$sql.= " AND fk_statut=2";
$sql.= " GROUP BY p.societe, p.firstname, p.lastname, dm";
dol_syslog("get donation payments");
$result=$db->query($sql);
if ($result)
{
$num = $db->num_rows($result);
$var=false;
$i = 0;
if ($num)
{
while ($i < $num)
{
$obj = $db->fetch_object($result);
if (! isset($encaiss[$obj->dm])) $encaiss[$obj->dm]=0;
$encaiss[$obj->dm] += $obj->amount;
if (! isset($encaiss_ttc[$obj->dm])) $encaiss_ttc[$obj->dm]=0;
$encaiss_ttc[$obj->dm] += $obj->amount;
$i++;
}
}
}
else
{
dol_print_error($db);
}
}
/*

View File

@ -79,7 +79,7 @@ if ($action == 'add' && $user->rights->tax->charges->creer)
{
$dateech=@dol_mktime(GETPOST('echhour'),GETPOST('echmin'),GETPOST('echsec'),GETPOST('echmonth'),GETPOST('echday'),GETPOST('echyear'));
$dateperiod=@dol_mktime(GETPOST('periodhour'),GETPOST('periodmin'),GETPOST('periodsec'),GETPOST('periodmonth'),GETPOST('periodday'),GETPOST('periodyear'));
$amount=GETPOST('amount');
$amount=price2num(GETPOST('amount'));
$actioncode=GETPOST('actioncode');
if (! $dateech)
{
@ -114,7 +114,7 @@ if ($action == 'add' && $user->rights->tax->charges->creer)
$chargesociales->lib=GETPOST('label');
$chargesociales->date_ech=$dateech;
$chargesociales->periode=$dateperiod;
$chargesociales->amount=price2num($amount);
$chargesociales->amount=$amount;
$id=$chargesociales->create($user);
if ($id <= 0)
@ -130,7 +130,7 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->tax->charges->cr
{
$dateech=dol_mktime(GETPOST('echhour'),GETPOST('echmin'),GETPOST('echsec'),GETPOST('echmonth'),GETPOST('echday'),GETPOST('echyear'));
$dateperiod=dol_mktime(GETPOST('periodhour'),GETPOST('periodmin'),GETPOST('periodsec'),GETPOST('periodmonth'),GETPOST('periodday'),GETPOST('periodyear'));
$amount=GETPOST('amount');
$amount=price2num(GETPOST('amount'));
if (! $dateech)
{
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("DateDue")), 'errors');
@ -146,7 +146,12 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->tax->charges->cr
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Amount")), 'errors');
$action = 'edit';
}
else
elseif (! is_numeric($amount))
{
setEventMessage($langs->trans("ErrorFieldMustBeANumeric",$langs->transnoentities("Amount")), 'errors');
$action = 'create';
}
else
{
$chargesociales=new ChargeSociales($db);
$result=$chargesociales->fetch($id);

View File

@ -100,6 +100,10 @@ if ($user->societe_id) {
}
$result = restrictedArea($user, 'tax', '', '', 'charges');
// Define modecompta ('CREANCES-DETTES' or 'RECETTES-DEPENSES')
$modecompta = $conf->global->ACCOUNTING_MODE;
if (GETPOST("modecompta")) $modecompta=GETPOST("modecompta");
/*
@ -292,7 +296,14 @@ if (is_array($coll_list)) {
} else {
$langs->load("errors");
if ($coll_list == -1) {
print '<tr><td colspan="5">' . $langs->trans("ErrorNoAccountancyModuleLoaded") . '</td></tr>';
if ($modecompta == 'CREANCES-DETTES')
{
print '<tr><td colspan="5">' . $langs->trans("ErrorNoAccountancyModuleLoaded") . '</td></tr>';
}
else
{
print '<tr><td colspan="5">' . $langs->trans("FeatureNotYetAvailable") . '</td></tr>';
}
} else if ($coll_list == -2) {
print '<tr><td colspan="5">' . $langs->trans("FeatureNotYetAvailable") . '</td></tr>';
} else {
@ -377,7 +388,14 @@ if (is_array($coll_list)) {
} else {
$langs->load("errors");
if ($coll_list == -1) {
print '<tr><td colspan="5">' . $langs->trans("ErrorNoAccountancyModuleLoaded") . '</td></tr>';
if ($modecompta == 'CREANCES-DETTES')
{
print '<tr><td colspan="5">' . $langs->trans("ErrorNoAccountancyModuleLoaded") . '</td></tr>';
}
else
{
print '<tr><td colspan="5">' . $langs->trans("FeatureNotYetAvailable") . '</td></tr>';
}
} else if ($coll_list == -2) {
print '<tr><td colspan="5">' . $langs->trans("FeatureNotYetAvailable") . '</td></tr>';
} else {
@ -457,7 +475,14 @@ if ($special_report) {
} else {
$langs->load("errors");
if ($coll_list == -1) {
print '<tr><td colspan="5">' . $langs->trans("ErrorNoAccountancyModuleLoaded") . '</td></tr>';
if ($modecompta == 'CREANCES-DETTES')
{
print '<tr><td colspan="5">' . $langs->trans("ErrorNoAccountancyModuleLoaded") . '</td></tr>';
}
else
{
print '<tr><td colspan="5">' . $langs->trans("FeatureNotYetAvailable") . '</td></tr>';
}
} else {
if ($coll_list == -2) {
print '<tr><td colspan="5">' . $langs->trans("FeatureNotYetAvailable") . '</td></tr>';
@ -530,7 +555,14 @@ if ($special_report) {
} else {
$langs->load("errors");
if ($coll_list == -1) {
print '<tr><td colspan="5">' . $langs->trans("ErrorNoAccountancyModuleLoaded") . '</td></tr>';
if ($modecompta == 'CREANCES-DETTES')
{
print '<tr><td colspan="5">' . $langs->trans("ErrorNoAccountancyModuleLoaded") . '</td></tr>';
}
else
{
print '<tr><td colspan="5">' . $langs->trans("FeatureNotYetAvailable") . '</td></tr>';
}
} else {
if ($coll_list == -2) {
print '<tr><td colspan="5">' . $langs->trans("FeatureNotYetAvailable") . '</td></tr>';

View File

@ -224,13 +224,7 @@ if (empty($reshook))
} else {
// Categories association
$contcats = GETPOST( 'contcats', 'array' );
if (!empty( $contcats )) {
$cat = new Categorie( $db );
foreach ($contcats as $id_category) {
$cat->fetch( $id_category );
$cat->add_type( $object, 'contact' );
}
}
$object->setCategories($contcats);
}
}
@ -304,6 +298,7 @@ if (empty($reshook))
$object->zip = GETPOST("zipcode");
$object->town = GETPOST("town");
$object->state_id = GETPOST("state_id",'int');
$object->fk_departement = GETPOST("state_id",'int'); // For backward compatibility
$object->country_id = GETPOST("country_id",'int');
$object->email = GETPOST("email",'alpha');
@ -333,13 +328,8 @@ if (empty($reshook))
// Then we add the associated categories
$categories = GETPOST( 'contcats', 'array' );
if (!empty( $categories )) {
$cat = new Categorie( $db );
foreach ($categories as $id_category) {
$cat->fetch( $id_category );
$cat->add_type( $object, 'contact' );
}
}
$object->setCategories($categories);
$object->old_lastname='';
$object->old_firstname='';
$action = 'view';

View File

@ -1123,6 +1123,51 @@ class Contact extends CommonObject
}
}
/**
* Sets object to supplied categories.
*
* Deletes object from existing categories not supplied.
* Adds it to non existing supplied categories.
* Existing categories are left untouch.
*
* @param int[]|int $categories Category or categories IDs
*/
public function setCategories($categories)
{
// Handle single category
if (!is_array($categories)) {
$categories = array($categories);
}
// Get current categories
require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
$c = new Categorie($this->db);
$existing = $c->containing($this->id, Categorie::TYPE_CONTACT, 'id');
// Diff
if (is_array($existing)) {
$to_del = array_diff($existing, $categories);
$to_add = array_diff($categories, $existing);
} else {
$to_del = array(); // Nothing to delete
$to_add = $categories;
}
// Process
foreach ($to_del as $del) {
if ($c->fetch($del) > 0) {
$c->del_type($this, 'contact');
}
}
foreach ($to_add as $add) {
if ($c->fetch($add) > 0) {
$c->add_type($this, 'contact');
}
}
return;
}
/**
* Function used to replace a thirdparty id with another one.
*

View File

@ -104,6 +104,25 @@ if ($object->id)
print '<tr><td width="20%">'.$langs->trans("Lastname").' / '.$langs->trans("Label").'</td><td width="30%">'.$object->lastname.'</td>';
print '<td width="20%">'.$langs->trans("Firstname").'</td><td width="30%">'.$object->firstname.'</td></tr>';
// Company
if (empty($conf->global->SOCIETE_DISABLE_CONTACTS))
{
if ($object->socid > 0)
{
$objsoc = new Societe($db);
$objsoc->fetch($object->socid);
print '<tr><td>'.$langs->trans("ThirdParty").'</td><td colspan="3">'.$objsoc->getNomUrl(1).'</td></tr>';
}
else
{
print '<tr><td>'.$langs->trans("ThirdParty").'</td><td colspan="3">';
print $langs->trans("ContactNotLinkedToCompany");
print '</td></tr>';
}
}
print '<tr><td>'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>';
print '</table>';

View File

@ -793,7 +793,7 @@ else if ($action == 'confirm_move' && $confirm == 'yes' && $user->rights->contra
setEventMessage($object->errors, 'errors');
}
$result = $object->setValueFrom('ref',GETPOST('ref','alpha'));;
$result = $object->setValueFrom('ref',GETPOST('ref','alpha'));
if ($result < 0) {
setEventMessage($object->errors, 'errors');
$action = 'editref';

View File

@ -402,7 +402,7 @@ class Contrat extends CommonObject
$result=$this->thirdparty->set_as_client();
// Define new ref
if (! $error && (preg_match('/^[\(]?PROV/i', $this->ref)))
if (! $error && (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref))) // empty should not happened, but when it occurs, the test save life
{
$num = $this->getNextNumRef($this->thirdparty);
}
@ -1284,7 +1284,7 @@ class Contrat extends CommonObject
$localtaxes_type=getLocalTaxesFromRate($txtva, 0, $this->societe, $mysoc);
$tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, 1,'', $localtaxes_type);
$tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, 1,$mysoc, $localtaxes_type);
$total_ht = $tabprice[0];
$total_tva = $tabprice[1];
$total_ttc = $tabprice[2];
@ -1457,7 +1457,7 @@ class Contrat extends CommonObject
$localtaxes_type=getLocalTaxesFromRate($tvatx, 0, $this->societe, $mysoc);
$tabprice=calcul_price_total($qty, $pu, $remise_percent, $tvatx, $localtax1tx, $localtax2tx, 0, $price_base_type, $info_bits, 1, '', $localtaxes_type);
$tabprice=calcul_price_total($qty, $pu, $remise_percent, $tvatx, $localtax1tx, $localtax2tx, 0, $price_base_type, $info_bits, 1, $mysoc, $localtaxes_type);
$total_ht = $tabprice[0];
$total_tva = $tabprice[1];
$total_ttc = $tabprice[2];
@ -2449,7 +2449,7 @@ class ContratLigne extends CommonObjectLine
*/
function update($user, $notrigger=0)
{
global $conf, $langs;
global $conf, $langs, $mysoc;
$error=0;
@ -2491,7 +2491,9 @@ class ContratLigne extends CommonObjectLine
// qty, pu, remise_percent et txtva
// TRES IMPORTANT: C'est au moment de l'insertion ligne qu'on doit stocker
// la part ht, tva et ttc, et ce au niveau de la ligne qui a son propre taux tva.
$tabprice=calcul_price_total($this->qty, $this->price_ht, $this->remise_percent, $this->tva_tx, $this->localtax1_tx, $this->localtax2_tx, 0, 'HT', 0, 1);
$localtaxes_type = getLocalTaxesFromRate($this->txtva, 0, $this->societe, $mysoc);
$tabprice=calcul_price_total($this->qty, $this->price_ht, $this->remise_percent, $this->tva_tx, $this->localtax1_tx, $this->localtax2_tx, 0, 'HT', 0, 1, $mysoc, $localtaxes_type);
$this->total_ht = $tabprice[0];
$this->total_tva = $tabprice[1];
$this->total_ttc = $tabprice[2];

View File

@ -28,7 +28,7 @@
// $cancel must be defined
// $id or $ref must be defined (object is loaded in this file with fetch)
if (($id > 0 || ! empty($ref)) && empty($cancel))
if (($id > 0 || (! empty($ref) && ! in_array($action, array('create','createtask')))) && empty($cancel))
{
$ret = $object->fetch($id,$ref);
if ($ret > 0)

View File

@ -104,7 +104,7 @@ class box_project extends ModeleBoxes
'td' => 'align="left"',
'text' => $objp->ref,
'tooltip' => $tooltip,
'url' => DOL_URL_ROOT."/product/card.php?id=".$objp->rowid,
'url' => DOL_URL_ROOT."/projet/card.php?id=".$objp->rowid,
);
$this->info_box_contents[$i][2] = array(

View File

@ -388,11 +388,16 @@ abstract class CommonDocGenerator
// Add vat by rates
foreach ($object->lines as $line)
{
// $line->tva_tx format depends on database field accuraty, no reliable. This is kept for backward comaptibility
if (empty($resarray[$array_key.'_total_vat_'.$line->tva_tx])) $resarray[$array_key.'_total_vat_'.$line->tva_tx]=0;
$resarray[$array_key.'_total_vat_'.$line->tva_tx]+=$line->total_tva;
$resarray[$array_key.'_total_vat_locale_'.$line->tva_tx]=price($resarray[$array_key.'_total_vat_'.$line->tva_tx]);
// $vatformated is vat without not expected chars (so 20, or 8.5 or 5.99 for example)
$vatformated=vatrate($line->tva_tx);
if (empty($resarray[$array_key.'_total_vat_'.$vatformated])) $resarray[$array_key.'_total_vat_'.$vatformated]=0;
$resarray[$array_key.'_total_vat_'.$vatformated]+=$line->total_tva;
$resarray[$array_key.'_total_vat_locale_'.$vatformated]=price($resarray[$array_key.'_total_vat_'.$vatformated]);
}
// Retrieve extrafields
if (is_array($object->array_options) && count($object->array_options))
{

View File

@ -1083,18 +1083,18 @@ abstract class CommonObject
function getValueFrom($table, $id, $field)
{
$result=false;
$sql = "SELECT ".$field." FROM ".MAIN_DB_PREFIX.$table;
$sql.= " WHERE rowid = ".$id;
dol_syslog(get_class($this).'::getValueFrom', LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql)
{
$row = $this->db->fetch_row($resql);
$result = $row[0];
}
if (!empty($id) && !empty($field) && !empty($table)) {
$sql = "SELECT ".$field." FROM ".MAIN_DB_PREFIX.$table;
$sql.= " WHERE rowid = ".$id;
dol_syslog(get_class($this).'::getValueFrom', LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql)
{
$row = $this->db->fetch_row($resql);
$result = $row[0];
}
}
return $result;
}
@ -2271,7 +2271,7 @@ abstract class CommonObject
{
dol_include_once('/'.$classpath.'/'.$classfile.'.class.php');
foreach($objectids as $i => $objectid); // $i is rowid into llx_element_element
foreach($objectids as $i => $objectid) // $i is rowid into llx_element_element
{
$object = new $classname($this->db);
$ret = $object->fetch($objectid);
@ -3805,10 +3805,10 @@ abstract class CommonObject
/**
* Function to show lines of extrafields with output datas
*
* @param object $extrafields Extrafield Object
* @param string $mode Show output ('view') or input ('edit') for extrafield
* @param array $params Optionnal parameters. Example: array('colspan'=>2)
* @param string $keyprefix Prefix string to add into name and id of field (can be used to avoid duplicate names)
* @param Extrafields $extrafields Extrafield Object
* @param string $mode Show output (view) or input (edit) for extrafield
* @param array $params Optional parameters
* @param string $keyprefix Prefix string to add into name and id of field (can be used to avoid duplicate names)
*
* @return string
*/
@ -3839,7 +3839,16 @@ abstract class CommonObject
$value=$this->array_options["options_".$key];
break;
case "edit":
$value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$this->array_options["options_".$key]);
if (isset($_POST["options_" . $key])) {
if (is_array($_POST["options_" . $key])) {
// $_POST["options"] is an array but following code expects a comma separated string
$value = implode(",", $_POST["options_" . $key]);
} else {
$value = $_POST["options_" . $key];
}
} else {
$value = $this->array_options["options_" . $key];
}
break;
}
if ($extrafields->attribute_type[$key] == 'separate')

View File

@ -387,8 +387,8 @@ class Conf
// conf->global->ACCOUNTING_MODE = Option des modules Comptabilites (simple ou expert). Defini le mode de calcul des etats comptables (CA,...)
if (empty($this->global->ACCOUNTING_MODE)) $this->global->ACCOUNTING_MODE='RECETTES-DEPENSES'; // By default. Can be 'RECETTES-DEPENSES' ou 'CREANCES-DETTES'
// By default, suppliers ojbects can be linked to all projects
$conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS = 1;
// By default, suppliers objects can be linked to all projects
$this->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS = 1;
// conf->liste_limit = constante de taille maximale des listes
if (empty($this->global->MAIN_SIZE_LISTE_LIMIT)) $this->global->MAIN_SIZE_LISTE_LIMIT=25;

View File

@ -815,7 +815,9 @@ class ExtraFields
{
$sqlwhere.= ' WHERE '.$InfoFieldList[4];
}
}else {
}
else
{
$sqlwhere.= ' WHERE 1';
}
if (in_array($InfoFieldList[0],array('tablewithentity'))) $sqlwhere.= ' AND entity = '.$conf->entity; // Some tables may have field, some other not. For the moment we disable it.
@ -1451,7 +1453,7 @@ class ExtraFields
else if (in_array($key_type,array('checkbox')))
{
$value_arr=GETPOST($keysuffix."options_".$key.$keyprefix);
$value_key=implode($value_arr,',');
$value_key=implode(',', $value_arr);
}
else if (in_array($key_type,array('price','double')))
{

View File

@ -3233,7 +3233,7 @@ class Form
if (! empty($more)) {
$formconfirm.= '<div class="confirmquestions">'.$more.'</div>';
}
$formconfirm.= ($question ? '<div class="confirmmessage"'.img_help('','').' '.$question . '</div>': '');
$formconfirm.= ($question ? '<div class="confirmmessage">'.img_help('','').' '.$question . '</div>': '');
$formconfirm.= '</div>'."\n";
$formconfirm.= "\n<!-- begin ajax form_confirm page=".$page." -->\n";
@ -4696,7 +4696,7 @@ class Form
if ($rendermode == 0)
{
$cate_arbo = $this->select_all_categories(Categorie::TYPE_PRODUCT, '', 'parent', 64, 0, 1);
$cate_arbo = $this->select_all_categories($type, '', 'parent', 64, 0, 1);
foreach($categories as $c) {
$arrayselected[] = $c->id;
}
@ -5135,9 +5135,10 @@ class Form
* @param int $height Height of photo (auto if 0)
* @param int $caneditfield Add edit fields
* @param string $cssclass CSS name to use on img for photo
* @param string $imagesize 'mini', 'small' or '' (original)
* @return string HTML code to output photo
*/
static function showphoto($modulepart, $object, $width=100, $height=0, $caneditfield=0, $cssclass='photowithmargin')
static function showphoto($modulepart, $object, $width=100, $height=0, $caneditfield=0, $cssclass='photowithmargin', $imagesize='')
{
global $conf,$langs;
@ -5156,7 +5157,12 @@ class Form
else if ($modulepart=='userphoto')
{
$dir=$conf->user->dir_output;
if ($object->photo) $file=get_exdir($id, 2, 0, 0, $object, 'user').$object->photo;
if (! empty($object->photo))
{
if ((string) $imagesize == 'mini') $file=get_exdir($id, 2, 0, 0, $object, 'user').getImageFileNameForSize($object->photo, '_mini');
else if ((string) $imagesize == 'small') $file=get_exdir($id, 2, 0, 0, $object, 'user').getImageFileNameForSize($object->photo, '_small');
else $file=get_exdir($id, 2, 0, 0, $object, 'user').$object->photo;
}
if (! empty($conf->global->MAIN_OLD_IMAGE_LINKS)) $altfile=$object->id.".jpg"; // For backward compatibility
$email=$object->email;
}

View File

@ -90,29 +90,30 @@ class FormProjets
}
/**
* Returns an array with projects qualified for a third party
* Returns an array with projects qualified for a third party
*
* @param int $socid Id third party (-1=all, 0=only projects not linked to a third party, id=projects not linked or linked to third party id)
* @param int $selected Id project preselected
* @param string $htmlname Nom de la zone html
* @param int $maxlength Maximum length of label
* @param int $option_only Return only html options lines without the select tag
* @param int $show_empty Add an empty line
* @param int $discard_closed Discard closed projects (0=Keep,1=hide completely,2=Disable)
* @param int $forcefocus Force focus on field (works with javascript only)
* @param int $disabled Disabled
* @param int $mode 0 for HTML mode and 1 for JSON mode
* @param string $filterkey Key to filter
* @return int Nber of project if OK, <0 if KO
* @param int $socid Id third party (-1=all, 0=only projects not linked to a third party, id=projects not linked or linked to third party id)
* @param int $selected Id project preselected
* @param string $htmlname Nom de la zone html
* @param int $maxlength Maximum length of label
* @param int $option_only Return only html options lines without the select tag
* @param int $show_empty Add an empty line
* @param int $discard_closed Discard closed projects (0=Keep,1=hide completely,2=Disable)
* @param int $forcefocus Force focus on field (works with javascript only)
* @param int $disabled Disabled
* @param int $mode 0 for HTML mode and 1 for array return (to be used by json_encode for example)
* @param string $filterkey Key to filter
* @return int Nb of project if OK, <0 if KO
*/
function select_projects_list($socid=-1, $selected='', $htmlname='projectid', $maxlength=24, $option_only=0, $show_empty=1, $discard_closed=0, $forcefocus=0, $disabled=0, $mode = 0, $filterkey = '')
function select_projects_list($socid=-1, $selected='', $htmlname='projectid', $maxlength=24, $option_only=0, $show_empty=1, $discard_closed=0, $forcefocus=0, $disabled=0, $mode=0, $filterkey = '')
{
global $user,$conf,$langs;
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
$out='';
$outarray=array();
$hideunselectables = false;
if (! empty($conf->global->PROJECT_HIDE_UNSELECTABLES)) $hideunselectables = true;

View File

@ -126,19 +126,25 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh
print '<tr>';
print '<td class="nowrap" style="padding-bottom: 2px; padding-right: 4px;">'.$langs->trans("VisibleTimeRange").'</td>';
print "<td class='nowrap maxwidthonsmartphone'>";
print '<div class="ui-grid-a"><div class="ui-block-a">';
print '<input type="number" class="short" name="begin_h" value="'.$begin_h.'" min="0" max="23">';
if (empty($conf->dol_use_jmobile)) print ' - ';
else print '</div><div class="ui-block-b">';
print '<input type="number" class="short" name="end_h" value="'.$end_h.'" min="1" max="24">';
if (empty($conf->dol_use_jmobile)) print ' '.$langs->trans("H");
print '</div></div>';
print '</td></tr>';
// Filter on days
print '<tr>';
print '<td class="nowrap">'.$langs->trans("VisibleDaysRange").'</td>';
print "<td class='nowrap maxwidthonsmartphone'>";
print '<div class="ui-grid-a"><div class="ui-block-a">';
print '<input type="number" class="short" name="begin_d" value="'.$begin_d.'" min="1" max="7">';
if (empty($conf->dol_use_jmobile)) print ' - ';
else print '</div><div class="ui-block-b">';
print '<input type="number" class="short" name="end_d" value="'.$end_d.'" min="1" max="7">';
print '</div></div>';
print '</td></tr>';
}

View File

@ -94,7 +94,7 @@ function societe_prepare_head(Societe $object)
}*/
// Tab to link resources
if ($conf->resource->enabled && ! empty($conf->global->RESOURCE_ON_THIRDPARTIES))
if (! empty($conf->resource->enabled) && ! empty($conf->global->RESOURCE_ON_THIRDPARTIES))
{
$head[$h][0] = DOL_URL_ROOT.'/resource/element_resource.php?element=societe&element_id='.$object->id;
$head[$h][1] = $langs->trans("Resources");
@ -537,7 +537,7 @@ function show_projects($conf,$langs,$db,$object,$backtopage='')
else
{
$var = false;
print '<tr '.$bc[$var].'><td colspan="4">'.$langs->trans("None").'</td></tr>';
print '<tr '.$bc[$var].'><td colspan="5">'.$langs->trans("None").'</td></tr>';
}
$db->free($result);
}

View File

@ -1603,6 +1603,16 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu
$sqlprotectagainstexternals = "SELECT rowid as fk_soc FROM ".MAIN_DB_PREFIX."societe WHERE rowid='".$db->escape($refname)."' AND entity IN (".getEntity('societe', 1).")";
}
// Wrapping for contact
else if ($modulepart == 'contact')
{
if ($fuser->rights->societe->lire)
{
$accessallowed=1;
}
$original_file=$conf->societe->multidir_output[$entity].'/contact/'.$original_file;
}
// Wrapping for invoices
else if ($modulepart == 'facture' || $modulepart == 'invoice')
{

View File

@ -5118,3 +5118,32 @@ function natural_search($fields, $value, $mode=0, $nofirstand=0)
return $res;
}
/**
* Return the filename of file to get the thumbs
*
* @param string $file Original filename
* @param string $extName Extension to differenciate thumb file name ('', '_small', '_mini')
* @param string $extImgTarget Force image format for thumbs. Use '' to keep same extension than original image.
* @return string New file name
*/
function getImageFileNameForSize($file, $extName, $extImgTarget='')
{
$dirName = dirname($file);
if ($dirName == '.') $dirName='';
$fileName = preg_replace('/(\.gif|\.jpeg|\.jpg|\.png|\.bmp)$/i','',$file); // On enleve extension quelquesoit la casse
$fileName = basename($fileName);
if (empty($extImgTarget)) $extImgTarget = (preg_match('/\.jpg$/i',$file)?'.jpg':'');
if (empty($extImgTarget)) $extImgTarget = (preg_match('/\.jpeg$/i',$file)?'.jpeg':'');
if (empty($extImgTarget)) $extImgTarget = (preg_match('/\.gif$/i',$file)?'.gif':'');
if (empty($extImgTarget)) $extImgTarget = (preg_match('/\.png$/i',$file)?'.png':'');
if (empty($extImgTarget)) $extImgTarget = (preg_match('/\.bmp$/i',$file)?'.bmp':'');
if (! $extImgTarget) return $file;
$subdir='';
if ($extName) $subdir = 'thumbs/';
return $dirName.$subdir.$fileName.$extName.$extImgTarget; // New filename for thumb
}

View File

@ -337,7 +337,6 @@ function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$target
if ($mode == 'source' && ! is_object($sourcecompany)) return -1;
if ($mode == 'target' && ! is_object($targetcompany)) return -1;
if ($mode == 'delivery' && ! is_object($deliverycompany)) return -1;
if (! empty($sourcecompany->state_id) && empty($sourcecompany->departement)) $sourcecompany->departement=getState($sourcecompany->state_id); //TODO: Deprecated
if (! empty($sourcecompany->state_id) && empty($sourcecompany->state)) $sourcecompany->state=getState($sourcecompany->state_id);
@ -1743,7 +1742,7 @@ function pdf_getLinkedObjects($object,$outputlangs)
else // We show both info of order and shipment
{
$linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefOrder") . ' / ' . $outputlangs->transnoentities("RefSending");
$linkedobjects[$objecttype]['ref_value'] = $outputlangs->transnoentities($order->ref) . ($order->ref_client ? ' ('.$order->ref_client.')' : '');
$linkedobjects[$objecttype]['ref_value'] = $outputlangs->convToOutputCharset($order->ref) . ($order->ref_client ? ' ('.$order->ref_client.')' : '');
$linkedobjects[$objecttype]['ref_value'].= ' / ' . $outputlangs->transnoentities($elementobject->ref);
$linkedobjects[$objecttype]['date_title'] = $outputlangs->transnoentities("OrderDate") . ' / ' . $outputlangs->transnoentities("DateSending");
$linkedobjects[$objecttype]['date_value'] = dol_print_date($order->date,'day','',$outputlangs);

View File

@ -53,7 +53,7 @@ function project_prepare_head($object)
|| ! empty($conf->ficheinter->enabled) || ! empty($conf->agenda->enabled) || ! empty($conf->deplacement->enabled))
{
$head[$h][0] = DOL_URL_ROOT.'/projet/element.php?id='.$object->id;
$head[$h][1] = $langs->trans("Overview");
$head[$h][1] = $langs->trans("ProjectOverview");
$head[$h][2] = 'element';
$h++;
}
@ -348,7 +348,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
$projectstatic->id=$lines[$i]->fk_project;
$projectstatic->ref=$lines[$i]->projectref;
$projectstatic->public=$lines[$i]->public;
if ($lines[$i]->public || in_array($lines[$i]->fk_project,$projectsArrayId)) print $projectstatic->getNomUrl(1);
if ($lines[$i]->public || in_array($lines[$i]->fk_project,$projectsArrayId) || ! empty($user->rights->projet->all->lire)) print $projectstatic->getNomUrl(1);
else print $projectstatic->getNomUrl(1,'nolink');
if ($showlineingray) print '</i>';
print "</td>";

View File

@ -416,7 +416,10 @@ function encodedecode_dbpassconf($level=0)
if ($fp = @fopen($file,'w'))
{
fputs($fp, $config);
fflush($fp);
fclose($fp);
clearstatcache();
// It's config file, so we set read permission for creator only.
// Should set permission to web user and groups for users used by batch
//@chmod($file, octdec('0600'));

View File

@ -79,7 +79,7 @@ function tax_prepare_head(ChargeSociales $object)
* @param int $y Year
* @param string $date_start Start date
* @param string $date_end End date
* @param int $modetax 0 or 1 (option vat on debit)
* @param int $modetax 0 or 1 (option vat on debit, 1 => $modecompta = 'CREANCES-DETTES')
* @param string $direction 'sell' or 'buy'
* @param int $m Month
* @return array List of customers third parties with vat, -1 if no accountancy module, -2 if not yet developped, -3 if error

View File

@ -59,12 +59,14 @@ function build_calfile($format,$title,$desc,$events_array,$outputfile)
fwrite($calfileh,"CALSCALE:GREGORIAN\n");
fwrite($calfileh,"X-WR-CALNAME:".$encoding.format_cal($format,$title)."\n");
fwrite($calfileh,"X-WR-CALDESC:".$encoding.format_cal($format,$desc)."\n");
$hh=convertSecondToTime($conf->global->MAIN_AGENDA_EXPORT_CACHE,'hour');
$mm=convertSecondToTime($conf->global->MAIN_AGENDA_EXPORT_CACHE,'min');
$ss=convertSecondToTime($conf->global->MAIN_AGENDA_EXPORT_CACHE,'sec');
//fwrite($calfileh,"X-WR-TIMEZONE:Europe/Paris\n");
if (! empty($conf->global->MAIN_AGENDA_EXPORT_CACHE)
&& $conf->global->MAIN_AGENDA_EXPORT_CACHE > 60) fwrite($calfileh,"X-PUBLISHED-TTL: P".$hh."H".$mm."M".$ss."S\n");
&& $conf->global->MAIN_AGENDA_EXPORT_CACHE > 60){
$hh=convertSecondToTime($conf->global->MAIN_AGENDA_EXPORT_CACHE,'hour');
$mm=convertSecondToTime($conf->global->MAIN_AGENDA_EXPORT_CACHE,'min');
$ss=convertSecondToTime($conf->global->MAIN_AGENDA_EXPORT_CACHE,'sec');
fwrite($calfileh,"X-PUBLISHED-TTL: P".$hh."H".$mm."M".$ss."S\n");
}
foreach ($events_array as $date => $event)
{

View File

@ -91,7 +91,7 @@ function check_user_password_dolibarr($usertotest,$passwordtotest,$entitytotest=
if (! $passok)
{
if ((! $passcrypted || $passtyped)
&& ($passtyped == $passclear))
&& ($passclear && ($passtyped == $passclear)))
{
$passok=true;
dol_syslog("functions_dolibarr::check_user_password_dolibarr Authentification ok - found pass in database");

View File

@ -68,6 +68,7 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
-- Third parties
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 500__+MAX_llx_menu__, 'companies', 'thirdparties', 2__+MAX_llx_menu__, '/societe/index.php?leftmenu=thirdparties', 'ThirdParty', 0, 'companies', '$user->rights->societe->lire', '', 2, 0, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 501__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/soc.php?action=create', 'MenuNewThirdParty', 1, 'companies', '$user->rights->societe->lire', '', 2, 0, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 502__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/societe/list.php?action=create', 'List', 1, 'companies', '$user->rights->societe->lire', '', 2, 0, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled && $conf->fournisseur->enabled', __HANDLER__, 'left', 503__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/fourn/list.php?leftmenu=suppliers', 'ListSuppliersShort', 1, 'suppliers', '$user->rights->societe->lire && $user->rights->fournisseur->lire', '', 2, 5, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled && $conf->fournisseur->enabled', __HANDLER__, 'left', 504__+MAX_llx_menu__, 'companies', '', 503__+MAX_llx_menu__, '/societe/soc.php?leftmenu=supplier&amp;action=create&amp;type=f', 'NewSupplier', 2, 'suppliers', '$user->rights->societe->creer', '', 2, 0, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->societe->enabled', __HANDLER__, 'left', 506__+MAX_llx_menu__, 'companies', '', 500__+MAX_llx_menu__, '/comm/prospect/list.php?leftmenu=prospects', 'ListProspectsShort', 1, 'companies', '$user->rights->societe->lire', '', 2, 3, __ENTITY__);

View File

@ -771,9 +771,10 @@ class pdf_einstein extends ModelePDFCommandes
// If payment mode not forced or forced to VIR, show payment with BAN
if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'VIR')
{
if (! empty($object->fk_bank) || ! empty($conf->global->FACTURE_RIB_NUMBER))
if (! empty($object->fk_account) || ! empty($object->fk_bank) || ! empty($conf->global->FACTURE_RIB_NUMBER))
{
$bankid=(empty($object->fk_bank)?$conf->global->FACTURE_RIB_NUMBER:$object->fk_bank);
$bankid=(empty($object->fk_account)?$conf->global->FACTURE_RIB_NUMBER:$object->fk_account);
if (! empty($object->fk_bank)) $bankid=$object->fk_bank; // For backward compatibility when object->fk_account is forced with object->fk_bank
$account = new Account($this->db);
$account->fetch($bankid);

View File

@ -958,9 +958,10 @@ class pdf_crabe extends ModelePDFFactures
// If payment mode not forced or forced to VIR, show payment with BAN
if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'VIR')
{
if (! empty($object->fk_account) || ! empty($conf->global->FACTURE_RIB_NUMBER))
if (! empty($object->fk_account) || ! empty($object->fk_bank) || ! empty($conf->global->FACTURE_RIB_NUMBER))
{
$bankid=(empty($object->fk_account)?$conf->global->FACTURE_RIB_NUMBER:$object->fk_account);
if (! empty($object->fk_bank)) $bankid=$object->fk_bank; // For backward compatibility when object->fk_account is forced with object->fk_bank
$account = new Account($this->db);
$account->fetch($bankid);

View File

@ -75,6 +75,7 @@ class mailing_contacts1 extends MailingTargets
$statssql[0].= " WHERE c.entity IN (".getEntity('societe', 1).")";
$statssql[0].= " AND c.email != ''"; // Note that null != '' is false
$statssql[0].= " AND c.no_email = 0";
$statssql[0].= " AND c.statut = 1";
return $statssql;
}
@ -98,6 +99,7 @@ class mailing_contacts1 extends MailingTargets
$sql.= " WHERE c.entity IN (".getEntity('societe', 1).")";
$sql.= " AND c.email != ''"; // Note that null != '' is false
$sql.= " AND c.no_email = 0";
$sql.= " AND c.statut = 1";
// La requete doit retourner un champ "nb" pour etre comprise
// par parent::getNbOfRecipients
@ -204,6 +206,7 @@ class mailing_contacts1 extends MailingTargets
$sql.= " WHERE c.entity IN (".getEntity('societe', 1).")";
$sql.= " AND c.email <> ''";
$sql.= " AND c.no_email = 0";
$sql.= " AND c.statut = 1";
$sql.= " AND c.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".$mailing_id.")";
foreach($filtersarray as $key)
{

View File

@ -86,6 +86,7 @@ class mailing_contacts2 extends MailingTargets
$sql.= " WHERE sp.entity IN (".getEntity('societe', 1).")";
$sql.= " AND sp.email <> ''"; // Note that null != '' is false
$sql.= " AND sp.no_email = 0";
$sql.= " AND sp.statut = 1";
//$sql.= " AND sp.poste != ''";
$sql.= " AND sp.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".$mailing_id.")";
if ($filtersarray[0]<>'all') $sql.= " AND sp.poste ='".$this->db->escape($filtersarray[0])."'";
@ -168,6 +169,7 @@ class mailing_contacts2 extends MailingTargets
$sql.= " WHERE sp.entity IN (".getEntity('societe', 1).")";
$sql.= " AND sp.email != ''"; // Note that null != '' is false
$sql.= " AND sp.no_email = 0";
$sql.= " AND sp.statut = 1";
//$sql.= " AND sp.poste != ''";
// La requete doit retourner un champ "nb" pour etre comprise
// par parent::getNbOfRecipients
@ -191,6 +193,7 @@ class mailing_contacts2 extends MailingTargets
$sql.= " WHERE sp.entity IN (".getEntity('societe', 1).")";
$sql.= " AND sp.email != ''"; // Note that null != '' is false
$sql.= " AND sp.no_email = 0";
$sql.= " AND sp.statut = 1";
$sql.= " AND (sp.poste IS NOT NULL AND sp.poste != '')";
$sql.= " GROUP BY sp.poste";
$sql.= " ORDER BY sp.poste";

View File

@ -85,6 +85,7 @@ class mailing_contacts3 extends MailingTargets
if ($filtersarray[0] <> 'all') $sql.= ", ".MAIN_DB_PREFIX."categorie_societe as cs";
$sql.= " WHERE sp.email <> ''"; // Note that null != '' is false
$sql.= " AND sp.no_email = 0";
$sql.= " AND sp.statut = 1";
$sql.= " AND sp.entity IN (".getEntity('societe', 1).")";
$sql.= " AND sp.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".$mailing_id.")";
if ($filtersarray[0] <> 'all') $sql.= " AND cs.fk_categorie = c.rowid";
@ -173,6 +174,7 @@ class mailing_contacts3 extends MailingTargets
$sql.= " WHERE c.entity IN (".getEntity('societe', 1).")";
$sql.= " AND c.email != ''"; // Note that null != '' is false
$sql.= " AND c.no_email = 0";
$sql.= " AND c.statut = 1";
/*
$sql = "SELECT count(distinct(sp.email)) as nb";
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp,";
@ -208,6 +210,7 @@ class mailing_contacts3 extends MailingTargets
$sql.= " ".MAIN_DB_PREFIX."categorie_societe as cs";
$sql.= " WHERE sp.email != ''"; // Note that null != '' is false
$sql.= " AND sp.no_email = 0";
$sql.= " AND sp.statut = 1";
$sql.= " AND sp.entity IN (".getEntity('societe', 1).")";
$sql.= " AND cs.fk_categorie = c.rowid";
$sql.= " AND cs.fk_soc = sp.fk_soc";

View File

@ -85,6 +85,7 @@ class mailing_contacts4 extends MailingTargets
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = sp.fk_soc";
$sql.= " WHERE sp.email != ''"; // Note that null != '' is false
$sql.= " AND sp.no_email = 0";
$sql.= " AND sp.statut = 1";
$sql.= " AND sp.entity IN (".getEntity('societe', 1).")";
if ($filtersarray[0] <> 'all') $sql.= " AND c.label = '".$this->db->escape($filtersarray[0])."'";
$sql.= " ORDER BY sp.lastname, sp.firstname";
@ -173,6 +174,7 @@ class mailing_contacts4 extends MailingTargets
$sql.= " WHERE c.entity IN (".getEntity('societe', 1).")";
$sql.= " AND c.email != ''"; // Note that null != '' is false
$sql.= " AND c.no_email = 0";
$sql.= " AND c.statut = 1";
/*
$sql = "SELECT count(distinct(sp.email)) as nb";
$sql.= " FROM ".MAIN_DB_PREFIX."socpeople as sp,";
@ -208,6 +210,7 @@ class mailing_contacts4 extends MailingTargets
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."categorie as c ON cs.fk_categorie = c.rowid";
$sql.= " WHERE sp.email != ''"; // Note that null != '' is false
$sql.= " AND sp.no_email = 0";
$sql.= " AND sp.statut = 1";
$sql.= " AND sp.entity IN (".getEntity('societe', 1).")";
$sql.= " GROUP BY c.label";
$sql.= " ORDER BY c.label";

View File

@ -81,7 +81,7 @@ class modMargin extends DolibarrModules
// New pages on tabs
$this->tabs = array(
'product:+margin:Margins:margins:$user->rights->margins->liretous:/margin/tabs/productMargins.php?id=__ID__',
'thirdparty:+margin:Margins:margins:empty($user->societe_id) && $user->rights->margins->liretous && ($societe->client > 0):/margin/tabs/thirdpartyMargins.php?socid=__ID__'
'thirdparty:+margin:Margins:margins:empty($user->societe_id) && $user->rights->margins->liretous && ($object->client > 0):/margin/tabs/thirdpartyMargins.php?socid=__ID__'
);

View File

@ -114,7 +114,23 @@ class modProjet extends DolibarrModules
$this->const[$r][2] = "DOL_DATA_ROOT/doctemplates/tasks";
$this->const[$r][3] = "";
$this->const[$r][4] = 0;
$r++;
$this->const[$r][0] = "PROJECT_USE_OPPORTUNIES";
$this->const[$r][1] = "chaine";
$this->const[$r][2] = "1";
$this->const[$r][3] = "";
$this->const[$r][4] = 0;
$r++;
/* not required (0 = not present)
$this->const[$r][0] = "PROJECT_HIDE_TASKS";
$this->const[$r][1] = "chaine";
$this->const[$r][2] = "0";
$this->const[$r][3] = "";
$this->const[$r][4] = 0;
*/
// Boxes
$this->boxes = array();
$r=0;
@ -284,8 +300,8 @@ class modProjet extends DolibarrModules
}
}
// End add extra fields
$this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('ptt.task_date'=>'TaskTimeDate','ptt.task_duration'=>"TimesSpent",'ptt.fk_user'=>"TaskTimeUser",'ptt.note'=>"TaskTimeNote"));
$this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('ptt.task_date'=>'task_time','ptt.task_duration'=>"task_time",'ptt.fk_user'=>"task_time",'ptt.note'=>"task_time"));
$this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('ptt.rowid'=>'IdTaskTime','ptt.task_date'=>'TaskTimeDate','ptt.task_duration'=>"TimesSpent",'ptt.fk_user'=>"TaskTimeUser",'ptt.note'=>"TaskTimeNote"));
$this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('ptt.rowid'=>'task_time','ptt.task_date'=>'task_time','ptt.task_duration'=>"task_time",'ptt.fk_user'=>"task_time",'ptt.note'=>"task_time"));
$this->export_sql_start[$r]='SELECT DISTINCT ';
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'projet as p';

View File

@ -917,9 +917,10 @@ class pdf_azur extends ModelePDFPropales
// If payment mode not forced or forced to VIR, show payment with BAN
if (empty($object->mode_reglement_code) || $object->mode_reglement_code == 'VIR')
{
if (! empty($object->fk_bank) || ! empty($conf->global->FACTURE_RIB_NUMBER))
if (! empty($object->fk_account) || ! empty($object->fk_bank) || ! empty($conf->global->FACTURE_RIB_NUMBER))
{
$bankid=(empty($object->fk_bank)?$conf->global->FACTURE_RIB_NUMBER:$object->fk_bank);
$bankid=(empty($object->fk_account)?$conf->global->FACTURE_RIB_NUMBER:$object->fk_account);
if (! empty($object->fk_bank)) $bankid=$object->fk_bank; // For backward compatibility when object->fk_account is forced with object->fk_bank
$account = new Account($this->db);
$account->fetch($bankid);

View File

@ -77,7 +77,7 @@ $hideref = (GETPOST('hideref','int') ? GETPOST('hideref','int') : (! empty($co
$object = new Expedition($db);
// Load object. Make an object->fetch
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not includ_once
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('expeditioncard','globalcard'));

View File

@ -7,7 +7,7 @@
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Cedric GROSS <c.gross@kreiz-it.fr>
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2014 Francis Appels <francis.appels@yahoo.com>
* Copyright (C) 2014-2015 Francis Appels <francis.appels@yahoo.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
@ -589,7 +589,7 @@ class Expedition extends CommonObject
$result=$soc->set_as_client();
// Define new ref
if (! $error && (preg_match('/^[\(]?PROV/i', $this->ref)))
if (! $error && (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref))) // empty should not happened, but when it occurs, the test save life
{
$numref = $this->getNextNumRef($soc);
}
@ -1002,7 +1002,7 @@ class Expedition extends CommonObject
}
}
/**
/**
* Delete shipment.
* Warning, do not delete a shipment if a delivery is linked to (with table llx_element_element)
*
@ -1011,9 +1011,13 @@ class Expedition extends CommonObject
function delete()
{
global $conf, $langs, $user;
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
if ($conf->productbatch->enabled)
{
require_once DOL_DOCUMENT_ROOT.'/expedition/class/expeditionbatch.class.php';
}
$error=0;
$this->error='';
// Add a protection to refuse deleting if shipment has at least one delivery
$this->fetchObjectLinked($this->id, 'shipping', 0, 'delivery'); // Get deliveries linked to this shipment
@ -1024,15 +1028,6 @@ class Expedition extends CommonObject
}
$this->db->begin();
if ($conf->productbatch->enabled)
{
require_once DOL_DOCUMENT_ROOT.'/expedition/class/expeditionbatch.class.php';
if (ExpeditionLineBatch::deletefromexp($this->db,$this->id) < 0)
{
$error++;$this->errors[]="Error ".$this->db->lasterror();
}
}
// Stock control
if ($conf->stock->enabled && $conf->global->STOCK_CALCULATE_ON_SHIPMENT && $this->statut > 0)
{
@ -1041,7 +1036,7 @@ class Expedition extends CommonObject
$langs->load("agenda");
// Loop on each product line to add a stock movement
$sql = "SELECT cd.fk_product, cd.subprice, ed.qty, ed.fk_entrepot";
$sql = "SELECT cd.fk_product, cd.subprice, ed.qty, ed.fk_entrepot, ed.rowid as expeditiondet_id";
$sql.= " FROM ".MAIN_DB_PREFIX."commandedet as cd,";
$sql.= " ".MAIN_DB_PREFIX."expeditiondet as ed";
$sql.= " WHERE ed.fk_expedition = ".$this->id;
@ -1056,26 +1051,62 @@ class Expedition extends CommonObject
{
dol_syslog(get_class($this)."::delete movement index ".$i);
$obj = $this->db->fetch_object($resql);
//var_dump($this->lines[$i]);
$mouvS = new MouvementStock($this->db);
$mouvS->origin = &$this;
// We decrement stock of product (and sub-products)
// We use warehouse selected for each line
$result=$mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $obj->qty, $obj->subprice, $langs->trans("ShipmentDeletedInDolibarr",$this->ref));
if ($result < 0)
// we do not log origin because it will be deleted
$mouvS->origin = null;
// get lot/serial
$lotArray = null;
if ($conf->productbatch->enabled)
{
$error++;
break;
$lotArray = ExpeditionLineBatch::fetchAll($this->db,$obj->expeditiondet_id);
if (! is_array($lotArray))
{
$error++;$this->errors[]="Error ".$this->db->lasterror();
}
}
if (empty($lotArray)) {
// no lot/serial
// We increment stock of product (and sub-products)
// We use warehouse selected for each line
$result=$mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $obj->qty, $obj->subprice, $langs->trans("ShipmentDeletedInDolibarr", $this->ref));
if ($result < 0)
{
$error++;$this->errors=$this->errors + $mouvS->errors;
break;
}
}
else
{
// We increment stock of batches
// We use warehouse selected for each line
foreach($lotArray as $lot)
{
$result=$mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $lot->dluo_qty, $obj->subprice, $langs->trans("ShipmentDeletedInDolibarr", $this->ref), $lot->eatby, $lot->sellby, $lot->batch);
if ($result < 0)
{
$error++;$this->errors=$this->errors + $mouvS->errors;
break;
}
}
}
}
}
else
{
$error++;
$error++;$this->errors[]="Error ".$this->db->lasterror();
}
}
// delete batch expedition line
if (! $error && $conf->productbatch->enabled)
{
if (ExpeditionLineBatch::deletefromexp($this->db,$this->id) < 0)
{
$error++;$this->errors[]="Error ".$this->db->lasterror();
}
}
if (! $error)
{
$sql = "DELETE FROM ".MAIN_DB_PREFIX."expeditiondet";
@ -1094,13 +1125,13 @@ class Expedition extends CommonObject
if ($this->db->query($sql))
{
// Call trigger
$result=$this->call_trigger('SHIPPING_DELETE',$user);
if ($result < 0) { $error++; }
// End call triggers
// Call trigger
$result=$this->call_trigger('SHIPPING_DELETE',$user);
if ($result < 0) { $error++; }
// End call triggers
if (! $error)
{
if (! $error)
{
$this->db->commit();
// We delete PDFs
@ -1127,8 +1158,8 @@ class Expedition extends CommonObject
}
return 1;
}
else
}
else
{
$this->db->rollback();
return -1;

View File

@ -189,11 +189,12 @@ class ExpeditionLineBatch extends CommonObject
$sql.= " WHERE fk_expeditiondet=".(int) $id_line_expdet;
dol_syslog(__METHOD__ ."", LOG_DEBUG);
$resql=$db->query($sql);
if ($resql)
{
$resql=$db->query($sql);
if ($resql)
{
$num=$db->num_rows($resql);
$i=0;
$i=0;
$ret = array();
while ($i<$num)
{
$tmp=new self($db);

View File

@ -1669,7 +1669,7 @@ else
print img_picto($langs->trans("Document"), "object_generic");
print ' <span>'.$piece_comptable.'</span></td>';
}
print '<td style="text-align:center;">'.$objp->date.'</td>';
print '<td style="text-align:center;">'.dol_print_date($db->jdate($objp->date), 'day').'</td>';
print '<td style="text-align:center;">';
if ($objp->projet_id > 0)
{

View File

@ -1543,7 +1543,7 @@ class ExpenseReport extends CommonObject
$response->warning_delay=$conf->expensereport->payment->warning_delay/60/60/24;
$response->label=$langs->trans("ExpenseReportsToPay");
$response->url=DOL_URL_ROOT.'/expensereport/list.php?mainmenu=hrm&amp;statut=5';
$response->img=img_object($langs->trans("ExpenseReports"),"user");
$response->img=img_object($langs->trans("ExpenseReports"),"trip");
while ($obj=$this->db->fetch_object($resql))
{

View File

@ -72,13 +72,21 @@ if ($id > 0 || ! empty($ref))
*/
print '<table class="border" width="100%">';
// Ref
print '<tr><td width="18%">'.$langs->trans("Ref")."</td>";
print '<td colspan="2">'.$object->ref.'</td>';
$linkback = '<a href="'.DOL_URL_ROOT.'/fichinter/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
// Ref
print '<tr><td width="25%">'.$langs->trans("Ref").'</td><td colspan="3">';
print $form->showrefnav($object, 'ref', $linkback, 1, 'ref', 'ref');
print '</td></tr>';
$nbrow=4;
$nbrow=3;
// Client
print "<tr><td>".$langs->trans("Customer")."</td>";
print '<td>';
print '<a href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$soc->id.'">'.$soc->name.'</a>';
print '</td>';
print '<td rowspan="'.$nbrow.'" valign="top" width="50%">';
/*
* Documents
*/
@ -124,7 +132,7 @@ if ($id > 0 || ! empty($ref))
print "</table>\n";
// Conversion du PDF en image png si fichier png non existant
if (! file_exists($fileimage) && ! file_exists($fileimagebis))
if ((! file_exists($fileimage) && ! file_exists($fileimagebis)) || (filemtime($fileimage) < filemtime($file)))
{
if (class_exists("Imagick"))
{
@ -141,21 +149,14 @@ if ($id > 0 || ! empty($ref))
print "</td></tr>";
// Client
print "<tr><td>".$langs->trans("Customer")."</td>";
print '<td colspan="2">';
print '<a href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$soc->id.'">'.$soc->name.'</a>';
print '</td>';
print '</tr>';
// Statut
print '<tr><td>'.$langs->trans("Status").'</td>';
print "<td colspan=\"2\">".$object->getLibStatut(4)."</td>\n";
print "<td>".$object->getLibStatut(4)."</td>\n";
print '</tr>';
// Date
print '<tr><td>'.$langs->trans("Date").'</td>';
print "<td colspan=\"2\">".dol_print_date($object->datec,"daytext")."</td>\n";
print "<td>".dol_print_date($object->datec,"daytext")."</td>\n";
print '</tr>';
print '</table>';

View File

@ -400,7 +400,7 @@ class Fichinter extends CommonObject
$now=dol_now();
// Define new ref
if (! $error && (preg_match('/^[\(]?PROV/i', $this->ref)))
if (! $error && (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref))) // empty should not happened, but when it occurs, the test save life
{
$num = $this->getNextNumRef($this->thirdparty);
}

View File

@ -30,7 +30,7 @@
* \brief File that include conf.php file and commons lib like functions.lib.php
*/
if (! defined('DOL_VERSION')) define('DOL_VERSION','3.8.1');
if (! defined('DOL_VERSION')) define('DOL_VERSION','3.8.2');
if (! defined('EURO')) define('EURO',chr(128));

View File

@ -388,7 +388,7 @@ class CommandeFournisseur extends CommonOrder
$soc->fetch($this->fourn_id);
// Check if object has a temporary ref
if (preg_match('/^[\(]?PROV/i', $this->ref))
if (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref)) // empty should not happened, but when it occurs, the test save life
{
$num = $this->getNextNumRef($soc);
}
@ -460,6 +460,7 @@ class CommandeFournisseur extends CommonOrder
{
$result = 1;
$this->log($user, 1, time()); // Statut 1
$this->statut = 1;
$this->ref = $num;
}
@ -684,7 +685,7 @@ class CommandeFournisseur extends CommonOrder
$soc->fetch($this->fourn_id);
// Check if object has a temporary ref
if (preg_match('/^[\(]?PROV/i', $this->ref))
if (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref)) // empty should not happened, but when it occurs, the test save life
{
$num = $this->getNextNumRef($soc);
}
@ -1570,6 +1571,7 @@ class CommandeFournisseur extends CommonOrder
$result=$this->call_trigger('ORDER_SUPPLIER_DELETE',$user);
if ($result < 0)
{
$this->errors[]='ErrorWhenRunningTrigger';
dol_syslog(get_class($this)."::delete ".$this->error, LOG_ERR);
return -1;
}
@ -1582,6 +1584,8 @@ class CommandeFournisseur extends CommonOrder
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
if (! $this->db->query($sql) )
{
$this->error=$this->db->lasterror();
$this->errors[]=$this->db->lasterror();
$error++;
}
@ -1592,12 +1596,14 @@ class CommandeFournisseur extends CommonOrder
if ($this->db->affected_rows($resql) < 1)
{
$this->error=$this->db->lasterror();
$this->errors[]=$this->db->lasterror();
$error++;
}
}
else
{
$this->error=$this->db->lasterror();
$this->errors[]=$this->db->lasterror();
$error++;
}
@ -1607,6 +1613,8 @@ class CommandeFournisseur extends CommonOrder
$result=$this->deleteExtraFields();
if ($result < 0)
{
$this->error='FailToDeleteExtraFields';
$this->errors[]='FailToDeleteExtraFields';
$error++;
dol_syslog(get_class($this)."::delete error -4 ".$this->error, LOG_ERR);
}
@ -1614,7 +1622,11 @@ class CommandeFournisseur extends CommonOrder
// Delete linked object
$res = $this->deleteObjectLinked();
if ($res < 0) $error++;
if ($res < 0) {
$this->error='FailToDeleteObjectLinked';
$this->errors[]='FailToDeleteObjectLinked';
$error++;
}
if (! $error)
{
@ -1629,6 +1641,7 @@ class CommandeFournisseur extends CommonOrder
if (! dol_delete_file($file,0,0,0,$this)) // For triggers
{
$this->error='ErrorFailToDeleteFile';
$this->errors[]='ErrorFailToDeleteFile';
$error++;
}
}
@ -1638,6 +1651,7 @@ class CommandeFournisseur extends CommonOrder
if (! $res)
{
$this->error='ErrorFailToDeleteDir';
$this->errors[]='ErrorFailToDeleteDir';
$error++;
}
}

Some files were not shown because too many files have changed in this diff Show More