Merge remote-tracking branch 'Upstream/develop' into develop-hrm

Conflicts:
	htdocs/user/card.php
This commit is contained in:
aspangaro 2015-10-17 07:19:46 +02:00
commit aac88519de
168 changed files with 4649 additions and 3673 deletions

View File

@ -15,7 +15,76 @@ WARNING: Following changes may create regression for some external modules, but
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:
@ -473,6 +542,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

@ -30,7 +30,7 @@ return "Regis Houssin";
# script_dolibarr_versions()
sub script_dolibarr_versions
{
return ( "3.7.2", "3.6.3", "3.5.6" );
return ( "3.8.1", "3.7.1", "3.6.4", "3.5.7" );
}
sub script_dolibarr_category
@ -163,7 +163,7 @@ return ("tar", "gunzip");
}
# script_dolibarr_install(&domain, version, &opts, &files, &upgrade-info)
# Actually installs joomla, and returns either 1 and an informational
# Actually installs dolibarr, and returns either 1 and an informational
# message, or 0 and an error
sub script_dolibarr_install
{
@ -206,6 +206,9 @@ $pgcharset = $tmpl->{'postgres_encoding'};
$charset = $dbtype eq "mysql" ? $mycharset : $pgcharset;
$collate = $dbtype eq "mysql" ? $mycollate : "C";
# Install filename
local $step = $version >= 3.8 ? "step" : "etape";
$path = &script_path_url($d, $opts);
if ($path =~ /^https:/ || $d->{'ssl'}) {
$url = "https://$d->{'dom'}";
@ -224,6 +227,10 @@ if (!$upgrade) {
&set_permissions_as_domain_user($d, 0666, $cfile);
&run_as_domain_user($d, "mkdir ".quotemeta($docdir));
&set_permissions_as_domain_user($d, 0777, $docdir);
if (!$version >= 3.7.2) {
&run_as_domain_user($d, "mkdir ".quotemeta($altdir));
&set_permissions_as_domain_user($d, 0777, $altdir);
}
}
else {
# Preserve old config file, documents and custom directory
@ -259,7 +266,7 @@ if ($upgrade) {
[ "versionfrom", $upgrade->{'version'} ],
[ "versionto", $ver ],
);
local $err = &call_dolibarr_wizard_page(\@params, "step5", $d, $opts);
local $err = &call_dolibarr_wizard_page(\@params, $step."5", $d, $opts);
return (-1, "Dolibarr wizard failed : $err") if ($err);
# Remove the installation directory.
@ -282,15 +289,15 @@ else {
[ "main_force_https", $opts->{'forcehttps'} ],
[ "dolibarr_main_db_character_set", $charset ],
[ "dolibarr_main_db_collation", $collate ],
[ "usealternaterootdir", "1" ],
[ "main_use_alt_dir", "1" ],
[ "main_alt_dir_name", "custom" ],
);
local $err = &call_dolibarr_wizard_page(\@params, "step1", $d, $opts);
local $err = &call_dolibarr_wizard_page(\@params, $step."1", $d, $opts);
return (-1, "Dolibarr wizard failed : $err") if ($err);
# Second page (Populate database)
local @params = ( [ "action", "set" ] );
local $err = &call_dolibarr_wizard_page(\@params, "step2", $d, $opts);
local $err = &call_dolibarr_wizard_page(\@params, $step."2", $d, $opts);
return (-1, "Dolibarr wizard failed : $err") if ($err);
# Third page (Add administrator account)
@ -299,7 +306,7 @@ else {
[ "pass", $dompass ],
[ "pass_verif", $dompass ],
);
local $err = &call_dolibarr_wizard_page(\@params, "step5", $d, $opts);
local $err = &call_dolibarr_wizard_page(\@params, $step."5", $d, $opts);
return (-1, "Dolibarr wizard failed : $err") if ($err);
# Remove the installation directory and protect config file.
@ -324,14 +331,10 @@ local ($params, $page, $d, $opts) = @_;
local $params = join("&", map { $_->[0]."=".&urlize($_->[1]) } @$params );
local $ipage = $opts->{'path'}."/install/".$page.".php";
local ($iout, $ierror);
&post_http_connection($d, $ipage, $params, \$iout, \$ierror);
print STDERR $iout;
if ($ierror) {
return $ierror;
}
return undef;
}
@ -347,8 +350,8 @@ local $derr = &delete_script_install_directory($d, $opts);
return (0, $derr) if ($derr);
# Remove all llx_ tables from the database
# 4 times because of constraints
for(my $i=0; $i<4; $i++) {
# 10 times because of constraints
for(my $i=0; $i<10; $i++) {
&cleanup_script_database($d, $opts->{'db'}, "llx_");
}
@ -381,9 +384,10 @@ sub script_dolibarr_check_latest
{
local ($ver) = @_;
local @vers = &osdn_package_versions("dolibarr",
$ver >= 3.2 ? "dolibarr\\-(3\\.[0-9\\.]+)\\.tgz" :
$ver >= 3.1 ? "dolibarr\\-(3\\.1\\.[0-9\\.]+)\\.tgz" :
$ver >= 3 ? "dolibarr\\-(3\\.0\\.[0-9\\.]+)\\.tgz" :
$ver >= 3.8 ? "dolibarr\\-(3\\.[0-9\\.]+)\\.tgz" :
$ver >= 3.7 ? "dolibarr\\-(3\\.7\\.[0-9\\.]+)\\.tgz" :
$ver >= 3.6 ? "dolibarr\\-(3\\.6\\.[0-9\\.]+)\\.tgz" :
$ver >= 3.5 ? "dolibarr\\-(3\\.5\\.[0-9\\.]+)\\.tgz" :
$ver >= 2.9 ? "dolibarr\\-(2\\.9\\.[0-9\\.]+)\\.tgz" :
"dolibarr\\-(2\\.8\\.[0-9\\.]+)\\.tgz");
return "Failed to find versions" if (!@vers);

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

@ -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

@ -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

@ -249,7 +249,7 @@ dol_fiche_head($head, 'general', $langs->trans("CommRequests"), 0, 'askpricesupp
/*
* Module numerotation
*/
print load_fiche_titre($langs->trans("AskPriceSupplierNumberingModules"));
print load_fiche_titre($langs->trans("AskPriceSupplierNumberingModules"),'','');
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
@ -351,7 +351,7 @@ print "</table><br>\n";
* Document templates generators
*/
print load_fiche_titre($langs->trans("AskPriceSupplierPDFModules"));
print load_fiche_titre($langs->trans("AskPriceSupplierPDFModules"),'','');
// Load array def with activated templates
$def = array();
@ -513,7 +513,7 @@ print '<br>';
* Other options
*
*/
print load_fiche_titre($langs->trans("OtherOptions"));
print load_fiche_titre($langs->trans("OtherOptions"),'','');
$var=true;
print "<table class=\"noborder\" width=\"100%\">";
@ -594,7 +594,7 @@ print '</table>';
* Directory
*/
print '<br>';
print load_fiche_titre($langs->trans("PathToDocuments"));
print load_fiche_titre($langs->trans("PathToDocuments"),'','');
print "<table class=\"noborder\" width=\"100%\">\n";
print "<tr class=\"liste_titre\">\n";

View File

@ -188,7 +188,7 @@ foreach($dirbarcode as $reldir)
$var=true;
print '<br>';
print load_fiche_titre($langs->trans("BarcodeEncodeModule"));
print load_fiche_titre($langs->trans("BarcodeEncodeModule"),'','');
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
@ -288,7 +288,7 @@ print "<br>";
* Autres options
*
*/
print load_fiche_titre($langs->trans("OtherOptions"));
print load_fiche_titre($langs->trans("OtherOptions"),'','');
print "<form method=\"post\" action=\"".$_SERVER["PHP_SELF"]."\">";
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@ -358,7 +358,7 @@ print '<br>';
// Select barcode numbering module
if ($conf->produit->enabled)
{
print load_fiche_titre($langs->trans("BarCodeNumberManager")." (".$langs->trans("Product").")");
print load_fiche_titre($langs->trans("BarCodeNumberManager")." (".$langs->trans("Product").")",'','');
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';

View File

@ -273,7 +273,7 @@ dol_fiche_head($head, 'general', $langs->trans("Orders"), 0, 'order');
* Orders Numbering model
*/
print load_fiche_titre($langs->trans("OrdersNumberingModules"));
print load_fiche_titre($langs->trans("OrdersNumberingModules"),'','');
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
@ -377,7 +377,7 @@ print "</table><br>\n";
* Document templates generators
*/
print load_fiche_titre($langs->trans("OrdersModelModule"));
print load_fiche_titre($langs->trans("OrdersModelModule"),'','');
// Load array def with activated templates
$def = array();
@ -540,7 +540,7 @@ print "<br>";
*
*/
print load_fiche_titre($langs->trans("OtherOptions"));
print load_fiche_titre($langs->trans("OtherOptions"),'','');
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Parameter").'</td>';
@ -638,7 +638,7 @@ print '<br>';
* Notifications
*/
print load_fiche_titre($langs->trans("Notifications"));
print load_fiche_titre($langs->trans("Notifications"),'','');
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Parameter").'</td>';

View File

@ -226,7 +226,7 @@ dol_fiche_head($head, 'contract', $langs->trans("Contracts"), 0, 'contract');
* Contracts Numbering model
*/
print load_fiche_titre($langs->trans("ContractsNumberingModules"));
print load_fiche_titre($langs->trans("ContractsNumberingModules"),'','');
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
@ -329,7 +329,7 @@ print '</table><br>';
* Documents models for Contracts
*/
print load_fiche_titre($langs->trans("TemplatePDFContracts"));
print load_fiche_titre($langs->trans("TemplatePDFContracts"),'','');
// Defini tableau def des modeles
$def = array();
@ -494,7 +494,7 @@ print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="set_other">';
print load_fiche_titre($langs->trans("OtherOptions"));
print load_fiche_titre($langs->trans("OtherOptions"),'','');
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Parameter").'</td>';

View File

@ -244,7 +244,7 @@ dol_fiche_head($head, 'expensereport', $langs->trans("ExpenseReports"), 0, 'trip
// Interventions numbering model
/*
print load_fiche_titre($langs->trans("FicheinterNumberingModules"));
print load_fiche_titre($langs->trans("FicheinterNumberingModules"),'','');
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';

View File

@ -302,7 +302,7 @@ dol_fiche_head($head, 'general', $langs->trans("Invoices"), 0, 'invoice');
* Numbering module
*/
print load_fiche_titre($langs->trans("BillsNumberingModule"));
print load_fiche_titre($langs->trans("BillsNumberingModule"),'','');
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
@ -471,7 +471,7 @@ print '</table>';
* Document templates generators
*/
print '<br>';
print load_fiche_titre($langs->trans("BillsPDFModules"));
print load_fiche_titre($langs->trans("BillsPDFModules"),'','');
// Load array def with activated templates
$type='invoice';
@ -631,7 +631,7 @@ print '</table>';
* Modes de reglement
*/
print '<br>';
print load_fiche_titre($langs->trans("SuggestedPaymentModesIfNotDefinedInInvoice"));
print load_fiche_titre($langs->trans("SuggestedPaymentModesIfNotDefinedInInvoice"),'','');
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'" />';
@ -726,7 +726,7 @@ print "</form>";
print "<br>";
print load_fiche_titre($langs->trans("OtherOptions"));
print load_fiche_titre($langs->trans("OtherOptions"),'','');
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
@ -805,7 +805,7 @@ print '</table>';
* Repertoire
*/
print '<br>';
print load_fiche_titre($langs->trans("PathToDocuments"));
print load_fiche_titre($langs->trans("PathToDocuments"),'','');
print '<table class="noborder" width="100%">'."\n";
print '<tr class="liste_titre">'."\n";
@ -823,7 +823,7 @@ print "</table>\n";
* Notifications
*/
print '<br>';
print load_fiche_titre($langs->trans("Notifications"));
print load_fiche_titre($langs->trans("Notifications"),'','');
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Parameter").'</td>';

View File

@ -255,7 +255,7 @@ dol_fiche_head($head, 'ficheinter', $langs->trans("Interventions"), 0, 'interven
// Interventions numbering model
print load_fiche_titre($langs->trans("FicheinterNumberingModules"));
print load_fiche_titre($langs->trans("FicheinterNumberingModules"),'','');
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
@ -357,7 +357,7 @@ print '</table><br>';
* Documents models for Interventions
*/
print load_fiche_titre($langs->trans("TemplatePDFInterventions"));
print load_fiche_titre($langs->trans("TemplatePDFInterventions"),'','');
// Defini tableau def des modeles
$type='ficheinter';
@ -511,7 +511,7 @@ print "<br>";
*
*/
print load_fiche_titre($langs->trans("OtherOptions"));
print load_fiche_titre($langs->trans("OtherOptions"),'','');
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Parameter").'</td>';

View File

@ -237,7 +237,7 @@ dol_fiche_head($head, $hselected, $langs->trans("ModuleSetup"));
* Livraison numbering model
*/
print load_fiche_titre($langs->trans("DeliveryOrderNumberingModules"));
print load_fiche_titre($langs->trans("DeliveryOrderNumberingModules"),'','');
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
@ -340,7 +340,7 @@ print '</table>';
* Documents Models for delivery
*/
print '<br>';
print load_fiche_titre($langs->trans("DeliveryOrderModel"));
print load_fiche_titre($langs->trans("DeliveryOrderModel"),'','');
// Defini tableau def de modele
$type="delivery";
@ -487,7 +487,7 @@ print '</table>';
* Autres Options
*/
print "<br>";
print load_fiche_titre($langs->trans("OtherOptions"));
print load_fiche_titre($langs->trans("OtherOptions"),'','');
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005-2011 Laurent Destailleur <eldy@users.sourceforge.org>
* Copyright (C) 2005-2015 Laurent Destailleur <eldy@users.sourceforge.org>
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
*
* This program is free software; you can redistribute it and/or modify
@ -132,10 +132,12 @@ print '<td>'.$langs->trans("Value").'</td>';
print "</tr>\n";
$var=!$var;
print '<tr '.$bc[$var].'><td>';
print $langs->trans("NotificationEMailFrom").'</td><td>';
print $langs->trans("NotificationEMailFrom").'</td>';
print '<td>';
print '<input size="32" type="email" name="email_from" value="'.$conf->global->NOTIFICATION_EMAIL_FROM.'">';
if (! empty($conf->global->NOTIFICATION_EMAIL_FROM) && ! isValidEmail($conf->global->NOTIFICATION_EMAIL_FROM)) print ' '.img_warning($langs->trans("ErrorBadEMail"));
print '</td></tr>';
print '</td>';
print '</tr>';
print '</table>';
print '<br>';
@ -150,8 +152,7 @@ if ($conf->societe->enabled)
print '<td>'.$langs->trans("Module").'</td>';
print '<td>'.$langs->trans("Code").'</td>';
print '<td>'.$langs->trans("Label").'</td>';
print '<td align="right">'.$langs->trans("NbOfTargetedContacts").'</td>';
print '<td>'.'</td>';
//print '<td align="right">'.$langs->trans("NbOfTargetedContacts").'</td>';
print "</tr>\n";
// Load array of available notifications
@ -173,10 +174,10 @@ if ($conf->societe->enabled)
print '<td>'.$elementLabel.'</td>';
print '<td>'.$notifiedevent['code'].'</td>';
print '<td>'.$label.'</td>';
print '<td align="right">';
/*print '<td align="right">';
$tmparray = $notify->getNotificationsArray($notifiedevent['code'], 0);
print count($tmparray);
print '</td>';
print '</td>';*/
print '</tr>';
}

View File

@ -270,7 +270,7 @@ dol_fiche_head($head, 'general', $langs->trans("Proposals"), 0, 'propal');
/*
* Module numerotation
*/
print load_fiche_titre($langs->trans("ProposalsNumberingModules"));
print load_fiche_titre($langs->trans("ProposalsNumberingModules"),'','');
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
@ -374,7 +374,7 @@ print "</table><br>\n";
* Document templates generators
*/
print load_fiche_titre($langs->trans("ProposalsPDFModules"));
print load_fiche_titre($langs->trans("ProposalsPDFModules"),'','');
// Load array def with activated templates
$def = array();
@ -536,7 +536,7 @@ print '<br>';
* Other options
*
*/
print load_fiche_titre($langs->trans("OtherOptions"));
print load_fiche_titre($langs->trans("OtherOptions"),'','');
$var=true;
print "<table class=\"noborder\" width=\"100%\">";
@ -643,7 +643,7 @@ print '</table>';
* Directory
*/
print '<br>';
print load_fiche_titre($langs->trans("PathToDocuments"));
print load_fiche_titre($langs->trans("PathToDocuments"),'','');
print "<table class=\"noborder\" width=\"100%\">\n";
print "<tr class=\"liste_titre\">\n";
@ -658,7 +658,7 @@ print "</table>\n<br>";
* Notifications
*/
print load_fiche_titre($langs->trans("Notifications"));
print load_fiche_titre($langs->trans("Notifications"),'','');
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Parameter").'</td>';

View File

@ -83,6 +83,8 @@ print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="update">';
dol_fiche_head();
/*
* Params
*/
@ -109,10 +111,13 @@ foreach ($list as $key)
print '</tr>';
print '</form>';
print "</table>\n";
print '<br /><div style="text-align:center"><input type="submit" class="button" value="'.$langs->trans('Modify').'" name="button"></div>';
print '</form>';
dol_fiche_end();
print '<div style="text-align:center"><input type="submit" class="button" value="'.$langs->trans('Modify').'" name="button"></div>';
llxFooter();
$db->close();
$db->close();

View File

@ -205,7 +205,7 @@ dol_fiche_head($head, 'invoice', $langs->trans("Suppliers"), 0, 'company');
// Supplier invoice numbering module
print load_fiche_titre($langs->trans("SuppliersInvoiceNumberingModel"));
print load_fiche_titre($langs->trans("SuppliersInvoiceNumberingModel"),'','');
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
@ -311,7 +311,7 @@ print '</table><br>';
* Modeles documents for supplier invoices
*/
print load_fiche_titre($langs->trans("BillsPDFModules"));
print load_fiche_titre($langs->trans("BillsPDFModules"),'','');
// Defini tableau def de modele
$def = array();
@ -453,7 +453,7 @@ print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="set_SUPPLIER_INVOICE_FREE_TEXT">';
print load_fiche_titre($langs->trans("OtherOptions"));
print load_fiche_titre($langs->trans("OtherOptions"),'','');
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Parameter").'</td>';
@ -487,7 +487,7 @@ print '</form>';
* Notifications
*/
print load_fiche_titre($langs->trans("Notifications"));
print load_fiche_titre($langs->trans("Notifications"),'','');
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Parameter").'</td>';

View File

@ -221,7 +221,7 @@ dol_fiche_head($head, 'order', $langs->trans("Suppliers"), 0, 'company');
// Supplier order numbering module
print load_fiche_titre($langs->trans("OrdersNumberingModules"));
print load_fiche_titre($langs->trans("OrdersNumberingModules"),'','');
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
@ -325,7 +325,7 @@ print '</table><br>';
* Documents models for supplier orders
*/
print load_fiche_titre($langs->trans("OrdersModelModule"));
print load_fiche_titre($langs->trans("OrdersModelModule"),'','');
// Defini tableau def de modele
$def = array();
@ -464,7 +464,7 @@ print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="set_SUPPLIER_ORDER_OTHER">';
print load_fiche_titre($langs->trans("OtherOptions"));
print load_fiche_titre($langs->trans("OtherOptions"),'','');
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Parameter").'</td>';
@ -512,7 +512,7 @@ print '</form>';
* Notifications
*/
print load_fiche_titre($langs->trans("Notifications"));
print load_fiche_titre($langs->trans("Notifications"),'','');
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Parameter").'</td>';

View File

@ -399,14 +399,13 @@ class Categorie extends CommonObject
}
else if ($reshook < 0) $error++;
$this->db->commit();
// Call trigger
$result=$this->call_trigger('CATEGORY_MODIFY',$user);
if ($result < 0) { $error++; $this->db->rollback(); return -1; }
// End call triggers
$this->db->commit();
return 1;
}
else

View File

@ -323,7 +323,7 @@ if ($action == 'add')
unset($_SESSION['assignedtouser']);
$moreparam='';
if ($user->id != $object->ownerid) $moreparam="usertodo=-1"; // We force to remove filter so created record is visible when going back to per user view.
if ($user->id != $object->userownerid) $moreparam="usertodo=-1"; // We force to remove filter so created record is visible when going back to per user view.
$db->commit();
if (! empty($backtopage))
@ -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

@ -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

@ -218,17 +218,15 @@ if ($id > 0)
dol_fiche_head($head, 'customer', $langs->trans("ThirdParty"),0,'company');
dol_banner_tab($object, 'socid', '', ($user->societe_id?0:1), 'rowid', 'nom');
print '<div class="fichecenter"><div class="fichehalfleft">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">';
print '<tr><td width="30%">'.$langs->trans("ThirdPartyName").'</td><td width="70%" colspan="3">';
print $form->showrefnav($object,'socid','',($user->societe_id?0:1),'rowid','nom','','');
print '</td></tr>';
// Alias name (commercial, trademark or alias name)
print '<tr><td>'.$langs->trans('AliasNameShort').'</td><td colspan="3">';
print '<tr><td class="titelfield">'.$langs->trans('AliasNameShort').'</td><td colspan="3">';
print $object->name_alias;
print "</td></tr>";
@ -264,39 +262,6 @@ if ($id > 0)
print '</tr>';
}
// Address
print '<tr><td>'.$langs->trans('Address').'</td><td colspan="3">';
dol_print_address($object->address,'gmap','thirdparty',$object->id);
print "</td></tr>";
// Zip / Town
print '<tr><td class="nowrap">'.$langs->trans('Zip').' / '.$langs->trans('Town').'</td>';
print '<td colspan="3">'.$object->zip.(($object->zip && $object->town)?' / ':'').$object->town."</td>";
print '</tr>';
// Country
print '<tr><td>'.$langs->trans("Country").'</td><td colspan="3">';
if (! empty($object->country_code))
{
//$img=picto_from_langcode($object->country_code);
$img='';
if ($object->isInEEC()) print $form->textwithpicto(($img?$img.' ':'').$object->country,$langs->trans("CountryIsInEEC"),1,0);
else print ($img?$img.' ':'').$object->country;
}
print '</td></tr>';
// EMail
print '<td>'.$langs->trans('EMail').'</td><td colspan="3">'.dol_print_email($object->email,0,$object->id,'AC_EMAIL').'</td></tr>';
// Web
print '<tr><td>'.$langs->trans("Web").'</td><td colspan="3">'.dol_print_url($object->url,'_blank').'</td></tr>';
// Phone
print '<tr><td>'.$langs->trans('Phone').'</td><td style="min-width: 25%;">'.dol_print_phone($object->phone,$object->country_code,0,$object->id,'AC_TEL').'</td>';
// Fax
print '<td>'.$langs->trans('Fax').'</td><td style="min-width: 25%;">'.dol_print_phone($object->fax,$object->country_code,0,$object->id,'AC_FAX').'</td></tr>';
// Skype
if (! empty($conf->skype->enabled))
{

View File

@ -75,84 +75,51 @@ 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
*/
@ -172,12 +139,13 @@ if (! empty($conf->propal->enabled) && $user->rights->propal->lire)
$resql=$db->query($sql);
if ($resql)
{
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td colspan="3">'.$langs->trans("ProposalsDraft").'</td></tr>';
$total = 0;
$num = $db->num_rows($resql);
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>';
if ($num > 0)
{
$i = 0;
@ -246,12 +214,13 @@ if (! empty($conf->commande->enabled) && $user->rights->commande->lire)
$resql = $db->query($sql);
if ($resql)
{
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td colspan="3">'.$langs->trans("DraftOrders").'</td></tr>';
$total = 0;
$num = $db->num_rows($resql);
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>';
if ($num)
{
$i = 0;
@ -329,7 +298,11 @@ if (! empty($conf->societe->enabled) && $user->rights->societe->lire)
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td colspan="2">'.$langs->trans("BoxTitleLastCustomersOrProspects",$max).'</td>';
print '<td colspan="2">';
if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) print $langs->trans("BoxTitleLastCustomersOrProspects",$max);
else if (! empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) print $langs->trans("BoxTitleLastModifiedProspects",$max);
else print $langs->trans("BoxTitleLastModifiedCustomers",$max);
print '</td>';
print '<td align="right">'.$langs->trans("DateModificationShort").'</td>';
print '</tr>';
if ($num)

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 = '';
}
}

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;

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

@ -159,7 +159,8 @@ $sts = array(-1,0,1,2,3);
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('prospectlist'));
$contextpage='prospectlist';
$hookmanager->initHooks(array($contextpage));
$extrafields = new ExtraFields($db);
// fetch optionals attributes and labels
@ -167,7 +168,7 @@ $extralabels = $extrafields->fetch_name_optionals_label('thirdparty');
$search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_');
// Do we click on 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
{
$socname="";
$stcomm="";
@ -271,7 +272,7 @@ if ($socname)
$sortfield = "s.nom";
$sortorder = "ASC";
}
// Extra fields
// Add where from extra fields
foreach ($search_array_options as $key => $val)
{
$crit=$val;
@ -339,15 +340,14 @@ if ($resql)
if ($search_status != '') $param.='&search_status='.$search_status;
if ($search_country != '') $param.='&amp;search_country='.$search_country;
if ($search_type_thirdparty != '') $param.='&amp;search_type_thirdparty='.$search_type_thirdparty;
foreach ($search_array_options as $key => $val)
// Add $param from extra fields
foreach ($search_array_options as $key => $val)
{
$crit=$val;
$tmpkey=preg_replace('/search_options_/','',$key);
$param.='&search_options_'.$tmpkey.'='.urlencode($val);
}
// $param and $urladd should have the same value
$urladd = $param;
print_barre_liste($langs->trans("ListOfProspects"), $page, $_SERVER["PHP_SELF"], $param, $sortfield,$sortorder,'',$num,$nbtotalofrecords,'title_companies.png');

View File

@ -52,9 +52,9 @@ if (GETPOST('cancel') && ! empty($backtopage))
if (GETPOST("action") == 'setremise')
{
$soc = New Societe($db);
$soc->fetch($_GET["id"]);
$result=$soc->set_remise_client($_POST["remise"],$_POST["note"],$user);
$object = new Societe($db);
$object->fetch($_GET["id"]);
$result=$object->set_remise_client($_POST["remise"],$_POST["note"],$user);
if ($result > 0)
{
@ -71,7 +71,7 @@ if (GETPOST("action") == 'setremise')
}
else
{
setEventMessage($soc->error, 'errors');
setEventMessages($object->error, $object->errors, 'errors');
}
}
@ -93,51 +93,50 @@ llxHeader();
if ($socid > 0)
{
// On recupere les donnees societes par l'objet
$objsoc = new Societe($db);
$objsoc->id=$socid;
$objsoc->fetch($socid);
$object = new Societe($db);
$object->fetch($socid);
$head = societe_prepare_head($objsoc);
$head = societe_prepare_head($object);
print '<form method="POST" action="remise.php?id='.$objsoc->id.'">';
print '<form method="POST" action="remise.php?id='.$object->id.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="setremise">';
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
dol_fiche_head($head, 'relativediscount', $langs->trans("ThirdParty"),0,'company');
print '<table class="border" width="100%">';
// Name
print '<tr><td colspan="2" width="25%">'.$langs->trans('Name').'</td>';
print '<td colspan="2">';
print $form->showrefnav($objsoc,'id','',1,'rowid','nom');
print '</td></tr>';
dol_banner_tab($object, 'socid', '', ($user->societe_id?0:1), 'rowid', 'nom');
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent">';
// Remise
print '<tr><td colspan="2" width="25%">';
print $langs->trans("CustomerRelativeDiscount").'</td><td colspan="2">'.price2num($objsoc->remise_percent)."%</td></tr>";
print '<tr><td class="titlefield">';
print $langs->trans("CustomerRelativeDiscount").'</td><td>'.price2num($object->remise_percent)."%</td></tr>";
print '</table>';
print '<br>';
print load_fiche_titre($langs->trans("NewRelativeDiscount"),'','');
print '<table class="border" width="100%">';
print '<table class="border centpercent">';
// Nouvelle valeur
print '<tr><td colspan="2">';
print $langs->trans("NewValue").'</td><td colspan="2"><input type="text" size="5" name="remise" value="'.($_POST["remise"]?$_POST["remise"]:'').'">%</td></tr>';
print '<tr><td class="titlefield">';
print $langs->trans("NewValue").'</td><td><input type="text" size="5" name="remise" value="'.($_POST["remise"]?$_POST["remise"]:'').'">%</td></tr>';
// Motif/Note
print '<tr><td colspan="2" width="25%">';
print $langs->trans("NoteReason").'</td><td colspan="2"><input type="text" size="60" name="note" value="'.$_POST["note"].'"></td></tr>';
print '<tr><td>';
print $langs->trans("NoteReason").'</td><td><input type="text" size="60" name="note" value="'.$_POST["note"].'"></td></tr>';
print "</table>";
print '</div>';
dol_fiche_end();
print '<div class="center">';
@ -160,7 +159,7 @@ if ($socid > 0)
$sql = "SELECT rc.rowid, rc.remise_client as remise_percent, rc.note, rc.datec as dc,";
$sql.= " u.login, u.rowid as user_id";
$sql.= " FROM ".MAIN_DB_PREFIX."societe_remise as rc, ".MAIN_DB_PREFIX."user as u";
$sql.= " WHERE rc.fk_soc =". $objsoc->id;
$sql.= " WHERE rc.fk_soc =". $object->id;
$sql.= " AND u.rowid = rc.fk_user_author";
$sql.= " ORDER BY rc.datec DESC";

View File

@ -36,7 +36,7 @@ $action=GETPOST('action','alpha');
$backtopage=GETPOST('backtopage','alpha');
// Security check
$socid = GETPOST('id','int');
$socid = GETPOST('id','int')?GETPOST('id','int'):GETPOST('socid','int');
if ($user->societe_id > 0)
{
$socid = $user->societe_id;
@ -212,36 +212,34 @@ llxHeader('',$langs->trans("GlobalDiscount"));
if ($socid > 0)
{
// On recupere les donnees societes par l'objet
$objsoc = new Societe($db);
$objsoc->id=$socid;
$objsoc->fetch($socid);
$object = new Societe($db);
$object->fetch($socid);
/*
* Affichage onglets
*/
$head = societe_prepare_head($objsoc);
$head = societe_prepare_head($object);
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$objsoc->id.'">';
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="setremise">';
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
dol_fiche_head($head, 'absolutediscount', $langs->trans("ThirdParty"),0,'company');
print '<table class="border" width="100%">';
// Name
print '<tr><td width="38%">'.$langs->trans('Name').'</td>';
print '<td>';
print $form->showrefnav($objsoc,'id','',1,'rowid','nom');
print '</td></tr>';
dol_banner_tab($object, 'socid', '', ($user->societe_id?0:1), 'rowid', 'nom');
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent">';
// Calcul avoirs en cours
$remise_all=$remise_user=0;
$sql = "SELECT SUM(rc.amount_ht) as amount, rc.fk_user";
$sql.= " FROM ".MAIN_DB_PREFIX."societe_remise_except as rc";
$sql.= " WHERE rc.fk_soc =". $objsoc->id;
$sql.= " WHERE rc.fk_soc =". $object->id;
$sql.= " AND (fk_facture_line IS NULL AND fk_facture IS NULL)";
$sql.= " GROUP BY rc.fk_user";
$resql=$db->query($sql);
@ -256,7 +254,7 @@ if ($socid > 0)
dol_print_error($db);
}
print '<tr><td width="38%">'.$langs->trans("CustomerAbsoluteDiscountAllUsers").'</td>';
print '<tr><td class="titlefield">'.$langs->trans("CustomerAbsoluteDiscountAllUsers").'</td>';
print '<td>'.$remise_all.'&nbsp;'.$langs->trans("Currency".$conf->currency).' '.$langs->trans("HT").'</td></tr>';
print '<tr><td>'.$langs->trans("CustomerAbsoluteDiscountMy").'</td>';
@ -271,13 +269,15 @@ if ($socid > 0)
print '<span class="hideonsmartphone">&nbsp;'.$langs->trans("Currency".$conf->currency).'</span></td></tr>';
print '<tr><td width="38%">'.$langs->trans("VAT").'</td>';
print '<td>';
print $form->load_tva('tva_tx',GETPOST('tva_tx'),$mysoc,$objsoc);
print $form->load_tva('tva_tx',GETPOST('tva_tx'),$mysoc,$object);
print '</td></tr>';
print '<tr><td>'.$langs->trans("NoteReason").'</td>';
print '<td><input type="text" size="60" name="desc" value="'.$_POST["desc"].'"></td></tr>';
print "</table>";
print '</div>';
dol_fiche_end();
print '<div class="center">';
@ -296,7 +296,7 @@ if ($socid > 0)
if ($_GET['action'] == 'remove')
{
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$objsoc->id.'&remid='.$_GET["remid"], $langs->trans('RemoveDiscount'), $langs->trans('ConfirmRemoveDiscount'), 'confirm_remove', '', 0, 1);
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&remid='.$_GET["remid"], $langs->trans('RemoveDiscount'), $langs->trans('ConfirmRemoveDiscount'), 'confirm_remove', '', 0, 1);
}
/*
@ -309,7 +309,7 @@ if ($socid > 0)
$sql.= " fa.facnumber as ref, fa.type as type";
$sql.= " FROM ".MAIN_DB_PREFIX."user as u, ".MAIN_DB_PREFIX."societe_remise_except as rc";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture as fa ON rc.fk_facture_source = fa.rowid";
$sql.= " WHERE rc.fk_soc =". $objsoc->id;
$sql.= " WHERE rc.fk_soc =". $object->id;
$sql.= " AND u.rowid = rc.fk_user";
$sql.= " AND (rc.fk_facture_line IS NULL AND rc.fk_facture IS NULL)";
$sql.= " ORDER BY rc.datec DESC";
@ -375,9 +375,9 @@ if ($socid > 0)
if ($user->rights->societe->creer || $user->rights->facture->creer)
{
print '<td class="nowrap">';
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$objsoc->id.'&amp;action=split&amp;remid='.$obj->rowid.'">'.img_picto($langs->trans("SplitDiscount"),'split').'</a>';
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=split&amp;remid='.$obj->rowid.'">'.img_picto($langs->trans("SplitDiscount"),'split').'</a>';
print ' &nbsp; ';
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$objsoc->id.'&amp;action=remove&amp;remid='.$obj->rowid.'">'.img_delete($langs->trans("RemoveDiscount")).'</a>';
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=remove&amp;remid='.$obj->rowid.'">'.img_delete($langs->trans("RemoveDiscount")).'</a>';
print '</td>';
}
else print '<td>&nbsp;</td>';
@ -403,7 +403,7 @@ if ($socid > 0)
array('type' => 'text', 'name' => 'amount_ttc_2', 'label' => $langs->trans("AmountTTC").' 2', 'value' => $amount2, 'size' => '5')
);
$langs->load("dict");
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$objsoc->id.'&remid='.$showconfirminfo['rowid'], $langs->trans('SplitDiscount'), $langs->trans('ConfirmSplitDiscount',price($showconfirminfo['amount_ttc']),$langs->transnoentities("Currency".$conf->currency)), 'confirm_split', $formquestion, 0, 0);
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&remid='.$showconfirminfo['rowid'], $langs->trans('SplitDiscount'), $langs->trans('ConfirmSplitDiscount',price($showconfirminfo['amount_ttc']),$langs->transnoentities("Currency".$conf->currency)), 'confirm_split', $formquestion, 0, 0);
}
}
else
@ -429,7 +429,7 @@ if ($socid > 0)
$sql.= " , ".MAIN_DB_PREFIX."facturedet as fc";
$sql.= " , ".MAIN_DB_PREFIX."societe_remise_except as rc";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture as fa ON rc.fk_facture_source = fa.rowid";
$sql.= " WHERE rc.fk_soc =". $objsoc->id;
$sql.= " WHERE rc.fk_soc =". $object->id;
$sql.= " AND rc.fk_facture_line = fc.rowid";
$sql.= " AND fc.fk_facture = f.rowid";
$sql.= " AND rc.fk_user = u.rowid";
@ -446,7 +446,7 @@ if ($socid > 0)
$sql2.= " , ".MAIN_DB_PREFIX."user as u";
$sql2.= " , ".MAIN_DB_PREFIX."societe_remise_except as rc";
$sql2.= " LEFT JOIN ".MAIN_DB_PREFIX."facture as fa ON rc.fk_facture_source = fa.rowid";
$sql2.= " WHERE rc.fk_soc =". $objsoc->id;
$sql2.= " WHERE rc.fk_soc =". $object->id;
$sql2.= " AND rc.fk_facture = f.rowid";
$sql2.= " AND rc.fk_user = u.rowid";

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);

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);
}
@ -1009,116 +1009,112 @@ class Commande extends CommonOrder
$error=0;
// Signed proposal
if ($object->statut == 2)
$this->date_commande = dol_now();
$this->source = 0;
$num=count($object->lines);
for ($i = 0; $i < $num; $i++)
{
$this->date_commande = dol_now();
$this->source = 0;
$line = new OrderLine($this->db);
$num=count($object->lines);
for ($i = 0; $i < $num; $i++)
{
$line = new OrderLine($this->db);
$line->libelle = $object->lines[$i]->libelle;
$line->label = $object->lines[$i]->label;
$line->desc = $object->lines[$i]->desc;
$line->price = $object->lines[$i]->price;
$line->subprice = $object->lines[$i]->subprice;
$line->tva_tx = $object->lines[$i]->tva_tx;
$line->localtax1_tx = $object->lines[$i]->localtax1_tx;
$line->localtax2_tx = $object->lines[$i]->localtax2_tx;
$line->qty = $object->lines[$i]->qty;
$line->fk_remise_except = $object->lines[$i]->fk_remise_except;
$line->remise_percent = $object->lines[$i]->remise_percent;
$line->fk_product = $object->lines[$i]->fk_product;
$line->info_bits = $object->lines[$i]->info_bits;
$line->product_type = $object->lines[$i]->product_type;
$line->rang = $object->lines[$i]->rang;
$line->special_code = $object->lines[$i]->special_code;
$line->fk_parent_line = $object->lines[$i]->fk_parent_line;
$line->fk_unit = $object->lines[$i]->fk_unit;
$line->libelle = $object->lines[$i]->libelle;
$line->label = $object->lines[$i]->label;
$line->desc = $object->lines[$i]->desc;
$line->price = $object->lines[$i]->price;
$line->subprice = $object->lines[$i]->subprice;
$line->tva_tx = $object->lines[$i]->tva_tx;
$line->localtax1_tx = $object->lines[$i]->localtax1_tx;
$line->localtax2_tx = $object->lines[$i]->localtax2_tx;
$line->qty = $object->lines[$i]->qty;
$line->fk_remise_except = $object->lines[$i]->fk_remise_except;
$line->remise_percent = $object->lines[$i]->remise_percent;
$line->fk_product = $object->lines[$i]->fk_product;
$line->info_bits = $object->lines[$i]->info_bits;
$line->product_type = $object->lines[$i]->product_type;
$line->rang = $object->lines[$i]->rang;
$line->special_code = $object->lines[$i]->special_code;
$line->fk_parent_line = $object->lines[$i]->fk_parent_line;
$line->fk_unit = $object->lines[$i]->fk_unit;
$line->date_start = $object->lines[$i]->date_start;
$line->date_end = $object->lines[$i]->date_end;
$line->date_start = $object->lines[$i]->date_start;
$line->date_end = $object->lines[$i]->date_end;
$line->fk_fournprice = $object->lines[$i]->fk_fournprice;
$marginInfos = getMarginInfos($object->lines[$i]->subprice, $object->lines[$i]->remise_percent, $object->lines[$i]->tva_tx, $object->lines[$i]->localtax1_tx, $object->lines[$i]->localtax2_tx, $object->lines[$i]->fk_fournprice, $object->lines[$i]->pa_ht);
$line->pa_ht = $marginInfos[0];
$line->marge_tx = $marginInfos[1];
$line->marque_tx = $marginInfos[2];
// get extrafields from original line
$object->lines[$i]->fetch_optionals($object->lines[$i]->rowid);
foreach($object->lines[$i]->array_options as $options_key => $value)
$line->array_options[$options_key] = $value;
$this->lines[$i] = $line;
}
$this->socid = $object->socid;
$this->fk_project = $object->fk_project;
$this->cond_reglement_id = $object->cond_reglement_id;
$this->mode_reglement_id = $object->mode_reglement_id;
$this->fk_account = $object->fk_account;
$this->availability_id = $object->availability_id;
$this->demand_reason_id = $object->demand_reason_id;
$this->date_livraison = $object->date_livraison;
$this->shipping_method_id = $object->shipping_method_id;
$this->fk_delivery_address = $object->fk_delivery_address;
$this->contact_id = $object->contactid;
$this->ref_client = $object->ref_client;
$this->note_private = $object->note_private;
$this->note_public = $object->note_public;
$this->origin = $object->element;
$this->origin_id = $object->id;
$line->fk_fournprice = $object->lines[$i]->fk_fournprice;
$marginInfos = getMarginInfos($object->lines[$i]->subprice, $object->lines[$i]->remise_percent, $object->lines[$i]->tva_tx, $object->lines[$i]->localtax1_tx, $object->lines[$i]->localtax2_tx, $object->lines[$i]->fk_fournprice, $object->lines[$i]->pa_ht);
$line->pa_ht = $marginInfos[0];
$line->marge_tx = $marginInfos[1];
$line->marque_tx = $marginInfos[2];
// get extrafields from original line
$object->fetch_optionals($object->id);
$object->lines[$i]->fetch_optionals($object->lines[$i]->rowid);
foreach($object->lines[$i]->array_options as $options_key => $value)
$line->array_options[$options_key] = $value;
$e = new ExtraFields($db);
$element_extrafields = $e->fetch_name_optionals_label($this->element);
$this->lines[$i] = $line;
}
foreach($object->array_options as $options_key => $value) {
if(array_key_exists(str_replace('options_', '', $options_key), $element_extrafields)){
$this->array_options[$options_key] = $value;
}
$this->socid = $object->socid;
$this->fk_project = $object->fk_project;
$this->cond_reglement_id = $object->cond_reglement_id;
$this->mode_reglement_id = $object->mode_reglement_id;
$this->fk_account = $object->fk_account;
$this->availability_id = $object->availability_id;
$this->demand_reason_id = $object->demand_reason_id;
$this->date_livraison = $object->date_livraison;
$this->shipping_method_id = $object->shipping_method_id;
$this->fk_delivery_address = $object->fk_delivery_address;
$this->contact_id = $object->contactid;
$this->ref_client = $object->ref_client;
$this->note_private = $object->note_private;
$this->note_public = $object->note_public;
$this->origin = $object->element;
$this->origin_id = $object->id;
// get extrafields from original line
$object->fetch_optionals($object->id);
$e = new ExtraFields($db);
$element_extrafields = $e->fetch_name_optionals_label($this->element);
foreach($object->array_options as $options_key => $value) {
if(array_key_exists(str_replace('options_', '', $options_key), $element_extrafields)){
$this->array_options[$options_key] = $value;
}
// Possibility to add external linked objects with hooks
$this->linked_objects[$this->origin] = $this->origin_id;
if (is_array($object->other_linked_objects) && ! empty($object->other_linked_objects))
}
// Possibility to add external linked objects with hooks
$this->linked_objects[$this->origin] = $this->origin_id;
if (is_array($object->other_linked_objects) && ! empty($object->other_linked_objects))
{
$this->linked_objects = array_merge($this->linked_objects, $object->other_linked_objects);
}
$ret = $this->create($user);
if ($ret > 0)
{
// Actions hooked (by external module)
$hookmanager->initHooks(array('orderdao'));
$parameters=array('objFrom'=>$object);
$action='';
$reshook=$hookmanager->executeHooks('createFrom',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) $error++;
if (! $error)
{
$this->linked_objects = array_merge($this->linked_objects, $object->other_linked_objects);
}
$ret = $this->create($user);
if ($ret > 0)
{
// Actions hooked (by external module)
$hookmanager->initHooks(array('orderdao'));
$parameters=array('objFrom'=>$object);
$action='';
$reshook=$hookmanager->executeHooks('createFrom',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) $error++;
if (! $error)
// Ne pas passer par la commande provisoire
if ($conf->global->COMMANDE_VALID_AFTER_CLOSE_PROPAL == 1)
{
// Ne pas passer par la commande provisoire
if ($conf->global->COMMANDE_VALID_AFTER_CLOSE_PROPAL == 1)
{
$this->fetch($ret);
$this->valid($user);
}
return $ret;
$this->fetch($ret);
$this->valid($user);
}
else return -1;
return $ret;
}
else return -1;
}
else return 0;
else return -1;
}

View File

@ -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,9 +326,9 @@ 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);
print_liste_field_titre($langs->trans('DeliveryDate'),$_SERVER["PHP_SELF"],'c.date_livraison','',$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);
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
@ -330,11 +351,15 @@ if ($resql)
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="orderday" value="'.$orderday.'">';
print '<input class="flat" type="text" size="1" maxlength="2" name="ordermonth" value="'.$ordermonth.'">';
$formother->select_year($orderyear?$orderyear:-1,'orderyear',1, 20, 5);
print '</td><td class="liste_titre" align="center">';
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="deliveryday" value="'.$deliveryday.'">';
print '<input class="flat" type="text" size="1" maxlength="2" name="deliverymonth" value="'.$deliverymonth.'">';
$formother->select_year($deliveryyear?$deliveryyear:-1,'deliveryyear',1, 20, 5);
print '</td>';
if (empty($conf->global->ORDER_DISABLE_DELIVERY_DATE))
{
print '<td class="liste_titre" align="center">';
if (! empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) print '<input class="flat" type="text" size="1" maxlength="2" name="deliveryday" value="'.$deliveryday.'">';
print '<input class="flat" type="text" size="1" maxlength="2" name="deliverymonth" value="'.$deliverymonth.'">';
$formother->select_year($deliveryyear?$deliveryyear:-1,'deliveryyear',1, 20, 5);
print '</td>';
}
print '<td class="liste_titre" align="right">';
print '<input class="flat" type="text" size="6" name="search_total_ht" value="'.$search_total_ht.'">';
print '</td>';

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

@ -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

@ -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

@ -49,7 +49,7 @@ $builddoc_generatebutton=GETPOST('builddoc_generatebutton');
$month = GETPOST("month","int");
$year = GETPOST("year","int");
$filter = GETPOST("filtre");
if (GETPOST('button_search'))
if (GETPOST('button_search') || GETPOST('button_search.x') || GETPOST('button_search_x'))
{
$filter=GETPOST('filtre',2);
//if ($filter != 'payed:0') $option='';

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

@ -411,8 +411,10 @@ if (empty($reshook))
*/
$title = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses"));
if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/contactnameonly/',$conf->global->MAIN_HTML_TITLE) && $object->lastname) $title=$object->lastname;
$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
llxHeader('',$langs->trans("ContactsAddresses"),$help_url);
llxHeader('', $title, $help_url);
$form = new Form($db);
$formcompany = new FormCompany($db);

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

@ -74,8 +74,10 @@ include DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_pre_headers.tpl.php';
$form = new Form($db);
$title = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses"));
if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/contactnameonly/',$conf->global->MAIN_HTML_TITLE) && $object->lastname) $title=$object->lastname;
$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
llxHeader("",$langs->trans("Contact"), $helpurl);
llxHeader('', $title, $helpurl);
if ($object->id)
{
@ -93,16 +95,14 @@ if ($object->id)
$totalsize+=$file['size'];
}
print '<table class="border" width="100%">';
// Ref
print '<tr><td width="20%">'.$langs->trans("Ref").'</td><td colspan="3">';
print $form->showrefnav($object, 'id', $linkback);
print '</td></tr>';
// Name
print '<tr><td width="20%">'.$langs->trans("Lastname").' / '.$langs->trans("Label").'</td><td width="30%">'.$object->lastname.'</td>';
print '<td width="20%">'.$langs->trans("Firstname").'</td><td width="30%">'.$object->firstname.'</td></tr>';
$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">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent">';
// Company
if (empty($conf->global->SOCIETE_DISABLE_CONTACTS))
@ -123,12 +123,19 @@ if ($object->id)
}
}
// Civility
print '<tr><td class="titlefield">'.$langs->trans("UserTitle").'</td><td colspan="3">';
print $object->getCivilityLabel();
print '</td></tr>';
print '<tr><td>'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>';
print '</table>';
print '</div>';
dol_fiche_end();
$modulepart = 'contact';
$permission = $user->rights->societe->contact->creer;
$param = '&id=' . $object->id;

View File

@ -39,10 +39,10 @@ $id = GETPOST('id', 'int');
if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'contact', $id, 'socpeople&societe');
$contact = new Contact($db);
$object = new Contact($db);
if ($id > 0)
{
$contact->fetch($id, $user);
$object->fetch($id, $user);
}
@ -57,8 +57,8 @@ if ($action == 'dolibarr2ldap')
$ldap=new Ldap();
$result=$ldap->connect_bind();
$info=$contact->_load_ldap_info();
$dn=$contact->_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);
@ -86,40 +86,35 @@ llxHeader('',$title,'EN:Module_Third_Parties|FR:Module_Tiers|ES:M&oacute;dulo_Em
$form = new Form($db);
$head = contact_prepare_head($contact);
$head = contact_prepare_head($object);
dol_fiche_head($head, 'ldap', $title, 0, 'contact');
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', '');
print '<div class="fichecenter">';
print '<table class="border" width="100%">';
// Ref
print '<tr><td width="20%">'.$langs->trans("Ref").'</td><td colspan="3">';
print $form->showrefnav($contact,'id');
print '</td></tr>';
// Name
print '<tr><td>'.$langs->trans("Lastname").' / '.$langs->trans("Label").'</td><td>'.$contact->lastname.'</td>';
print '<td>'.$langs->trans("Firstname").'</td><td width="25%">'.$contact->firstname.'</td></tr>';
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent">';
// Company
if ($contact->socid > 0)
if ($object->socid > 0)
{
$objsoc = new Societe($db);
$objsoc->fetch($contact->socid);
$thirdparty = new Societe($db);
$thirdparty->fetch($object->socid);
print '<tr><td width="20%">'.$langs->trans("ThirdParty").'</td><td colspan="3">'.$objsoc->getNomUrl(1).'</td></tr>';
print '<tr><td class="titlefield">'.$langs->trans("ThirdParty").'</td><td colspan="3">'.$thirdparty->getNomUrl(1).'</td></tr>';
}
else
{
print '<tr><td width="20%">'.$langs->trans("ThirdParty").'</td><td colspan="3">';
print '<tr><td class="titlefield">'.$langs->trans("ThirdParty").'</td><td colspan="3">';
print $langs->trans("ContactNotLinkedToCompany");
print '</td></tr>';
}
// Civility
print '<tr><td>'.$langs->trans("UserTitle").'</td><td colspan="3">';
print $contact->getCivilityLabel();
print '<tr><td class="titlefield">'.$langs->trans("UserTitle").'</td><td colspan="3">';
print $object->getCivilityLabel();
print '</td></tr>';
// LDAP DN
@ -135,6 +130,8 @@ print '<tr><td>LDAP '.$langs->trans("LDAPServerPort").'</td><td class="valeur" c
print '</table>';
print '</div>';
dol_fiche_end();
@ -146,7 +143,7 @@ print '<div class="tabsAction">';
if (! empty($conf->global->LDAP_CONTACT_ACTIVE) && $conf->global->LDAP_CONTACT_ACTIVE != 'ldap2dolibarr')
{
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$contact->id.'&amp;action=dolibarr2ldap">'.$langs->trans("ForceSynchronize").'</a>';
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=dolibarr2ldap">'.$langs->trans("ForceSynchronize").'</a>';
}
print "</div>\n";
@ -170,9 +167,9 @@ $ldap=new Ldap();
$result=$ldap->connect_bind();
if ($result > 0)
{
$info=$contact->_load_ldap_info();
$dn=$contact->_load_ldap_dn($info,1);
$search = "(".$contact->_load_ldap_dn($info,2).")";
$info=$object->_load_ldap_info();
$dn=$object->_load_ldap_dn($info,1);
$search = "(".$object->_load_ldap_dn($info,2).")";
$records=$ldap->getAttribute($dn,$search);
//var_dump($records);

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

@ -55,12 +55,14 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include,
* View
*/
$now=dol_now();
$title = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses"));
$form = new Form($db);
$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
llxHeader('',$title,$help_url);
llxHeader('', $title, $help_url);
if ($id > 0)
{
@ -77,19 +79,17 @@ if ($id > 0)
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.'/contact/list.php">'.$langs->trans("BackToList").'</a>';
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', '');
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent">';
$linkback = '<a href="'.DOL_URL_ROOT.'/contact/list.php">'.$langs->trans("BackToList").'</a>';
// Ref
print '<tr><td width="20%">'.$langs->trans("Ref").'</td><td colspan="3">';
print $form->showrefnav($object, 'id', $linkback);
print '</td></tr>';
// Name
print '<tr><td width="20%">'.$langs->trans("Lastname").' / '.$langs->trans("Label").'</td><td width="30%">'.$object->lastname.'</td>';
print '<td width="20%">'.$langs->trans("Firstname").'</td><td width="30%">'.$object->firstname.'</td></tr>';
// Company
if (empty($conf->global->SOCIETE_DISABLE_CONTACTS))
{
@ -110,7 +110,7 @@ if ($id > 0)
}
// Civility
print '<tr><td>'.$langs->trans("UserTitle").'</td><td colspan="3">';
print '<tr><td class="titlefield">'.$langs->trans("UserTitle").'</td><td colspan="3">';
print $object->getCivilityLabel();
print '</td></tr>';
@ -120,7 +120,7 @@ if ($id > 0)
{
include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
print '<td>'.$langs->trans("DateToBirth").'</td><td colspan="3">'.dol_print_date($object->birthday,"day");
print '<td class="titlefield">'.$langs->trans("DateToBirth").'</td><td colspan="3">'.dol_print_date($object->birthday,"day");
print ' &nbsp; ';
//var_dump($birthdatearray);
@ -144,9 +144,11 @@ if ($id > 0)
print "</table>";
print '<div>';
print '<br>';
$colwidth='20';
$cssclass='titlefield';
include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';

View File

@ -70,8 +70,9 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->societe->contact
$now=dol_now();
$title = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses"));
llxHeader('',$title,'EN:Module_Third_Parties|FR:Module_Tiers|ES:M&oacute;dulo_Empresas');
if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/contactnameonly/',$conf->global->MAIN_HTML_TITLE) && $object->lastname) $title=$object->lastname;
$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
llxHeader('', $title, $helpurl);
$form = new Form($db);
@ -155,21 +156,17 @@ if ($action == 'edit')
}
else
{
/*
* Fiche en mode visu
*/
print '<table class="border" width="100%">';
// View mode
$linkback = '<a href="'.DOL_URL_ROOT.'/contact/list.php">'.$langs->trans("BackToList").'</a>';
// Ref
print '<tr><td width="20%">'.$langs->trans("Ref").'</td><td colspan="3">';
print $form->showrefnav($object, 'id', $linkback);
print '</td></tr>';
// Name
print '<tr><td width="20%">'.$langs->trans("Lastname").' / '.$langs->trans("Label").'</td><td width="30%">'.$object->lastname.'</td>';
print '<td width="20%">'.$langs->trans("Firstname").'</td><td width="30%">'.$object->firstname.'</td></tr>';
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', '');
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border centpercent">';
// Company
if (empty($conf->global->SOCIETE_DISABLE_CONTACTS))
@ -191,7 +188,7 @@ else
}
// Civility
print '<tr><td>'.$langs->trans("UserTitle").'</td><td colspan="3">';
print '<tr><td class="titlefield">'.$langs->trans("UserTitle").'</td><td colspan="3">';
print $object->getCivilityLabel();
print '</td></tr>';
@ -225,6 +222,7 @@ else
print "</table>";
print '</div>';
}
dol_fiche_end();

View File

@ -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)
@ -747,7 +748,9 @@ if (empty($reshook))
{
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("RefNewContract")),'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

@ -0,0 +1,48 @@
<?php
/* Copyright (C) 2014 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* or see http://www.gnu.org/
*/
/**
* \file htdocs/core/actions_changeselectedfields.inc.php
* \brief Code for actions when we change list of fields on a list page
*/
// $action must be defined
// $db must be defined
// $conf must be defined
// $object must be defined (object is loaded in this file with fetch)
// Save selection
if (GETPOST('formfilteraction') == 'listafterchangingselectedfields')
{
$tabparam=array();
$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
if (GETPOST("selectedfields")) $tabparam["MAIN_SELECTEDFIELDS_".$varpage]=GETPOST("selectedfields");
else $tabparam["MAIN_SELECTEDFIELDS_".$varpage]='';
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
$result=dol_set_user_param($db, $conf, $user, $tabparam);
//$action='list';
//var_dump($tabparam);exit;
}

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++;
@ -3949,10 +3949,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 +3983,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

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

View File

@ -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;
@ -4671,37 +4671,55 @@ class Form
* Show a multiselect form from an array.
*
* @param string $htmlname Name of select
* @param array $array Array with array to show
* @param array $array Array with array of fields we could show. This array may be modified according to setup of user.
* @param string $varpage Id of context for page. Can be set with $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage;
* @return string HTML multiselect string
* @see selectarray
*/
static function multiSelectArrayWithCheckbox($htmlname, $array)
static function multiSelectArrayWithCheckbox($htmlname, &$array, $varpage)
{
global $user;
$tmpvar="MAIN_SELECTEDFIELDS_".$varpage;
if (! empty($user->conf->$tmpvar))
{
$tmparray=explode(',', $user->conf->$tmpvar);
foreach($array as $key => $val)
{
//var_dump($key);
//var_dump($tmparray);
if (in_array($key, $tmparray)) $array[$key]['checked']=1;
else $array[$key]['checked']=0;
}
}
//var_dump($array);
$lis='';
$liststring='';
$listcheckedstring='';
foreach($array as $key => $val)
{
if (isset($val['cond']) && ! $val['cond']) continue;
if ($val['label'])
if (isset($val['enabled']) && ! $val['enabled'])
{
unset($array[$key]); // We don't want this field
continue;
}
if ($val['label'])
{
$lis.='<li><input type="checkbox" value="'.$key.'"'.($val['checked']?' checked="checked"':'').'/>'.dol_escape_htmltag($val['label']).'</li>';
$liststring.=$key.',';
$lis.='<li><input type="checkbox" value="'.$key.'"'.(empty($val['checked'])?'':' checked="checked"').'/>'.dol_escape_htmltag($val['label']).'</li>';
$listcheckedstring.=(empty($val['checked'])?'':$key.',');
}
}
$out ='<!-- Component multiSelectArrayWithCheckbox '.$htmlname.' -->
<dl class="dropdown">
<dt>
<a href="#">
'.img_picto('','list').'
<input type="hidden" class="'.$htmlname.'" name="'.$htmlname.'" value="'.$liststring.'">
<input type="hidden" class="'.$htmlname.'" name="'.$htmlname.'" value="'.$listcheckedstring.'">
</a>
</dt>
<dd>
<div class="multiselectcheckbox'.$htmlname.'">
<ul>
@ -4730,9 +4748,9 @@ class Form
});
$(\'.multiselectcheckbox'.$htmlname.' input[type="checkbox"]\').on(\'click\', function () {
console.log("A new field was added/removed")
$("input:hidden[name=formfilteraction]").val(\'listafterchangingselectedfields\')
var title = $(this).val() + ",";
if ($(this).is(\':checked\')) {
$(\'.'.$htmlname.'\').val(title + $(\'.'.$htmlname.'\').val());
}
@ -4779,7 +4797,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;
}
@ -5247,9 +5265,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;
@ -5257,19 +5275,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

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2001 Eric Seigne <erics@rycks.com>
* Copyright (C) 2004-2012 Destailleur Laurent <eldy@users.sourceforge.net>
* Copyright (C) 2004-2015 Destailleur Laurent <eldy@users.sourceforge.net>
* Copyright (C) 2005-2010 Regis Houssin <regis.houssin@capnetworks.com>
*
* This program is free software; you can redistribute it and/or modify
@ -579,6 +579,19 @@ 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
{
// Overwrite translation with param MAIN_OVERWRITE_TRANS_xx_XX
$tmparray=explode(';', $conf->global->$replacekey);
foreach($tmparray as $tmp)
{
$tmparray2=explode(':',$tmp);
$str=preg_replace('/'.preg_quote($tmparray2[0]).'/',$tmparray2[1],$str);
}
}
if (! preg_match('/^Format/',$key))
{
//print $str;

View File

@ -226,7 +226,7 @@ abstract class DoliDB implements Database
*/
function order($sortfield=null,$sortorder=null)
{
if (isset($sortfield))
if (! empty($sortfield))
{
$return='';
$fields=explode(',',$sortfield);
@ -236,7 +236,7 @@ abstract class DoliDB implements Database
else $return.=',';
$return.=preg_replace('/[^0-9a-z_\.]/i','',$val);
if (isset($sortorder))
if (! empty($sortorder))
{
$return.=' '.preg_replace('/[^0-9a-z]/i','',$sortorder);
}

View File

@ -58,6 +58,16 @@ function societe_prepare_head(Societe $object)
$head[$h][2] = 'customer';
$h++;
}
if (($object->client==1 || $object->client==2 || $object->client==3) && (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)))
{
$langs->load("products");
// price
$head[$h][0] = DOL_URL_ROOT.'/societe/price.php?socid='.$object->id;
$head[$h][1] = $langs->trans("CustomerPrices");
$head[$h][2] = 'price';
$h++;
}
if (! empty($conf->fournisseur->enabled) && $object->fournisseur && ! empty($user->rights->fournisseur->lire))
{
$head[$h][0] = DOL_URL_ROOT.'/fourn/card.php?socid='.$object->id;
@ -169,16 +179,6 @@ function societe_prepare_head(Societe $object)
$h++;
}
if (($object->client==1 || $object->client==2 || $object->client==3) && (! empty ( $conf->global->PRODUIT_CUSTOMER_PRICES )))
{
$langs->load("products");
// price
$head[$h][0] = DOL_URL_ROOT.'/societe/price.php?socid='.$object->id;
$head[$h][1] = $langs->trans("CustomerPrices");
$head[$h][2] = 'price';
$h++;
}
// Log
$head[$h][0] = DOL_URL_ROOT.'/societe/info.php?socid='.$object->id;
$head[$h][1] = $langs->trans("Info");
@ -647,7 +647,7 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
$num = $db->num_rows($result);
$var=true;
if ($num)
if ($num || (GETPOST('button_search') || GETPOST('button_search.x') || GETPOST('button_search_x')))
{
print '<tr class="liste_titre">';
// Name - Position

View File

@ -921,7 +921,7 @@ function dolCopyDir($srcfile, $destfile, $newmask, $overwriteifexists)
*
* @param string $srcfile Source file (can't be a directory. use native php @rename() to move a directory)
* @param string $destfile Destination file (can't be a directory. use native php @rename() to move a directory)
* @param integer $newmask Mask for new file (0 by default means $conf->global->MAIN_UMASK)
* @param integer $newmask Mask in octal string for new file (0 by default means $conf->global->MAIN_UMASK)
* @param int $overwriteifexists Overwrite file if exists (1 by default)
* @return boolean True if OK, false if KO
*/
@ -949,8 +949,12 @@ function dol_move($srcfile, $destfile, $newmask=0, $overwriteifexists=1)
}
else dol_syslog("files.lib.php::dol_move failed", LOG_WARNING);
}
if (empty($newmask) && ! empty($conf->global->MAIN_UMASK)) $newmask=$conf->global->MAIN_UMASK;
@chmod($newpathofdestfile, octdec($newmask));
if (empty($newmask)) $newmask=empty($conf->global->MAIN_UMASK)?'0755':$conf->global->MAIN_UMASK;
$newmaskdec=octdec($newmask);
// Currently method is restricted to files (dol_delete_files previously used is for files, and mask usage if for files too)
// to allow mask usage for dir, we shoul introduce a new param "isdir" to 1 to complete newmask like this
// if ($isdir) $newmaskdec |= octdec('0111'); // Set x bit required for directories
@chmod($newpathofdestfile, $newmaskdec);
}
return $result;

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]))
@ -745,7 +746,7 @@ function dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $pi
else
$isactive=false;
if ($i <= $limittoshow || $isactive )
if ($i <= $limittoshow || $isactive)
{
$out.='<div class="inline-block tabsElem'.($isactive ? ' tabsElemActive' : '').((! $isactive && ! empty($conf->global->MAIN_HIDE_INACTIVETAB_ON_PRINT))?' hideonprint':'').'"><!-- id tab = '.(empty($links[$i][2])?'':$links[$i][2]).' -->';
if (isset($links[$i][2]) && $links[$i][2] == 'image')
@ -775,7 +776,13 @@ function dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $pi
}
else
{
$outmore.='<div class="" style="display:inherit; background-color:#f9f9f9; padding-top:5px; padding-right:15px; padding-left:12px;">';
// The popup with the other tabs
if (! $popuptab)
{
$popuptab=1;
$outmore.='<div class="popuptabset">';
}
$outmore.='<div class="popuptab" style="display:inherit;">';
if (isset($links[$i][2]) && $links[$i][2] == 'image')
{
if (!empty($links[$i][0]))
@ -788,16 +795,18 @@ function dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $pi
$outmore.='<a'.(! empty($links[$i][2])?' id="'.$links[$i][2].'"':'').' class="inline-block" href="'.$links[$i][0].'">'.$links[$i][1].'</a>'."\n";
$outmore.='</div>';
$nbintab++;
}
$displaytab=$i;
}
if ($popuptab) $outmore.='</div>';
if ($displaytab > $limittoshow)
{
$tabsname=str_replace("@", "", $picto);
$out.='<div id="moretabs'.$tabsname.'" class="inline-block tabsElem">';
$out.='<a href="" data-role="button" style="background-color: #f0f0f0;" class="tab inline-block">'.$langs->trans("More").' <span class="badge">'.$nbintab.'</span></a>';
$out.='<a href="#" data-role="button" class="tab moretab inline-block">'.$langs->trans("More").'... ('.$nbintab.')</a>';
$out.='<div id="moretabsList'.$tabsname.'" style="position: absolute; left: -999em;text-align: left;margin:0px;padding:2px">'.$outmore.'</div>';
$out.="</div>\n";
@ -1488,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) {

View File

@ -386,7 +386,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>";
@ -896,16 +896,6 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks=
if (strcmp($statut, '') && $statut >= 0) $title=$langs->trans("Projects").' '.$langs->trans($projectstatic->statuts_long[$statut]);
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre($title,"index.php","","","","",$sortfield,$sortorder);
if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES))
{
print_liste_field_titre($langs->trans("OpportunityAmount"),"","","","",'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("OpportunityStatus"),"","","","",'align="right"',$sortfield,$sortorder);
}
if (empty($conf->global->PROJECT_HIDE_TASKS)) print_liste_field_titre($langs->trans("Tasks"),"","","","",'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Status"),"","","","",'align="right"',$sortfield,$sortorder);
print "</tr>\n";
$sql = "SELECT p.rowid as projectid, p.ref, p.title, p.fk_user_creat, p.public, p.fk_statut as status, p.fk_opp_status as opp_status, p.opp_amount, COUNT(DISTINCT t.rowid) as nb"; // We use DISTINCT here because line can be doubled if task has 2 links to same user
$sql.= " FROM ".MAIN_DB_PREFIX."projet as p";
@ -962,6 +952,17 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks=
$num = $db->num_rows($resql);
$i = 0;
print '<tr class="liste_titre">';
print_liste_field_titre($title.' <span class="badge">'.$num.'</span>',$_SERVER["PHP_SELF"],"","","","",$sortfield,$sortorder);
if (! empty($conf->global->PROJECT_USE_OPPORTUNITIES))
{
print_liste_field_titre($langs->trans("OpportunityAmount"),"","","","",'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("OpportunityStatus"),"","","","",'align="right"',$sortfield,$sortorder);
}
if (empty($conf->global->PROJECT_HIDE_TASKS)) print_liste_field_titre($langs->trans("Tasks"),"","","","",'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Status"),"","","","",'align="right"',$sortfield,$sortorder);
print "</tr>\n";
while ($i < $num)
{
$objp = $db->fetch_object($resql);

View File

@ -486,7 +486,7 @@ function show_theme($fuser,$edit=0,$foruserprofile=false)
{
print $formother->showColor($conf->global->THEME_ELDY_BACKTITLE1, $langs->trans("Default"));
}
print ' &nbsp; ('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
print ' &nbsp; ('.$langs->trans("Default").': <strong>e6e6e6</strong>, '.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')';
print '</td>';
print '</tr>';

View File

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

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

@ -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'),

View File

@ -21,7 +21,7 @@ $module = $object->element;
$note_public = 'note_public';
$note_private = 'note_private';
$colwidth=(isset($colwidth)?$colwidth:25);
$colwidth=(isset($colwidth)?$colwidth:(empty($cssclass)?'25':''));
$permission=(isset($permission)?$permission:(isset($user->rights->$module->creer)?$user->rights->$module->creer:0)); // If already defined by caller page
$moreparam=(isset($moreparam)?$moreparam:'');
@ -50,7 +50,7 @@ if (! empty($conf->global->MAIN_AUTO_TIMESTAMP_IN_PRIVATE_NOTES))
// Special cases
if ($module == 'propal') { $permission=$user->rights->propale->creer;}
elseif ($module == 'askpricesupplier') { $permission=$user->rights->askpricesupplier->creer;}
elseif ($module == 'askpricesupplier') { $permission=$user->rights->askpricesupplier->creer;}
elseif ($module == 'fichinter') { $permission=$user->rights->ficheinter->creer;}
elseif ($module == 'project') { $permission=$user->rights->projet->creer;}
elseif ($module == 'project_task') { $permission=$user->rights->projet->creer;}
@ -69,12 +69,12 @@ else $typeofdata='textarea:12:100';
<!-- BEGIN PHP TEMPLATE NOTES -->
<div class="border table-border centpercent">
<div class="table-border-row">
<div class="table-key-border-col"<?php echo ' style="width: '.$colwidth.'%"'; ?>><?php echo $form->editfieldkey("NotePublic", $note_public, $value_public, $object, $permission, $typeofdata, $moreparam); ?></div>
<div class="table-key-border-col<?php echo (empty($cssclass)?'':' '.$cssclass); ?>"<?php echo ($colwidth ? ' style="width: '.$colwidth.'%"' : ''); ?>><?php echo $form->editfieldkey("NotePublic", $note_public, $value_public, $object, $permission, $typeofdata, $moreparam); ?></div>
<div class="table-val-border-col"><?php echo $form->editfieldval("NotePublic", $note_public, $value_public, $object, $permission, $typeofdata, '', null, null, $moreparam); ?></div>
</div>
<?php if (empty($user->societe_id)) { ?>
<div class="table-border-row">
<div class="table-key-border-col"<?php echo ' style="width: '.$colwidth.'%"'; ?>><?php echo $form->editfieldkey("NotePrivate", $note_private, $value_private, $object, $permission, $typeofdata, $moreparam); ?></div>
<div class="table-key-border-col<?php echo (empty($cssclass)?'':' '.$cssclass); ?>"<?php echo ($colwidth ? ' style="width: '.$colwidth.'%"' : ''); ?>><?php echo $form->editfieldkey("NotePrivate", $note_private, $value_private, $object, $permission, $typeofdata, $moreparam); ?></div>
<div class="table-val-border-col"><?php echo $form->editfieldval("NotePrivate", $note_private, $value_private, $object, $permission, $typeofdata, '', null, null, $moreparam); ?></div>
</div>
<?php } ?>

View File

@ -43,6 +43,7 @@ if (! $sortfield) $sortfield="d.datedon";
$limit = $conf->liste_limit;
$statut=isset($_GET["statut"])?$_GET["statut"]:"-1";
$search_all=GETPOST('sall','alpha');
$search_ref=GETPOST('search_ref','alpha');
$search_company=GETPOST('search_company','alpha');
$search_name=GETPOST('search_name','alpha');
@ -51,14 +52,29 @@ $optioncss = GETPOST('optioncss','alpha');
if (!$user->rights->don->lire) accessforbidden();
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_ref="";
$search_all="";
$search_ref="";
$search_company="";
$search_name="";
$search_amount="";
}
// 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(
'd.rowid'=>'Id',
'd.ref'=>'Ref',
'd.lastname'=>'Lastname',
'd.firstname'=>'Firstname',
);
/*
* View
*/
@ -83,6 +99,10 @@ if (trim($search_ref) != '')
{
$sql.= ' AND d.rowid LIKE \'%'.$db->escape(trim($search_ref)) . '%\'';
}
if (trim($search_all) != '')
{
$sql .= natural_search(array_keys($fieldstosearchall), $search_all);
}
if (trim($search_company) != '')
{
$sql .= natural_search('d.societe', $search_company);
@ -120,6 +140,18 @@ if ($resql)
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="type" value="'.$type.'">';
if ($search_all)
{
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
print $langs->trans("FilterOnInto", $search_all, join(', ',$fieldstosearchall));
}
print "<table class=\"noborder\" width=\"100%\">";
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"d.rowid","", $param,"",$sortfield,$sortorder);

View File

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

View File

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

View File

@ -1100,13 +1100,13 @@ if ($action == 'create')
print '<table class="border" width="100%">';
print '<tbody>';
print '<tr>';
print '<td>'.$langs->trans("DateStart").'</td>';
print '<td class="fieldrequired">'.$langs->trans("DateStart").'</td>';
print '<td>';
$form->select_date($date_start?$date_start:-1,'date_debut',0,0,0,'',1,1);
print '</td>';
print '</tr>';
print '<tr>';
print '<td>'.$langs->trans("DateEnd").'</td>';
print '<td class="fieldrequired">'.$langs->trans("DateEnd").'</td>';
print '<td>';
$form->select_date($date_end?$date_end:-1,'date_fin',0,0,0,'',1,1);
print '</td>';
@ -1321,56 +1321,56 @@ else
if ($action == 'save')
{
$ret=$form->formconfirm($_SERVER["PHP_SELF"]."?id=".$id,$langs->trans("SaveTrip"),$langs->trans("ConfirmSaveTrip"),"confirm_validate","","",1);
$ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$id,$langs->trans("SaveTrip"),$langs->trans("ConfirmSaveTrip"),"confirm_validate","","",1);
if ($ret == 'html') print '<br>';
}
if ($action == 'save_from_refuse')
{
$ret=$form->formconfirm($_SERVER["PHP_SELF"]."?id=".$id,$langs->trans("SaveTrip"),$langs->trans("ConfirmSaveTrip"),"confirm_save_from_refuse","","",1);
$ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$id,$langs->trans("SaveTrip"),$langs->trans("ConfirmSaveTrip"),"confirm_save_from_refuse","","",1);
if ($ret == 'html') print '<br>';
}
if ($action == 'delete')
{
$ret=$form->formconfirm($_SERVER["PHP_SELF"]."?id=".$id,$langs->trans("DeleteTrip"),$langs->trans("ConfirmDeleteTrip"),"confirm_delete","","",1);
$ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$id,$langs->trans("DeleteTrip"),$langs->trans("ConfirmDeleteTrip"),"confirm_delete","","",1);
if ($ret == 'html') print '<br>';
}
if ($action == 'validate')
{
$ret=$form->formconfirm($_SERVER["PHP_SELF"]."?id=".$id,$langs->trans("ValideTrip"),$langs->trans("ConfirmValideTrip"),"confirm_approve","","",1);
$ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$id,$langs->trans("ValideTrip"),$langs->trans("ConfirmValideTrip"),"confirm_approve","","",1);
if ($ret == 'html') print '<br>';
}
if ($action == 'paid')
{
$ret=$form->formconfirm($_SERVER["PHP_SELF"]."?id=".$id,$langs->trans("PaidTrip"),$langs->trans("ConfirmPaidTrip"),"confirm_paid","","",1);
$ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$id,$langs->trans("PaidTrip"),$langs->trans("ConfirmPaidTrip"),"confirm_paid","","",1);
if ($ret == 'html') print '<br>';
}
if ($action == 'cancel')
{
$array_input = array('text'=>$langs->trans("ConfirmCancelTrip"), array('type'=>"text",'label'=>$langs->trans("Comment"),'name'=>"detail_cancel",'size'=>"50",'value'=>""));
$ret=$form->formconfirm($_SEVER["PHP_SELF"]."?id=".$id,$langs->trans("Cancel"),"","confirm_cancel",$array_input,"",1);
$ret=$form->form_confirm($_SEVER["PHP_SELF"]."?id=".$id,$langs->trans("Cancel"),"","confirm_cancel",$array_input,"",1);
if ($ret == 'html') print '<br>';
}
if ($action == 'brouillonner'):
$ret=$form->formconfirm($_SERVER["PHP_SELF"]."?id=".$id,$langs->trans("BrouillonnerTrip"),$langs->trans("ConfirmBrouillonnerTrip"),"confirm_brouillonner","","",1);
$ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$id,$langs->trans("BrouillonnerTrip"),$langs->trans("ConfirmBrouillonnerTrip"),"confirm_brouillonner","","",1);
if ($ret == 'html') print '<br>';
endif;
if ($action == 'refuse') // Deny
{
$array_input = array('text'=>$langs->trans("ConfirmRefuseTrip"), array('type'=>"text",'label'=>$langs->trans("Comment"),'name'=>"detail_refuse",'size'=>"50",'value'=>""));
$ret=$form->formconfirm($_SERVER["PHP_SELF"]."?id=".$id,$langs->trans("Deny"),'',"confirm_refuse",$array_input,"yes",1);
$ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$id,$langs->trans("Deny"),'',"confirm_refuse",$array_input,"yes",1);
if ($ret == 'html') print '<br>';
}
if ($action == 'delete_line')
{
$ret=$form->formconfirm($_SERVER["PHP_SELF"]."?id=".$id."&rowid=".GETPOST('rowid'),$langs->trans("DeleteLine"),$langs->trans("ConfirmDeleteLine"),"confirm_delete_line",'','yes',1);
$ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$id."&rowid=".GETPOST('rowid'),$langs->trans("DeleteLine"),$langs->trans("ConfirmDeleteLine"),"confirm_delete_line",'','yes',1);
if ($ret == 'html') print '<br>';
}
@ -1669,7 +1669,7 @@ else
print img_picto($langs->trans("Document"), "object_generic");
print ' <span>'.$piece_comptable.'</span></td>';
}
print '<td style="text-align:center;">'.$objp->date.'</td>';
print '<td style="text-align:center;">'.dol_print_date($db->jdate($objp->date), 'day').'</td>';
print '<td style="text-align:center;">';
if ($objp->projet_id > 0)
{

View File

@ -39,6 +39,7 @@ $socid = $_GET["socid"]?$_GET["socid"]:'';
if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'expensereport','','');
$sall = GETPOST('sall');
$search_ref = GETPOST('search_ref');
$search_user = GETPOST('search_user','int');
$search_amount_ht = GETPOST('search_amount_ht','alpha');
@ -66,6 +67,14 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both
if ($search_status == '') $search_status=-1;
if ($search_user == '') $search_user=-1;
// List of fields to search into when doing a "search in all"
$fieldstosearchall = array(
'd.ref'=>'Ref',
'u.lastname'=>'Lastname',
'u.firstname'=>"Firstname",
);
/*
* View
*/
@ -101,6 +110,11 @@ $sql.= " FROM ".MAIN_DB_PREFIX."expensereport as d";
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON d.fk_user_author = u.rowid";
$sql.= " WHERE d.entity = ".$conf->entity;
// Search all
if (!empty($sall))
{
$sql.= natural_search(array_keys($fieldstosearchall), $sall);
}
// Ref
if(!empty($search_ref)){
$sql.= " AND d.ref LIKE '%".$db->escape($search_ref)."%'";
@ -183,6 +197,16 @@ if ($resql)
print_barre_liste($langs->trans("ListTripsAndExpenses"), $page, $_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords);
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'."\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.'">';
if ($sall)
{
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
print $langs->trans("FilterOnInto", $sall, join(', ',$fieldstosearchall));
}
print '<table class="noborder" width="100%">';
print "<tr class=\"liste_titre\">";

View File

@ -211,7 +211,7 @@ print '<div class="fichecenter"><div class="fichethirdleft">';
// Show filter box
print '<form name="stats" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="mode" value="'.$mode.'">';
print '<table class="border" width="100%">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td class="liste_titre" colspan="2">'.$langs->trans("Filter").'</td></tr>';
// Company
/*
@ -237,8 +237,8 @@ print '</table>';
print '</form>';
print '<br><br>';
print '<table class="border" width="100%">';
print '<tr height="24">';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre" height="24">';
print '<td align="center">'.$langs->trans("Year").'</td>';
print '<td align="center">'.$langs->trans("Number").'</td>';
print '<td align="center">'.$langs->trans("AmountTotal").'</td>';

View File

@ -108,13 +108,13 @@ dol_fiche_head('');
if ($_GET["action"] == 'ndfTOaccount'):
$idTrip = $_GET['idTrip'];
$ret=$html->formconfirm($_SERVER["PHP_SELF"]."?idTrip=".$idTrip."&account=".$idAccount,$langs->trans("ndfToAccount"),$langs->trans("ConfirmNdfToAccount"),"confirm_ndf_to_account","","",1);
$ret=$html->form_confirm($_SERVER["PHP_SELF"]."?idTrip=".$idTrip."&account=".$idAccount,$langs->trans("ndfToAccount"),$langs->trans("ConfirmNdfToAccount"),"confirm_ndf_to_account","","",1);
if ($ret == 'html') print '<br />';
endif;
if ($_GET["action"] == 'accountTOndf'):
$idTrip = $_GET['idTrip'];
$ret=$html->formconfirm($_SERVER["PHP_SELF"]."?idTrip=".$idTrip."&account=".$idAccount,$langs->trans("AccountToNdf"),$langs->trans("ConfirmAccountToNdf"),"confirm_account_to_ndf","","",1);
$ret=$html->form_confirm($_SERVER["PHP_SELF"]."?idTrip=".$idTrip."&account=".$idAccount,$langs->trans("AccountToNdf"),$langs->trans("ConfirmAccountToNdf"),"confirm_account_to_ndf","","",1);
if ($ret == 'html') print '<br />';
endif;
@ -212,4 +212,4 @@ dol_fiche_end();
llxFooter();
$db->close();
$db->close();

View File

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

View File

@ -64,7 +64,7 @@ $search_status=GETPOST('search_status');
$sall=GETPOST('sall');
$optioncss = GETPOST('optioncss','alpha');
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_ref="";
$search_company="";
@ -72,6 +72,17 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both
$search_status="";
}
// List of fields to search into when doing a "search in all"
$fieldstosearchall = array(
'f.ref'=>'Ref',
's.nom'=>"ThirdParty",
'f.description'=>'Description',
'f.note_public'=>'NotePublic',
);
if (empty($user->socid)) $fieldstosearchall["f.note_private"]="NotePrivate";
if (! empty($conf->global->FICHINTER_DISABLE_DETAILS)) unset($fieldstosearchall['f.description']);
/*
* View
*/
@ -110,9 +121,7 @@ if (! $user->rights->societe->client->voir && empty($socid))
if ($socid)
$sql.= " AND s.rowid = " . $socid;
if ($sall) {
$arraytosearch=array('f.ref', 'f.description', 's.nom');
if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) $arraytosearch=array('f.ref', 'f.description', 's.nom', 'fd.description');
$sql .= natural_search($arraytosearch, $sall);
$sql .= natural_search(array_keys($fieldstosearchall), $sall);
}
$sql.= $db->order($sortfield,$sortorder);
$sql.= $db->plimit($limit+1, $offset);
@ -135,11 +144,22 @@ if ($result)
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'."\n";
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<table class="noborder" width="100%">';
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));
}
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"f.ref","",$urlparam,'width="15%"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom","",$urlparam,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER["PHP_SELF"],"s.nom","",$urlparam,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Description"),$_SERVER["PHP_SELF"],"f.description","",$urlparam,'',$sortfield,$sortorder);
if (empty($conf->global->FICHINTER_DISABLE_DETAILS))
{

View File

@ -131,16 +131,15 @@ if ($object->id > 0)
dol_fiche_head($head, 'supplier', $langs->trans("ThirdParty"),0,'company');
dol_banner_tab($object, 'socid', '', ($user->societe_id?0:1), 'rowid', 'nom');
print '<div class="fichecenter"><div class="fichehalfleft">';
print '<div class="underbanner clearboth"></div>';
print '<table width="100%" class="border">';
print '<tr><td width="30%">'.$langs->trans("ThirdPartyName").'</td><td width="70%" colspan="3">';
print $form->showrefnav($object,'socid','',($user->societe_id?0:1),'rowid','nom','','');
print '</td></tr>';
// Alias names (commercial, trademark or alias names)
print '<tr><td>'.$langs->trans('AliasNameShort').'</td><td colspan="3">';
print '<tr><td class="titlefield">'.$langs->trans('AliasNameShort').'</td><td colspan="3">';
print $object->name_alias;
print "</td></tr>";
@ -168,35 +167,6 @@ if ($object->id > 0)
print '</tr>';
}
// Address
print '<tr><td valign="top">'.$langs->trans("Address").'</td><td colspan="3">';
dol_print_address($object->address,'gmap','thirdparty',$object->id);
print '</td></tr>';
// Zip / Town
print '<tr><td class="nowrap">'.$langs->trans("Zip").' / '.$langs->trans("Town").'</td><td colspan="3">'.$object->zip.(($object->zip && $object->town)?' / ':'').$object->town.'</td>';
print '</tr>';
// Country
print '<tr><td>'.$langs->trans("Country").'</td><td colspan="3">';
//$img=picto_from_langcode($object->country_code);
$img='';
if ($object->isInEEC()) print $form->textwithpicto(($img?$img.' ':'').$object->country,$langs->trans("CountryIsInEEC"),1,0);
else print ($img?$img.' ':'').$object->country;
print '</td></tr>';
// EMail
print '<td>'.$langs->trans('EMail').'</td><td colspan="3">'.dol_print_email($object->email,0,$object->id,'AC_EMAIL').'</td></tr>';
// Web
print '<tr><td>'.$langs->trans("Web").'</td><td colspan="3">'.dol_print_url($object->url).'</td></tr>';
// Phone
print '<tr><td>'.$langs->trans("Phone").'</td><td style="min-width: 25%;">'.dol_print_phone($object->phone,$object->country_code,0,$object->id,'AC_TEL').'</td>';
// Fax
print '<td>'.$langs->trans("Fax").'</td><td style="min-width: 25%;">'.dol_print_phone($object->fax,$object->country_code,0,$object->id,'AC_FAX').'</td></tr>';
// Assujetti a TVA ou pas
print '<tr>';
print '<td class="nowrap">'.$langs->trans('VATIsUsed').'</td><td colspan="3">';

