Merge remote-tracking branch 'refs/remotes/Dolibarr/develop' into develop-best-pmp-pos-margin

This commit is contained in:
fappels 2015-10-26 10:36:40 +01:00
commit 14470feabd
208 changed files with 4587 additions and 3334 deletions

View File

@ -131,8 +131,9 @@ script:
# - cat upgrade370380.log
- php upgrade2.php 3.7.0 3.8.0 ignoredbversion > upgrade370380-2.log
- php upgrade.php 3.8.0 3.9.0 ignoredbversion > upgrade380390.log
- cat upgrade380390.log
- php upgrade2.php 3.8.0 3.9.0 ignoredbversion > upgrade380390-2.log
# - cat upgrade370380-2.log
# - cat upgrade380390-2.log
- cd ../..
- date
- phpunit -d memory_limit=-1 --configuration test/phpunit/phpunittest.xml test/phpunit/AllTests.php

View File

@ -2,7 +2,9 @@
English Dolibarr ChangeLog
--------------------------------------------------------------
WARNING: Do not try to make any Dolibarr upgrade if you are running Mysql version 5.5.40.
WARNING:
Do not try to make any Dolibarr upgrade if you are running Mysql version 5.5.40.
Mysql version 5.5.40 has a very critical bug making your data beeing definitely lost.
You may also experience troubles with Mysql 5.5.41 with error "Lost connection" during migration.
Upgrading to any other version or any other database system is abolutely required BEFORE trying
@ -11,11 +13,82 @@ make a Dolibarr upgrade.
***** ChangeLog for 3.9 compared to 3.8.* *****
WARNING: Following changes may create regression for some external modules, but were necessary to make
WARNING:
Following changes may create regression for some external modules, but were necessary to make
Dolibarr better:
- Deprecated hidden option MAIN_USE_CUSTOM_TRANSLATION has been removed. Use table llx_overwrite_trans instead.
- Trigger LINECONTRACT_INSERT has been renamed into LINECONTRACT_CREATE to match common denomination.
***** 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:
@ -279,9 +352,11 @@ FIX send mail, copy sendto don't read the list of contact
FIX Properly escape untrusted data to prevent HTML injection.
FIX send mail, copy sendto don't read the list of contact
Path to save photos of products was moved in 3.7.0 to match path of other attached files. If you had loose
your photo on the photo tab of products, you can set the constant "PRODUCT_USE_OLD_PATH_FOR_PHOTO" to
restore old path.
WARNING:
Path to save photos of products was moved to match path of other attached files. If you had loose your photo
on the photo tab of products, you can set the constant "PRODUCT_USE_OLD_PATH_FOR_PHOTO" to 1 (home - setup - other)
to restore old path and get back working links without having to resubmit images.
WARNING:
@ -454,11 +529,14 @@ You may also experience troubles with Mysql 5.5.41 with error "Lost connection"
Upgrading to any other version or database system is abolutely required BEFORE trying to
make a Dolibarr upgrade.
WARNING: Following changes may create regression for some external modules, but was necessary to make
WARNING:
Following changes may create regression for some external modules, but was necessary to make
Dolibarr better:
- Path to save photos of products was moved to match path of other attached files. If you had loose your photo
on the photo tab of products, you can set the constant "PRODUCT_USE_OLD_PATH_FOR_PHOTO" to restore old path.
on the photo tab of products, you can set the constant "PRODUCT_USE_OLD_PATH_FOR_PHOTO" to 1 (home - setup - other)
to restore old path and get back working links without having to resubmit images.
- If you can't see trips and expenses records, check that you have the new permission "read all
trips and expenses".
- Deprecated module "oscommerce" were removed.
@ -473,6 +551,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

@ -77,50 +77,56 @@ Voir fichier ChangeLog.
## CE QUE DOLIBARR PEUT FAIRE
Modules principaux:
### Modules principaux (tous optionnels):
- Annuaires des prospects et/ou client et/ou fournisseurs
- Gestion de catalogue de produits et services
- Gestion de stock
- Gestion des devis, propositions commerciales
- Gestion des commandes
- Gestion des factures clients/fournisseurs et paiements
- Gestion des virements bancaires SEPA
- Gestion des comptes bancaires
- Agenda partagé
- Gestion des commandes
- Gestion des devis, propositions commerciales
- Gestion des factures clients et fournisseurs
- Suivi des opportunités et/ou projets (suivi de rentabilité incluant les factures, notes de frais, temps consommé valorisé, ...)
- Gestion de contrats de services
- Gestion des paiements
- Gestion des virements bancaires
- Gestion de stock
- Gestion des expéditions
- GED (Gestion Electronique de Documents)
- EMailings de masse
- Réalisation de sondages
- Point de vente/Caisse enregistreuse
- …
### Autres modules:
Autres modules:
- Gestion de marque-pages
- Gestion des promesses de dons
- Gestion de la TVA NPR (non perçue récupérable - pour les utilisateurs français des DOM-TOM)
- Rapports
- Imports/Exports des données
- Connectivité LDAP
- Export PDF de tous les éléments (factures, propositions commerciales, commandes, bons expéditions, etc...)
- De nombreuses autres fonctionnalités issues de modules officiels ou non (AWStats, Bittorrent, Gravatar, Google, Webcalendar...)
- …
### Divers:
Divers:
- Application multi-utilisateurs avec différents niveaux de permissions par module.
- Peux être multi-société par ajout du module externe multi-société.
- Peux-être multi-devise par ajout du module externe multi-devise.
- Plusieurs gestionnaires de menus (possibilité de différencier les menus pour les utilisateurs internes ou externes comme les clients ou fournisseurs).
- Application simple à utiliser.
- Plusieurs thèmes visuels.
- Code simple et facilement personnalisable.
- Requiert PHP et Mysql ou Postgresql (Voir versions exactes sur http://wiki.dolibarr.org/index.php/Prérequis).
- Compatible avec toutes les offres Cloud du marché respectant les prérequis MySQL et PHP ou Postgresql.
- Export PDF de tous les éléments (factures, propositions commerciales, commandes, bons expéditions, etc...)
## CE QUE DOLIBARR NE PEUT PAS FAIRE (TACHES A FAIRE)
Voici un liste de fonctionnalites pas encore gérées par Dolibarr:
- Pas de compta analytique double-partie (uniquement gestion de trésorerie).
- Pas encore de compta analytique double-partie (uniquement gestion de trésorerie).
- Dolibarr ne gère qu'une seule monnaie à la fois (mono-devise).
- Dolibarr ne gère en standard qu'une société/institution/association mère (mono-société). Pour en gérer plusieurs (comme vos filiales), il faut, soit faire plusieurs installations de Dolibarr, soit installer le module MultiCompany qui permet de gérer n société/institutions/associations dans une seule instance par une isolation logique des données.
- Dolibarr ne contient pas de module de Gestion de la paie.
- Les tâches du module de gestion de projets n'ont pas de dépendance entre elle.
- Dolibarr ne contient pas de Webmail.

View File

@ -69,39 +69,22 @@ See the [ChangeLog](ChangeLog) file.
## FEATURES
### General features
- Users and groups with finely grained rights
- Localization in most major languages
- Very user friendly and easy to use
- Highly customizable: enable only the modules you need, add user personalized fields, choose your skin, several menu managers (can be used by internal users as a back-office with a particular menu, or by external users as a front-office with another one)
- Works with PHP 5.3+ and MySQL 4.1+ or PostgreSQL 8.1. (See requirements on the [Wiki](http://wiki.dolibarr.org/index.php/Prerequisite))
- Compatible with all Cloud solutions that match MySQL, PHP or PostgreSQL prerequisites.
- An easy to understand, maintain and code interfaces with your own information system (PHP with no heavy framework; trigger and hook architecture)
- Support for country specific features:
- Spanish Tax RE and ISPF
- French NPR VAT rate (VAT called "Non Perçue Récupérable" for DOM-TOM)
- Canadian double taxes (federal/province) and other countries using cumulative VAT
- Tunisian tax stamp
- Compatible with [European directives](http://europa.eu/legislation_summaries/taxation/l31057_en.htm) (2006/112/CE ... 2010/45/UE)
- ...
### Main modules
### Main modules (all optional)
- Customers, Prospects and/or Suppliers directory
- Products and/or Services catalog
- Bank accounts management
- Customer and Supplier Orders management
- Commercial proposals management
- Contracts management
- Invoices management
- Customer and Supplier Orders management
- Invoices and payment management
- Standing orders management (European SEPA)
- Bank accounts management
- Shared calendar
- Opportunities and/or project management (following project benefit including invoices, expense reports, time spent, ...)
- Projects management
- Events management
- Payments management
- Standing orders management
- Contracts management
- Stock management
- Shipping management
- Interventions management
- PDF or ODT generation for invoice, proposals, orders...
- Agenda with ical and vcal export for third party tools integration
- Electronic Document Management (EDM)
- Foundations members management
@ -127,6 +110,25 @@ See the [ChangeLog](ChangeLog) file.
- Payment platforms integration (PayBox, PayPal)
- …
### Other general features
- Multi-Users and groups with finely grained rights
- Localization in most major languages
- Can manage several companies by adding external module multi-company.
- Can manage several currencies by adding external module multi-currency.
- Very user friendly and easy to use
- Highly customizable: enable only the modules you need, add user personalized fields, choose your skin, several menu managers (can be used by internal users as a back-office with a particular menu, or by external users as a front-office with another one)
- Works with PHP 5.3+ and MySQL 4.1+ or PostgreSQL 8.1. (See requirements on the [Wiki](http://wiki.dolibarr.org/index.php/Prerequisite))
- Compatible with all Cloud solutions that match MySQL, PHP or PostgreSQL prerequisites.
- An easy to understand, maintain and code interfaces with your own information system (PHP with no heavy framework; trigger and hook architecture)
- Support for country specific features:
- Spanish Tax RE and ISPF
- French NPR VAT rate (VAT called "Non Perçue Récupérable" for DOM-TOM)
- Canadian double taxes (federal/province) and other countries using cumulative VAT
- Tunisian tax stamp
- Compatible with [European directives](http://europa.eu/legislation_summaries/taxation/l31057_en.htm) (2006/112/CE ... 2010/45/UE)
- PDF or ODT generation for invoice, proposals, orders...
- …
### Extending
Dolibarr can be extended with a lot of other external modules from third party developers available at the [DoliStore](http://www.dolistore.com).
@ -135,10 +137,7 @@ Dolibarr can be extended with a lot of other external modules from third party d
These are features that Dolibarr does **not** yet fully support:
- Double-entry bookkeeping (only bank and treasury management)
- Multiple currencies
- Multiple companies
If you want to manage several companies or foundations, you must install the software several times (on same server or not) or use the MultiCompany addon module that allows to manage several companies in one Dolibarr instance (one database but with a logical isolation of datas)
- Double-entry bookkeeping yet (only bank and treasury management)
- Tasks dependencies in projects
- Payroll module
- Webmail

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

@ -231,7 +231,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

@ -76,7 +76,7 @@ if ($action == 'disable') {
$action = 'update';
if ($result < 0) {
setEventMessage($accounting->error, 'errors');
setEventMessages($accounting->error, $accounting->errors, 'errors');
}
} else if ($action == 'enable') {
if ($accounting->fetch($id)) {
@ -84,7 +84,7 @@ if ($action == 'disable') {
}
$action = 'update';
if ($result < 0) {
setEventMessage($accounting->error, 'errors');
setEventMessages($accounting->error, $accounting->errors, 'errors');
}
}

View File

@ -125,7 +125,7 @@ else if ($action == 'delete')
}
if ($result < 0) {
setEventMessage($accounting->error, 'errors');
setEventMessages($accounting->error, $accounting->errors, 'errors');
}
}

View File

@ -100,9 +100,9 @@ if ($action == 'update') {
}
if (! $error) {
setEventMessage($langs->trans("SetupSaved"));
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessage($langs->trans("Error"), 'errors');
setEventMessages($langs->trans("Error"), null, 'errors');
}
}

View File

@ -66,7 +66,7 @@ if ($action == 'confirm_delete' && $confirm == "yes")
}
else
{
setEventMessage($object->error, 'errors');
setEventMessages($object->error, $object->errors, 'errors');
}
}
@ -84,12 +84,12 @@ else if ($action == 'add')
if (empty($object->date_start) && empty($object->date_end))
{
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Date")), 'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
$error++;
}
if (empty($object->label))
{
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Label")), 'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Label")), null, 'errors');
$error++;
}
@ -110,7 +110,7 @@ else if ($action == 'add')
{
$db->rollback();
setEventMessage($object->error, 'errors');
setEventMessages($object->error, $object->errors, 'errors');
$action='create';
}
}
@ -147,7 +147,7 @@ else if ($action == 'update')
}
else
{
setEventMessage($object->error, 'errors');
setEventMessages($object->error, $object->errors, 'errors');
}
}
else

View File

@ -76,14 +76,14 @@ if ($_POST["action"] == 'import') {
$result = $accounting->create($user);
if ($result > 0) {
setEventMessage($langs->trans("AccountingAccountAdd"), 'mesgs');
setEventMessages($langs->trans("AccountingAccountAdd"), null, 'mesgs');
} else {
setEventMessage($accounting->error, 'errors');
setEventMessages($accounting->error, $accounting->errors, 'errors');
}
$cpt ++;
}
} else {
setEventMessage($langs->trans('AccountPlanNotFoundCheckSetting'), 'errors');
setEventMessages($langs->trans('AccountPlanNotFoundCheckSetting'), null, 'errors');
}
} else {
print '<div><font color="red">' . $langs->trans("AnyLineImport") . '</font></div>';

View File

@ -111,11 +111,11 @@ if ($action == 'update')
if (! $error)
{
setEventMessage($langs->trans("SetupSaved"));
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
}
else
{
setEventMessage($langs->trans("Error"),'errors');
setEventMessages($langs->trans("Error"), null, 'errors');
}
}
@ -126,9 +126,9 @@ if ($action == 'setlistsorttodo') {
$error ++;
if (! $error) {
setEventMessage($langs->trans("SetupSaved"), 'mesgs');
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessage($langs->trans("Error"), 'mesgs');
setEventMessages($langs->trans("Error"), null, 'mesgs');
}
}
@ -138,9 +138,9 @@ if ($action == 'setlistsortdone') {
if (! $res > 0)
$error ++;
if (! $error) {
setEventMessage($langs->trans("SetupSaved"), 'mesgs');
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessage($langs->trans("Error"), 'mesgs');
setEventMessages($langs->trans("Error"), null, 'mesgs');
}
}

View File

@ -68,9 +68,9 @@ if ($action == 'update') {
}
if (! $error) {
setEventMessage($langs->trans("SetupSaved"));
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessage($langs->trans("Error"), 'errors');
setEventMessages($langs->trans("Error"), null, 'errors');
}
}

View File

@ -116,7 +116,7 @@ if ($action == 'update') {
$result=$accounting->fetch($accounting_account_id,null,1);
if ($result<0) {
//setEventMessage(null, $accounting->errors,'errors');
//setEventMessages(null, $accounting->errors, 'errors');
$msg .= '<div><font color="red">' . $langs->trans("ErrorDB") . ' : ' . $langs->trans("Product") . ' ' . $productid . ' ' . $langs->trans("NotVentilatedinAccount") . ' : id=' . $accounting_account_id . '<br/> <pre>' . $sql . '</pre></font></div>';
} else {

View File

@ -51,7 +51,7 @@ if ($action == "confirm_update") {
$error = 0;
if ((intval($debit) != 0) && (intval($credit) != 0)) {
if ((floatval($debit)!=0.0) && (floatval($credit)!=0.0)) {
setEventMessage($langs->trans('ErrorDebitCredit'), 'errors');
$error ++;
}
@ -69,11 +69,11 @@ if ($action == "confirm_update") {
$book->debit = $debit;
$book->credit = $credit;
if (! empty($debit)) {
if (floatval($debit)!=0.0) {
$book->montant = $debit;
$book->sens = 'D';
}
if (! empty($credit)) {
if (floatval($credit)!=0.0) {
$book->montant = $credit;
$book->sens = 'C';
}
@ -372,4 +372,4 @@ if ($action == 'create') {
}
llxFooter();
$db->close();
$db->close();

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

@ -84,23 +84,24 @@ if ($object->id > 0)
dol_fiche_head($head, 'agenda', $langs->trans("Member"),0,'user');
print '<table class="border" width="100%">';
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php">'.$langs->trans("BackToList").'</a>';
// Reference
print '<tr><td width="20%">'.$langs->trans('Ref').'</td>';
print '<td colspan="3">';
print $form->showrefnav($object, 'id', $linkback);
print '</td>';
print '</tr>';
dol_banner_tab($object, 'rowid', $linkback);
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent">';
// Login
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED))
{
print '<tr><td>'.$langs->trans("Login").' / '.$langs->trans("Id").'</td><td class="valeur">'.$object->login.'&nbsp;</td></tr>';
print '<tr><td class="titlefield">'.$langs->trans("Login").' / '.$langs->trans("Id").'</td><td class="valeur">'.$object->login.'&nbsp;</td></tr>';
}
// Type
print '<tr><td class="titlefield">'.$langs->trans("Type").'</td><td class="valeur">'.$adht->getNomUrl(1)."</td></tr>\n";
// Morphy
print '<tr><td>'.$langs->trans("Nature").'</td><td class="valeur" >'.$object->getmorphylib().'</td>';
/*print '<td rowspan="'.$rowspan.'" align="center" valign="middle" width="25%">';
@ -108,9 +109,6 @@ if ($object->id > 0)
print '</td>';*/
print '</tr>';
// Type
print '<tr><td>'.$langs->trans("Type").'</td><td class="valeur">'.$adht->getNomUrl(1)."</td></tr>\n";
// Company
print '<tr><td>'.$langs->trans("Company").'</td><td class="valeur">'.$object->societe.'</td></tr>';
@ -118,20 +116,12 @@ if ($object->id > 0)
print '<tr><td>'.$langs->trans("UserTitle").'</td><td class="valeur">'.$object->getCivilityLabel().'&nbsp;</td>';
print '</tr>';
// Lastname
print '<tr><td>'.$langs->trans("Lastname").'</td><td class="valeur" colspan="3">'.$object->lastname.'&nbsp;</td>';
print '</tr>';
// Firstname
print '<tr><td>'.$langs->trans("Firstname").'</td><td class="valeur" colspan="3">'.$object->firstname.'&nbsp;</td></tr>';
// Status
print '<tr><td>'.$langs->trans("Status").'</td><td class="valeur">'.$object->getLibStatut(4).'</td></tr>';
print '</table>';
print '</div>';
dol_fiche_end();
/*
* Barre d'action

View File

@ -257,12 +257,12 @@ if (empty($reshook))
if ($morphy != 'mor' && empty($lastname)) {
$error++;
$langs->load("errors");
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Lastname")), 'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Lastname")), null, 'errors');
}
if ($morphy != 'mor' && (!isset($firstname) || $firstname=='')) {
$error++;
$langs->load("errors");
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Firstname")), 'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Firstname")), null, 'errors');
}
// Create new object
@ -485,14 +485,14 @@ if (empty($reshook))
// Check parameters
if (empty($morphy) || $morphy == "-1") {
$error++;
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Nature")), 'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Nature")), null, 'errors');
}
// Test si le login existe deja
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED))
{
if (empty($login)) {
$error++;
setEventMessage($langs->trans("ErrorFieldRequired",$langs->trans("Login")), 'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Login")), null, 'errors');
}
else {
$sql = "SELECT login FROM ".MAIN_DB_PREFIX."adherent WHERE login='".$db->escape($login)."'";
@ -508,22 +508,22 @@ if (empty($reshook))
}
if (empty($pass)) {
$error++;
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Password")), 'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Password")), null, 'errors');
}
}
if ($morphy != 'mor' && empty($lastname)) {
$error++;
$langs->load("errors");
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Lastname")), 'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Lastname")), null, 'errors');
}
if ($morphy != 'mor' && (!isset($firstname) || $firstname=='')) {
$error++;
$langs->load("errors");
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Firstname")), 'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Firstname")), null, 'errors');
}
if (! ($typeid > 0)) { // Keep () before !
$error++;
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")), 'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), null, 'errors');
}
if ($conf->global->ADHERENT_MAIL_REQUIRED && ! isValidEMail($email)) {
$error++;
@ -802,13 +802,6 @@ else
print '<tr><td><span class="fieldrequired">'.$langs->trans("Login").' / '.$langs->trans("Id").'</span></td><td><input type="text" name="member_login" size="40" value="'.(isset($_POST["member_login"])?$_POST["member_login"]:$object->login).'"></td></tr>';
}
// Moral-Physique
$morphys["phy"] = $langs->trans("Physical");
$morphys["mor"] = $langs->trans("Moral");
print '<tr><td class="fieldrequired">'.$langs->trans("Nature")."</td><td>\n";
print $form->selectarray("morphy", $morphys, GETPOST('morphy','alpha')?GETPOST('morphy','alpha'):$object->morphy, 1);
print "</td>\n";
// Type
print '<tr><td class="fieldrequired">'.$langs->trans("MemberType").'</td><td>';
$listetype=$adht->liste_array();
@ -820,6 +813,13 @@ else
}
print "</td>\n";
// Morphy
$morphys["phy"] = $langs->trans("Physical");
$morphys["mor"] = $langs->trans("Moral");
print '<tr><td class="fieldrequired">'.$langs->trans("Nature")."</td><td>\n";
print $form->selectarray("morphy", $morphys, GETPOST('morphy','alpha')?GETPOST('morphy','alpha'):$object->morphy, 1);
print "</td>\n";
// Company
print '<tr><td id="tdcompany">'.$langs->trans("Company").'</td><td><input type="text" name="societe" size="40" value="'.(GETPOST('societe','alpha')?GETPOST('societe','alpha'):$object->societe).'"></td></tr>';
@ -1050,7 +1050,7 @@ else
print '<tr><td><span class="fieldrequired">'.$langs->trans("Login").' / '.$langs->trans("Id").'</span></td><td colspan="2"><input type="text" name="login" size="30" value="'.(isset($_POST["login"])?$_POST["login"]:$object->login).'"></td></tr>';
}
// Physique-Moral
// Morphy
$morphys["phy"] = $langs->trans("Physical");
$morphys["mor"] = $langs->trans("Morale");
print '<tr><td><span class="fieldrequired">'.$langs->trans("Nature").'</span></td><td>';
@ -1402,37 +1402,29 @@ else
if (! empty($conf->societe->enabled)) $rowspan++;
if (! empty($conf->skype->enabled)) $rowspan++;
print '<table class="border" width="100%">';
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php">'.$langs->trans("BackToList").'</a>';
// Ref
print '<tr><td width="20%">'.$langs->trans("Ref").'</td>';
print '<td class="valeur" colspan="2">';
print $form->showrefnav($object, 'rowid', $linkback);
print '</td></tr>';
$showphoto='<td rowspan="'.$rowspan.'" align="center" class="hideonsmartphone" valign="middle" width="25%">';
$showphoto.=$form->showphoto('memberphoto',$object);
$showphoto.='</td>';
dol_banner_tab($object, 'rowid', $linkback);
print '<div class="fichecenter">';
print '<div class="fichehalfleft">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent">';
// Login
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED))
{
print '<tr><td>'.$langs->trans("Login").' / '.$langs->trans("Id").'</td><td class="valeur">'.$object->login.'&nbsp;</td>';
// Photo
print $showphoto; $showphoto='';
print '</tr>';
print '<tr><td>'.$langs->trans("Login").' / '.$langs->trans("Id").'</td><td class="valeur">'.$object->login.'&nbsp;</td></tr>';
}
// Morphy
print '<tr><td>'.$langs->trans("Nature").'</td><td class="valeur" >'.$object->getmorphylib().'</td>';
print $showphoto; $showphoto='';
print '</tr>';
// Type
print '<tr><td>'.$langs->trans("Type").'</td><td class="valeur">'.$adht->getNomUrl(1)."</td></tr>\n";
// Morphy
print '<tr><td>'.$langs->trans("Nature").'</td><td class="valeur" >'.$object->getmorphylib().'</td>';
print '</tr>';
// Company
print '<tr><td>'.$langs->trans("Company").'</td><td class="valeur">'.$object->societe.'</td></tr>';
@ -1440,16 +1432,6 @@ else
print '<tr><td>'.$langs->trans("UserTitle").'</td><td class="valeur">'.$object->getCivilityLabel().'&nbsp;</td>';
print '</tr>';
// Lastname
print '<tr><td>'.$langs->trans("Lastname").'</td><td class="valeur">'.$object->lastname.'&nbsp;</td>';
print '</tr>';
// Firstname
print '<tr><td>'.$langs->trans("Firstname").'</td><td class="valeur">'.$object->firstname.'&nbsp;</td></tr>';
// EMail
print '<tr><td>'.$langs->trans("EMail").'</td><td class="valeur">'.dol_print_email($object->email,0,$object->fk_soc,1).'</td></tr>';
// Password
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED))
{
@ -1463,48 +1445,26 @@ else
print '</td></tr>';
}
// Address
print '<tr><td>'.$langs->trans("Address").'</td><td class="valeur">';
dol_print_address($object->address,'gmap','member',$object->id);
print '</td></tr>';
// Zip / Town
print '<tr><td class="nowrap">'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td class="valeur">'.$object->zip.(($object->zip && $object->town)?' / ':'').$object->town.'</td></tr>';
// Country
print '<tr><td>'.$langs->trans("Country").'</td><td class="valeur">';
$img=picto_from_langcode($object->country_code);
if ($img) print $img.' ';
print getCountry($object->country_code);
print '</td></tr>';
// State
print '<tr><td>'.$langs->trans('State').'</td><td class="valeur">'.$object->state.'</td>';
// Tel pro.
print '<tr><td>'.$langs->trans("PhonePro").'</td><td class="valeur">'.dol_print_phone($object->phone,$object->country_code,0,$object->fk_soc,1).'</td></tr>';
// Tel perso
print '<tr><td>'.$langs->trans("PhonePerso").'</td><td class="valeur">'.dol_print_phone($object->phone_perso,$object->country_code,0,$object->fk_soc,1).'</td></tr>';
// Tel mobile
print '<tr><td>'.$langs->trans("PhoneMobile").'</td><td class="valeur">'.dol_print_phone($object->phone_mobile,$object->country_code,0,$object->fk_soc,1).'</td></tr>';
// Skype
if (! empty($conf->skype->enabled))
{
print '<tr><td>'.$langs->trans("Skype").'</td><td class="valeur">'.dol_print_skype($object->skype,0,$object->fk_soc,1).'</td></tr>';
}
print '</table>';
print '</div>';
print '<div class="fichehalfright"><div class="ficheaddleft">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border tableforfield" width="100%">';
// Birthday
print '<tr><td>'.$langs->trans("Birthday").'</td><td class="valeur">'.dol_print_date($object->birth,'day').'</td></tr>';
// Public
print '<tr><td>'.$langs->trans("Public").'</td><td class="valeur">'.yn($object->public).'</td></tr>';
// Status
print '<tr><td>'.$langs->trans("Status").'</td><td class="valeur">'.$object->getLibStatut(4).'</td></tr>';
// Categories
if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire))
{
@ -1592,14 +1552,34 @@ else
}
print '</td></tr>';
// Date end subscription
print '<tr><td>'.$langs->trans("SubscriptionEndDate").'</td><td class="valeur">';
if ($object->datefin)
{
print dol_print_date($object->datefin,'day');
if ($object->hasDelay()) {
print " ".img_warning($langs->trans("Late"));
}
}
else
{
print $langs->trans("SubscriptionNotReceived");
if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // Affiche picto retard uniquement si non brouillon et non resilie
}
print '</td></tr>';
print "</table>\n";
print "</div>\n";
print "</div></div></div>\n";
print '<div style="clear:both"></div>';
dol_fiche_end();
/*
* Hotbar
*/
print '<div class="tabsAction">';
$parameters = array();
$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been

View File

@ -567,54 +567,155 @@ if ($rowid > 0)
dol_fiche_head($head, 'subscription', $langs->trans("Member"), 0, 'user');
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php">'.$langs->trans("BackToList").'</a>';
dol_banner_tab($object, 'rowid', $linkback);
print '<div class="fichecenter">';
print '<div class="fichehalfleft">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">';
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php">'.$langs->trans("BackToList").'</a>';
// Login
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED))
{
print '<tr><td>'.$langs->trans("Login").' / '.$langs->trans("Id").'</td><td class="valeur">'.$object->login.'&nbsp;</td></tr>';
}
// Ref
print '<tr><td width="20%">'.$langs->trans("Ref").'</td>';
print '<td class="valeur" colspan="2">';
print $form->showrefnav($object, 'rowid', $linkback);
print '</td></tr>';
// Type
print '<tr><td>'.$langs->trans("Type").'</td><td class="valeur">'.$adht->getNomUrl(1)."</td></tr>\n";
$showphoto='<td rowspan="'.$rowspan.'" class="hideonsmartphone" align="center" valign="middle" width="25%">'.$form->showphoto('memberphoto',$object).'</td>';
// Morphy
print '<tr><td>'.$langs->trans("Nature").'</td><td class="valeur" >'.$object->getmorphylib().'</td>';
print '</tr>';
// Login
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED))
{
print '<tr><td>'.$langs->trans("Login").' / '.$langs->trans("Id").'</td><td class="valeur">'.$object->login.'&nbsp;</td>';
print $showphoto; $showphoto='';
print '</tr>';
}
// Company
print '<tr><td>'.$langs->trans("Company").'</td><td class="valeur">'.$object->societe.'</td></tr>';
// Morphy
print '<tr><td>'.$langs->trans("Nature").'</td><td class="valeur" >'.$object->getmorphylib().'</td>';
print $showphoto; $showphoto='';
print '</tr>';
// Civility
print '<tr><td>'.$langs->trans("UserTitle").'</td><td class="valeur">'.$object->getCivilityLabel().'&nbsp;</td>';
print '</tr>';
// Type
print '<tr><td>'.$langs->trans("Type").'</td><td class="valeur">'.$adht->getNomUrl(1)."</td></tr>\n";
// Password
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED))
{
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>';
}
// Company
print '<tr><td>'.$langs->trans("Company").'</td><td class="valeur">'.$object->societe.'</td></tr>';
// Skype
if (! empty($conf->skype->enabled))
{
print '<tr><td>'.$langs->trans("Skype").'</td><td class="valeur">'.dol_print_skype($object->skype,0,$object->fk_soc,1).'</td></tr>';
}
// Civility
print '<tr><td>'.$langs->trans("UserTitle").'</td><td class="valeur">'.$object->getCivilityLabel().'&nbsp;</td>';
print '</tr>';
print '</table>';
print '</div>';
print '<div class="fichehalfright"><div class="ficheaddleft">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border tableforfield" width="100%">';
// Birthday
print '<tr><td>'.$langs->trans("Birthday").'</td><td class="valeur">'.dol_print_date($object->birth,'day').'</td></tr>';
// Lastname
print '<tr><td>'.$langs->trans("Lastname").'</td><td class="valeur">'.$object->lastname.'&nbsp;</td>';
print '</tr>';
// Public
print '<tr><td>'.$langs->trans("Public").'</td><td class="valeur">'.yn($object->public).'</td></tr>';
// Firstname
print '<tr><td>'.$langs->trans("Firstname").'</td><td class="valeur">'.$object->firstname.'&nbsp;</td>';
print '</tr>';
// Categories
if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire))
{
print '<tr><td>' . $langs->trans("Categories") . '</td>';
print '<td colspan="2">';
print $form->showCategories($object->id, 'member', 1);
print '</td></tr>';
}
// EMail
print '<tr><td>'.$langs->trans("EMail").'</td><td class="valeur">'.dol_print_email($object->email,0,$object->fk_soc,1).'</td></tr>';
// Other attributes
$parameters=array('colspan'=>2);
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
if (empty($reshook) && ! empty($extrafields->attribute_label))
{
print $object->showOptionals($extrafields, 'view', $parameters);
}
// Status
print '<tr><td>'.$langs->trans("Status").'</td><td class="valeur">'.$object->getLibStatut(4).'</td></tr>';
// Third party Dolibarr
if (! empty($conf->societe->enabled))
{
print '<tr><td>';
print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans("LinkedToDolibarrThirdParty");
print '</td>';
if ($action != 'editthirdparty' && $user->rights->adherent->creer) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editthirdparty&amp;rowid='.$object->id.'">'.img_edit($langs->trans('SetLinkToThirdParty'),1).'</a></td>';
print '</tr></table>';
print '</td><td colspan="2" class="valeur">';
if ($action == 'editthirdparty')
{
$htmlname='socid';
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'" name="form'.$htmlname.'">';
print '<input type="hidden" name="rowid" value="'.$object->id.'">';
print '<input type="hidden" name="action" value="set'.$htmlname.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<table class="nobordernopadding" cellpadding="0" cellspacing="0">';
print '<tr><td>';
print $form->select_company($object->fk_soc,'socid','',1);
print '</td>';
print '<td align="left"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
print '</tr></table></form>';
}
else
{
if ($object->fk_soc)
{
$company=new Societe($db);
$result=$company->fetch($object->fk_soc);
print $company->getNomUrl(1);
}
else
{
print $langs->trans("NoThirdPartyAssociatedToMember");
}
}
print '</td></tr>';
}
// Login Dolibarr
print '<tr><td>';
print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans("LinkedToDolibarrUser");
print '</td>';
if ($action != 'editlogin' && $user->rights->adherent->creer)
{
print '<td align="right">';
if ($user->rights->user->user->creer)
{
print '<a href="'.$_SERVER["PHP_SELF"].'?action=editlogin&amp;rowid='.$object->id.'">'.img_edit($langs->trans('SetLinkToUser'),1).'</a>';
}
print '</td>';
}
print '</tr></table>';
print '</td><td colspan="2" class="valeur">';
if ($action == 'editlogin')
{
$form->form_users($_SERVER['PHP_SELF'].'?rowid='.$object->id,$object->user_id,'userid','');
}
else
{
if ($object->user_id)
{
$form->form_users($_SERVER['PHP_SELF'].'?rowid='.$object->id,$object->user_id,'none');
}
else print $langs->trans("NoDolibarrAccess");
}
print '</td></tr>';
// Date end subscription
print '<tr><td>'.$langs->trans("SubscriptionEndDate").'</td><td class="valeur">';
@ -632,83 +733,16 @@ if ($rowid > 0)
}
print '</td></tr>';
// Third party Dolibarr
if (! empty($conf->societe->enabled))
{
print '<tr><td>';
print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans("LinkedToDolibarrThirdParty");
print '</td>';
if ($action != 'editthirdparty' && $user->rights->adherent->creer) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editthirdparty&amp;rowid='.$object->id.'">'.img_edit($langs->trans('SetLinkToThirdParty'),1).'</a></td>';
print '</tr></table>';
print '</td><td class="valeur">';
if ($action == 'editthirdparty')
{
$htmlname='socid';
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'" name="form'.$htmlname.'">';
print '<input type="hidden" name="rowid" value="'.$object->id.'">';
print '<input type="hidden" name="action" value="set'.$htmlname.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<table class="nobordernopadding" cellpadding="0" cellspacing="0">';
print '<tr><td>';
print $form->select_company($object->fk_soc,'socid','',1);
print '</td>';
print '<td align="left"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
print '</tr></table></form>';
}
else
{
if ($object->fk_soc)
{
$company=new Societe($db);
$result=$company->fetch($object->fk_soc);
print $company->getNomUrl(1);
}
else
{
print $langs->trans("NoThirdPartyAssociatedToMember");
}
}
print '</td></tr>';
}
// Login Dolibarr
print '<tr><td>';
print '<table class="nobordernopadding" width="100%"><tr><td>';
print $langs->trans("LinkedToDolibarrUser");
print '</td>';
if ($action != 'editlogin' && $user->rights->adherent->creer) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editlogin&amp;rowid='.$object->id.'">'.img_edit($langs->trans('SetLinkToUser'),1).'</a></td>';
print '</tr></table>';
print '</td><td class="valeur">';
if ($action == 'editlogin')
{
/*$include=array();
if (empty($user->rights->user->user->creer)) // If can edit only itself user, we can link to itself only
{
$include=array($object->user_id,$user->id);
}*/
$form->form_users($_SERVER['PHP_SELF'].'?rowid='.$object->id,$object->user_id,'userid','');
}
else
{
if ($object->user_id)
{
$form->form_users($_SERVER['PHP_SELF'].'?rowid='.$object->id,$object->user_id,'none');
}
else print $langs->trans("NoDolibarrAccess");
}
print '</td></tr>';
print "</table>\n";
print "</div></div></div>\n";
print '<div style="clear:both"></div>';
dol_fiche_end();
print '</form>';
dol_htmloutput_errors($errmsg,$errmsgs);
/*
* Hotbar
*/

View File

@ -1976,12 +1976,14 @@ class Adherent extends CommonObject
// Process
foreach ($to_del as $del) {
$c->fetch($del);
$c->del_type($this, 'member');
if ($c->fetch($del) > 0) {
$c->del_type($this, 'member');
}
}
foreach ($to_add as $add) {
$c->fetch($add);
$c->add_type($this, 'member');
if ($c->fetch($add) > 0) {
$c->add_type($this, 'member');
}
}
return;

View File

@ -83,6 +83,7 @@ include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_pre_headers.tpl.php
* View
*/
$form = new Form($db);
llxHeader();
@ -91,19 +92,7 @@ if ($id > 0)
$result=$membert->fetch($object->typeid);
if ($result > 0)
{
/*
* Affichage onglets
*/
if (! empty($conf->notification->enabled))
$langs->load("mails");
$head = member_prepare_head($object);
$form=new Form($db);
dol_fiche_head($head, 'document', $langs->trans("Member"),0,'user');
// Construit liste des fichiers
$filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
$totalsize=0;
@ -111,34 +100,41 @@ if ($id > 0)
{
$totalsize+=$file['size'];
}
if (! empty($conf->notification->enabled))
$langs->load("mails");
$head = member_prepare_head($object);
print '<table class="border" width="100%">';
dol_fiche_head($head, 'document', $langs->trans("Member"),0,'user');
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php">'.$langs->trans("BackToList").'</a>';
dol_banner_tab($object, 'rowid', $linkback);
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent">';
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php">'.$langs->trans("BackToList").'</a>';
// Ref
print '<tr><td width="20%">'.$langs->trans("Ref").'</td>';
print '<td class="valeur">';
print $form->showrefnav($object, 'rowid', $linkback);
print '</td></tr>';
// Login
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED))
{
print '<tr><td>'.$langs->trans("Login").' / '.$langs->trans("Id").'</td><td class="valeur">'.$object->login.'&nbsp;</td></tr>';
print '<tr><td class="titlefield">'.$langs->trans("Login").' / '.$langs->trans("Id").'</td><td class="valeur">'.$object->login.'&nbsp;</td></tr>';
}
// Type
print '<tr><td>'.$langs->trans("Type").'</td><td class="valeur">'.$membert->getNomUrl(1)."</td></tr>\n";
// Morphy
print '<tr><td>'.$langs->trans("Nature").'</td><td class="valeur" >'.$object->getmorphylib().'</td>';
print '<tr><td class="titlefield">'.$langs->trans("Nature").'</td><td class="valeur" >'.$object->getmorphylib().'</td>';
/*print '<td rowspan="'.$rowspan.'" align="center" valign="middle" width="25%">';
print $form->showphoto('memberphoto',$object);
print '</td>';*/
print '</tr>';
// Type
print '<tr><td>'.$langs->trans("Type").'</td><td class="valeur">'.$membert->getNomUrl(1)."</td></tr>\n";
// Company
print '<tr><td>'.$langs->trans("Company").'</td><td class="valeur">'.$object->societe.'</td></tr>';
@ -146,17 +142,6 @@ if ($id > 0)
print '<tr><td>'.$langs->trans("UserTitle").'</td><td class="valeur">'.$object->getCivilityLabel().'&nbsp;</td>';
print '</tr>';
// Lastname
print '<tr><td>'.$langs->trans("Lastname").'</td><td class="valeur">'.$object->lastname.'&nbsp;</td>';
print '</tr>';
// Firstname
print '<tr><td>'.$langs->trans("Firstname").'</td><td class="valeur">'.$object->firstname.'&nbsp;</td>';
print '</tr>';
// Status
print '<tr><td>'.$langs->trans("Status").'</td><td class="valeur">'.$object->getLibStatut(4).'</td></tr>';
// Nbre fichiers
print '<tr><td>'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
@ -166,6 +151,8 @@ if ($id > 0)
print '</table>';
print '</div>';
dol_fiche_end();
$modulepart = 'member';
$permission = $user->rights->adherent->creer;

View File

@ -180,18 +180,24 @@ if ($user->rights->adherent->cotisation->creer && $action == 'edit')
$head[$h][2] = 'info';
$h++;
dol_fiche_head($head, 'general', $langs->trans("Subscription"), 0, 'payment');
print "\n";
print '<form name="update" action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print "<input type=\"hidden\" name=\"action\" value=\"update\">";
print "<input type=\"hidden\" name=\"rowid\" value=\"$rowid\">";
print "<input type=\"hidden\" name=\"fk_bank\" value=\"".$subscription->fk_bank."\">";
dol_fiche_head($head, 'general', $langs->trans("Subscription"), 0, 'payment');
print "\n";
print '<table class="border" width="100%">';
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/cotisations.php">'.$langs->trans("BackToList").'</a>';
// Ref
print '<tr><td width="20%">'.$langs->trans("Ref").'</td><td class="valeur" colspan="2">'.$subscription->ref.'&nbsp;</td></tr>';
print '<tr><td width="20%">'.$langs->trans("Ref").'</td>';
print '<td class="valeur" colspan="3">';
print $form->showrefnav($subscription, 'rowid', $linkback, 1);
print '</td></tr>';
// Member
$adh->ref=$adh->getFullName($langs);
@ -239,18 +245,18 @@ if ($user->rights->adherent->cotisation->creer && $action == 'edit')
}
}
print '<tr><td colspan="3" align="center">';
print '<input type="submit" class="button" name="submit" value="'.$langs->trans("Save").'">';
print '</table>';
dol_fiche_end();
print '<div class="center">';
print '<input type="submit" class="button" name="submit" value="'.$langs->trans("Save").'">';
print ' &nbsp; &nbsp; &nbsp; ';
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
print '</td></tr>';
print '</table>';
print '</div>';
print '</form>';
print "\n";
print '</div>';
print "\n";
}
if ($rowid && $action != 'edit')
@ -355,8 +361,7 @@ if ($rowid && $action != 'edit')
print "</table>\n";
print '</form>';
print "</div>\n";
dol_fiche_end();
/*
* Barre d'actions
@ -388,6 +393,6 @@ if ($rowid && $action != 'edit')
}
$db->close();
llxFooter();
$db->close();

View File

@ -125,29 +125,32 @@ if ($result)
//print '<tr><td width="30%" class="notopnoleft" valign="top">';
print '<div class="fichecenter"><div class="fichethirdleft">';
// Search contact/address
if (! empty($conf->adherent->enabled) && $user->rights->adherent->lire)
{
$listofsearchfields['search_member']=array('text'=>'Member');
}
if (count($listofsearchfields))
{
print '<form method="post" action="'.DOL_URL_ROOT.'/core/search.php">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<table class="noborder nohover centpercent">';
$i=0;
foreach($listofsearchfields as $key => $value)
{
if ($i == 0) print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("Search").'</td></tr>';
print '<tr>';
print '<td class="nowrap"><label for="'.$key.'">'.$langs->trans($value["text"]).'</label>:</td><td><input type="text" class="flat" name="'.$key.'" id="'.$key.'" size="18"></td>';
if ($i == 0) print '<td rowspan="'.count($listofsearchfields).'"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td>';
print '</tr>';
$i++;
}
print '</table>';
print '</form>';
print '<br>';
}
// Formulaire recherche adherent
print '<form action="list.php" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="search">';
print '<table class="noborder nohover" width="100%">';
print '<tr class="liste_titre">';
print '<td colspan="3">'.$langs->trans("SearchAMember").'</td>';
print "</tr>\n";
$var=false;
print "<tr ".$bc[$var].">";
print '<td>';
print '<label for="search_ref">'.$langs->trans("Ref").'</label>:</td><td><input type="text" name="search_ref" id="search_ref" class="flat" size="16">';
print '</td><td rowspan="3"><input class="button" type="submit" value="'.$langs->trans("Search").'"></td></tr>';
print "<tr ".$bc[$var].">";
print '<td>';
print '<label for="search_lastname">'.$langs->trans("Name").'</label>:</td><td><input type="text" name="search_lastname" id="search_lastname" class="flat" size="16">';
print '</td></tr>';
print "<tr ".$bc[$var].">";
print '<td>';
print '<label for="sall">'.$langs->trans("Other").'</label>:</td><td><input type="text" name="sall" id="sall" class="flat" size="16">';
print '</td></tr>';
print "</table></form>";
/*
@ -156,7 +159,6 @@ print "</table></form>";
if ($conf->use_javascript_ajax)
{
print '<br>';
print '<table class="noborder nohover" width="100%">';
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Statistics").'</td></tr>';
print '<tr '.$bc[0].'><td align="center" colspan="2">';

View File

@ -42,23 +42,34 @@ $result=restrictedArea($user,'adherent',$id);
* View
*/
$form = new Form($db);
llxHeader('',$langs->trans("Member"),'EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros');
$adh = new Adherent($db);
$adh->fetch($id);
$adh->info($id);
$object = new Adherent($db);
$object->fetch($id);
$object->info($id);
$head = member_prepare_head($adh);
$head = member_prepare_head($object);
dol_fiche_head($head, 'info', $langs->trans("Member"), 0, 'user');
print '<table width="100%"><tr><td>';
dol_print_object_info($adh);
print '</td></tr></table>';
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php">'.$langs->trans("BackToList").'</a>';
dol_banner_tab($object, 'rowid', $linkback);
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<br>';
dol_print_object_info($object);
print '</div>';
dol_fiche_end();
llxFooter();
$db->close();