View File

@ -392,7 +392,7 @@ class CommandeFournisseur extends CommonOrder
$soc->fetch($this->fourn_id);
// Check if object has a temporary ref
if (preg_match('/^[\(]?PROV/i', $this->ref))
if (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref)) // empty should not happened, but when it occurs, the test save life
{
$num = $this->getNextNumRef($soc);
}
@ -688,7 +688,7 @@ class CommandeFournisseur extends CommonOrder
$soc->fetch($this->fourn_id);
// Check if object has a temporary ref
if (preg_match('/^[\(]?PROV/i', $this->ref))
if (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref)) // empty should not happened, but when it occurs, the test save life
{
$num = $this->getNextNumRef($soc);
}

View File

@ -930,7 +930,7 @@ class FactureFournisseur 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
{
$num = $this->getNextNumRef($this->client);
}

View File

@ -1675,7 +1675,10 @@ elseif (! empty($object->id))
$object->date_commande=dol_now();
// We check if number is temporary number
if (preg_match('/^[\(]?PROV/i',$object->ref)) $newref = $object->getNextNumRef($object->thirdparty);
if (preg_match('/^[\(]?PROV/i',$object->ref) || empty($object->ref)) // empty should not happened, but when it occurs, the test save life
{
$newref = $object->getNextNumRef($object->thirdparty);
}
else $newref = $object->ref;
if ($newref < 0)