View File

@ -44,12 +44,11 @@ if ($user->societe_id > 0)
$socid = $user->societe_id;
}
$adh = new Adherent($db);
$adh->id = $rowid;
$result=$adh->fetch($rowid);
$object = new Adherent($db);
$result=$object->fetch($rowid);
if (! $result)
{
dol_print_error($db,"Failed to get adherent: ".$adh->error);
dol_print_error($db,"Failed to get adherent: ".$object->error);
exit;
}
@ -65,8 +64,8 @@ if ($action == 'dolibarr2ldap')
$ldap=new Ldap();
$result=$ldap->connect_bind();
$info=$adh->_load_ldap_info();
$dn=$adh->_load_ldap_dn($info);
$info=$object->_load_ldap_info();
$dn=$object->_load_ldap_dn($info);
$olddn=$dn; // We can say that old dn = dn as we force synchro
$result=$ldap->update($dn,$info,$user,$olddn);
@ -93,35 +92,27 @@ llxHeader('',$langs->trans("Member"),'EN:Module_Foundations|FR:Module_Adh&eacute
$form = new Form($db);
$head = member_prepare_head($adh);
$head = member_prepare_head($object);
dol_fiche_head($head, 'ldap', $langs->trans("Member"), 0, 'user');
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php">'.$langs->trans("BackToList").'</a>';
print '<table class="border" width="100%">';
dol_banner_tab($object, 'rowid', $linkback);
// Ref
print '<tr><td width="20%">'.$langs->trans("Ref").'</td>';
print '<td class="valeur">';
print $form->showrefnav($adh,'id');
print '</td></tr>';
print '<div class="fichecenter">';
// Lastname
print '<tr><td>'.$langs->trans("Lastname").'</td><td class="valeur">'.$adh->lastname.'&nbsp;</td>';
print '</tr>';
// Firstname
print '<tr><td width="15%">'.$langs->trans("Firstname").'</td><td class="valeur">'.$adh->firstname.'&nbsp;</td>';
print '</tr>';
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent">';
// Login
print '<tr><td>'.$langs->trans("Login").'</td><td class="valeur">'.$adh->login.'&nbsp;</td></tr>';
print '<tr><td class="titlefield">'.$langs->trans("Login").'</td><td class="valeur">'.$object->login.'&nbsp;</td></tr>';
// Password not crypted
if (! empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD))
{
print '<tr><td>'.$langs->trans("LDAPFieldPasswordNotCrypted").'</td>';
print '<td class="valeur">'.$adh->pass.'</td>';
print '<td class="valeur">'.$object->pass.'</td>';
print "</tr>\n";
}
@ -129,12 +120,12 @@ if (! empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD))
if (! empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED))
{
print '<tr><td>'.$langs->trans("LDAPFieldPasswordCrypted").'</td>';
print '<td class="valeur">'.$adh->pass_crypted.'</td>';
print '<td class="valeur">'.$object->pass_crypted.'</td>';
print "</tr>\n";
}
// Type
print '<tr><td>'.$langs->trans("Type").'</td><td class="valeur">'.$adh->type."</td></tr>\n";
print '<tr><td>'.$langs->trans("Type").'</td><td class="valeur">'.$object->type."</td></tr>\n";
$langs->load("admin");
@ -155,6 +146,8 @@ print '</table>';
print '</div>';
dol_fiche_end();
/*
* Barre d'actions
*/
@ -163,7 +156,7 @@ print '<div class="tabsAction">';
if (! empty($conf->global->LDAP_MEMBER_ACTIVE) && $conf->global->LDAP_MEMBER_ACTIVE != 'ldap2dolibarr')
{
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$adh->id.'&amp;action=dolibarr2ldap">'.$langs->trans("ForceSynchronize").'</a></div>';
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=dolibarr2ldap">'.$langs->trans("ForceSynchronize").'</a></div>';
}
print "</div>\n";
@ -187,9 +180,9 @@ $ldap=new Ldap();
$result=$ldap->connect_bind();
if ($result > 0)
{
$info=$adh->_load_ldap_info();
$dn=$adh->_load_ldap_dn($info,1);
$search = "(".$adh->_load_ldap_dn($info,2).")";
$info=$object->_load_ldap_info();
$dn=$object->_load_ldap_dn($info,1);
$search = "(".$object->_load_ldap_dn($info,2).")";
if (empty($dn))
{

View File

@ -78,6 +78,21 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both
$hookmanager->initHooks(array('memberlist'));
$extrafields = new ExtraFields($db);
// List of fields to search into when doing a "search in all"
$fieldstosearchall = array(
'd.rowid'=>'Ref',
//'d.ref'=>'Ref',
'd.lastname'=>'Lastname',
'd.firstname'=>'Firstname',
'd.societe'=>"Company",
'd.email'=>'EMail',
'd.address'=>'Address',
'd.zip'=>'Zip',
'd.town'=>'Town',
'd.note_public'=>'NotePublic',
'd.note_private'=>'NotePrivate',
);
/*
* View
@ -111,7 +126,7 @@ if ($catid == -2) $sql.= " AND cm.fk_categorie IS NULL";
if ($search_categ > 0) $sql.= " AND cm.fk_categorie = ".$db->escape($search_categ);
if ($search_categ == -2) $sql.= " AND cm.fk_categorie IS NULL";
$sql.= " AND d.entity IN (".getEntity('adherent', 1).")";
if ($sall) $sql.=natural_search(array("d.rowid", "d.firstname", "d.lastname", "d.societe", "d.email", "d.login", "d.address", "d.town", "d.note_public", "d.note_private"), $sall);
if ($sall) $sql.=natural_search(array_keys($fieldstosearchall), $sall);
if ($type > 0) $sql.=" AND t.rowid=".$db->escape($type);
if (isset($_GET["statut"]) || isset($_POST["statut"])) $sql.=" AND d.statut in (".$db->escape($statut).")"; // Peut valoir un nombre ou liste de nombre separes par virgules
if ($search_ref)
@ -180,16 +195,16 @@ if ($resql)
if ($optioncss != '') $param.='&optioncss='.$optioncss;
print_barre_liste($titre,$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords);
if ($sall)
{
print $langs->trans("Filter")." (".$langs->trans("Ref").", ".$langs->trans("Lastname").", ".$langs->trans("Firstname").", ".$langs->trans("EMail").", ".$langs->trans("Address")." ".$langs->trans("or")." ".$langs->trans("Town")."): ";
print '<strong>'.$sall.'</strong>';
}
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].($param?'?'.$param:'').'">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
if ($sall)
{
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
print $langs->trans("FilterOnInto", $sall, join(', ',$fieldstosearchall));
}
// Filter on categories
$moreforfilter='';
if (! empty($conf->categorie->enabled))

View File

@ -73,33 +73,31 @@ if ($id)
print "<form method=\"post\" action=\"".$_SERVER['PHP_SELF']."\">";
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<table class="border" width="100%">';
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php">'.$langs->trans("BackToList").'</a>';
// Reference
print '<tr><td width="20%">'.$langs->trans('Ref').'</td>';
print '<td colspan="3">';
print $form->showrefnav($object, 'id', $linkback);
print '</td>';
print '</tr>';
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/list.php">'.$langs->trans("BackToList").'</a>';
dol_banner_tab($object, 'rowid', $linkback);
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent">';
// Login
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED))
{
print '<tr><td>'.$langs->trans("Login").' / '.$langs->trans("Id").'</td><td class="valeur">'.$object->login.'&nbsp;</td></tr>';
print '<tr><td class="titlefield">'.$langs->trans("Login").' / '.$langs->trans("Id").'</td><td class="valeur">'.$object->login.'&nbsp;</td></tr>';
}
// Type
print '<tr><td>'.$langs->trans("Type").'</td><td class="valeur">'.$adht->getNomUrl(1)."</td></tr>\n";
// Morphy
print '<tr><td>'.$langs->trans("Nature").'</td><td class="valeur" >'.$object->getmorphylib().'</td>';
print '<tr><td class="titlefield">'.$langs->trans("Nature").'</td><td class="valeur" >'.$object->getmorphylib().'</td>';
/*print '<td rowspan="'.$rowspan.'" align="center" valign="middle" width="25%">';
print $form->showphoto('memberphoto',$member);
print '</td>';*/
print '</tr>';
// Type
print '<tr><td>'.$langs->trans("Type").'</td><td class="valeur">'.$adht->getNomUrl(1)."</td></tr>\n";
// Company
print '<tr><td>'.$langs->trans("Company").'</td><td class="valeur">'.$object->societe.'</td></tr>';
@ -107,21 +105,13 @@ if ($id)
print '<tr><td>'.$langs->trans("UserTitle").'</td><td class="valeur">'.$object->getCivilityLabel().'&nbsp;</td>';
print '</tr>';
// Lastname
print '<tr><td>'.$langs->trans("Lastname").'</td><td class="valeur" colspan="3">'.$object->lastname.'&nbsp;</td>';
print '</tr>';
// Firstname
print '<tr><td>'.$langs->trans("Firstname").'</td><td class="valeur" colspan="3">'.$object->firstname.'&nbsp;</td></tr>';
// Status
print '<tr><td>'.$langs->trans("Status").'</td><td class="valeur">'.$object->getLibStatut(4).'</td></tr>';
print "</table>";
print '</div>';
print '<br>';
$colwidth='20';
$cssclass='titlefield';
$permission = $user->rights->adherent->creer; // Used by the include of notes.tpl.php
include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';

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

@ -251,6 +251,23 @@ else if ($action == 'set_BANK_ASK_PAYMENT_BANK_DURING_ORDER')
}
}
// Activate ask for warehouse
else if ($action == 'set_WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER')
{
$res = dolibarr_set_const($db, "WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER",$value,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
if (! $error)
{
setEventMessage($langs->trans("SetupSaved"));
}
else
{
setEventMessage($langs->trans("Error"),'errors');
}
}
/*
* View
@ -630,6 +647,36 @@ else
print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_ORDER").'</td><td>&nbsp;</td><td align="center">'.$langs->trans('NotAvailable').'</td></tr>';
}
// Ask for warehouse during order
if ($conf->stock->enabled)
{
$var=!$var;
print '<tr '.$bc[$var].'><td>';
print $langs->trans("WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER").'</td><td>&nbsp</td><td align="center">';
if (! empty($conf->use_javascript_ajax))
{
print ajax_constantonoff('WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER');
}
else
{
if (empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER))
{
print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER&amp;value=1">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
}
else
{
print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER&amp;value=0">'.img_picto($langs->trans("Enabled"),'switch_on').'</a>';
}
}
print '</td></tr>';
}
else
{
$var=!$var;
print '<tr '.$bc[$var].'><td>';
print $langs->trans("WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER").'</td><td>&nbsp;</td><td align="center">'.$langs->trans('NotAvailable').'</td></tr>';
}
print '</table>';
print '<br>';

View File

@ -55,12 +55,12 @@ if ($action == 'add' || (GETPOST('add') && $action != 'update'))
if (empty($constname))
{
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Name")),'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Name")), null, 'errors');
$error++;
}
if ($constvalue == '')
{
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Value")),'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Value")), null, 'errors');
$error++;
}

View File

@ -34,6 +34,7 @@ require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$langs->load("errors");
@ -465,6 +466,9 @@ if ($id == 11)
'fichinter' => $langs->trans('InterventionCard')
);
if (! empty($conf->global->MAIN_SUPPORT_SHARED_CONTACT_BETWEEN_THIRDPARTIES)) $elementList["societe"] = $langs->trans('ThirdParty');
complete_elementList_with_modules($elementList);
asort($elementList);
$sourceList = array(
'internal' => $langs->trans('Internal'),

View File

@ -169,19 +169,19 @@ if (($action == 'send' || $action == 'sendhtml') && ! GETPOST('addfile') && ! GE
if (empty($_POST["frommail"]))
{
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("MailFrom")),'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("MailFrom")), null, 'errors');
$action='test';
$error++;
}
if (empty($sendto))
{
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("MailTo")),'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("MailTo")), null, 'errors');
$action='test';
$error++;
}
if (! $error)
{
// Le message est-il en html
// Is the message in HTML?
$msgishtml=0; // Message is not HTML
if ($action == 'sendhtml') $msgishtml=1; // Force message to HTML

View File

@ -135,25 +135,25 @@ if ($action == 'add')
$error=0;
if (! $error && ! $_POST['menu_handler'])
{
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("MenuHandler")), 'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("MenuHandler")), null, 'errors');
$action = 'create';
$error++;
}
if (! $error && ! $_POST['type'])
{
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Type")), 'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Type")), null, 'errors');
$action = 'create';
$error++;
}
if (! $error && ! $_POST['url'])
{
setEventMessage($langs->trans("ErrorFieldRequired",$langs->trans("Url")), 'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Url")), null, 'errors');
$action = 'create';
$error++;
}
if (! $error && ! $_POST['titre'])
{
setEventMessage($langs->trans("ErrorFieldRequired",$langs->trans("Title")), 'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Title")), null, 'errors');
$action = 'create';
$error++;
}

View File

@ -141,7 +141,7 @@ foreach ($modulesdir as $dir)
if (! $objMod->numero > 0)
{
dol_syslog('a module descriptor must have a numero property', LOG_ERR);
dol_syslog('The module descriptor '.$modName.' must have a numero property', LOG_ERR);
}
$j = $objMod->numero;

View File

@ -94,19 +94,19 @@ if ($action == 'send' && ! $_POST['cancel'])
}
if (empty($body))
{
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Message")),'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Message")), null, 'errors');
$action='test';
$error++;
}
if (empty($smsfrom) || ! str_replace('+','',$smsfrom))
{
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("SmsFrom")),'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("SmsFrom")), null, 'errors');
$action='test';
$error++;
}
if (empty($sendto) || ! str_replace('+','',$sendto))
{
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("SmsTo")),'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("SmsTo")), null, 'errors');
$action='test';
$error++;
}

View File

@ -25,11 +25,15 @@
*/
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php';
$langs->load("admin");
$langs->load("help");
$langs->load("members");
$youuselaststable = 0;
/*
* View
@ -42,9 +46,54 @@ print load_fiche_titre("Dolibarr",'','title_setup');
print '<div style="padding-left: 30px;">'.img_picto_common('', 'dolibarr_box.png','height="120"').'</div>';
print '<div class="fichecenter"><div class="fichehalfleft">';
print $langs->trans("Version").' / '.$langs->trans("DolibarrLicense").':';
print '<ul>';
print '<li>'.DOL_VERSION.' / <a href="http://www.gnu.org/copyleft/gpl.html">GNU-GPL v3+</a></li>';
print '<li><strong>'.DOL_VERSION.'</strong>';
$result = getURLContent('http://sourceforge.net/projects/dolibarr/rss');
//var_dump($result['content']);
$sfurl = simplexml_load_string($result['content']);
if ($sfurl)
{
$title=$sfurl->channel[0]->item[0]->title;
function word_limiter($text, $limit = 30, $chars = '0123456789.')
{
if (strlen( $text ) > $limit)
{
$words = str_word_count($text, 2, $chars);
$words = array_reverse($words, TRUE);
foreach($words as $length => $word) {
if ($length + strlen( $word ) >= $limit)
{
array_shift($words);
} else {
break;
}
}
$words = array_reverse($words);
$text = implode(" ", $words) . '';
}
return $text;
}
$str = word_limiter($title);
$str = preg_replace('/[^0-9\.]/', '', $str);
print ' ('.$langs->trans("LastStableVersion").': <b>'.$str.'</b>';
if (DOL_VERSION == $str)
{
$youuselaststable=1;
print $langs->trans("YouUseLastStableVersion");
}
print ')';
print ' / <a href="http://www.gnu.org/copyleft/gpl.html">GNU-GPL v3+</a></li>';
}
print '</ul>';
//print "<br>\n";
@ -114,6 +163,9 @@ print '</li>';
print '</ul>';
print '</div><div class="fichehalfright">';
print $langs->trans("HelpCenter").':';
print '<ul>';
print '<li>';
@ -122,6 +174,7 @@ print '<a target="_blank" href="'.DOL_URL_ROOT.'/support/index.php" data-ajax="f
print '</li>';
print '</ul>';
print $langs->trans("Foundation").':';
print '<ul>';
@ -153,6 +206,33 @@ print '</li>';
print '</ul>';
print '</div>';
print '</div>';
print '<div class="clearboth"></div>';
if ($youuselaststable)
{
print '<br>';
print '<br>';
$tmp=versiondolibarrarray();
if ((empty($tmp[2]) && (strpos($tmp[1], '0') === 0)) || (strpos($tmp[2], '0') === 0))
{
print $langs->trans("TitleExampleForMajorRelease").':<br>';
print '<textarea style="width:80%; min-height: 60px">';
print $langs->trans("ExampleOfNewsMessageForMajorRelease", DOL_VERSION, DOL_VERSION);
print '</textarea>';
}
else
{
print $langs->trans("TitleExampleForMaintenanceRelease").':<br>';
print '<textarea style="width:80%; min-height: 60px">';
print $langs->trans("ExampleOfNewsMessageForMaintenanceRelease", DOL_VERSION, DOL_VERSION);
print '</textarea>';
}
}
llxFooter();

View File

@ -0,0 +1 @@

View File

@ -0,0 +1 @@

View File

@ -96,12 +96,12 @@ if ($action == 'builddoc')
if (empty($forbarcode)) // barcode value
{
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("BarcodeValue")),'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("BarcodeValue")), null, 'errors');
$error++;
}
if (empty($fk_barcode_type)) // barcode type = barcode encoding
{
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("BarcodeType")),'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("BarcodeType")), null, 'errors');
$error++;
}

View File

@ -140,7 +140,7 @@ if ($action == 'add' && $user->rights->categorie->creer)
if (! $object->label)
{
$error++;
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Ref")), 'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Ref")), null, 'errors');
$action = 'create';
}

View File

@ -87,7 +87,7 @@ if ($action == 'update' && $user->rights->categorie->creer)
{
$error++;
$action = 'edit';
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Label")), 'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Label")), null, 'errors');
}
if (! $error && empty($categorie->error))
{

View File

@ -191,14 +191,14 @@ if ($action == 'add')
{
$error++; $donotclearsession=1;
$action = 'create';
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("DateEnd")), 'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DateEnd")), null, 'errors');
}
if (empty($conf->global->AGENDA_USE_EVENT_TYPE) && ! GETPOST('label'))
{
$error++; $donotclearsession=1;
$action = 'create';
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Title")), 'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Title")), null, 'errors');
}
// Initialisation objet cactioncomm
@ -206,7 +206,7 @@ if ($action == 'add')
{
$error++; $donotclearsession=1;
$action = 'create';
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")), 'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), null, 'errors');
}
else
{
@ -289,20 +289,20 @@ if ($action == 'add')
{
$error++; $donotclearsession=1;
$action = 'create';
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("ActionsOwnedBy")), 'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ActionsOwnedBy")), null, 'errors');
}
if ($object->type_code == 'AC_RDV' && ($datep == '' || ($datef == '' && empty($fulldayevent))))
{
$error++; $donotclearsession=1;
$action = 'create';
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("DateEnd")), 'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DateEnd")), null, 'errors');
}
if (! GETPOST('apyear') && ! GETPOST('adyear'))
{
$error++; $donotclearsession=1;
$action = 'create';
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Date")), 'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
}
// Fill array 'array_options' with data from add form
@ -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))
@ -450,7 +450,7 @@ if ($action == 'update')
{
$error++; $donotclearsession=1;
$action = 'edit';
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")), 'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), null, 'errors');
}
else
{
@ -460,7 +460,7 @@ if ($action == 'update')
{
$error++; $donotclearsession=1;
$action = 'edit';
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("ActionsOwnedBy")), 'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ActionsOwnedBy")), null, 'errors');
}
// Fill array 'array_options' with data from add form
@ -1304,7 +1304,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

@ -219,7 +219,7 @@ if (empty($reshook))
$date_delivery = dol_mktime(12, 0, 0, GETPOST('liv_month'), GETPOST('liv_day'), GETPOST('liv_year'));
if ($socid < 1) {
setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Customer")), 'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Customer")), null, 'errors');
$action = 'create';
$error ++;
}
@ -434,7 +434,7 @@ if (empty($reshook))
// Close proposal
else if ($action == 'setstatut' && $user->rights->askpricesupplier->cloturer && ! GETPOST('cancel')) {
if (! GETPOST('statut')) {
setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentities("CloseAs")), 'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("CloseAs")), null, 'errors');
$action = 'statut';
} else {
// prevent browser refresh from closing proposal several times
@ -525,17 +525,17 @@ if (empty($reshook))
}
if (GETPOST('prod_entry_mode') == 'free' && empty($idprod) && GETPOST('type') < 0) {
setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), 'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), null, 'errors');
$error ++;
}
if (GETPOST('prod_entry_mode') == 'free' && empty($idprod) && $price_ht == '') // Unit price can be 0 but not ''. Also price can be negative for proposal.
{
setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("UnitPriceHT")), 'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("UnitPriceHT")), null, 'errors');
$error ++;
}
if (GETPOST('prod_entry_mode') == 'free' && empty($idprod) && empty($product_desc)) {
setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Description")), 'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Description")), null, 'errors');
$error ++;
}
@ -783,7 +783,7 @@ if (empty($reshook))
// Check parameters
if (GETPOST('type') < 0) {
setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), 'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), null, 'errors');
$error ++;
}
}

View File

@ -1264,12 +1264,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

@ -32,6 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php';
if (! empty($conf->contrat->enabled)) require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
if (! empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
if (! empty($conf->commande->enabled)) require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
if (! empty($conf->fournisseur->enabled)) require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
if (! $user->rights->societe->lire) accessforbidden();
@ -65,6 +66,7 @@ $formfile = new FormFile($db);
$companystatic=new Societe($db);
if (! empty($conf->propal->enabled)) $propalstatic=new Propal($db);
if (! empty($conf->commande->enabled)) $orderstatic=new Commande($db);
if (! empty($conf->fournisseur->enabled)) $supplierorderstatic=new CommandeFournisseur($db);
llxHeader();
@ -75,89 +77,58 @@ print '<div class="fichecenter"><div class="fichethirdleft">';
// Search proposal
if (! empty($conf->propal->enabled) && $user->rights->propal->lire)
{
$var=false;
print '<form method="post" action="'.DOL_URL_ROOT.'/comm/propal/list.php">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<table class="noborder nohover" width="100%">';
print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("SearchAProposal").'</td></tr>';
print '<tr '.$bc[$var].'>';
print '<td class="nowrap"><label for="sf_ref">'.$langs->trans("Ref").'</label>:</td><td><input type="text" class="flat" name="sf_ref" id="sf_ref" size="18"></td>';
print '<td rowspan="2"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td></tr>';
print '<tr '.$bc[$var].'><td class="nowrap"><label for="sall">'.$langs->trans("Other").'</label>:</td><td><input type="text" class="flat" name="sall" id="sall" size="18"></td>';
print '</tr>';
print "</table></form>\n";
print "<br>\n";
$listofsearchfields['search_proposal']=array('text'=>'Proposal');
}
// Search customer order
if (! empty($conf->commande->enabled) && $user->rights->commande->lire)
{
$var=false;
print '<form method="post" action="'.DOL_URL_ROOT.'/commande/list.php">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<table class="noborder nohover" width="100%">';
print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("SearchACustomerOrder").'</td></tr>';
print '<tr '.$bc[$var].'><td>';
print '<label for="sref">'.$langs->trans("Ref").'</label>:</td><td><input type="text" class="flat" name="sref" id="sref" size=18></td><td rowspan="2"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td></tr>';
print '<tr '.$bc[$var].'><td class="nowrap"><label for="sall">'.$langs->trans("Other").'</label>:</td><td><input type="text" class="flat" name="sall" id="sall" size="18"></td>';
print '</tr>';
print "</table></form><br>\n";
$listofsearchfields['search_customer_order']=array('text'=>'CustomerOrder');
}
// Search supplier order
if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande->lire)
{
$var=false;
print '<form method="post" action="'.DOL_URL_ROOT.'/fourn/commande/list.php">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<table class="noborder nohover" width="100%">';
print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("SearchASupplierOrder").'</td></tr>';
print '<tr '.$bc[$var].'><td>';
print '<label for="search_ref">'.$langs->trans("Ref").'</label>:</td><td><input type="text" class="flat" name="search_ref" id="search_ref" size=18></td><td rowspan="2"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td></tr>';
print '<tr '.$bc[$var].'><td class="nowrap"><label for="search_all">'.$langs->trans("Other").'</label>:</td><td><input type="text" class="flat" name="search_all" id="search_all" size="18"></td>';
print '</tr>';
print "</table></form><br>\n";
$listofsearchfields['search_supplier_order']=array('text'=>'SupplierOrder');
}
// Search intervention
if (! empty($conf->ficheinter->enabled) && $user->rights->ficheinter->lire)
{
$listofsearchfields['search_intervention']=array('text'=>'Intervention');
}
// Search contract
if (! empty($conf->contrat->enabled) && $user->rights->contrat->lire)
{
$var=false;
print '<form method="post" action="'.DOL_URL_ROOT.'/contrat/list.php">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<table class="noborder nohover" width="100%">';
print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("SearchAContract").'</td></tr>';
print '<tr '.$bc[$var].'>';
print '<td class="nowrap"><label for="search_contract">'.$langs->trans("Ref").'</label>:</td><td><input type="text" class="flat" name="search_contract" id="search_contract" size="18"></td>';
print '<td rowspan="2"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td></tr>';
print '<tr '.$bc[$var].'><td class="nowrap"><label for="sall">'.$langs->trans("Other").'</label>:</td><td><input type="text" class="flat" name="sall" id="sall" size="18"></td>';
print '</tr>';
print "</table></form>\n";
print "<br>";
$listofsearchfields['search_contract']=array('text'=>'Contrat');
}
// Search contract
if (! empty($conf->ficheinter->enabled) && $user->rights->ficheinter->lire)
if (count($listofsearchfields))
{
$var=false;
print '<form method="post" action="'.DOL_URL_ROOT.'/fichinter/list.php">';
print '<form method="post" action="'.DOL_URL_ROOT.'/core/search.php">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<table class="noborder nohover" width="100%">';
print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("SearchAnIntervention").'</td></tr>';
print '<tr '.$bc[$var].'>';
print '<td class="nowrap"><label for="search_contract">'.$langs->trans("Ref").'</label>:</td><td><input type="text" class="flat" name="search_inter" id="search_inter" size="18"></td>';
print '<td rowspan="2"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td></tr>';
print '<tr '.$bc[$var].'><td class="nowrap"><label for="sall">'.$langs->trans("Other").'</label>:</td><td><input type="text" class="flat" name="sall" id="sall" size="18"></td>';
print '</tr>';
print "</table></form>\n";
print "<br>";
print '<table class="noborder nohover centpercent">';
$i=0;
foreach($listofsearchfields as $key => $value)
{
if ($i == 0) print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("Search").'</td></tr>';
print '<tr>';
print '<td class="nowrap"><label for="'.$key.'">'.$langs->trans($value["text"]).'</label>:</td><td><input type="text" class="flat" name="'.$key.'" id="'.$key.'" size="18"></td>';
if ($i == 0) print '<td rowspan="'.count($listofsearchfields).'"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td>';
print '</tr>';
$i++;
}
print '</table>';
print '</form>';
print '<br>';
}
/*
* Draft proposals
*/
if (! empty($conf->propal->enabled) && $user->rights->propal->lire)
{
$langs->load("propal");
$sql = "SELECT p.rowid, p.ref, p.ref_client, p.total_ht, p.tva as total_tva, p.total as total_ttc, s.rowid as socid, s.nom as name, s.client, s.canvas";
$sql.= ", s.code_client";
$sql.= " FROM ".MAIN_DB_PREFIX."propal as p";
@ -177,7 +148,7 @@ if (! empty($conf->propal->enabled) && $user->rights->propal->lire)
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td colspan="3">'.$langs->trans("ProposalsDraft").' <span class="badge">'.$num.'</span></td></tr>';
print '<td colspan="3">'.$langs->trans("ProposalsDraft").($num?' <span class="badge">'.$num.'</span>':'').'</td></tr>';
if ($num > 0)
{
@ -215,6 +186,10 @@ if (! empty($conf->propal->enabled) && $user->rights->propal->lire)
print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td colspan="2" align="right">'.price($total)."</td></tr>";
}
}
else
{
print '<tr colspan="3" '.$bc[$var].'><td>'.$langs->trans("NoProposal").'</td></tr>';
}
print "</table><br>";
$db->free($resql);
@ -252,7 +227,7 @@ if (! empty($conf->commande->enabled) && $user->rights->commande->lire)
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td colspan="3">'.$langs->trans("DraftOrders").' <span class="badge">'.$num.'</span></td></tr>';
print '<td colspan="3">'.$langs->trans("DraftOrders").($num?' <span class="badge">'.$num.'</span>':'').'</td></tr>';
if ($num)
{
@ -290,10 +265,96 @@ if (! empty($conf->commande->enabled) && $user->rights->commande->lire)
print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td colspan="2" align="right">'.price($total)."</td></tr>";
}
}
else
{
print '<tr colspan="3" '.$bc[$var].'><td>'.$langs->trans("NoOrder").'</td></tr>';
}
print "</table><br>";
$db->free($resql);
}
else
{
dol_print_error($db);
}
}
/*
* Draft suppliers orders
*/
if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande->lire)
{
$langs->load("orders");
$sql = "SELECT cf.rowid, cf.ref, cf.ref_supplier, cf.total_ttc, s.rowid as socid, s.nom as name, s.client, s.canvas";
$sql.= ", s.code_client";
$sql.= ", s.code_fournisseur";
$sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as cf";
$sql.= ", ".MAIN_DB_PREFIX."societe as s";
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE cf.fk_soc = s.rowid";
$sql.= " AND cf.fk_statut = 0";
$sql.= " AND cf.entity IN (".getEntity('supplier_order', 1).")";
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
if ($socid) $sql.= " AND cf.fk_soc = ".$socid;
$resql = $db->query($sql);
if ($resql)
{
$total = 0;
$num = $db->num_rows($resql);
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td colspan="3">'.$langs->trans("DraftSuppliersOrders").($num?' <span class="badge">'.$num.'</span>':'').'</td></tr>';
if ($num)
{
$i = 0;
$var = true;
while ($i < $num)
{
$var=!$var;
$obj = $db->fetch_object($resql);
print '<tr '.$bc[$var].'><td class="nowrap">';
$supplierorderstatic->id=$obj->rowid;
$supplierorderstatic->ref=$obj->ref;
$supplierorderstatic->ref_supplier=$obj->ref_suppliert;
$supplierorderstatic->total_ht = $obj->total_ht;
$supplierorderstatic->total_tva = $obj->total_tva;
$supplierorderstatic->total_ttc = $obj->total_ttc;
print $supplierorderstatic->getNomUrl(1);
print '</td>';
print '<td class="nowrap">';
$companystatic->id=$obj->socid;
$companystatic->name=$obj->name;
$companystatic->client=$obj->client;
$companystatic->code_client = $obj->code_client;
$companystatic->code_fournisseur = $obj->code_fournisseur;
$companystatic->canvas=$obj->canvas;
print $companystatic->getNomUrl(1,'customer',16);
print '</td>';
print '<td align="right" class="nowrap">'.price($obj->total_ttc).'</td></tr>';
$i++;
$total += $obj->total_ttc;
}
if ($total>0)
{
$var=!$var;
print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td colspan="2" align="right">'.price($total)."</td></tr>";
}
}
else
{
print '<tr colspan="3" '.$bc[$var].'><td>'.$langs->trans("NoSupplierOrder").'</td></tr>';
}
print "</table><br>";
$db->free($resql);
} else {
dol_print_error($db);
}
}

View File

@ -403,7 +403,7 @@ if (empty($reshook))
$object->sendto = $_POST["sendto"];
if (! $object->sendto)
{
setEventMessage($langs->trans("ErrorFieldRequired",$langs->trans("MailTo")), 'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("MailTo")), null, 'errors');
$error++;
}

View File

@ -129,7 +129,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');
}
@ -141,7 +141,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 = '';
}
}
@ -222,7 +222,7 @@ if (empty($reshook))
if (empty($datep)) {
$error ++;
setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), 'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
}
if (! $error) {
@ -267,18 +267,19 @@ if (empty($reshook))
$duration = GETPOST('duree_validite');
if (empty($datep)) {
setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), 'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
$action = 'create';
$error ++;
}
if (empty($duration)) {
setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ValidityDuration")), 'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ValidityDuration")), null, 'errors');
$action = 'create';
$error ++;
}
if ($socid < 1) {
setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Customer")), 'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Customer")), null, 'errors');
$action = 'create';
$error ++;
}
@ -575,7 +576,7 @@ if (empty($reshook))
else if ($action == 'setstatut' && $user->rights->propal->cloturer && ! GETPOST('cancel'))
{
if (! GETPOST('statut')) {
setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentities("CloseAs")), 'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CloseAs")), null, 'errors');
$action = 'statut';
} else {
// prevent browser refresh from closing proposal several times
@ -621,7 +622,7 @@ if (empty($reshook))
else if ($action == 'setstatut' && $user->rights->propal->cloturer && ! GETPOST('cancel'))
{
if (! GETPOST('statut')) {
setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentities("CloseAs")), 'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CloseAs")), null, 'errors');
$action = 'statut';
} else {
// prevent browser refresh from closing proposal several times
@ -710,17 +711,17 @@ if (empty($reshook))
}
if (GETPOST('prod_entry_mode') == 'free' && empty($idprod) && GETPOST('type') < 0) {
setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), 'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), null, 'errors');
$error ++;
}
if (GETPOST('prod_entry_mode') == 'free' && empty($idprod) && $price_ht == '') // Unit price can be 0 but not ''. Also price can be negative for proposal.
{
setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("UnitPriceHT")), 'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("UnitPriceHT")), null, 'errors');
$error ++;
}
if (GETPOST('prod_entry_mode') == 'free' && empty($idprod) && empty($product_desc)) {
setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Description")), 'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Description")), null, 'errors');
$error ++;
}
@ -999,7 +1000,7 @@ if (empty($reshook))
// Check parameters
if (GETPOST('type') < 0) {
setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), 'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), null, 'errors');
$error ++;
}
}

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

@ -438,7 +438,8 @@ 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, $product_type, '', $localtaxes_type);
$tabprice=calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $product_type, $mysoc, $localtaxes_type);
$total_ht = $tabprice[0];
$total_tva = $tabprice[1];
$total_ttc = $tabprice[2];
@ -1039,7 +1040,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';
@ -1052,44 +1053,42 @@ class Propal extends CommonObject
foreach($this->lines as $line)
$line->fetch_optionals($line->rowid);
// Load source object
$objFrom = 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"))
{
@ -1098,32 +1097,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++;
}
}
@ -1133,9 +1132,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++;
}
@ -1151,7 +1150,7 @@ class Propal extends CommonObject
if (! $error)
{
$this->db->commit();
return $this->id;
return $clonedObj->id;
}
else
{
@ -1457,12 +1456,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;
@ -2100,26 +2099,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

@ -108,6 +108,15 @@ $viewstatut=$object_statut;
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('propallist'));
// List of fields to search into when doing a "search in all"
$fieldstosearchall = array(
'p.ref'=>'Ref',
'p.ref_client'=>'CustomerRef',
'pd.description'=>'Description',
's.nom'=>"ThirdParty",
'p.note_public'=>'NotePublic',
);
if (empty($user->socid)) $fieldstosearchall["p.note_private"]="NotePrivate";
/*
@ -192,7 +201,7 @@ if ($search_montant_ht != '')
$sql.= natural_search("p.total_ht", $search_montant_ht, 1);
}
if ($sall) {
$sql .= natural_search(array('s.nom', 'p.note_private', 'p.note_public', 'pd.description'), $sall);
$sql .= natural_search(array_keys($fieldstosearchall), $sall);
}
if ($search_product_category > 0) $sql.=" AND cp.fk_categorie = ".$search_product_category;
if ($socid > 0) $sql.= ' AND s.rowid = '.$socid;
@ -262,8 +271,19 @@ if ($result)
// Lignes des champs de filtre
print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="list">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
if ($sall)
{
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
//sort($fieldstosearchall);
print $langs->trans("FilterOnInto", $sall, join(', ',$fieldstosearchall));
}
$i = 0;
$moreforfilter='';

View File

@ -140,7 +140,7 @@ if ($action == 'setremise')
$error=0;
if (empty($_POST["desc"]))
{
setEventMessage($langs->trans("ErrorFieldRequired",$langs->trans("ReasonDiscount")), 'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("ReasonDiscount")), null, 'errors');
$error++;
}

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>
@ -151,7 +151,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)
@ -166,7 +166,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);
@ -231,7 +231,7 @@ if (empty($reshook))
}
if ($socid < 1) {
setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Customer")), 'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Customer")), null, 'errors');
$action = 'create';
$error++;
}
@ -595,7 +595,7 @@ if (empty($reshook))
}
if (GETPOST('prod_entry_mode') == 'free' && empty($idprod) && (! ($price_ht >= 0) || $price_ht == '')) // Unit price can be 0 but not ''
{
setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("UnitPriceHT")), 'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("UnitPriceHT")), null, 'errors');
$error++;
}
if ($qty == '') {
@ -875,7 +875,7 @@ if (empty($reshook))
// Check parameters
if (GETPOST('type') < 0) {
setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), 'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), null, 'errors');
$error++;
}
}

View File

@ -227,14 +227,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;
}
@ -251,7 +251,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);
}
@ -702,6 +702,7 @@ class Commande extends CommonOrder
$sql.= " ref, fk_soc, date_creation, fk_user_author, fk_projet, date_commande, source, note_private, note_public, ref_ext, ref_client, ref_int";
$sql.= ", model_pdf, fk_cond_reglement, fk_mode_reglement, fk_account, fk_availability, fk_input_reason, date_livraison, fk_delivery_address";
$sql.= ", fk_shipping_method";
$sql.= ", fk_warehouse";
$sql.= ", remise_absolue, remise_percent";
$sql.= ", fk_incoterms, location_incoterms";
$sql.= ", entity";
@ -724,6 +725,7 @@ class Commande extends CommonOrder
$sql.= ", ".($this->date_livraison?"'".$this->db->idate($this->date_livraison)."'":"null");
$sql.= ", ".($this->fk_delivery_address>0?$this->fk_delivery_address:'NULL');
$sql.= ", ".($this->shipping_method_id>0?$this->shipping_method_id:'NULL');
$sql.= ", ".($this->warehouse_id>0?$this->warehouse_id:'NULL');
$sql.= ", ".($this->remise_absolue>0?$this->db->escape($this->remise_absolue):'NULL');
$sql.= ", ".($this->remise_percent>0?$this->db->escape($this->remise_percent):0);
$sql.= ", ".(int) $this->fk_incoterms;
@ -1009,116 +1011,113 @@ 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->warehouse_id = $object->warehouse_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;
}
@ -1146,7 +1145,7 @@ class Commande extends CommonOrder
* @param int $fk_fournprice Id supplier price
* @param int $pa_ht Buying price (without tax)
* @param string $label Label
* @param array $array_options extrafields array
* @param array $array_options extrafields array. Example array('options_codeforfield1'=>'valueforfield1', 'options_codeforfield2'=>'valueforfield2', ...)
* @param string $fk_unit Code of the unit to use. Null to use the default one
* @return int >0 if OK, <0 if KO
*
@ -1436,6 +1435,7 @@ class Commande extends CommonOrder
$sql.= ', c.date_commande';
$sql.= ', c.date_livraison';
$sql.= ', c.fk_shipping_method';
$sql.= ', c.fk_warehouse';
$sql.= ', c.fk_projet, c.remise_percent, c.remise, c.remise_absolue, c.source, c.facture as billed';
$sql.= ', c.note_private, c.note_public, c.ref_client, c.ref_ext, c.ref_int, c.model_pdf, c.fk_delivery_address, c.extraparams';
$sql.= ', c.fk_incoterms, c.location_incoterms';
@ -1503,6 +1503,7 @@ class Commande extends CommonOrder
$this->demand_reason_code = $obj->demand_reason_code;
$this->date_livraison = $this->db->jdate($obj->date_livraison);
$this->shipping_method_id = ($obj->fk_shipping_method>0)?$obj->fk_shipping_method:null;
$this->warehouse_id = ($obj->fk_warehouse>0)?$obj->fk_warehouse:null;
$this->fk_delivery_address = $obj->fk_delivery_address;
//Incoterms

View File

@ -76,7 +76,7 @@ $limit = $conf->liste_limit;
$viewstatut=GETPOST('viewstatut');
// Purge search criteria
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
{
$search_categ='';
$search_user='';
@ -95,6 +95,17 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('orderlist'));
// List of fields to search into when doing a "search in all"
$fieldstosearchall = array(
'c.ref'=>'Ref',
'c.ref_client'=>'RefCustomerOrder',
'pd.description'=>'Description',
's.nom'=>"ThirdParty",
'c.note_public'=>'NotePublic',
);
if (empty($user->socid)) $fieldstosearchall["c.note_private"]="NotePrivate";
/*
* Actions
*/
@ -139,7 +150,7 @@ if ($search_product_category > 0) $sql.=" AND cp.fk_categorie = ".$search_produc
if ($socid > 0) $sql.= ' AND s.rowid = '.$socid;
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
if ($search_ref) $sql .= natural_search('c.ref', $search_ref);
if ($sall) $sql .= natural_search(array('c.ref', 'c.note_private'), $sall);
if ($sall) $sql .= natural_search(array_keys($fieldstosearchall), $sall);
if ($viewstatut <> '')
{
if ($viewstatut < 4 && $viewstatut > -3)
@ -259,9 +270,19 @@ if ($resql)
// Lignes des champs de filtre
print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="list">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="viewstatut" value="'.$viewstatut.'">';
if ($sall)
{
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
print $langs->trans("FilterOnInto", $sall, join(', ',$fieldstosearchall));
}
$moreforfilter='';
// If the user can view prospects other than his'
@ -305,7 +326,7 @@ if ($resql)
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans('Ref'),$_SERVER["PHP_SELF"],'c.ref','',$param,'width="25%"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('RefCustomerOrder'),$_SERVER["PHP_SELF"],'c.ref_client','',$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('Company'),$_SERVER["PHP_SELF"],'s.nom','',$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('ThirdParty'),$_SERVER["PHP_SELF"],'s.nom','',$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('OrderDate'),$_SERVER["PHP_SELF"],'c.date_commande','',$param, 'align="center"',$sortfield,$sortorder);
if (empty($conf->global->ORDER_DISABLE_DELIVERY_DATE)) print_liste_field_titre($langs->trans('DeliveryDate'),$_SERVER["PHP_SELF"],'c.date_livraison','',$param, 'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans('AmountHT'),$_SERVER["PHP_SELF"],'c.total_ht','',$param, 'align="right"',$sortfield,$sortorder);

View File

@ -135,15 +135,15 @@ if ($action == 'add' && $id && ! isset($_POST["cancel"]) && $user->rights->banqu
if (! $dateop) {
$error++;
setEventMessage($langs->trans("ErrorFieldRequired",$langs->trans("Date")), 'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Date")), null, 'errors');
}
if (! $operation) {
$error++;
setEventMessage($langs->trans("ErrorFieldRequired",$langs->trans("Type")), 'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Type")), null, 'errors');
}
if (! $amount) {
$error++;
setEventMessage($langs->trans("ErrorFieldRequired",$langs->trans("Amount")), 'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Amount")), null, 'errors');
}
if (! $error)

View File

@ -200,7 +200,7 @@ if ($id > 0 || !empty($ref)) {
* Confirmation suppression fichier
*/
if ($action == 'delete') {
$ret = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id . '&urlfile=' . urlencode($_GET["urlfile"]),
$ret = $form->form_confirm($_SERVER["PHP_SELF"] . '?id=' . $object->id . '&urlfile=' . urlencode($_GET["urlfile"]),
$langs->trans('DeleteFile'),
$langs->trans('ConfirmDeleteFile'), 'confirm_deletefile',
'', 0, 1);

View File

@ -166,7 +166,7 @@ if ($user->rights->banque->consolidate && ($action == 'num_releve' || $action ==
// Check parameters
if ($rappro && empty($num_rel))
{
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("AccountStatement")), 'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("AccountStatement")), null, 'errors');
$error++;
}

View File

@ -54,22 +54,22 @@ if ($action == 'add')
if (! $label)
{
$error=1;
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Description")), 'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Description")), null, 'errors');
}
if (! $amount)
{
$error=1;
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Amount")), 'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Amount")), null, 'errors');
}
if (! GETPOST('account_from','int'))
{
$error=1;
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("TransferFrom")), 'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("TransferFrom")), null, 'errors');
}
if (! GETPOST('account_to','int'))
{
$error=1;
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("TransferTo")), 'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("TransferTo")), null, 'errors');
}
if (! $error)
{

View File

@ -125,17 +125,17 @@ else if ($action == 'add' && $user->rights->deplacement->creer)
if (! $object->date)
{
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Date")), 'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
$error++;
}
if ($object->type == '-1')
{
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Type")), 'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), null, 'errors');
$error++;
}
if (! ($object->fk_user > 0))
{
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Person")), 'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Person")), null, 'errors');
$error++;
}