View File

@ -74,6 +74,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(
'cf.ref'=>'Ref',
'cf.ref_supplier'=>'RefSupplier',
//'pd.description'=>'Description',
's.nom'=>"ThirdParty",
'cf.note_public'=>'NotePublic',
);
if (empty($user->socid)) $fieldstosearchall["cf.note_private"]="NotePrivate";
/*
* View
@ -141,7 +152,7 @@ if ($search_ttc != '')
}
if ($sall)
{
$sql .= natural_search(array('cf.ref', 'cf.ref_supplier', 'cf.note_public', 'cf.note_private'), $sall);
$sql .= natural_search(array_keys($fieldstosearchall), $sall);
}
if ($socid) $sql.= " AND s.rowid = ".$socid;
@ -190,6 +201,19 @@ if ($resql)
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords);
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
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));
}
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"cf.ref","",$param,'',$sortfield,$sortorder);

View File

@ -68,6 +68,7 @@ $pagenext = $page + 1;
if (! $sortorder) $sortorder="DESC";
if (! $sortfield) $sortfield="fac.datef,fac.rowid";
$search_all = GETPOST('sall');
$search_ref = GETPOST("search_ref","int");
$search_ref_supplier = GETPOST("search_ref_supplier","alpha");
$search_label = GETPOST("search_label","alpha");
@ -86,6 +87,7 @@ $optioncss = GETPOST('optioncss','alpha');
if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test must be present to be compatible with all browsers
{
$search_all="";
$search_ref="";
$search_ref_supplier="";
$search_label="";
@ -97,6 +99,18 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both
$filter="";
}
// List of fields to search into when doing a "search in all"
$fieldstosearchall = array(
'fac.ref'=>'Ref',
'fac.ref_supplier'=>'RefSupplier',
//'fd.description'=>'Description',
's.nom'=>"ThirdParty",
'fac.note_public'=>'NotePublic',
);
if (empty($user->socid)) $fieldstosearchall["fac.note_private"]="NotePrivate";
/*
* Actions
*/
@ -157,7 +171,10 @@ if ($filter && $filter != -1) // GETPOST('filtre') may be a string
$sql .= " AND " . $filt[0] . " = " . $filt[1];
}
}
if ($search_all)
{
$sql.= natural_search(array_keys($fieldstosearchall), $search_all);
}
if ($search_ref)
{
if (is_numeric($search_ref)) $sql .= natural_search(array('fac.ref'), $search_ref);
@ -255,6 +272,18 @@ if ($resql)
print_barre_liste($langs->trans("BillsSuppliers").($socid?" $soc->name.":""),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords);
print '<form method="GET" 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.'">';
print '<input type="hidden" name="viewstatut" value="'.$viewstatut.'">';
if ($search_all)
{
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
print $langs->trans("FilterOnInto", $search_all, join(', ',$fieldstosearchall));
}
print '<table class="liste" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"fac.ref,fac.rowid","",$param,"",$sortfield,$sortorder);

View File

@ -84,20 +84,26 @@ if ($action == 'create')
$description = trim(GETPOST('description'));
$userID = GETPOST('userID');
// If no start date
if ($type <= 0)
{
setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), 'errors');
$error++;
$action='create';
}
// If no start date
if (empty($date_debut))
{
header('Location: card.php?action=request&error=nodatedebut');
exit;
}
// If no end date
if (empty($date_fin))
{
header('Location: card.php?action=request&error=nodatefin');
exit;
}
// If start date after end date
if ($date_debut > $date_fin)
{
@ -128,22 +134,27 @@ if ($action == 'create')
exit;
}
$cp->fk_user = $userid;
$cp->description = $description;
$cp->date_debut = $date_debut;
$cp->date_fin = $date_fin;
$cp->fk_validator = $valideur;
$cp->halfday = $halfday;
$cp->fk_type = $type;
$verif = $cp->create($user);
$result = 0;
if (! $error)
{
$cp->fk_user = $userid;
$cp->description = $description;
$cp->date_debut = $date_debut;
$cp->date_fin = $date_fin;
$cp->fk_validator = $valideur;
$cp->halfday = $halfday;
$cp->fk_type = $type;
$result = $cp->create($user);
}
// If no SQL error we redirect to the request card
if ($verif > 0)
if ($result > 0)
{
$db->commit();
header('Location: card.php?id='.$verif);
header('Location: card.php?id='.$result);
exit;
}
else
@ -151,7 +162,7 @@ if ($action == 'create')
$db->rollback();
// Otherwise we display the request form with the SQL error message
header('Location: card.php?action=request&error=SQL_Create&msg='.$cp->error);
header('Location: card.php?action=request');
exit;
}
}