View File

@ -277,7 +277,7 @@ if (empty($reshook))
$date = dol_mktime(12, 0, 0, $_POST['invoicedatemonth'], $_POST['invoicedateday'], $_POST['invoicedateyear']);
if (empty($date))
{
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Date")),'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$id.'&action=editinvoicedate');
exit;
}
@ -550,7 +550,7 @@ if (empty($reshook))
$result = $object->set_paid($user, $close_code, $close_note);
if ($result<0) setEventMessage($object->error,'errors');
} else {
setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Reason")), 'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Reason")), null, 'errors');
}
} // Classify "abandoned"
else if ($action == 'confirm_canceled' && $confirm == 'yes') {
@ -561,7 +561,7 @@ if (empty($reshook))
$result = $object->set_canceled($user, $close_code, $close_note);
if ($result<0) setEventMessage($object->error,'errors');
} else {
setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Reason")), 'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Reason")), null, 'errors');
}
}
@ -671,12 +671,12 @@ if (empty($reshook))
if (empty($dateinvoice))
{
$error++;
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Date")),'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
}
if (! ($_POST['fac_replacement'] > 0)) {
$error ++;
setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ReplaceInvoice")), 'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ReplaceInvoice")), null, 'errors');
}
if (! $error) {
@ -716,14 +716,14 @@ if (empty($reshook))
if (! ($_POST['fac_avoir'] > 0))
{
$error ++;
setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CorrectInvoice")), 'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CorrectInvoice")), null, 'errors');
}
$dateinvoice = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
if (empty($dateinvoice))
{
$error ++;
setEventMessage($langs->trans("ErrorFieldRequired", $langs->trans("Date")), 'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Date")), null, 'errors');
}
if (! $error)
@ -815,7 +815,7 @@ if (empty($reshook))
if (empty($dateinvoice))
{
$error++;
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Date")),'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
}
if (! $error)
@ -843,14 +843,14 @@ if (empty($reshook))
if (GETPOST('socid', 'int') < 1)
{
$error ++;
setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Customer")), 'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Customer")), null, 'errors');
}
$dateinvoice = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
if (empty($dateinvoice))
{
$error++;
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Date")),'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
}
if (! $error)
@ -1245,7 +1245,7 @@ if (empty($reshook))
}
if (GETPOST('prod_entry_mode') == 'free' && empty($idprod) && (! ($price_ht >= 0) || $price_ht == '')) // Unit price can be 0 but not ''
{
setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("UnitPriceHT")), 'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("UnitPriceHT")), null, 'errors');
$error ++;
}
if ($qty == '') {
@ -1555,7 +1555,7 @@ if (empty($reshook))
// Check parameters
if (GETPOST('type') < 0) {
setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), 'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), null, 'errors');
$error ++;
}
}
@ -1790,6 +1790,9 @@ if (empty($reshook))
dol_print_error($db);
}
}
if ($error)
$action = 'edit_extras';
}
}
@ -2344,8 +2347,8 @@ if ($action == 'create')
}
print '<tr><td>' . $langs->trans($newclassname) . '</td><td colspan="2">' . $objectsrc->getNomUrl(1);
//We check if Origin document has already an invoice attached to it
$objectsrc->fetchObjectLinked($originid,'','','facture');
// We check if Origin document (id and type is known) has already at least one invoice attached to it
$objectsrc->fetchObjectLinked($originid,$origin,'','facture');
$cntinvoice=count($objectsrc->linkedObjects['facture']);
if ($cntinvoice>=1)
{

View File

@ -65,8 +65,8 @@ $textobject=strtolower($langs->transnoentitiesnoconv("BillsCustomers"));
llxHeader('',$langs->trans("BillsSetup"));
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans("BillsSetup"),$linkback,'title_setup');
print '<br>';
$head = invoice_admin_prepare_head();

View File

@ -66,8 +66,8 @@ $textobject=strtolower($langs->transnoentitiesnoconv("BillsCustomers"));
llxHeader('',$langs->trans("BillsSetup"));
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
print load_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

@ -122,6 +122,64 @@ class Facture extends CommonInvoice
*/
public $situation_final;
/**
* Standard invoice
*/
const TYPE_STANDARD = 0;
/**
* Replacement invoice
*/
const TYPE_REPLACEMENT = 1;
/**
* Credit note invoice
*/
const TYPE_CREDIT_NOTE = 2;
/**
* Deposit invoice
*/
const TYPE_DEPOSIT = 3;
/**
* Proforma invoice (should not be used. a proforma is an order)
*/
const TYPE_PROFORMA = 4;
/**
* Situation invoice
*/
const TYPE_SITUATION = 5;
/**
* Draft
*/
const STATUS_DRAFT = 0;
/**
* Validated (need to be paid)
*/
const STATUS_VALIDATED = 1;
/**
* Classified paid.
* If paid partially, $this->close_code can be:
* - CLOSECODE_DISCOUNTVAT
* - CLOSECODE_BADDEBT
* If paid completelly, this->close_code will be null
*/
const STATUS_CLOSED = 2;
/**
* Classified abandoned and no payment done.
* $this->close_code can be:
* - CLOSECODE_BADDEBT
* - CLOSECODE_ABANDONED
* - CLOSECODE_REPLACED
*/
const STATUS_ABANDONED = 3;
const CLOSECODE_DISCOUNTVAT = 'discount_vat';
const CLOSECODE_BADDEBT = 'badcustomer';
const CLOSECODE_ABANDONED = 'abandon';
@ -1732,7 +1790,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

@ -107,6 +107,16 @@ $hookmanager->initHooks(array('invoicelist'));
$now=dol_now();
// List of fields to search into when doing a "search in all"
$fieldstosearchall = array(
'f.facnumber'=>'Ref',
'f.ref_client'=>'RefCustomer',
'fd.description'=>'Description',
's.nom'=>"ThirdParty",
'f.note_public'=>'NotePublic',
);
if (empty($user->socid)) $fieldstosearchall["f.note_private"]="NotePrivate";
/*
* Actions
@ -134,6 +144,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both
$month='';
}
/*
* View
@ -232,7 +243,7 @@ if (! $sall)
}
else
{
$sql .= natural_search(array('s.nom', 'f.facnumber', 'f.note_public', 'fd.description'), $sall);
$sql .= natural_search(array_keys($fieldstosearchall), $sall);
}
$sql.= ' ORDER BY ';
$listfield=explode(',',$sortfield);
@ -275,7 +286,19 @@ if ($resql)
$i = 0;
print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">'."\n";
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="list">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="viewstatut" value="'.$viewstatut.'">';
if ($sall)
{
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
print $langs->trans("FilterOnInto", $sall, join(', ',$fieldstosearchall));
}
// If the user can view prospects other than his'
$moreforfilter='';
if ($user->rights->societe->client->voir || $socid)

View File

@ -71,37 +71,40 @@ print load_fiche_titre($langs->trans("HRMArea"),'', 'title_hrm.png');
print '<div class="fichecenter"><div class="fichethirdleft">';
/*
* Search expenses
*/
if (! empty($conf->holiday->enabled) && $user->rights->holiday->read)
{
$langs->load("holiday");
$listofsearchfields['search_holiday']=array('text'=>'TitreRequestCP');
}
if (! empty($conf->deplacement->enabled) && $user->rights->deplacement->lire)
{
$langs->load("trips");
print '<form method="post" action="'.DOL_URL_ROOT.'/compta/deplacement/list.php">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<table class="noborder nohover" width="100%">';
print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("SearchATripAndExpense").'</td></tr>';
print "<tr ".$bc[0].">";
print "<td><label for=\"search_ref\">".$langs->trans("Ref").'</label>:</td><td><input type="text" name="search_ref" id="search_ref" class="flat" size="18"></td>';
print '<td><input type="submit" value="'.$langs->trans("Search").'" class="button"></td>';
//print "<tr ".$bc[0]."><td><label for=\"sall\">".$langs->trans("Other").'</label>:</td><td><input type="text" name="sall" id="sall" class="flat" size="18"></td>';
print '</tr>';
print "</table></form><br>";
$listofsearchfields['search_deplacement']=array('text'=>'ExpenseReport');
}
if (! empty($conf->expensereport->enabled) && $user->rights->expensereport->lire)
{
$langs->load("trips");
print '<form method="post" action="'.DOL_URL_ROOT.'/expensereport/list.php">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<table class="noborder nohover" width="100%">';
print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("SearchATripAndExpense").'</td></tr>';
print "<tr ".$bc[0].">";
print "<td><label for=\"search_ref\">".$langs->trans("Ref").'</label>:</td><td><input type="text" name="search_ref" id="search_ref" class="flat" size="18"></td>';
print '<td><input type="submit" value="'.$langs->trans("Search").'" class="button"></td>';
//print "<tr ".$bc[0]."><td><label for=\"sall\">".$langs->trans("Other").'</label>:</td><td><input type="text" name="sall" id="sall" class="flat" size="18"></td>';
print '</tr>';
print "</table></form><br>";
$listofsearchfields['search_expensereport']=array('text'=>'ExpenseReport');
}
if (count($listofsearchfields))
{
print '<form method="post" action="'.DOL_URL_ROOT.'/core/search.php">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<table class="noborder nohover centpercent">';
$i=0;
foreach($listofsearchfields as $key => $value)
{
if ($i == 0) print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("Search").'</td></tr>';
print '<tr>';
print '<td class="nowrap"><label for="'.$key.'">'.$langs->trans($value["text"]).'</label>:</td><td><input type="text" class="flat" name="'.$key.'" id="'.$key.'" size="18"></td>';
if ($i == 0) print '<td rowspan="'.count($listofsearchfields).'"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td>';
print '</tr>';
$i++;
}
print '</table>';
print '</form>';
print '<br>';
}

View File

@ -90,56 +90,40 @@ print '<div class="fichecenter"><div class="fichethirdleft">';
$max=3;
/*
* Search invoices
*/
// Search customer invoices
if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
{
print '<form method="post" action="'.DOL_URL_ROOT.'/compta/facture/list.php">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<table class="noborder nohover" width="100%">';
print "<tr class=\"liste_titre\">";
print '<td colspan="3">'.$langs->trans("SearchACustomerInvoice").'</td></tr>';
print "<tr ".$bc[0]."><td><label for=\"sf_ref\">".$langs->trans("Ref").'</label>:</td><td><input type="text" name="sf_ref" id="sf_ref" class="flat" size="18"></td>';
print '<td rowspan="2"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td></tr>';
print "<tr ".$bc[0]."><td><label for=\"sall\">".$langs->trans("Other").'</label>:</td><td><input type="text" name="sall" id="sall" class="flat" size="18"></td>';
print '</tr>';
print "</table></form><br>";
$listofsearchfields['search_invoice']=array('text'=>'CustomerInvoice');
}
/*
* Search supplier invoices
*/
// Search supplier invoices
if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->lire)
{
print '<form method="post" action="'.DOL_URL_ROOT.'/fourn/facture/list.php">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<table class="noborder nohover" width="100%">';
print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("SearchASupplierInvoice").'</td></tr>';
print "<tr ".$bc[0].">";
print "<td><label for=\"search_ref\">".$langs->trans("Ref").'</label>:</td><td><input type="text" name="search_ref" id="search_ref" class="flat" size="18"></td>';
print '<td rowspan="2"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td></tr>';
print "<tr ".$bc[0]."><td><label for=\"search_ref_supplier\">".$langs->trans("RefSupplier").'</label>:</td><td><input type="text" name="search_ref_supplier" id="search_ref_supplier" class="flat" size="18"></td>';
print '</tr>';
print "</table></form><br>";
$listofsearchfields['search_supplier_invoice']=array('text'=>'SupplierInvoice');
}
/*
* Search donations
*/
if (! empty($conf->don->enabled) && $user->rights->don->lire)
{
$langs->load("donations");
print '<form method="post" action="'.DOL_URL_ROOT.'/don/list.php">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<table class="noborder nohover" width="100%">';
print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("SearchADonation").'</td></tr>';
print "<tr ".$bc[0].">";
print "<td><label for=\"search_ref\">".$langs->trans("Ref").'</label>:</td><td><input type="text" name="search_ref" id="search_ref" class="flat" size="18"></td>';
print '<td><input type="submit" value="'.$langs->trans("Search").'" class="button"></td>';
//print "<tr ".$bc[0]."><td><label for=\"sall\"".$langs->trans("Other").'</label>:</td><td><input type="text" name="sall" id="sall" class="flat" size="18"></td>';
print '</tr>';
print "</table></form><br>";
$listofsearchfields['search_donation']=array('text'=>'Donation');
}
if (count($listofsearchfields))
{
print '<form method="post" action="'.DOL_URL_ROOT.'/core/search.php">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<table class="noborder nohover centpercent">';
$i=0;
foreach($listofsearchfields as $key => $value)
{
if ($i == 0) print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("Search").'</td></tr>';
print '<tr>';
print '<td class="nowrap"><label for="'.$key.'">'.$langs->trans($value["text"]).'</label>:</td><td><input type="text" class="flat" name="'.$key.'" id="'.$key.'" size="18"></td>';
if ($i == 0) print '<td rowspan="'.count($listofsearchfields).'"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td>';
print '</tr>';
$i++;
}
print '</table>';
print '</form>';
print '<br>';
}
/**

View File

@ -61,7 +61,7 @@ if ($action == 'confirm_rejet')
if (empty($daterej))
{
$error++;
setEventMessage($langs->trans("ErrorFieldRequired",$langs->trans("Date")),'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("Date")), null, 'errors');
}
elseif ($daterej > dol_now())
@ -74,7 +74,7 @@ if ($action == 'confirm_rejet')
if (GETPOST('motif','alpha') == 0)
{
$error++;
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("RefusedReason")),'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("RefusedReason")), null, 'errors');
}
if ( ! $error )

View File

@ -92,27 +92,27 @@ if ($action == 'add' && $_POST["cancel"] <> $langs->trans("Cancel"))
if (empty($datep) || empty($datev) || empty($datesp) || empty($dateep))
{
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Date")),'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
$error++;
}
if (empty($object->fk_user) || $object->fk_user < 0)
{
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Employee")),'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Employee")), null, 'errors');
$error++;
}
if (empty($object->type_payment) || $object->type_payment < 0)
{
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("PaymentMode")),'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("PaymentMode")), null, 'errors');
$error++;
}
if (empty($object->amount))
{
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Amount")),'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Amount")), null, 'errors');
$error++;
}
if (! empty($conf->banque->enabled) && ! $object->accountid > 0)
{
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Account")),'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Account")), null, 'errors');
$error++;
}

View File

@ -79,26 +79,26 @@ 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)
{
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("DateDue")), 'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("DateDue")), null, 'errors');
$action = 'create';
}
elseif (! $dateperiod)
{
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Period")), 'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Period")), null, 'errors');
$action = 'create';
}
elseif (! $actioncode > 0)
{
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Type")), 'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Type")), null, 'errors');
$action = 'create';
}
elseif (empty($amount))
{
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Amount")), 'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Amount")), null, 'errors');
$action = 'create';
}
elseif (! is_numeric($amount))
@ -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,23 +130,28 @@ 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');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("DateDue")), null, 'errors');
$action = 'edit';
}
elseif (! $dateperiod)
{
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Period")), 'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Period")), null, 'errors');
$action = 'edit';
}
elseif (empty($amount))
{
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Amount")), 'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Amount")), null, '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

@ -81,22 +81,22 @@ if ($action == 'add' && $_POST["cancel"] <> $langs->trans("Cancel"))
if (empty($tva->datev))
{
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("DateValue")),'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DateValue")), null, 'errors');
$error++;
}
if (empty($tva->datep))
{
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("DatePayment")),'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DatePayment")), null, 'errors');
$error++;
}
if (empty($tva->type_payment) || $tva->type_payment < 0)
{
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("PaymentMode")),'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("PaymentMode")), null, 'errors');
$error++;
}
if (empty($tva->amount))
{
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Amount")),'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Amount")), null, 'errors');
$error++;
}

View File

@ -1144,12 +1144,14 @@ class Contact extends CommonObject
// Process
foreach ($to_del as $del) {
$c->fetch($del);
$c->del_type($this, 'contact');
if ($c->fetch($del) > 0) {
$c->del_type($this, 'contact');
}
}
foreach ($to_add as $add) {
$c->fetch($add);
$c->add_type($this, 'contact');
if ($c->fetch($add) > 0) {
$c->add_type($this, 'contact');
}
}
return;

View File

@ -95,6 +95,8 @@ if ($object->id)
$totalsize+=$file['size'];
}
$linkback = '<a href="'.DOL_URL_ROOT.'/contact/list.php">'.$langs->trans("BackToList").'</a>';
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', '');
print '<div class="fichecenter">';

View File

@ -40,6 +40,7 @@ $contactid = GETPOST('id','int');
if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'contact', $contactid,'');
$sall=GETPOST("sall");
$search_firstlast_only=GETPOST("search_firstlast_only");
$search_lastname=GETPOST("search_lastname");
$search_firstname=GETPOST("search_firstname");
@ -56,13 +57,13 @@ $search_priv=GETPOST("search_priv");
$search_categ=GETPOST("search_categ",'int');
$search_status=GETPOST("search_status",'int');
if ($search_status=='') $search_status=1; // always display activ customer first
$optioncss = GETPOST('optioncss','alpha');
$type=GETPOST("type");
$view=GETPOST("view");
$sall=GETPOST("contactname");
$sortfield = GETPOST('sortfield', 'alpha');
$sortorder = GETPOST('sortorder', 'alpha');
$page = GETPOST('page', 'int');
@ -98,8 +99,9 @@ else if ($type == "o")
$urlfiche="";
}
if (GETPOST('button_removefilter_x') || GETPOST('button_removefilter')) // Both tests are required to be compatible with all browsers
if (GETPOST('button_removefilter_x') || GETPOST('button_removefilter.x') || GETPOST('button_removefilter')) // All tests are required to be compatible with all browsers
{
$sall="";
$search_firstlast_only="";
$search_lastname="";
$search_firstname="";
@ -113,11 +115,17 @@ if (GETPOST('button_removefilter_x') || GETPOST('button_removefilter')) // Both
$search_email="";
$search_skype="";
$search_priv="";
$sall="";
$seach_status=1;
}
if ($search_priv < 0) $search_priv='';
// List of fields to search into when doing a "search in all"
$fieldstosearchall = array(
'p.lastname'=>'Lastname',
'p.firstname'=>'Firstname',
'p.email'=>'EMail',
's.nom'=>"ThirdParty",
);
/*
@ -225,7 +233,7 @@ else if ($type == "p") // filtre sur type
}
if ($sall)
{
$sql .= natural_search(array('p.lastname', 'p.firstname', 'p.email', 's.nom'), $sall);
$sql .= natural_search(array_keys($fieldstosearchall), $sall);
}
if (! empty($socid))
{
@ -241,13 +249,13 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
// Add order and limit
if($view == "recent")
{
$sql.= " ORDER BY p.datec DESC ";
$sql.= " ".$db->plimit($conf->liste_limit+1, $offset);
$sql.= $db->order("p.datec","DESC");
$sql.= $db->plimit($conf->liste_limit+1, $offset);
}
else
{
$sql.= " ORDER BY $sortfield $sortorder ";
$sql.= " ".$db->plimit($conf->liste_limit+1, $offset);
$sql.= $db->order($sortfield,$sortorder);
$sql.= $db->plimit($conf->liste_limit+1, $offset);
}
//print $sql;
@ -278,11 +286,12 @@ if ($result)
if ($sall)
{
print $langs->trans("Filter")." (".$langs->trans("Lastname").", ".$langs->trans("Firstname").", ".$langs->trans("ThirdParty")." ".$langs->trans("or")." ".$langs->trans("EMail")."): ".$sall;
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
print $langs->trans("FilterOnInto", $sall, join(', ',$fieldstosearchall));
}
if ($search_firstlast_only)
{
print $langs->trans("Filter")." (".$langs->trans("Lastname").", ".$langs->trans("Firstname")."): ".$search_firstlast_only;
print $langs->trans("FilterOnInto", $search_firstlast_only, $langs->trans("Lastname").", ".$langs->trans("Firstname"));
}
if (! empty($conf->categorie->enabled))

View File

@ -125,7 +125,7 @@ if (empty($reshook))
if (! GETPOST('dateend'))
{
$error++;
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("DateEnd")),'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DateEnd")), null, 'errors');
}
if (! $error)
{
@ -206,13 +206,13 @@ if (empty($reshook))
if (empty($datecontrat))
{
$error++;
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Date")),'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors');
$action='create';
}
if ($socid<1)
{
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Customer")),'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Customer")), null, 'errors');
$action='create';
$error++;
}
@ -237,6 +237,7 @@ if (empty($reshook))
$object->fk_project = GETPOST('projectid','int');
$object->remise_percent = GETPOST('remise_percent','alpha');
$object->ref = GETPOST('ref','alpha');
$object->ref_customer = GETPOST('ref_customer','alpha');
$object->ref_supplier = GETPOST('ref_supplier','alpha');
// If creation from another object of another module (Example: origin=propal, originid=1)
@ -418,12 +419,12 @@ if (empty($reshook))
if ($qty == '')
{
setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Qty")),'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Qty")), null, 'errors');
$error++;
}
if (GETPOST('prod_entry_mode') == 'free' && empty($idprod) && empty($product_desc))
{
setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Description")),'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Description")), null, 'errors');
$error++;
}
@ -745,9 +746,11 @@ if (empty($reshook))
}
else
{
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("RefNewContract")),'errors');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("RefNewContract")), null, 'errors');
}
} else if ($action == 'update_extras') {
}
else if ($action == 'update_extras')
{
// Fill array 'array_options' with data from update form
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
$ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute'));
@ -767,9 +770,10 @@ if (empty($reshook))
$action = 'edit_extras';
setEventMessage($object->error,'errors');
}
} elseif ($action=='setref_supplier') {
}
elseif ($action=='setref_supplier')
{
$cancelbutton = GETPOST('cancel');
if (!$cancelbutton) {
$result = $object->fetch($id);
@ -790,7 +794,34 @@ if (empty($reshook))
header("Location: " . $_SERVER['PHP_SELF'] . "?id=" . $id);
exit;
}
} elseif ($action=='setref') {
}
elseif ($action=='setref_customer')
{
$cancelbutton = GETPOST('cancel');
if (!$cancelbutton)
{
$result = $object->fetch($id);
if ($result < 0) {
setEventMessage($object->errors, 'errors');
}
$result = $object->setValueFrom('ref_customer',GETPOST('ref_customer','alpha'));
if ($result < 0) {
setEventMessage($object->errors, 'errors');
$action = 'editref_customer';
} else {
header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
exit;
}
}
else {
header("Location: " . $_SERVER['PHP_SELF'] . "?id=" . $id);
exit;
}
}
elseif ($action=='setref')
{
$cancelbutton = GETPOST('cancel');
if (!$cancelbutton) {
@ -1001,14 +1032,18 @@ if ($action == 'create')
}
print '<tr><td class="fieldrequired">'.$langs->trans('Ref').'</td><td colspan="2">'.$tmpcode.'</td></tr>';
// Ref customer
print '<tr><td>'.$langs->trans('RefCustomer').'</td>';
print '<td colspan="2"><input type="text" size="5" name="ref_customer" id="ref_customer" value="'.GETPOST('ref_customer','alpha').'"></td></tr>';
// Ref supplier
print '<tr><td>'.$langs->trans('RefSupplier').'</td>';
print '<td colspan="2"><input type="text" size="5" name="ref_supplier" id="ref_supplier" value="'.GETPOST('ref_supplier','alpha').'"></td></tr>';
// Customer
// Thirdparty
print '<tr>';
print '<td class="fieldrequired">'.$langs->trans('Customer').'</td>';
if($socid>0)
print '<td class="fieldrequired">'.$langs->trans('Thirdparty').'</td>';
if ($socid>0)
{
print '<td colspan="2">';
print $soc->getNomUrl(1);
@ -1018,7 +1053,7 @@ if ($action == 'create')
else
{
print '<td colspan="2">';
print $form->select_company('','socid','s.client = 1 OR s.client = 3',1);
print $form->select_company('','socid','',1);
print '</td>';
}
print '</tr>'."\n";
@ -1206,6 +1241,14 @@ else
}
print '<tr>';
print '<td width="20%">';
print $form->editfieldkey("RefCustomer",'ref_customer',$object->ref_customer,$object,$user->rights->contrat->creer);
print '</td><td>';
print $form->editfieldval("RefCustomer",'ref_customer',$object->ref_customer,$object,$user->rights->contrat->creer);
print '</td>';
print '</tr>';
print '<tr>';
print '<td width="20%">';
print $form->editfieldkey("RefSupplier",'ref_supplier',$object->ref_supplier,$object,$user->rights->contrat->creer);
print '</td><td>';
@ -1592,7 +1635,7 @@ else
'text' => $langs->trans("ConfirmMoveToAnotherContractQuestion"),
array('type' => 'select', 'name' => 'newcid', 'values' => $arraycontractid));
$form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id."&lineid=".GETPOST('rowid'),$langs->trans("MoveToAnotherContract"),$langs->trans("ConfirmMoveToAnotherContract"),"confirm_move",$formquestion);
$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$object->id."&lineid=".GETPOST('rowid'),$langs->trans("MoveToAnotherContract"),$langs->trans("ConfirmMoveToAnotherContract"),"confirm_move",$formquestion);
print '<table class="notopnoleftnoright" width="100%"><tr '.$bc[$var].' height="6"><td></td></tr></table>';
}
@ -1604,7 +1647,7 @@ else
$dateactstart = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
$dateactend = dol_mktime(12, 0, 0, GETPOST('endmonth'), GETPOST('endday'), GETPOST('endyear'));
$comment = GETPOST('comment');
$form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id."&ligne=".GETPOST('ligne')."&date=".$dateactstart."&dateend=".$dateactend."&comment=".urlencode($comment),$langs->trans("ActivateService"),$langs->trans("ConfirmActivateService",dol_print_date($dateactstart,"%A %d %B %Y")),"confirm_active", '', 0, 1);
$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$object->id."&ligne=".GETPOST('ligne')."&date=".$dateactstart."&dateend=".$dateactend."&comment=".urlencode($comment),$langs->trans("ActivateService"),$langs->trans("ConfirmActivateService",dol_print_date($dateactstart,"%A %d %B %Y")),"confirm_active", '', 0, 1);
print '<table class="notopnoleftnoright" width="100%"><tr '.$bc[$var].' height="6"><td></td></tr></table>';
}
@ -1616,7 +1659,7 @@ else
$dateactstart = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
$dateactend = dol_mktime(12, 0, 0, GETPOST('endmonth'), GETPOST('endday'), GETPOST('endyear'));
$comment = GETPOST('comment');
$form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id."&ligne=".GETPOST('ligne')."&date=".$dateactstart."&dateend=".$dateactend."&comment=".urlencode($comment), $langs->trans("CloseService"), $langs->trans("ConfirmCloseService",dol_print_date($dateactend,"%A %d %B %Y")), "confirm_closeline", '', 0, 1);
$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$object->id."&ligne=".GETPOST('ligne')."&date=".$dateactstart."&dateend=".$dateactend."&comment=".urlencode($comment), $langs->trans("CloseService"), $langs->trans("ConfirmCloseService",dol_print_date($dateactend,"%A %d %B %Y")), "confirm_closeline", '', 0, 1);
print '<table class="notopnoleftnoright" width="100%"><tr '.$bc[$var].' height="6"><td></td></tr></table>';
}

View File

@ -50,6 +50,12 @@ class Contrat extends CommonObject
*/
protected $table_ref_field = 'ref';
/**
* Customer reference of the contract
* @var string
*/
var $ref_customer;
/**
* Supplier reference of the contract
* @var string
@ -369,7 +375,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);
}
@ -476,13 +482,13 @@ class Contrat extends CommonObject
function fetch($id,$ref='')
{
$sql = "SELECT rowid, statut, ref, fk_soc, mise_en_service as datemise,";
$sql.= " ref_supplier, ref_customer,";
$sql.= " ref_ext,";
$sql.= " fk_user_mise_en_service, date_contrat as datecontrat,";
$sql.= " fk_user_author,";
$sql.= " fk_projet,";
$sql.= " fk_commercial_signature, fk_commercial_suivi,";
$sql.= " note_private, note_public, model_pdf, extraparams";
$sql.= " ,ref_supplier";
$sql.= " ,ref_ext";
$sql.= " FROM ".MAIN_DB_PREFIX."contrat";
if ($ref)
{
@ -501,6 +507,7 @@ class Contrat extends CommonObject
{
$this->id = $result["rowid"];
$this->ref = (!isset($result["ref"]) || !$result["ref"]) ? $result["rowid"] : $result["ref"];
$this->ref_customer = $result["ref_customer"];
$this->ref_supplier = $result["ref_supplier"];
$this->ref_ext = $result["ref_ext"];
$this->statut = $result["statut"];
@ -839,7 +846,7 @@ class Contrat extends CommonObject
// Insert contract
$sql = "INSERT INTO ".MAIN_DB_PREFIX."contrat (datec, fk_soc, fk_user_author, date_contrat,";
$sql.= " fk_commercial_signature, fk_commercial_suivi, fk_projet,";
$sql.= " ref, entity, note_private, note_public, ref_supplier, ref_ext)";
$sql.= " ref, entity, note_private, note_public, ref_customer, ref_supplier, ref_ext)";
$sql.= " VALUES ('".$this->db->idate($now)."',".$this->socid.",".$user->id;
$sql.= ", '".$this->db->idate($this->date_contrat)."'";
$sql.= ",".($this->commercial_signature_id>0?$this->commercial_signature_id:"NULL");
@ -849,6 +856,7 @@ class Contrat extends CommonObject
$sql.= ", ".$conf->entity;
$sql.= ", ".(!empty($this->note_private)?("'".$this->db->escape($this->note_private)."'"):"NULL");
$sql.= ", ".(!empty($this->note_public)?("'".$this->db->escape($this->note_public)."'"):"NULL");
$sql.= ", ".(!empty($this->ref_customer)?("'".$this->db->escape($this->ref_customer)."'"):"NULL");
$sql.= ", ".(!empty($this->ref_supplier)?("'".$this->db->escape($this->ref_supplier)."'"):"NULL");
$sql.= ", ".(!empty($this->ref_ext)?("'".$this->db->escape($this->ref_ext)."'"):"NULL");
$sql.= ")";
@ -1101,6 +1109,7 @@ class Contrat extends CommonObject
// Clean parameters
if (isset($this->ref)) $this->ref=trim($this->ref);
if (isset($this->ref_customer)) $this->ref_customer=trim($this->ref_customer);
if (isset($this->ref_supplier)) $this->ref_supplier=trim($this->ref_supplier);
if (isset($this->ref_ext)) $this->ref_ext=trim($this->ref_ext);
if (isset($this->entity)) $this->entity=trim($this->entity);
@ -1125,6 +1134,7 @@ class Contrat extends CommonObject
$sql = "UPDATE ".MAIN_DB_PREFIX."contrat SET";
$sql.= " ref=".(isset($this->ref)?"'".$this->db->escape($this->ref)."'":"null").",";
$sql.= " ref_customer=".(isset($this->ref_customer)?"'".$this->db->escape($this->ref_customer)."'":"null").",";
$sql.= " ref_supplier=".(isset($this->ref_supplier)?"'".$this->db->escape($this->ref_supplier)."'":"null").",";
$sql.= " ref_ext=".(isset($this->ref_ext)?"'".$this->db->escape($this->ref_ext)."'":"null").",";
$sql.= " entity=".$conf->entity.",";
@ -1251,7 +1261,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];
@ -1424,7 +1434,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];
@ -2024,6 +2034,8 @@ class Contrat extends CommonObject
$this->specimen=1;
$this->ref = 'SPECIMEN';
$this->ref_customer = 'SPECIMENCUST';
$this->ref_supplier = 'SPECIMENSUPP';
$this->socid = 1;
$this->statut= 0;
$this->date_contrat = dol_now();
@ -2416,7 +2428,7 @@ class ContratLigne extends CommonObjectLine
*/
function update($user, $notrigger=0)
{
global $conf, $langs;
global $conf, $langs, $mysoc;
$error=0;
@ -2458,7 +2470,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

@ -1,11 +1,11 @@
<?php
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Claudio Aschieri <c.aschieri@19.coop>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2015 Claudio Aschieri <c.aschieri@19.coop>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -80,6 +80,17 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both
if ($search_status == '') $search_status=1;
// List of fields to search into when doing a "search in all"
$fieldstosearchall = array(
'c.ref'=>'Ref',
'c.ref_customer'=>'RefCustomer',
'c.ref_supplier'=>'RefSupplier',
's.nom'=>"ThirdParty",
'cd.description'=>'Description',
'c.note_public'=>'NotePublic',
);
if (empty($user->socid)) $fieldstosearchall["c.note_private"]="NotePrivate";
/*
* View
@ -93,7 +104,7 @@ $socstatic = new Societe($db);
llxHeader();
$sql = 'SELECT';
$sql.= " c.rowid as cid, c.ref, c.datec, c.date_contrat, c.statut, c.ref_supplier,";
$sql.= " c.rowid as cid, c.ref, c.datec, c.date_contrat, c.statut, c.ref_customer, c.ref_supplier,";
$sql.= " s.nom as name, s.rowid as socid,";
$sql.= ' SUM('.$db->ifsql("cd.statut=0",1,0).') as nb_initial,';
$sql.= ' SUM('.$db->ifsql("cd.statut=4 AND (cd.date_fin_validite IS NULL OR cd.date_fin_validite >= '".$db->idate($now)."')",1,0).') as nb_running,';
@ -132,7 +143,7 @@ if ($search_sale > 0)
}
if ($sall) {
$sql .= natural_search(array('s.nom', 'cd.label', 'cd.description'), $sall);
$sql .= natural_search(array_keys($fieldstosearchall), $sall);
}
if ($search_user > 0) $sql.= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='contrat' AND tc.source='internal' AND ec.element_id = c.rowid AND ec.fk_socpeople = ".$search_user;
$sql.= " GROUP BY c.rowid, c.ref, c.datec, c.date_contrat, c.statut, c.ref_supplier, s.nom, s.rowid";
@ -149,7 +160,17 @@ if ($resql)
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="list">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
if ($sall)
{
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
print $langs->trans("FilterOnInto", $sall, join(', ',$fieldstosearchall));
}
// If the user can view prospects other than his'
$moreforfilter='';
if ($user->rights->societe->client->voir || $socid)
@ -199,8 +220,9 @@ if ($resql)
if ($optioncss != '') $param.='&optioncss='.$optioncss;
print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "c.rowid","","$param",'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("RefCustomer"), $_SERVER["PHP_SELF"], "c.ref_supplier","","$param",'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Company"), $_SERVER["PHP_SELF"], "s.nom","","$param",'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("RefCustomer"), $_SERVER["PHP_SELF"], "c.ref_customer","","$param",'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("RefSupplier"), $_SERVER["PHP_SELF"], "c.ref_supplier","","$param",'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("ThirdParty"), $_SERVER["PHP_SELF"], "s.nom","","$param",'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("SalesRepresentative"), $_SERVER["PHP_SELF"], "","","$param",'',$sortfield,$sortorder);
//print_liste_field_titre($langs->trans("DateCreation"), $_SERVER["PHP_SELF"], "c.datec","","$param",'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("DateContract"), $_SERVER["PHP_SELF"], "c.date_contrat","","$param",'align="center"',$sortfield,$sortorder);
@ -218,10 +240,13 @@ if ($resql)
print '<input type="text" class="flat" size="3" name="search_contract" value="'.dol_escape_htmltag($search_contract).'">';
print '</td>';
print '<td class="liste_titre">';
print '<input type="text" class="flat" size="7" name="search_ref_supplier value="'.dol_escape_htmltag($search_ref_supplier).'">';
print '<input type="text" class="flat" size="6" name="search_ref_customer value="'.dol_escape_htmltag($search_ref_supplier).'">';
print '</td>';
print '<td class="liste_titre">';
print '<input type="text" class="flat" size="24" name="search_name" value="'.dol_escape_htmltag($search_name).'">';
print '<input type="text" class="flat" size="6" name="search_ref_supplier value="'.dol_escape_htmltag($search_ref_supplier).'">';
print '</td>';
print '<td class="liste_titre">';
print '<input type="text" class="flat" size="12" name="search_name" value="'.dol_escape_htmltag($search_name).'">';
print '</td>';
print '<td class="liste_titre">&nbsp;</td>';
//print '<td class="liste_titre">&nbsp;</td>';
@ -240,6 +265,7 @@ if ($resql)
print img_object($langs->trans("ShowContract"),"contract").' '.(isset($obj->ref) ? $obj->ref : $obj->cid) .'</a>';
if ($obj->nb_late) print img_warning($langs->trans("Late"));
print '</td>';
print '<td>'.$obj->ref_customer.'</td>';
print '<td>'.$obj->ref_supplier.'</td>';
print '<td><a href="../comm/card.php?socid='.$obj->socid.'">'.img_object($langs->trans("ShowCompany"),"company").' '.$obj->name.'</a></td>';
//print '<td align="center">'.dol_print_date($obj->datec).'</td>';

View File

@ -37,12 +37,69 @@ include_once DOL_DOCUMENT_ROOT.'/core/lib/json.lib.php';
$search_boxvalue=GETPOST('q');
$arrayresult=array('a'=>'aaaa', 'b'=>'bbbb');
$arrayresult=array();
if ($conf->projet->enabled)
// Define $searchform
if ((( ! empty($conf->societe->enabled) && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS))) || ! empty($conf->fournisseur->enabled)) && ! empty($conf->global->MAIN_SEARCHFORM_SOCIETE) && $user->rights->societe->lire)
{
$arrayresult['searchintoproject']=$langs->trans("SearchIntoProject", $search_boxvalue);
$langs->load("companies");
//$searchform.=printSearchForm(DOL_URL_ROOT.'/societe/list.php', DOL_URL_ROOT.'/societe/list.php', $langs->trans("ThirdParties"), 'soc', 'sall', 'T', 'searchleftt', img_object('','company'));
$arrayresult['searchintothirdparty']=img_picto('','object_company').' '.$langs->trans("SearchIntoThirdparties", $search_boxvalue);
}
if (! empty($conf->societe->enabled) && ! empty($conf->global->MAIN_SEARCHFORM_CONTACT) && $user->rights->societe->lire)
{
$langs->load("companies");
//$searchform.=printSearchForm(DOL_URL_ROOT.'/contact/list.php', DOL_URL_ROOT.'/contact/list.php', $langs->trans("Contacts"), 'contact', 'sall', 'A', 'searchleftc', img_object('','contact'));
$arrayresult['searchintocontact']=img_picto('','object_contact').' '.$langs->trans("SearchIntoContacts", $search_boxvalue);
}
if (((! empty($conf->product->enabled) && $user->rights->produit->lire) || (! empty($conf->service->enabled) && $user->rights->service->lire))
&& ! empty($conf->global->MAIN_SEARCHFORM_PRODUITSERVICE))
{
$langs->load("products");
//$searchform.=printSearchForm(DOL_URL_ROOT.'/product/list.php', DOL_URL_ROOT.'/product/list.php', $langs->trans("Products")."/".$langs->trans("Services"), 'products', 'sall', 'P', 'searchleftp', img_object('','product'));
$arrayresult['searchintoproduct']=img_picto('','object_product').' '.$langs->trans("SearchIntoProductsOrServices", $search_boxvalue);
}
/*if (((! empty($conf->product->enabled) && $user->rights->produit->lire) || (! empty($conf->service->enabled) && $user->rights->service->lire)) && ! empty($conf->fournisseur->enabled)
&& ! empty($conf->global->MAIN_SEARCHFORM_PRODUITSERVICE_SUPPLIER))
{
$langs->load("products");
$searchform.=printSearchForm(DOL_URL_ROOT.'/fourn/product/list.php', DOL_URL_ROOT.'/fourn/product/list.php', $langs->trans("SupplierRef"), 'products', 'srefsupplier', '', 'searchlefts', img_object('','product'));
}*/
if (! empty($conf->adherent->enabled) && ! empty($conf->global->MAIN_SEARCHFORM_ADHERENT) && $user->rights->adherent->lire)
{
$langs->load("members");
//$searchform.=printSearchForm(DOL_URL_ROOT.'/adherents/list.php', DOL_URL_ROOT.'/adherents/list.php', $langs->trans("Members"), 'member', 'sall', 'M', 'searchleftm', img_object('','user'));
$arrayresult['searchintomember']=img_picto('','object_user').' '.$langs->trans("SearchIntoMembers", $search_boxvalue);
}
if (! empty($conf->projet->enabled) && ! empty($conf->global->MAIN_SEARCHFORM_PROJECT) && $user->rights->projet->lire)
{
$langs->load("projects");
//$searchform.=printSearchForm(DOL_URL_ROOT.'/projet/list.php', DOL_URL_ROOT.'/projet/list.php', $langs->trans("Projects"), 'project', 'search_all', 'Q', 'searchleftproj', img_object('','projectpub'));
$arrayresult['searchintoprojects']=img_picto('','object_projectpub').' '.$langs->trans("SearchIntoProjects", $search_boxvalue);
}
// Execute hook printSearchForm
$parameters=array();
$reshook=$hookmanager->executeHooks('printSearchForm',$parameters); // Note that $action and $object may have been modified by some hooks
if (empty($reshook))
{
$searchform.=$hookmanager->resPrint;
}
else $searchform=$hookmanager->resPrint;
print json_encode($arrayresult);
if (is_object($db)) $db->close();

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

@ -447,18 +447,18 @@ abstract class CommonObject
$countriesusingstate=array('AU','US','IN','GB','ES','UK','TR');
$contacti=0;
$contactid=0;
$thirdpartyid=0;
if ($this->elemet == 'societe')
if ($this->element == 'societe')
{
$thirdpartyid=$this->id;
}
if ($this->elemet == 'contact')
if ($this->element == 'contact')
{
$contactid=$this->id;
$thirdpartyid=$object->fk_soc;
}
if ($this->elemet == 'user')
if ($this->element == 'user')
{
$contactid=$this->contact_id;
$thirdpartyid=$object->fk_soc;
@ -489,40 +489,40 @@ abstract class CommonObject
$outdone++;
}
if ($this->phone_pro || $this->phone_mobile || $this->phone_perso || $this->fax || $this->office_phone || $this->user_mobile || $this->office_fax) $out.=($outdone?'<br>':'');
if ($this->phone && empty($this->phone_pro)) { // For objects that store pro phone into ->phone
$out.=dol_print_phone($this->phone,$country_code['code'],$contactid,$thirdpartyid,'AC_TEL','&nbsp;','phone',$langs->trans("PhonePro")); $outdone++;
if (! empty($this->phone_pro) || ! empty($this->phone_mobile) || ! empty($this->phone_perso) || ! empty($this->fax) || ! empty($this->office_phone) || ! empty($this->user_mobile) || ! empty($this->office_fax)) $out.=($outdone?'<br>':'');
if (! empty($this->phone) && empty($this->phone_pro)) { // For objects that store pro phone into ->phone
$out.=dol_print_phone($this->phone,$this->country_code,$contactid,$thirdpartyid,'AC_TEL','&nbsp;','phone',$langs->trans("PhonePro")); $outdone++;
}
if (! empty($this->phone_pro)) {
$out.=dol_print_phone($this->phone_pro,$country_code['code'],$contactid,$thirdpartyid,'AC_TEL','&nbsp;','phone',$langs->trans("PhonePro")); $outdone++;
$out.=dol_print_phone($this->phone_pro,$this->country_code,$contactid,$thirdpartyid,'AC_TEL','&nbsp;','phone',$langs->trans("PhonePro")); $outdone++;
}
if (! empty($this->phone_mobile)) {
$out.=dol_print_phone($this->phone_mobile,$country_code['code'],$contactid,$thirdpartyid,'AC_TEL','&nbsp;','phone',$langs->trans("PhoneMobile")); $outdone++;
$out.=dol_print_phone($this->phone_mobile,$this->country_code,$contactid,$thirdpartyid,'AC_TEL','&nbsp;','phone',$langs->trans("PhoneMobile")); $outdone++;
}
if (! empty($this->phone_perso)) {
$out.=dol_print_phone($this->phone_perso,$country_code['code'],$contactid,$thirdpartyid,'AC_TEL','&nbsp;','phone',$langs->trans("PhonePerso")); $outdone++;
$out.=dol_print_phone($this->phone_perso,$this->country_code,$contactid,$thirdpartyid,'AC_TEL','&nbsp;','phone',$langs->trans("PhonePerso")); $outdone++;
}
if (! empty($this->fax)) {
$out.=dol_print_phone($this->fax,$country_code['code'],$contactid,$thirdpartyid,'AC_FAX','&nbsp;','fax',$langs->trans("Fax")); $outdone++;
$out.=dol_print_phone($this->fax,$this->country_code,$contactid,$thirdpartyid,'AC_FAX','&nbsp;','fax',$langs->trans("Fax")); $outdone++;
}
if (! empty($this->office_phone)) {
$out.=dol_print_phone($this->office_phone,$country_code['code'],$contactid,$thirdpartyid,'AC_TEL','&nbsp;','phone',$langs->trans("PhonePro")); $outdone++;
$out.=dol_print_phone($this->office_phone,$this->country_code,$contactid,$thirdpartyid,'AC_TEL','&nbsp;','phone',$langs->trans("PhonePro")); $outdone++;
}
if (! empty($this->user_mobile)) {
$out.=dol_print_phone($this->user_mobile,$country_code['code'],$contactid,$thirdpartyid,'AC_TEL','&nbsp;','phone',$langs->trans("PhoneMobile")); $outdone++;
$out.=dol_print_phone($this->user_mobile,$this->country_code,$contactid,$thirdpartyid,'AC_TEL','&nbsp;','phone',$langs->trans("PhoneMobile")); $outdone++;
}
if (! empty($this->office_fax)) {
$out.=dol_print_phone($this->fax,$country_code['code'],$contactid,$thirdpartyid,'AC_FAX','&nbsp;','fax',$langs->trans("Fax")); $outdone++;
$out.=dol_print_phone($this->fax,$this->country_code,$contactid,$thirdpartyid,'AC_FAX','&nbsp;','fax',$langs->trans("Fax")); $outdone++;
}
$out.='<div style="clear: both;"></div>';
$outdone=0;
if ($this->email)
if (! empty($this->email))
{
$out.=dol_print_email($this->email,$this->id,$object->id,'AC_EMAIL',0,0,1);
$outdone++;
}
if ($this->url)
if (! empty($this->url))
{
$out.=dol_print_url($this->url,'',0,1);
$outdone++;
@ -1507,6 +1507,36 @@ abstract class CommonObject
}
/**
* Change the warehouse
*
* @param int $warehouse_id Id of warehouse
* @return int 1 if OK, 0 if KO
*/
function setWarehouse($warehouse_id)
{
if (! $this->table_element) {
dol_syslog(get_class($this)."::setWarehouse was called on objet with property table_element not defined",LOG_ERR);
return -1;
}
if ($warehouse_id<0) $warehouse_id='NULL';
dol_syslog(get_class($this).'::setWarehouse('.$warehouse_id.')');
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;
$sql.= " SET fk_warehouse = ".$warehouse_id;
$sql.= " WHERE rowid=".$this->id;
if ($this->db->query($sql)) {
$this->warehouse_id = ($warehouse_id=='NULL')?null:$warehouse_id;
return 1;
} else {
dol_syslog(get_class($this).'::setWarehouse Error ', LOG_DEBUG);
$this->error=$this->db->error();
return 0;
}
}
/**
* Set last model used by doc generator
*
@ -2231,13 +2261,18 @@ abstract class CommonObject
/**
* Fetch array of objects linked to current object. Links are loaded into this->linkedObjects array and this->linkedObjectsIds
*
* @param int $sourceid Object source id
* @param string $sourcetype Object source type
* @param int $targetid Object target id
* @param string $targettype Object target type
* Possible usage for parameters:
* - all parameters empty -> we look all link to current object (current object can be source or target)
* - one couple id+type is provided -> this will set $justsource or $justtarget
* - one couple id+type is provided and other type is provided -> this will set $justsource or $justtarget + criteria on other type
*
*
* @param int $sourceid Object source id (if not defined, id of object)
* @param string $sourcetype Object source type (if not defined, element name of object)
* @param int $targetid Object target id (if not defined, id of object)
* @param string $targettype Object target type (if not defined, elemennt name of object)
* @param string $clause 'OR' or 'AND' clause used when both source id and target id are provided
* @param int $alsosametype 0=Return only links to different object than source. 1=Include also link to objects of same type.
* @param int $alsosametype 0=Return only links to object that differs from source. 1=Include also link to objects of same type.
* @return void
* @see add_object_linked, updateObjectLinked, deleteObjectLinked
*/
@ -2255,12 +2290,12 @@ abstract class CommonObject
if (! empty($sourceid) && ! empty($sourcetype) && empty($targetid))
{
$justsource=true;
$justsource=true; // the source (id and type) is a search criteria
if (! empty($targettype)) $withtargettype=true;
}
if (! empty($targetid) && ! empty($targettype) && empty($sourceid))
{
$justtarget=true;
$justtarget=true; // the target (id and type) is a search criteria
if (! empty($sourcetype)) $withsourcetype=true;
}
@ -2309,13 +2344,27 @@ abstract class CommonObject
while ($i < $num)
{
$obj = $this->db->fetch_object($resql);
if ($obj->fk_source == $sourceid)
if ($justsource || $justtarget)
{
$this->linkedObjectsIds[$obj->targettype][$obj->rowid]=$obj->fk_target;
if ($justsource)
{
$this->linkedObjectsIds[$obj->targettype][$obj->rowid]=$obj->fk_target;
}
else if ($justtarget)
{
$this->linkedObjectsIds[$obj->sourcetype][$obj->rowid]=$obj->fk_source;
}
}
if ($obj->fk_target == $targetid)
else
{
$this->linkedObjectsIds[$obj->sourcetype][$obj->rowid]=$obj->fk_source;
if ($obj->fk_source == $sourceid && $obj->sourcetype == $sourcetype)
{
$this->linkedObjectsIds[$obj->targettype][$obj->rowid]=$obj->fk_target;
}
if ($obj->fk_target == $targetid && $obj->targettype == $targettype)
{
$this->linkedObjectsIds[$obj->sourcetype][$obj->rowid]=$obj->fk_source;
}
}
$i++;
}
@ -2986,60 +3035,60 @@ abstract class CommonObject
print '<tr class="liste_titre nodrag nodrop">';
if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) print '<td align="center" width="5">&nbsp;</td>';
if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) print '<td class="linecolnum" align="center" width="5">&nbsp;</td>';
// Description
print '<td>'.$langs->trans('Description').'</td>';
print '<td class="linecoldescription">'.$langs->trans('Description').'</td>';
if ($this->element == 'askpricesupplier')
{
print '<td align="right"><span id="title_fourn_ref">'.$langs->trans("AskPriceSupplierRefFourn").'</span></td>';
print '<td class="linerefsupplier" align="right"><span id="title_fourn_ref">'.$langs->trans("AskPriceSupplierRefFourn").'</span></td>';
}
// VAT
print '<td align="right" width="50">'.$langs->trans('VAT').'</td>';
print '<td class="linecolvat" align="right" width="50">'.$langs->trans('VAT').'</td>';
// Price HT
print '<td align="right" width="80">'.$langs->trans('PriceUHT').'</td>';
print '<td class="linecoluht" align="right" width="80">'.$langs->trans('PriceUHT').'</td>';
if ($inputalsopricewithtax) print '<td align="right" width="80">'.$langs->trans('PriceUTTC').'</td>';
// Qty
print '<td align="right" width="50">'.$langs->trans('Qty').'</td>';
print '<td class="linecolqty" align="right" width="50">'.$langs->trans('Qty').'</td>';
if($conf->global->PRODUCT_USE_UNITS)
{
print '<td align="left" width="50">'.$langs->trans('Unit').'</td>';
print '<td class="linecoluseunit" align="left" width="50">'.$langs->trans('Unit').'</td>';
}
// Reduction short
print '<td align="right" width="50">'.$langs->trans('ReductionShort').'</td>';
print '<td class="linecoldiscount" align="right" width="50">'.$langs->trans('ReductionShort').'</td>';
if ($this->situation_cycle_ref) {
print '<td align="right" width="50">' . $langs->trans('Progress') . '</td>';
print '<td class="linecolcycleref" align="right" width="50">' . $langs->trans('Progress') . '</td>';
}
if ($usemargins && ! empty($conf->margin->enabled) && empty($user->societe_id))
{
if ($conf->global->MARGIN_TYPE == "1")
print '<td align="right" class="margininfos" width="80">'.$langs->trans('BuyingPrice').'</td>';
print '<td class="linecolmargin1 margininfos" align="right" width="80">'.$langs->trans('BuyingPrice').'</td>';
else
print '<td align="right" class="margininfos" width="80">'.$langs->trans('CostPrice').'</td>';
print '<td class="linecolmargin1 margininfos" align="right" width="80">'.$langs->trans('CostPrice').'</td>';
if (! empty($conf->global->DISPLAY_MARGIN_RATES) && $user->rights->margins->liretous)
print '<td align="right" class="margininfos" width="50">'.$langs->trans('MarginRate').'</td>';
print '<td class="linecolmargin2 margininfos" align="right" width="50">'.$langs->trans('MarginRate').'</td>';
if (! empty($conf->global->DISPLAY_MARK_RATES) && $user->rights->margins->liretous)
print '<td align="right" class="margininfos" width="50">'.$langs->trans('MarkRate').'</td>';
print '<td class="linecolmargin2 margininfos" align="right" width="50">'.$langs->trans('MarkRate').'</td>';
}
// Total HT
print '<td align="right" width="50">'.$langs->trans('TotalHTShort').'</td>';
print '<td class="linecolht" align="right" width="50">'.$langs->trans('TotalHTShort').'</td>';
print '<td></td>'; // No width to allow autodim
print '<td class="linecoledit"></td>'; // No width to allow autodim
print '<td width="10"></td>';
print '<td class="linecoldelete" width="10"></td>';
print '<td width="10"></td>';
print '<td class="linecolmove" width="10"></td>';
print "</tr>\n";
@ -3782,10 +3831,10 @@ abstract class CommonObject
foreach ($tab as $key => $value)
{
// Test fetch_array ! is_int($key) because fetch_array seult is a mix table with Key as alpha and Key as int (depend db engine)
// Test fetch_array ! is_int($key) because fetch_array result is a mix table with Key as alpha and Key as int (depend db engine)
if ($key != 'rowid' && $key != 'tms' && $key != 'fk_member' && ! is_int($key))
{
// we can add this attribute to adherent object
// we can add this attribute to object
$this->array_options["options_".$key]=$value;
}
}
@ -3833,7 +3882,7 @@ abstract class CommonObject
/**
* Add/Update all extra fields values for the current object.
* Data to describe values to insert/update are stored into $this->array_options=array('options_codeforfield1'=>'valueforfield1', 'options_codeforfield2'=>'valueforfield2', ...)
* This function delte record with all extrafields and insert them again from the array $this->array_options.
* This function delete record with all extrafields and insert them again from the array $this->array_options.
*
* @return int -1=error, O=did nothing, 1=OK
*/
@ -3887,12 +3936,25 @@ abstract class CommonObject
// 1 : classPath
$InfoFieldList = explode(":", $param_list[0]);
dol_include_once($InfoFieldList[1]);
$object = new $InfoFieldList[0]($this->db);
if ($value)
{
$object->fetch(0,$value);
$this->array_options[$key]=$object->id;
}
if ($InfoFieldList[0] && class_exists($InfoFieldList[0]))
{
$object = new $InfoFieldList[0]($this->db);
if ($value)
{
$res=$object->fetch(0,$value);
if ($res > 0) $this->array_options[$key]=$object->id;
else
{
$this->error="Ref '".$value."' for object '".$object->element."' not found";
$this->db->rollback();
return -1;
}
}
}
else
{
dol_syslog('Error bad setup of extrafield', LOG_WARNING);
}
break;
}
}
@ -3949,10 +4011,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
*/
@ -3983,7 +4045,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