View File

@ -53,6 +53,7 @@ $pagenext = $page + 1;
$id = GETPOST('id','int');
$sall = GETPOST('sall');
$search_ref = GETPOST('search_ref');
$month_create = GETPOST('month_create');
$year_create = GETPOST('year_create');
@ -64,7 +65,7 @@ $search_employe = GETPOST('search_employe');
$search_valideur = GETPOST('search_valideur');
$search_statut = GETPOST('select_statut');
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_ref="";
$month_create="";
@ -78,6 +79,12 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both
$search_statut="";
}
// List of fields to search into when doing a "search in all"
$fieldstosearchall = array(
'cp.rowid'=>'Ref',
'cp.description'=>'Description',
);
/*
* Actions
@ -171,6 +178,12 @@ if(!empty($search_valideur) && $search_valideur != -1) {
if(!empty($search_statut) && $search_statut != -1) {
$filter.= " AND cp.statut = '".$db->escape($search_statut)."'\n";
}
// Search all
if (!empty($sall))
{
$filter.= natural_search(array_keys($fieldstosearchall), $sall);
}
/*************************************
* Fin des filtres de recherche
@ -252,6 +265,18 @@ if ($id > 0) print '</br>';
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.'">';
if ($sall)
{
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
print $langs->trans("FilterOnInto", $sall, join(', ',$fieldstosearchall));
}
print '<table class="noborder" width="100%;">';
print "<tr class=\"liste_titre\">";
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"cp.rowid","",'','',$sortfield,$sortorder);

1
htdocs/install/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/filelist.xml

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