@ -439,9 +439,10 @@ class Conf
if (! isset($this->global->MAIN_MAX_DECIMALS_TOT)) $this->global->MAIN_MAX_DECIMALS_TOT=2;
if (! isset($this->global->MAIN_MAX_DECIMALS_SHOWN)) $this->global->MAIN_MAX_DECIMALS_SHOWN=8;
// Default pdf use dash between lines
if (! isset($this->global->MAIN_PDF_DASH_BETWEEN_LINES)) $this->global->MAIN_PDF_DASH_BETWEEN_LINES=1;
// Default pdf option
if (! isset($this->global->MAIN_PDF_DASH_BETWEEN_LINES)) $this->global->MAIN_PDF_DASH_BETWEEN_LINES=1; // use dash between lines
if (! isset($this->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) $this->global->PDF_ALLOW_HTML_FOR_FREE_TEXT=1; // allow html content into free footer text
// Set default value to MAIN_SHOW_LOGO
if (! isset($this->global->MAIN_SHOW_LOGO)) $this->global->MAIN_SHOW_LOGO=1;

View File

@ -111,7 +111,7 @@ class ExtraFields
* @param string $elementtype Element type ('member', 'product', 'thirdparty', ...)
* @param int $unique Is field unique or not
* @param int $required Is field required or not
* @param string $default_value Defaulted value
* @param string $default_value Defaulted value (Example: '', '0', 'null', 'avalue')
* @param array $param Params for field
* @param int $alwayseditable Is attribute always editable regardless of the document status
* @param string $perms Permission to check
@ -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.
@ -1083,10 +1085,19 @@ class ExtraFields
// 1 : classPath
$InfoFieldList = explode(":", $param_list[0]);
dol_include_once($InfoFieldList[1]);
$object = new $InfoFieldList[0]($this->db);
$object->fetch($value);
$out='<input type="text" class="flat" name="'.$keysuffix.'options_'.$key.$keyprefix.'" size="20" value="'.$object->ref.'" >';
if ($InfoFieldList[0] && class_exists($InfoFieldList[0]))
{
$object = new $InfoFieldList[0]($this->db);
$object->fetch($value);
$valuetoshow=$object->ref;
if ($object->element == 'societe') $valuetoshow=$object->name; // Special case for thirdparty because ref is id because name is not unique
$out.='<input type="text" class="flat" name="'.$keysuffix.'options_'.$key.$keyprefix.'" size="20" value="'.$valuetoshow.'" >';
}
else
{
dol_syslog('Error bad setup of extrafield', LOG_WARNING);
$out.='Error bad setup of extrafield';
}
}
/* Add comments
if ($type == 'date') $out.=' (YYYY-MM-DD)';
@ -1324,9 +1335,17 @@ class ExtraFields
// 1 : classPath
$InfoFieldList = explode(":", $param_list[0]);
dol_include_once($InfoFieldList[1]);
$object = new $InfoFieldList[0]($this->db);
$object->fetch($value);
$value=$object->getNomUrl(3);
if ($InfoFieldList[0] && class_exists($InfoFieldList[0]))
{
$object = new $InfoFieldList[0]($this->db);
$object->fetch($value);
$value=$object->getNomUrl(3);
}
else
{
dol_syslog('Error bad setup of extrafield', LOG_WARNING);
$out.='Error bad setup of extrafield';
}
}
}
elseif ($type == 'text')
@ -1451,7 +1470,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

@ -3235,10 +3235,10 @@ 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 formconfirm page=".$page." -->\n";
$formconfirm.= "\n<!-- begin ajax form_confirm page=".$page." -->\n";
$formconfirm.= '<script type="text/javascript">'."\n";
$formconfirm.= 'jQuery(document).ready(function() {
$(function() {
@ -3309,11 +3309,11 @@ class Form
});
});
</script>';
$formconfirm.= "<!-- end ajax formconfirm -->\n";
$formconfirm.= "<!-- end ajax form_confirm -->\n";
}
else
{
$formconfirm.= "\n<!-- begin formconfirm page=".$page." -->\n";
$formconfirm.= "\n<!-- begin form_confirm page=".$page." -->\n";
$formconfirm.= '<form method="POST" action="'.$page.'" class="notoptoleftroright">'."\n";
$formconfirm.= '<input type="hidden" name="action" value="'.$action.'">'."\n";
@ -3346,7 +3346,7 @@ class Form
$formconfirm.= "</form>\n";
$formconfirm.= '<br>';
$formconfirm.= "<!-- end formconfirm -->\n";
$formconfirm.= "<!-- end form_confirm -->\n";
}
return $formconfirm;
@ -4501,7 +4501,7 @@ class Form
/**
* Return a HTML select string, built from an array of key+value but content returned into select come from an Ajax call of an URL.
* Note: Do not apply langs->trans function on returned content, content may be entity encoded twice.
* Note: Do not apply langs->trans function on returned content of Ajax service, content may be entity encoded twice.
*
* @param string $htmlname Name of html select area
* @param string $url Url
@ -4534,9 +4534,14 @@ class Form
};
},
results: function (remoteData, pageNumber, query) {
console.log(remoteData);
return {results:[{id:\'none\', text:\'aa\'}, {id:\'rrr\', text:\'Red\'},{id:\'bbb\', text:\'Search a into projects\'}], more:false}
//return {results:[remoteData], more:false}
//console.log(remoteData);
result = []
$.each( remoteData, function( key, value ) {
result.push({id: key, text: value});
});
//console.log(result);
//return {results:[{id:\'none\', text:\'aa\'}, {id:\'rrr\', text:\'Red\'},{id:\'bbb\', text:\'Search a into projects\'}], more:false}
return {results: result, more:false}
},
/*processResults: function (data, page) {
// parse the results into the format expected by Select2.
@ -4557,7 +4562,8 @@ class Form
$(".'.$htmlname.'").change(function() {
alert(\'eee\');
$(".'.$htmlname.'").select2.clearSearch();
/* $(".'.$htmlname.'").select2("search",""); */
$(".'.$htmlname.'").select2("val",""); /* reset combo box */
} );
@ -4797,7 +4803,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;
}
@ -5265,9 +5271,9 @@ class Form
$dir=$conf->societe->multidir_output[$entity];
$smallfile=$object->logo;
$smallfile=preg_replace('/(\.png|\.gif|\.jpg|\.jpeg|\.bmp)/i','_small\\1',$smallfile);
if ($object->logo) $file=$id.'/logos/thumbs/'.$smallfile;
if (! empty($object->logo)) $file=$id.'/logos/thumbs/'.$smallfile;
}
if ($modulepart=='contact')
else if ($modulepart=='contact')
{
$dir=$conf->societe->multidir_output[$entity].'/contact';
$file=$id.'/photos/'.$object->photo;
@ -5275,19 +5281,19 @@ 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)) $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;
}
else if ($modulepart=='memberphoto')
{
$dir=$conf->adherent->dir_output;
if ($object->photo) $file=get_exdir($id, 2, 0, 0, $object, 'invoice_supplier').'photos/'.$object->photo;
if (! empty($object->photo)) $file=get_exdir($id, 2, 0, 0, $object, 'invoice_supplier').'photos/'.$object->photo;
if (! empty($conf->global->MAIN_OLD_IMAGE_LINKS)) $altfile=$object->id.".jpg"; // For backward compatibility
$email=$object->email;
} else {
$dir=$conf->$modulepart->dir_output;
if ($object->photo) $file=get_exdir($id, 2, 0, 0, $adherent, 'member').'photos/'.$object->photo;
if (! empty($object->photo)) $file=get_exdir($id, 2, 0, 0, $object, 'member').'photos/'.$object->photo;
if (! empty($conf->global->MAIN_OLD_IMAGE_LINKS)) $altfile=$object->id.".jpg"; // For backward compatibility
$email=$object->email;
}

View File

@ -598,7 +598,7 @@ class FormOther
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
$color = colorArrayToHex(colorStringToArray($color,array()),'');
if ($color) print '<input type="text" class="colorthumb" disabled style="padding: 1px; margin-top: 0; margin-bottom: 0; width: 36px; background-color: #'.$color.'" value="'.$color.'">';
if ($color) print '<input type="text" class="colorthumb" disabled style="padding: 1px; margin-top: 0; margin-bottom: 0; width: 40px; background-color: #'.$color.'" value="'.$color.'">';
else print $textifnotdefined;
}

View File

@ -580,10 +580,9 @@ class Translate
$str=$this->tab_translate[$key];
// Make some string replacement after translation
$replacekey='MAIN_REPLACE_TRANS_'.$this->defaultlang;
if (! empty($conf->global->$replacekey)) // Replacement translation variable with string1:newstring1,string2:newstring2
$replacekey='MAIN_REPLACE_TRANS_'.$this->defaultlang;
if (! empty($conf->global->$replacekey)) // Replacement translation variable with string1:newstring1;string2:newstring2
{
// Overwrite translation with param MAIN_OVERWRITE_TRANS_xx_XX
$tmparray=explode(';', $conf->global->$replacekey);
foreach($tmparray as $tmp)
{
@ -660,17 +659,17 @@ class Translate
{
$str=$this->tab_translate[$key];
// Overwrite translation
$overwritekey='MAIN_OVERWRITE_TRANS_'.$this->defaultlang;
if (! empty($conf->global->$overwritekey)) // Overwrite translation with key1:newstring1,key2:newstring2
// Make some string replacement after translation
$replacekey='MAIN_REPLACE_TRANS_'.$this->defaultlang;
if (! empty($conf->global->$replacekey)) // Replacement translation variable with string1:newstring1;string2:newstring2
{
$tmparray=explode(',', $conf->global->$overwritekey);
$tmparray=explode(';', $conf->global->$replacekey);
foreach($tmparray as $tmp)
{
$tmparray2=explode(':',$tmp);
if ($tmparray2[0]==$key) { $str=$tmparray2[1]; break; }
$str=preg_replace('/'.preg_quote($tmparray2[0]).'/',$tmparray2[1],$str);
}
}
}
if (! preg_match('/^Format/',$key))
{
@ -982,7 +981,8 @@ class Translate
}
/**
* Return an array with content of all loaded translation keys (found into this->tab_translate)
* Return an array with content of all loaded translation keys (found into this->tab_translate) so
* we get a substitution array we can use for substitutions (for mail or ODT generation for example)
*
* @return array Array of translation keys lang_key => string_translation_loaded
*/
@ -997,9 +997,3 @@ class Translate
return $substitutionarray;
}
}
function warning_handler($errno, $errstr, $errfile, $errline, array $errcontext) {
global $str;
print 'str='.$str;
}

View File

@ -678,9 +678,11 @@ function activateModule($value,$withdeps=1)
$ret='';
$modName = $value;
$modFile = $modName . ".class.php";
$modulesdir = dolGetModulesDirs();
// Loop on each directory
// Loop on each directory to fill $modulesdir
$modulesdir = dolGetModulesDirs();
// Loop on each modulesdir directories
$found=false;
foreach ($modulesdir as $dir)
{
@ -775,9 +777,11 @@ function unActivateModule($value, $requiredby=1)
$ret='';
$modName = $value;
$modFile = $modName . ".class.php";
$modulesdir = dolGetModulesDirs();
// Loop on each directory
// Loop on each directory to fill $modulesdir
$modulesdir = dolGetModulesDirs();
// Loop on each modulesdir directories
$found=false;
foreach ($modulesdir as $dir)
{
@ -887,13 +891,13 @@ function complete_dictionary_with_modules(&$taborder,&$tabname,&$tablib,&$tabsql
if ($modulequalified)
{
// Load languages files of module
if (isset($objMod->langfiles) && is_array($objMod->langfiles))
{
foreach($objMod->langfiles as $langfile)
{
$langs->load($langfile);
}
}
if (isset($objMod->langfiles) && is_array($objMod->langfiles))
{
foreach($objMod->langfiles as $langfile)
{
$langs->load($langfile);
}
}
// Complete arrays
//&$tabname,&$tablib,&$tabsql,&$tabsqlsort,&$tabfield,&$tabfieldvalue,&$tabfieldinsert,&$tabrowid,&$tabcond
@ -943,6 +947,107 @@ function complete_dictionary_with_modules(&$taborder,&$tabname,&$tablib,&$tabsql
return 1;
}
/**
* Add external modules to list of contact element
*
* @param array $elementList elementList
* @return int 1
*/
function complete_elementList_with_modules(&$elementList)
{
global $db, $modules, $conf, $langs;
// Search modules
$filename = array();
$modules = array();
$orders = array();
$categ = array();
$dirmod = array();
$i = 0; // is a sequencer of modules found
$j = 0; // j is module number. Automatically affected if module number not defined.
$modulesdir = dolGetModulesDirs();
foreach ($modulesdir as $dir)
{
// Load modules attributes in arrays (name, numero, orders) from dir directory
//print $dir."\n<br>";
dol_syslog("Scan directory ".$dir." for modules");
$handle=@opendir(dol_osencode($dir));
if (is_resource($handle))
{
while (($file = readdir($handle))!==false)
{
//print "$i ".$file."\n<br>";
if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, dol_strlen($file) - 10) == '.class.php')
{
$modName = substr($file, 0, dol_strlen($file) - 10);
if ($modName)
{
include_once $dir.$file;
$objMod = new $modName($db);
if ($objMod->numero > 0)
{
$j = $objMod->numero;
}
else
{
$j = 1000 + $i;
}
$modulequalified=1;
// We discard modules according to features level (PS: if module is activated we always show it)
$const_name = 'MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i','',get_class($objMod)));
if ($objMod->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2 && ! $conf->global->$const_name) $modulequalified=0;
if ($objMod->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1 && ! $conf->global->$const_name) $modulequalified=0;
//If module is not activated disqualified
if (empty($conf->global->$const_name)) $modulequalified=0;
if ($modulequalified)
{
// Load languages files of module
if (isset($objMod->langfiles) && is_array($objMod->langfiles))
{
foreach($objMod->langfiles as $langfile)
{
$langs->load($langfile);
}
}
$modules[$i] = $objMod;
$filename[$i]= $modName;
$orders[$i] = $objMod->family."_".$j; // Tri par famille puis numero module
//print "x".$modName." ".$orders[$i]."\n<br>";
if (isset($categ[$objMod->special])) $categ[$objMod->special]++; // Array of all different modules categories
else $categ[$objMod->special]=1;
$dirmod[$i] = $dirroot;
if (! empty($objMod->module_parts['contactelement']))
{
$elementList[$objMod->name] = $langs->trans($objMod->name);
//exit;
}
$j++;
$i++;
}
else dol_syslog("Module ".get_class($objMod)." not qualified");
}
}
}
closedir($handle);
}
else
{
dol_syslog("htdocs/admin/modules.php: Failed to open directory ".$dir.". See permission and open_basedir option.", LOG_WARNING);
}
}
return 1;
}
/**
* Show array with constants to edit

View File

@ -1506,7 +1506,7 @@ function dol_add_file_process($upload_dir, $allowoverwrite=0, $donotupdatesessio
else
{
$langs->load("errors");
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("File")), 'warnings');
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("File")), null, 'errors');
}
}

View File

@ -732,7 +732,8 @@ function dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $pi
$limittoshow=(empty($conf->global->MAIN_MAXTABS_IN_CARD)?99:$conf->global->MAIN_MAXTABS_IN_CARD);
$displaytab=0;
$nbintab=0;
$popuptab=0;
for ($i = 0 ; $i <= $maxkey ; $i++)
{
if ((is_numeric($active) && $i == $active) || (! empty($links[$i][2]) && ! is_numeric($active) && $active == $links[$i][2]))
@ -1496,30 +1497,30 @@ function dol_print_skype($skype,$cid=0,$socid=0,$addlink=0,$max=64)
/**
* Format phone numbers according to country
*
* @param string $phone Phone number to format
* @param string $country Country code to use for formatting
* @param int $cid Id of contact if known
* @param int $socid Id of third party if known
* @param string $addlink ''=no link to create action, 'AC_TEL'=add link to clicktodial (if module enabled) and add link to create event (if conf->global->AGENDA_ADDACTIONFORPHONE set)
* @param string $separ Separation between numbers for a better visibility example : xx.xx.xx.xx.xx
* @param string $withpicto Show picto
* @param string $titlealt Text to show on alt
* @return string Formated phone number
* @param string $phone Phone number to format
* @param string $countrycode Country code to use for formatting
* @param int $cid Id of contact if known
* @param int $socid Id of third party if known
* @param string $addlink ''=no link to create action, 'AC_TEL'=add link to clicktodial (if module enabled) and add link to create event (if conf->global->AGENDA_ADDACTIONFORPHONE set)
* @param string $separ Separation between numbers for a better visibility example : xx.xx.xx.xx.xx
* @param string $withpicto Show picto
* @param string $titlealt Text to show on alt
* @return string Formated phone number
*/
function dol_print_phone($phone,$country='',$cid=0,$socid=0,$addlink='',$separ="&nbsp;",$withpicto='',$titlealt='')
function dol_print_phone($phone,$countrycode='',$cid=0,$socid=0,$addlink='',$separ="&nbsp;",$withpicto='',$titlealt='')
{
global $conf,$user,$langs,$mysoc;
// Clean phone parameter
$phone = preg_replace("/[\s.-]/","",trim($phone));
if (empty($phone)) { return ''; }
if (empty($country)) $country=$mysoc->country_code;
if (empty($countrycode)) $countrycode=$mysoc->country_code;
// Short format for small screens
if ($conf->dol_optimize_smallscreen) $separ='';
$newphone=$phone;
if (strtoupper($country) == "FR")
if (strtoupper($countrycode) == "FR")
{
// France
if (dol_strlen($phone) == 10) {
@ -1688,10 +1689,10 @@ function dol_print_address($address, $htmlid, $mode, $id, $noprint=0)
$showgmap=$showomap=0;
// TODO Add a hook here
if ($mode=='thirdparty' && ! empty($conf->google->enabled) && ! empty($conf->global->GOOGLE_ENABLE_GMAPS)) $showgmap=1;
if (($mode=='thirdparty' || $mode =='societe') && ! empty($conf->google->enabled) && ! empty($conf->global->GOOGLE_ENABLE_GMAPS)) $showgmap=1;
if ($mode=='contact' && ! empty($conf->google->enabled) && ! empty($conf->global->GOOGLE_ENABLE_GMAPS_CONTACTS)) $showgmap=1;
if ($mode=='member' && ! empty($conf->google->enabled) && ! empty($conf->global->GOOGLE_ENABLE_GMAPS_MEMBERS)) $showgmap=1;
if ($mode=='thirdparty' && ! empty($conf->openstreetmap->enabled) && ! empty($conf->global->OPENSTREETMAP_ENABLE_MAPS)) $showomap=1;
if (($mode=='thirdparty' || $mode =='societe') && ! empty($conf->openstreetmap->enabled) && ! empty($conf->global->OPENSTREETMAP_ENABLE_MAPS)) $showomap=1;
if ($mode=='contact' && ! empty($conf->openstreetmap->enabled) && ! empty($conf->global->OPENSTREETMAP_ENABLE_MAPS_CONTACTS)) $showomap=1;
if ($mode=='member' && ! empty($conf->openstreetmap->enabled) && ! empty($conf->global->OPENSTREETMAP_ENABLE_MAPS_MEMBERS)) $showomap=1;
@ -4383,7 +4384,7 @@ function get_date_range($date_start,$date_end,$format = '',$outputlangs='', $wit
*
* @param string $firstname Firstname
* @param string $lastname Lastname
* @param int $nameorder -1=Auto, 0=Lastname+Firstname, 1=Firstname+Lastname
* @param int $nameorder -1=Auto, 0=Lastname+Firstname, 1=Firstname+Lastname, 2=Firstname
* @return string Firstname + lastname or Lastname + firstname
*/
function dolGetFirstLastname($firstname,$lastname,$nameorder=-1)

View File

@ -303,12 +303,10 @@ function pdfGetHeightForHtmlContent(&$pdf, $htmlcontent)
$pdf->startTransaction();
// store starting values
$start_y = $pdf->GetY();
var_dump($start_y);
//var_dump($start_y);
$start_page = $pdf->getPage();
// call your printing functions with your parameters
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// call printing functions with content
$pdf->writeHTMLCell(0, 0, 0, $start_y, $htmlcontent, 0, 1, false, true, 'J',true);
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// get the new Y
$end_y = $pdf->GetY();
$end_page = $pdf->getPage();
@ -386,7 +384,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);

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

@ -74,7 +74,7 @@ function dol_decode($chain)
* If constant MAIN_SECURITY_SALT is defined, we use it as a salt.
*
* @param string $chain String to hash
* @param int $type Type of hash (0:auto, 1:sha1, 2:sha1+md5, 3:md5)
* @param int $type Type of hash (0:auto, 1:sha1, 2:sha1+md5, 3:md5). Use 3 here, if hash is not needed for security purpose, for security need, prefer 0.
* @return string Hash of string
*/
function dol_hash($chain,$type=0)

View File

@ -414,7 +414,7 @@ function show_theme($fuser,$edit=0,$foruserprofile=false)
{
if ($conf->global->THEME_ELDY_USE_HOVER == '1') $color='edf4fb';
else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_HOVER,array()),'');
if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; width: 36px; background-color: #'.$color.'" value="'.$color.'">';
if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; width: 40px; background-color: #'.$color.'" value="'.$color.'">';
else print $langs->trans("None");
}
print ' &nbsp; ('.$langs->trans("Default").': <strong>edf4fb</strong>, '.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
@ -440,7 +440,7 @@ function show_theme($fuser,$edit=0,$foruserprofile=false)
else
{
$color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1,array()),'');
if ($color) print '<input type="text" class="colorthumb" disabled style="padding: 1px; margin-top: 0; margin-bottom: 0; width: 36px; background-color: #'.$color.'" value="'.$color.'">';
if ($color) print '<input type="text" class="colorthumb" disabled style="padding: 1px; margin-top: 0; margin-bottom: 0; width: 40px; background-color: #'.$color.'" value="'.$color.'">';
else print '';
}
if ($edit) print '<br>('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
@ -459,7 +459,7 @@ function show_theme($fuser,$edit=0,$foruserprofile=false)
else
{
$color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1,array()),'');
if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; width: 36px; background-color: #'.$color.'" value="'.$color.'">';
if ($color) print '<input type="text" class="colorthumb" disabled="disabled" style="padding: 1px; margin-top: 0; margin-bottom: 0; width: 40px; background-color: #'.$color.'" value="'.$color.'">';
else print $langs->trans("Default");
}
print ' &nbsp; ('.$langs->trans("Default").': <strong>6e7896</strong>, '.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';

View File

@ -68,7 +68,8 @@ 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 && $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', __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__, '/societe/list.php?type=f&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__);
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', 507__+MAX_llx_menu__, 'companies', '', 506__+MAX_llx_menu__, '/societe/soc.php?leftmenu=prospects&amp;action=create&amp;type=p', 'MenuNewProspect', 2, 'companies', '$user->rights->societe->creer', '', 2, 0, __ENTITY__);

View File

@ -616,10 +616,8 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
if (! empty($conf->societe->enabled) && ! empty($conf->fournisseur->enabled))
{
$langs->load("suppliers");
$newmenu->add("/fourn/list.php?leftmenu=suppliers", $langs->trans("ListSuppliersShort"), 1, $user->rights->fournisseur->lire, '', $mainmenu, 'suppliers');
$newmenu->add("/societe/list.php?type=f&leftmenu=suppliers", $langs->trans("ListSuppliersShort"), 1, $user->rights->fournisseur->lire, '', $mainmenu, 'suppliers');
$newmenu->add("/societe/soc.php?leftmenu=suppliers&amp;action=create&amp;type=f",$langs->trans("MenuNewSupplier"), 2, $user->rights->societe->creer && $user->rights->fournisseur->lire);
//$newmenu->add("/fourn/list.php?leftmenu=suppliers", $langs->trans("List"), 2, $user->rights->societe->lire && $user->rights->fournisseur->lire);
//$newmenu->add("/contact/list.php?leftmenu=suppliers&amp;type=f",$langs->trans("Contacts"), 2, $user->rights->societe->lire && $user->rights->fournisseur->lire && $user->rights->societe->contact->lire);
}
// Contacts
@ -1146,7 +1144,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
// Security check
$newmenu->add("/societe/soc.php?leftmenu=suppliers&amp;action=create&amp;type=f",$langs->trans("NewSupplier"), 1, $user->rights->societe->creer && $user->rights->fournisseur->lire);
$newmenu->add("/fourn/list.php",$langs->trans("List"), 1, $user->rights->societe->lire && $user->rights->fournisseur->lire);
$newmenu->add("/societe/list.php?type=f",$langs->trans("List"), 1, $user->rights->societe->lire && $user->rights->fournisseur->lire);
$newmenu->add("/contact/list.php?leftmenu=suppliers&amp;type=f",$langs->trans("Contacts"), 1, $user->rights->societe->contact->lire && $user->rights->fournisseur->lire);
$newmenu->add("/fourn/stats.php",$langs->trans("Statistics"), 1, $user->rights->societe->lire && $user->rights->fournisseur->lire);
}

140
htdocs/core/search.php Normal file
View File

@ -0,0 +1,140 @@
<?php
/* Copyright (C) 2015 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This file is a modified version of datepicker.php from phpBSM to fix some
* bugs, to add new features and to dramatically increase speed.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/core/search.php
* \brief Wrapper that receive any search. Depending on input field, make a redirect to correct URL.
*/
if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled cause need to load personalized language
if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled cause need to load personalized language
if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Not disabled cause need to do translations
if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK',1);
if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL',1);
if (! defined('NOLOGIN')) define('NOLOGIN',1); // Not disabled cause need to load personalized language
if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU',1);
//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML',1);
require_once '../main.inc.php';
/*
* Actions
*/
if (GETPOST('search_proposal') != '')
{
header("Location: ".DOL_URL_ROOT.'/comm/propal/list.php?sall='.urlencode(GETPOST('search_proposal')));
exit;
}
if (GETPOST('search_customer_order') != '')
{
header("Location: ".DOL_URL_ROOT.'/commande/list.php?sall='.urlencode(GETPOST('search_customer_order')));
exit;
}
if (GETPOST('search_supplier_order') != '')
{
header("Location: ".DOL_URL_ROOT.'/fourn/commande/list.php?search_all='.urlencode(GETPOST('search_supplier_order')));
exit;
}
if (GETPOST('search_intervention') != '')
{
header("Location: ".DOL_URL_ROOT.'/fichinter/list.php?sall='.urlencode(GETPOST('search_intervention')));
exit;
}
if (GETPOST('search_contract') != '')
{
header("Location: ".DOL_URL_ROOT.'/contrat/list.php?sall='.urlencode(GETPOST('search_contract')));
exit;
}
if (GETPOST('search_invoice') != '')
{
header("Location: ".DOL_URL_ROOT.'/compta/facture/list.php?sall='.urlencode(GETPOST('search_invoice')));
exit;
}
if (GETPOST('search_supplier_invoice') != '')
{
header("Location: ".DOL_URL_ROOT.'/fourn/facture/list.php?sall='.urlencode(GETPOST('search_supplier_invoice')));
exit;
}
if (GETPOST('search_donation') != '')
{
header("Location: ".DOL_URL_ROOT.'/don/list.php?sall='.urlencode(GETPOST('search_donation')));
exit;
}
if (GETPOST('search_product') != '')
{
header("Location: ".DOL_URL_ROOT.'/product/list.php?sall='.urlencode(GETPOST('search_product')));
exit;
}
if (GETPOST('search_thirdparty') != '')
{
header("Location: ".DOL_URL_ROOT.'/societe/list.php?mode=search&sall='.urlencode(GETPOST('search_thirdparty')));
exit;
}
if (GETPOST('search_contact') != '')
{
header("Location: ".DOL_URL_ROOT.'/contact/list.php?mode=search&sall='.urlencode(GETPOST('search_contact')));
exit;
}
if (GETPOST('search_deplacement') != '')
{
header("Location: ".DOL_URL_ROOT.'/compta/deplacement/list.php?mode=search&sall='.urlencode(GETPOST('search_deplacement')));
exit;
}
if (GETPOST('search_expensereport') != '')
{
header("Location: ".DOL_URL_ROOT.'/expensereport/list.php?mode=search&sall='.urlencode(GETPOST('search_expensereport')));
exit;
}
if (GETPOST('search_holiday') != '')
{
header("Location: ".DOL_URL_ROOT.'/holiday/list.php?mode=search&sall='.urlencode(GETPOST('search_holiday')));
exit;
}
if (GETPOST('search_member') != '')
{
header("Location: ".DOL_URL_ROOT.'/adherents/list.php?mode=search&sall='.urlencode(GETPOST('search_member')));
exit;
}
if (GETPOST('search_project') != '')
{
header("Location: ".DOL_URL_ROOT.'/projet/list.php?mode=search&search_all='.urlencode(GETPOST('search_project')));
exit;
}
if (GETPOST('search_task') != '')
{
header("Location: ".DOL_URL_ROOT.'/projet/tasks/index.php?mode=search&search_all='.urlencode(GETPOST('search_task')));
exit;
}
// If we are here, search was called with no supported criteria
if (! empty($_SERVER['HTTP_REFERER']))
{
header("Location: ".$_SERVER['HTTP_REFERER']);
exit;
}
else
{
print 'The wrapper search.php was called without any search criteria';
}

View File

@ -70,14 +70,14 @@ $searchform = '';
if ((( ! empty($conf->societe->enabled) && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS))) || ! empty($conf->fournisseur->enabled)) && ! empty($conf->global->MAIN_SEARCHFORM_SOCIETE) && $user->rights->societe->lire)
{
$langs->load("companies");
$searchform.=printSearchForm(DOL_URL_ROOT.'/societe/list.php', DOL_URL_ROOT.'/societe/list.php', img_object('','company').' '.$langs->trans("ThirdParties"), 'soc', 'socname');
$searchform.=printSearchForm(DOL_URL_ROOT.'/societe/list.php', DOL_URL_ROOT.'/societe/list.php', img_object('','company').' '.$langs->trans("ThirdParties"), 'soc', 'sall', '', 'company');
$nbofsearch++;
}
if (! empty($conf->societe->enabled) && ! empty($conf->global->MAIN_SEARCHFORM_CONTACT) && $user->rights->societe->lire)
{
$langs->load("companies");
$searchform.=printSearchForm(DOL_URL_ROOT.'/contact/list.php', DOL_URL_ROOT.'/contact/list.php', img_object('','contact').' '.$langs->trans("Contacts"), 'contact', 'contactname');
$searchform.=printSearchForm(DOL_URL_ROOT.'/contact/list.php', DOL_URL_ROOT.'/contact/list.php', img_object('','contact').' '.$langs->trans("Contacts"), 'contact', 'sall', '', 'contact');
$nbofsearch++;
}
@ -85,7 +85,7 @@ if (((! empty($conf->product->enabled) && $user->rights->produit->lire) || (! em
&& ! empty($conf->global->MAIN_SEARCHFORM_PRODUITSERVICE))
{
$langs->load("products");
$searchform.=printSearchForm(DOL_URL_ROOT.'/product/list.php', DOL_URL_ROOT.'/product/list.php', img_object('','product').' '.$langs->trans("Products")."/".$langs->trans("Services"), 'products', 'sall', '', 'sall'.rand(0,10));
$searchform.=printSearchForm(DOL_URL_ROOT.'/product/list.php', DOL_URL_ROOT.'/product/list.php', img_object('','product').' '.$langs->trans("Products")."/".$langs->trans("Services"), 'products', 'sall', '', 'product');
$nbofsearch++;
}
@ -100,7 +100,7 @@ if (((! empty($conf->product->enabled) && $user->rights->produit->lire) || (! em
if (! empty($conf->adherent->enabled) && ! empty($conf->global->MAIN_SEARCHFORM_ADHERENT) && $user->rights->adherent->lire)
{
$langs->load("members");
$searchform.=printSearchForm(DOL_URL_ROOT.'/adherents/list.php', DOL_URL_ROOT.'/adherents/list.php', img_object('','user').' '.$langs->trans("Members"), 'member', 'sall', 'sall'.rand(0,10));
$searchform.=printSearchForm(DOL_URL_ROOT.'/adherents/list.php', DOL_URL_ROOT.'/adherents/list.php', img_object('','user').' '.$langs->trans("Members"), 'member', 'sall', '', 'member');
$nbofsearch++;
}

View File

@ -100,9 +100,12 @@
<table class="nobordernopadding">
<tr><td>
<textarea name="param" id="param" cols="80" rows="<?php echo ROWS_4 ?>"><?php echo GETPOST('param'); ?></textarea>
</td><td id="helpselect"><?php print $form->textwithpicto('', $langs->trans("ExtrafieldParamHelpselect"),1,0)?></td>
<td><span id="helpsellist"><?php print $form->textwithpicto('', $langs->trans("ExtrafieldParamHelpsellist"),1,0)?></span>
<span id="helpchkbxlst"><?php print $form->textwithpicto('', $langs->trans("ExtrafieldParamHelpchkbxlst"),1,0)?></span></td></tr>
</td><td>
<span id="helpselect"><?php print $form->textwithpicto('', $langs->trans("ExtrafieldParamHelpselect"),1,0)?></span>
<span id="helpsellist"><?php print $form->textwithpicto('', $langs->trans("ExtrafieldParamHelpsellist"),1,0)?></span>
<span id="helpchkbxlst"><?php print $form->textwithpicto('', $langs->trans("ExtrafieldParamHelpchkbxlst"),1,0)?></span>
<span id="helplink"><?php print $form->textwithpicto('', $langs->trans("ExtrafieldParamHelplink"),1,0)?></span>
</td></tr>
</table>
</td>

View File

@ -93,7 +93,7 @@ elseif (($type== 'sellist') || ($type == 'chkbxlst') || ($type == 'link') )
<tr><td><?php echo $langs->trans("Position"); ?></td><td class="valeur"><input type="text" name="pos" size="5" value="<?php echo $extrafields->attribute_pos[$attrname]; ?>"></td></tr>
<!-- Value (for select list / radio) -->
<?php
if(($type == 'select') || ($type == 'sellist') || ($type == 'checkbox') || ($type == 'chkbxlst') || ($type == 'radio'))
if(($type == 'select') || ($type == 'sellist') || ($type == 'checkbox') || ($type == 'chkbxlst') || ($type == 'radio') || ($type == 'link'))
{
?>
<tr id="value_choice">

View File

@ -28,7 +28,7 @@ if (empty($relativepathwithnofile)) $relativepathwithnofile='';
if ($action == 'delete')
{
$langs->load("companies"); // Need for string DeleteFile+ConfirmDeleteFiles
$ret = $form->formconfirm(
$ret = $form->form_confirm(
$_SERVER["PHP_SELF"] . '?id=' . $object->id . '&urlfile=' . urlencode(GETPOST("urlfile")) . '&linkid=' . GETPOST('linkid', 'int') . (empty($param)?'':$param),
$langs->trans('DeleteFile'),
$langs->trans('ConfirmDeleteFile'),

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