Merge branch 'develop' into new_branch_30_01_2019
This commit is contained in:
commit
affdc08848
58
README-FR.md
58
README-FR.md
@ -15,37 +15,43 @@ Dolibarr est distribué sous les termes de la licence GNU General Public License
|
||||
|
||||
## INSTALLER DOLIBARR
|
||||
|
||||
Si vous n'avez pas de connaissances techniques, et que vous recherchez
|
||||
un programme d'installation qui installe Dolibarr ERP/CRM en quelques clics,
|
||||
vous devez vous ré-orienter vers DoliWamp (la version tout-en-un
|
||||
de Dolibarr pour Windows), DoliDeb (la version tout-en-un pour Debian ou
|
||||
Ubuntu) ou DoliRpm (la version tout-en-un de Dolibarr pour Fedora, Redhat,
|
||||
OpenSuse, Mandriva ou Mageia).
|
||||
### Configuration simple
|
||||
|
||||
Vous pouvez les télécharger depuis la rubrique *download* du portail officiel:
|
||||
https://www.dolibarr.org/
|
||||
Si vous avez peu de compétences techniques et que vous souhaitez installer Dolibarr ERP/CRM en quelques clics, vous pouvez utiliser l'une des versions pré-packagées avec les prérequis:
|
||||
|
||||
Si vous avez déjà installé un serveur Web avec PHP et une base de données (MariaDb/MySql/PostgreSql),
|
||||
vous pouvez installer Dolibarr avec cette version de la manière suivante:
|
||||
- DoliWamp pour Windows
|
||||
- DoliDeb pour Debian ou Ubuntu
|
||||
- DoliRpm pour Redhat, Fedora, OpenSuse, Mandriva ou Mageia
|
||||
|
||||
- Copiez le répertoire "dolibarr" et son contenu dans la racine de votre serveur
|
||||
web, ou bien copiez le répertoire sur le serveur et configurez ce serveur pour
|
||||
utiliser "dolibarr/htdocs" comme racine d'un nouveau virtual host (ce second
|
||||
choix requiert des compétences et habilitations en administration du serveur
|
||||
web).
|
||||
|
||||
- Créez un fichier vide "htdocs/conf/conf.php" et attribuez les permissions
|
||||
en lecture et écriture pour le user du serveur web (les permissions en
|
||||
écriture seront supprimées une fois l'installation terminée).
|
||||
Les packages peuvent être téléchargés à partir de [site web officiel] (https://www.dolibarr.org/).
|
||||
|
||||
- Depuis votre navigateur, appelez la page "install/" de dolibarr. L'url dépend
|
||||
du choix fait à la première étape:
|
||||
http://localhost/dolibarr/htdocs/install/
|
||||
ou
|
||||
http://yourdolibarrvirtualhost/install/
|
||||
|
||||
- Suivez les instructions fournies par l'installateur...
|
||||
### Configuration avancée
|
||||
|
||||
Vous pouvez aussi utiliser un serveur Web et une base de données prise en charge (MariaDB, MySQL ou PostgreSQL) pour installer la version standard.
|
||||
|
||||
- Décompressez l'archive .zip téléchargée pour copier le répertoire "dolibarr/htdocs" et tous ses fichiers à la racine du serveur Web ou récupérez-les directement à partir de GitHub (recommandé si vous connaissez git):
|
||||
|
||||
git clone https://github.com/dolibarr/dolibarr -b x.y (où x.y est la version principale comme 3.6, 9.0, ...)
|
||||
|
||||
- Configurez votre serveur Web pour qu'il utilise "*dolibarr/htdocs*" en tant que racine si votre serveur Web ne possède pas déjà de répertoire défini vers lequel pointer.
|
||||
|
||||
- Créez un fichier `htdocs/conf/conf.php` vide et définissez les autorisations d'*écrire* pour l'utilisateur de votre serveur Web (l'autorisation *écrire* sera supprimée une fois l'installation terminée)
|
||||
|
||||
- Depuis votre navigateur, allez à la page "install/" de dolibarr
|
||||
|
||||
L’URL dépendra de la façon dont votre configuration Web a été configurée pour pointer vers votre installation de dolibarr. Cela peut ressembler à:
|
||||
|
||||
http://localhost/dolibarr/htdocs/install/
|
||||
|
||||
ou
|
||||
|
||||
http://localhost/dolibarr/install/
|
||||
|
||||
ou
|
||||
|
||||
http://yourdolibarrvirtualhost/install/
|
||||
|
||||
- Suivez les instructions de l'installateur
|
||||
|
||||
|
||||
## METTRE A JOUR DOLIBARR
|
||||
|
||||
41
README.md
41
README.md
@ -29,27 +29,6 @@ Other licenses apply for some included dependencies. See [COPYRIGHT](https://git
|
||||
|
||||
## INSTALLING
|
||||
|
||||
### Download
|
||||
|
||||
Releases can be downloaded from [official website](https://www.dolibarr.org/).
|
||||
|
||||
### Install from composer
|
||||
|
||||
If you do not already have Composer installed, you may do so by following the instructions at [getcomposer.org](https://getcomposer.org/). On Linux and macOS, you may run the following commands:
|
||||
|
||||
```bash
|
||||
curl -sS https://getcomposer.org/installer | php
|
||||
mv composer.phar /usr/local/bin/composer
|
||||
```
|
||||
|
||||
On Windows, you can download and run https://getcomposer.org/Composer-Setup.exe
|
||||
|
||||
You can then create a new project
|
||||
|
||||
```bash
|
||||
composer create-project dolibarr/dolibarr erp
|
||||
```
|
||||
|
||||
### Simple setup
|
||||
|
||||
If you have low technical skills and you're looking to install Dolibarr ERP/CRM in just a few clicks, you can use one of the packaged versions:
|
||||
@ -58,16 +37,23 @@ If you have low technical skills and you're looking to install Dolibarr ERP/CRM
|
||||
- DoliDeb for Debian or Ubuntu
|
||||
- DoliRpm for Redhat, Fedora, OpenSuse, Mandriva or Mageia
|
||||
|
||||
Releases can be downloaded from [official website](https://www.dolibarr.org/).
|
||||
|
||||
### Advanced setup
|
||||
|
||||
You can use a Web server and a supported database (MariaDB, MySQL or PostgreSQL) to install the standard version.
|
||||
|
||||
- Uncompress the downloaded archive
|
||||
- Copy the "dolibarr" directory and all its files inside your web server root or anywhere you'd like and set up your web server to use "*dolibarr/htdocs*" as root for a new web server virtual host (second choice need to be server administrator)
|
||||
- Create an empty `htdocs/conf/conf.php` file and set permissions for your web server user (*write* permissions will be removed once install is finished)
|
||||
- Uncompress the downloaded .zip archive to copy the "dolibarr/htdocs" directory and all its files inside your web server root or get the files directly from GitHub (recommanded if you known git):
|
||||
|
||||
git clone https://github.com/dolibarr/dolibarr -b x.y (where x.y is main version like 3.6, 9.0, ...)
|
||||
|
||||
- Set up your web server to use "*dolibarr/htdocs*" as root if you'r web server does not have directory to point to already defined.
|
||||
|
||||
- Create an empty `htdocs/conf/conf.php` file and set *write* permissions for your web server user (*write* permission will be removed once install is finished)
|
||||
|
||||
- From your browser, go to the dolibarr "install/" page
|
||||
|
||||
The URL will depends on choices made in the first step:
|
||||
The URL will depends on how you web setup was setup to point to your dolibarr installation. It may looks like:
|
||||
|
||||
http://localhost/dolibarr/htdocs/install/
|
||||
|
||||
@ -81,6 +67,11 @@ You can use a Web server and a supported database (MariaDB, MySQL or PostgreSQL)
|
||||
|
||||
- Follow the installer instructions
|
||||
|
||||
### Saas/Cloud setup
|
||||
|
||||
If you don't have time to install it yourself, you can try some commercial 'ready to use' Cloud offers (See https://saas.dolibarr.org). However, this third solution is not free.
|
||||
|
||||
|
||||
|
||||
## UPGRADING
|
||||
|
||||
|
||||
@ -589,7 +589,8 @@ if ($nboftargetok) {
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpoffice/phpexcel/Examples`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpoffice/phpexcel/unitTests`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/phpoffice/phpexcel/license.md`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/sabre/sabre/dav/tests`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/sabre/sabre/*/tests`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/stripe/tests`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/stripe/LICENSE`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/fonts/dejavu-fonts-ttf-*`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tcpdf/fonts/freefont-*`;
|
||||
|
||||
@ -43,6 +43,22 @@ $oldtypetonewone=array('texte'=>'text','chaine'=>'string'); // old type to new o
|
||||
|
||||
$action = GETPOST('action','alpha');
|
||||
|
||||
$error = 0;
|
||||
|
||||
// Editing global variables not related to a specific theme
|
||||
$constantes=array(
|
||||
'MEMBER_REMINDER_EMAIL'=>array('type'=>'yesno', 'label'=>$langs->trans('MEMBER_REMINDER_EMAIL', $langs->transnoentities("Module2300Name"))),
|
||||
'ADHERENT_EMAIL_TEMPLATE_REMIND_EXPIRATION' =>'emailtemplate:member',
|
||||
'ADHERENT_EMAIL_TEMPLATE_AUTOREGISTER' =>'emailtemplate:member', /* old was ADHERENT_AUTOREGISTER_MAIL */
|
||||
'ADHERENT_EMAIL_TEMPLATE_MEMBER_VALIDATION' =>'emailtemplate:member', /* old was ADHERENT_MAIL_VALID */
|
||||
'ADHERENT_EMAIL_TEMPLATE_SUBSCRIPTION' =>'emailtemplate:member', /* old was ADHERENT_MAIL_COTIS */
|
||||
'ADHERENT_EMAIL_TEMPLATE_CANCELATION' =>'emailtemplate:member', /* old was ADHERENT_MAIL_RESIL */
|
||||
'ADHERENT_MAIL_FROM'=>'string',
|
||||
'ADHERENT_AUTOREGISTER_NOTIF_MAIL_SUBJECT'=>'string',
|
||||
'ADHERENT_AUTOREGISTER_NOTIF_MAIL'=>'html',
|
||||
);
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
@ -133,24 +149,10 @@ $head = member_admin_prepare_head();
|
||||
|
||||
dol_fiche_head($head, 'emails', $langs->trans("Members"), -1, 'user');
|
||||
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="updateall">';
|
||||
|
||||
/*
|
||||
* Editing global variables not related to a specific theme
|
||||
*/
|
||||
$constantes=array(
|
||||
'ADHERENT_MAIL_FROM'=>'string',
|
||||
'ADHERENT_AUTOREGISTER_NOTIF_MAIL_SUBJECT'=>'string',
|
||||
'ADHERENT_AUTOREGISTER_NOTIF_MAIL'=>'html',
|
||||
'ADHERENT_EMAIL_TEMPLATE_AUTOREGISTER' =>'emailtemplate:member', /* old was ADHERENT_AUTOREGISTER_MAIL */
|
||||
'ADHERENT_EMAIL_TEMPLATE_MEMBER_VALIDATION' =>'emailtemplate:member', /* old was ADHERENT_MAIL_VALID */
|
||||
'ADHERENT_EMAIL_TEMPLATE_SUBSCRIPTION' =>'emailtemplate:member', /* old was ADHERENT_MAIL_COTIS */
|
||||
'ADHERENT_EMAIL_TEMPLATE_CANCELATION' =>'emailtemplate:member', /* old was ADHERENT_MAIL_RESIL */
|
||||
'MEMBER_REMINDER_EMAIL'=>array('type'=>'yesno', 'label'=>$langs->trans('MEMBER_REMINDER_EMAIL', $langs->transnoentities("Module2300Name"))),
|
||||
'ADHERENT_EMAIL_TEMPLATE_REMIND_EXPIRATION' =>'emailtemplate:member',
|
||||
);
|
||||
// TODO Use global form
|
||||
//print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
//print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
//print '<input type="hidden" name="action" value="updateall">';
|
||||
|
||||
$helptext='*'.$langs->trans("FollowingConstantsWillBeSubstituted").'<br>';
|
||||
$helptext.='__DOL_MAIN_URL_ROOT__, __ID__, __FIRSTNAME__, __LASTNAME__, __FULLNAME__, __LOGIN__, __PASSWORD__, ';
|
||||
@ -159,6 +161,9 @@ $helptext.='__COMPANY__, __ADDRESS__, __ZIP__, __TOWN__, __COUNTRY__, __EMAIL__,
|
||||
|
||||
form_constantes($constantes, 0, $helptext);
|
||||
|
||||
//print '<div align="center"><input type="submit" class="button" value="'.$langs->trans("Update").'" name="update"></div>';
|
||||
//print '</form>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
// End of page
|
||||
|
||||
@ -136,7 +136,7 @@ if ($conf->use_javascript_ajax)
|
||||
}
|
||||
|
||||
|
||||
print $langs->trans("BlankSubscriptionFormDesc").'<br><br>';
|
||||
print '<span class="opacitymedium">'.$langs->trans("BlankSubscriptionFormDesc").'</span><br><br>';
|
||||
|
||||
|
||||
$enabledisablehtml = $langs->trans("EnablePublicSubscriptionForm").' ';
|
||||
|
||||
@ -2520,7 +2520,7 @@ class Adherent extends CommonObject
|
||||
|
||||
|
||||
/**
|
||||
* Charge les informations d'ordre info dans l'objet adherent
|
||||
* Load type info information in the member object
|
||||
*
|
||||
* @param int $id Id of member to load
|
||||
* @return void
|
||||
|
||||
@ -164,7 +164,7 @@ class AdherentType extends CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* Met a jour en base donnees du type
|
||||
* Updating the type in the database
|
||||
*
|
||||
* @param User $user Object user making change
|
||||
* @param int $notrigger 1=do not execute triggers, 0 otherwise
|
||||
@ -234,9 +234,9 @@ class AdherentType extends CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* Fonction qui permet de supprimer le status de l'adherent
|
||||
* Function to delete the member's status
|
||||
*
|
||||
* @return int >0 if OK, 0 if not found, < 0 if KO
|
||||
* @return int > 0 if OK, 0 if not found, < 0 if KO
|
||||
*/
|
||||
function delete()
|
||||
{
|
||||
@ -267,7 +267,7 @@ class AdherentType extends CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* Fonction qui permet de recuperer le status de l'adherent
|
||||
* Function that retrieves the status of the member
|
||||
*
|
||||
* @param int $rowid Id of member type to load
|
||||
* @return int <0 if KO, >0 if OK
|
||||
|
||||
@ -144,7 +144,7 @@ print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre"><input type="text" name="search_event" value="'.dol_escape_htmltag($search_event).'"></td>';
|
||||
print '<td class="liste_titre"></td>';
|
||||
// Action column
|
||||
print '<td class="liste_titre" align="right">';
|
||||
print '<td class="liste_titre right">';
|
||||
$searchpicto=$form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
@ -179,7 +179,7 @@ if (! empty($triggers))
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$trigger['code'].'</td>';
|
||||
print '<td>'.$trigger['label'].'</td>';
|
||||
print '<td align="right" width="40">';
|
||||
print '<td class="right" width="40">';
|
||||
$key='MAIN_AGENDA_ACTIONAUTO_'.$trigger['code'];
|
||||
$value=$conf->global->$key;
|
||||
print '<input class="oddeven" type="checkbox" name="'.$key.'" value="1"'.((($action=='selectall'||$value) && $action!="selectnone")?' checked':'').'>';
|
||||
|
||||
@ -220,7 +220,7 @@ while ($i <= $MAXAGENDA)
|
||||
// Offset TZ
|
||||
print '<td><input type="text" class="flat hideifnotset" name="AGENDA_EXT_OFFSETTZ'.$key.'" value="'. (GETPOST('AGENDA_EXT_OFFSETTZ'.$key)?GETPOST('AGENDA_EXT_OFFSETTZ'.$key):$conf->global->$offsettz) . '" size="2"></td>';
|
||||
// Color (Possible colors are limited by Google)
|
||||
print '<td class="nowrap" align="right">';
|
||||
print '<td class="nowrap right">';
|
||||
//print $formadmin->selectColor($conf->global->$color, "google_agenda_color".$key, $colorlist);
|
||||
print $formother->selectColor((GETPOST("AGENDA_EXT_COLOR".$key)?GETPOST("AGENDA_EXT_COLOR".$key):$conf->global->$color), "AGENDA_EXT_COLOR".$key, 'extsitesconfig', 1, '', 'hideifnotset');
|
||||
print '</td>';
|
||||
|
||||
@ -35,7 +35,7 @@ if (!$user->admin)
|
||||
accessforbidden();
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('admin', 'other', 'agenda'));
|
||||
$langs->loadLangs(array('admin', 'other', 'agenda', 'users'));
|
||||
|
||||
$action = GETPOST('action','alpha');
|
||||
$value = GETPOST('value','alpha');
|
||||
@ -353,7 +353,8 @@ print '</td></tr>'."\n";
|
||||
|
||||
// AGENDA_DEFAULT_VIEW
|
||||
print '<tr class="oddeven">'."\n";
|
||||
print '<td>'.$langs->trans("AGENDA_DEFAULT_VIEW").'</td>'."\n";
|
||||
$htmltext=$langs->trans("ThisValueCanOverwrittenOnUserLevel", $langs->transnoentitiesnoconv("UserGUISetup"));
|
||||
print '<td>'.$form->textwithpicto($langs->trans("AGENDA_DEFAULT_VIEW"), $htmltext).'</td>'."\n";
|
||||
print '<td align="center"> </td>'."\n";
|
||||
print '<td class="right">'."\n";
|
||||
$tmplist=array(''=>' ', 'show_list'=>$langs->trans("ViewList"), 'show_month'=>$langs->trans("ViewCal"), 'show_week'=>$langs->trans("ViewWeek"), 'show_day'=>$langs->trans("ViewDay"), 'show_peruser'=>$langs->trans("ViewPerUser"));
|
||||
|
||||
@ -333,7 +333,7 @@ if (! empty($conf->product->enabled))
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("SetDefaultBarcodeTypeProducts").'</td>';
|
||||
print '<td width="60" align="right">';
|
||||
print '<td width="60" class="right">';
|
||||
print $formbarcode->selectBarcodeType($conf->global->PRODUIT_DEFAULT_BARCODE_TYPE, "PRODUIT_DEFAULT_BARCODE_TYPE", 1);
|
||||
print '</td></tr>';
|
||||
}
|
||||
@ -344,7 +344,7 @@ if (! empty($conf->societe->enabled))
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("SetDefaultBarcodeTypeThirdParties").'</td>';
|
||||
print '<td width="60" align="right">';
|
||||
print '<td width="60" class="right">';
|
||||
print $formbarcode->selectBarcodeType($conf->global->GENBARCODE_BARCODETYPE_THIRDPARTY, "GENBARCODE_BARCODETYPE_THIRDPARTY", 1);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
@ -417,7 +417,7 @@ if ($action == 'edit' || $action == 'updateedit')
|
||||
print '<tr class="oddeven hideonsmartphone"><td><label for="logo">'.$langs->trans("Logo").' (png,jpg)</label></td><td>';
|
||||
print '<table width="100%" class="nobordernopadding"><tr class="nocellnopadd"><td valign="middle" class="nocellnopadd">';
|
||||
print '<input type="file" class="flat class=minwidth200" name="logo" id="logo">';
|
||||
print '</td><td class="nocellnopadd" valign="middle" align="right">';
|
||||
print '</td><td class="nocellnopadd right" valign="middle">';
|
||||
if (! empty($mysoc->logo_mini)) {
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=removelogo">'.img_delete($langs->trans("Delete")).'</a>';
|
||||
if (file_exists($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini)) {
|
||||
|
||||
@ -304,10 +304,10 @@ print '</div>';
|
||||
if ($conf->use_javascript_ajax)
|
||||
{
|
||||
print '<br>';
|
||||
print '<div id="updateconst" align="right">';
|
||||
print '<div id="updateconst" class="right">';
|
||||
print '<input type="submit" name="update" class="button" value="'.$langs->trans("Modify").'">';
|
||||
print '</div>';
|
||||
print '<div id="delconst" align="right">';
|
||||
print '<div id="delconst" class="right">';
|
||||
print '<input type="submit" name="delete" class="button" value="'.$langs->trans("Delete").'">';
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
@ -1246,7 +1246,7 @@ if ($id)
|
||||
}
|
||||
if ($id == 4) print '<td></td>';
|
||||
print '<td class="liste_titre"></td>';
|
||||
print '<td class="liste_titre" colspan="2" align="right">';
|
||||
print '<td class="liste_titre right" colspan="2">';
|
||||
if ($filterfound)
|
||||
{
|
||||
$searchpicto=$form->showFilterAndCheckAddButtons(0);
|
||||
|
||||
@ -385,7 +385,7 @@ $parameters=array('arrayfields'=>$arrayfields);
|
||||
$reshook=$hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
// Action column
|
||||
print '<td class="liste_titre" align="right">';
|
||||
print '<td class="liste_titre right">';
|
||||
$searchpicto=$form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
|
||||
@ -356,7 +356,7 @@ $parameters=array('arrayfields'=>$arrayfields);
|
||||
$reshook=$hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
// Action column
|
||||
print '<td class="liste_titre" align="right">';
|
||||
print '<td class="liste_titre right">';
|
||||
$searchpicto=$form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
|
||||
@ -621,7 +621,7 @@ if ($resql)
|
||||
// There is several pages
|
||||
if ($num > $listlimit)
|
||||
{
|
||||
print '<tr class="none"><td align="right" colspan="'.(3+count($fieldlist)).'">';
|
||||
print '<tr class="none"><td class="right" colspan="'.(3+count($fieldlist)).'">';
|
||||
print_fleche_navigation($page, $_SERVER["PHP_SELF"], $paramwithsearch, ($num > $listlimit), '<li class="pagination"><span>'.$langs->trans("Page").' '.($page+1).'</span></li>');
|
||||
print '</td></tr>';
|
||||
}
|
||||
@ -657,7 +657,7 @@ if ($resql)
|
||||
}
|
||||
if (empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) print '<td class="liste_titre"></td>';
|
||||
// Action column
|
||||
print '<td class="liste_titre" align="right" width="64">';
|
||||
print '<td class="liste_titre right" width="64">';
|
||||
$searchpicto=$form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
|
||||
@ -79,7 +79,7 @@ print '<input type="hidden" name="action" value="updateoptions">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Parameters").'</td>'."\n";
|
||||
print '<td align="right" width="60">'.$langs->trans("Value").'</td>'."\n";
|
||||
print '<td class="right" width="60">'.$langs->trans("Value").'</td>'."\n";
|
||||
print '<td></td>';
|
||||
|
||||
|
||||
@ -88,13 +88,13 @@ print '<tr class="oddeven">';
|
||||
print '<td width="80%">'.$langs->trans("UseSearchToSelectResource").'</td>';
|
||||
if (empty($conf->use_javascript_ajax))
|
||||
{
|
||||
print '<td class="nowrap" align="right" colspan="2">';
|
||||
print '<td class="nowrap right" colspan="2">';
|
||||
print $langs->trans("NotAvailableWhenAjaxDisabled");
|
||||
print '</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td width="60" align="right">';
|
||||
print '<td width="60" class="right">';
|
||||
$arrval=array(
|
||||
'0'=>$langs->trans("No"),
|
||||
'1'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch",1).')',
|
||||
|
||||
@ -330,7 +330,7 @@ if ($conf->global->USER_PASSWORD_GENERATED == "Perso"){
|
||||
print '</table>';
|
||||
|
||||
print '<br>';
|
||||
print '<table align="right">';
|
||||
print '<table class="right">';
|
||||
print '<tr><td>';
|
||||
print '<a class="button" id="linkChangePattern">'.$langs->trans("Save").'</a>';
|
||||
print '</td></tr>';
|
||||
|
||||
@ -202,7 +202,7 @@ print '<input type="hidden" name="action" value="set">';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Type").'</td><td>'.$langs->trans("Value").'</td>';
|
||||
print '<td align="right" colspan="2"><input type="submit" class="button" '.$option.' value="'.$langs->trans("Modify").'"></td>';
|
||||
print '<td class="right" colspan="2"><input type="submit" class="button" '.$option.' value="'.$langs->trans("Modify").'"></td>';
|
||||
print "</tr>\n";
|
||||
|
||||
foreach ($syslogModules as $moduleName)
|
||||
|
||||
@ -147,7 +147,7 @@ else
|
||||
print '<tr class="oddeven"><td><label for="activate_MAIN_INFO_VAT_RETURN">'.$langs->trans("VATReturn").'</label></td>';
|
||||
if (! $conf->use_javascript_ajax)
|
||||
{
|
||||
print '<td class="nowrap" align="right">';
|
||||
print '<td class="nowrap right">';
|
||||
print $langs->trans("NotAvailableWhenAjaxDisabled");
|
||||
print "</td>";
|
||||
}
|
||||
|
||||
@ -255,7 +255,7 @@ if ($result)
|
||||
//print '<input class="flat" type="text" size="10" name="search_desc" value="'.$search_desc.'">';
|
||||
print '</td>';
|
||||
|
||||
print '<td align="right" class="liste_titre">';
|
||||
print '<td class="liste_titre right">';
|
||||
$searchpicto=$form->showFilterAndCheckAddButtons(0);
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
|
||||
@ -500,7 +500,7 @@ if ($mode == 'searchkey')
|
||||
//}
|
||||
print '</td>';
|
||||
// Action column
|
||||
print '<td class="nowrap" align="right">';
|
||||
print '<td class="nowrap right">';
|
||||
$searchpicto=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1);
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
|
||||
@ -502,7 +502,7 @@ if ($id)
|
||||
|
||||
fieldListWebsites($fieldlist,$obj,$tabname[$id],'add');
|
||||
|
||||
print '<td colspan="3" align="right">';
|
||||
print '<td colspan="3" class="right">';
|
||||
if ($action != 'edit')
|
||||
{
|
||||
print '<input type="submit" class="button" name="actionadd" value="'.$langs->trans("Add").'">';
|
||||
@ -585,7 +585,7 @@ if ($id)
|
||||
|
||||
if (empty($reshook)) fieldListWebsites($fieldlist,$obj,$tabname[$id],'edit');
|
||||
|
||||
print '<td colspan="3" align="right"><a name="'.(! empty($obj->rowid)?$obj->rowid:$obj->code).'"> </a><input type="submit" class="button" name="actionmodify" value="'.$langs->trans("Modify").'">';
|
||||
print '<td colspan="3" class="right"><a name="'.(! empty($obj->rowid)?$obj->rowid:$obj->code).'"> </a><input type="submit" class="button" name="actionmodify" value="'.$langs->trans("Modify").'">';
|
||||
print ' <input type="submit" class="button" name="actioncancel" value="'.$langs->trans("Cancel").'"></td>';
|
||||
}
|
||||
else
|
||||
|
||||
@ -364,7 +364,7 @@ $parameters=array('arrayfields'=>$arrayfields);
|
||||
$reshook=$hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
// Action column
|
||||
print '<td class="liste_titre" align="right">';
|
||||
print '<td class="liste_titre right">';
|
||||
$searchpicto=$form->showFilterButtons();
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
|
||||
@ -116,7 +116,7 @@ if (!empty($conf->global->BLOCKEDLOG_USE_REMOTE_AUTHORITY)) {
|
||||
// Example with a yes / no select
|
||||
print '<tr class="oddeven">';
|
||||
print '<td>'.$langs->trans("BlockedLogAuthorityUrl").img_info($langs->trans('BlockedLogAuthorityNeededToStoreYouFingerprintsInNonAlterableRemote')).'</td>';
|
||||
print '<td align="right" width="300">';
|
||||
print '<td class="right" width="300">';
|
||||
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="set_BLOCKEDLOG_AUTHORITY_URL">';
|
||||
|
||||
@ -327,7 +327,7 @@ if (GETPOST('withtab','alpha')) $param.='&withtab='.urlencode(GETPOST('withtab',
|
||||
|
||||
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
|
||||
print '<div align="right">';
|
||||
print '<div class="right">';
|
||||
print $langs->trans("RestrictYearToExport").': ';
|
||||
$smonth=GETPOST('monthtoexport','int');
|
||||
// Month
|
||||
@ -430,7 +430,7 @@ print getTitleFieldOfList($langs->trans('Author'), 0, $_SERVER["PHP_SELF"],'user
|
||||
print getTitleFieldOfList($langs->trans('Action'), 0, $_SERVER["PHP_SELF"],'','',$param,'',$sortfield,$sortorder,'')."\n";
|
||||
print getTitleFieldOfList($langs->trans('Ref'), 0, $_SERVER["PHP_SELF"],'ref_object','',$param,'',$sortfield,$sortorder,'')."\n";
|
||||
print getTitleFieldOfList('', 0, $_SERVER["PHP_SELF"],'','',$param,'',$sortfield,$sortorder,'')."\n";
|
||||
print getTitleFieldOfList($langs->trans('Amount'), 0, $_SERVER["PHP_SELF"],'','',$param,'align="right"',$sortfield,$sortorder,'')."\n";
|
||||
print getTitleFieldOfList($langs->trans('Amount'), 0, $_SERVER["PHP_SELF"],'','',$param,'class="right"',$sortfield,$sortorder,'')."\n";
|
||||
print getTitleFieldOfList($langs->trans('DataOfArchivedEvent'), 0, $_SERVER["PHP_SELF"],'','',$param,'align="center"',$sortfield,$sortorder,'')."\n";
|
||||
print getTitleFieldOfList($langs->trans('Fingerprint'), 0, $_SERVER["PHP_SELF"],'','',$param,'',$sortfield,$sortorder,'')."\n";
|
||||
print getTitleFieldOfList($langs->trans('Status'), 0, $_SERVER["PHP_SELF"],'','',$param,'align="center"',$sortfield,$sortorder,'')."\n";
|
||||
|
||||
@ -121,7 +121,7 @@ if ($resql)
|
||||
print_liste_field_titre("Target",'','','','','align="center"');
|
||||
print_liste_field_titre("Owner",$_SERVER["PHP_SELF"],"u.lastname","", $param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre("Date",$_SERVER["PHP_SELF"],"b.dateb","", $param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre("Position",$_SERVER["PHP_SELF"],"b.position","", $param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre("Position",$_SERVER["PHP_SELF"],"b.position","", $param,'class="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre('');
|
||||
print "</tr>\n";
|
||||
|
||||
@ -182,7 +182,7 @@ if ($resql)
|
||||
print '<td class="right">'.$obj->position."</td>";
|
||||
|
||||
// Actions
|
||||
print '<td align="right" class="nowrap">';
|
||||
print '<td class="nowrap right">';
|
||||
if ($user->rights->bookmark->creer)
|
||||
{
|
||||
print "<a href=\"".DOL_URL_ROOT."/bookmarks/card.php?action=edit&id=".$obj->rowid."&backtopage=".urlencode($_SERVER["PHP_SELF"])."\">".img_edit()."</a> ";
|
||||
|
||||
@ -169,7 +169,7 @@ foreach($fulltree as $key => $val)
|
||||
'fk_menu'=>$val['fk_parent'],
|
||||
'entry'=>'<table class="nobordernopadding centpercent"><tr><td><span class="noborderoncategories" '.($categstatic->color?' style="background: #'.$categstatic->color.';"':' style="background: #aaa"').'>'.$li.'</span></td>'.
|
||||
//'<td width="50%">'.dolGetFirstLineOfText($desc).'</td>'.
|
||||
'<td align="right" width="20px;"><a href="'.DOL_URL_ROOT.'/categories/viewcat.php?id='.$val['id'].'&type='.$type.'">'.img_view().'</a></td>'.
|
||||
'<td class="right" width="20px;"><a href="'.DOL_URL_ROOT.'/categories/viewcat.php?id='.$val['id'].'&type='.$type.'">'.img_view().'</a></td>'.
|
||||
'</tr></table>'
|
||||
);
|
||||
}
|
||||
|
||||
@ -263,7 +263,7 @@ if ($object->fetch($id) >= 0)
|
||||
//print '<td class="liste_titre" align="center">'.$langs->trans("NbOfUniqueEMails").'</td>';
|
||||
print '<div class="tagtd" align="center">'.$langs->trans("NbOfUniqueEMails").'</div>';
|
||||
//print '<td class="liste_titre" align="left">'.$langs->trans("Filter").'</td>';
|
||||
print '<div class="tagtd" align="left">'.$langs->trans("Filter").'</div>';
|
||||
print '<div class="tagtd left">'.$langs->trans("Filter").'</div>';
|
||||
//print '<td class="liste_titre" align="center"> </td>';
|
||||
print '<div class="tagtd"> </div>';
|
||||
//print "</tr>\n";
|
||||
@ -363,7 +363,7 @@ if ($object->fetch($id) >= 0)
|
||||
}
|
||||
print '</div>';
|
||||
|
||||
print '<div class="tagtd" align="left">';
|
||||
print '<div class="tagtd left">';
|
||||
if ($allowaddtarget)
|
||||
{
|
||||
try {
|
||||
@ -378,7 +378,7 @@ if ($object->fetch($id) >= 0)
|
||||
}
|
||||
print '</div>';
|
||||
|
||||
print '<div class="tagtd" align="right">';
|
||||
print '<div class="tagtd right">';
|
||||
if ($allowaddtarget)
|
||||
{
|
||||
print '<input type="submit" class="button" name="button_'.$modulename.'" value="'.$langs->trans("Add").'">';
|
||||
@ -501,11 +501,11 @@ if ($object->fetch($id) >= 0)
|
||||
print ' ';
|
||||
print '</td>';
|
||||
//Statut
|
||||
print '<td class="liste_titre" align="right">';
|
||||
print '<td class="liste_titre right">';
|
||||
print $formmailing->selectDestinariesStatus($search_dest_status,'search_dest_status',1);
|
||||
print '</td>';
|
||||
// Action column
|
||||
print '<td class="liste_titre" align="right">';
|
||||
print '<td class="liste_titre right">';
|
||||
$searchpicto=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1);
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
@ -526,7 +526,7 @@ if ($object->fetch($id) >= 0)
|
||||
{
|
||||
print_liste_field_titre("DateSending",$_SERVER["PHP_SELF"],"mc.date_envoi",$param,'','align="center"',$sortfield,$sortorder);
|
||||
}
|
||||
print_liste_field_titre("Status",$_SERVER["PHP_SELF"],"mc.statut",$param,'','align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre("Status",$_SERVER["PHP_SELF"],"mc.statut",$param,'','class="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch ');
|
||||
print '</tr>';
|
||||
|
||||
@ -590,13 +590,13 @@ if ($object->fetch($id) >= 0)
|
||||
if ($obj->statut == 0)
|
||||
{
|
||||
print '<td align="center"> </td>';
|
||||
print '<td align="right" class="nowrap">'.$langs->trans("MailingStatusNotSent");
|
||||
print '<td class="nowrap right">'.$langs->trans("MailingStatusNotSent");
|
||||
print '</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<td align="center">'.$obj->date_envoi.'</td>';
|
||||
print '<td align="right" class="nowrap">';
|
||||
print '<td class="nowrap right">';
|
||||
print $object::libStatutDest($obj->statut, 2, $obj->error_text);
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
@ -303,13 +303,13 @@ class ChargeSociales extends CommonObject
|
||||
|
||||
|
||||
/**
|
||||
* Met a jour une charge sociale
|
||||
* Update social or fiscal contribution
|
||||
*
|
||||
* @param User $user Utilisateur qui modifie
|
||||
* @param User $user User that modify
|
||||
* @param int $notrigger 0=launch triggers after, 1=disable triggers
|
||||
* @return int <0 si erreur, >0 si ok
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function update($user,$notrigger=0)
|
||||
function update($user, $notrigger = 0)
|
||||
{
|
||||
$error=0;
|
||||
$this->db->begin();
|
||||
@ -325,11 +325,11 @@ class ChargeSociales extends CommonObject
|
||||
|
||||
dol_syslog(get_class($this)."::update", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
|
||||
|
||||
if (! $resql) {
|
||||
$error++; $this->errors[]="Error ".$this->db->lasterror();
|
||||
}
|
||||
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
if (! $notrigger)
|
||||
@ -340,7 +340,7 @@ class ChargeSociales extends CommonObject
|
||||
// End call triggers
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Commit or rollback
|
||||
if ($error)
|
||||
{
|
||||
@ -357,8 +357,6 @@ class ChargeSociales extends CommonObject
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
657
htdocs/contact/consumption.php
Normal file
657
htdocs/contact/consumption.php
Normal file
@ -0,0 +1,657 @@
|
||||
<?php
|
||||
/* Copyright (C) 2012-2013 Philippe Berthet <berthet@systune.be>
|
||||
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2013-2015 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2015-2017 Ferran Marcet <fmarcet@2byte.es>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/societe/consumption.php
|
||||
* \ingroup societe
|
||||
* \brief Add a tab on thirpdarty view to list all products/services bought or sells by thirdparty
|
||||
*/
|
||||
|
||||
require "../main.inc.php";
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/contact.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
|
||||
|
||||
// Security check
|
||||
$id = GETPOST('id', 'int');
|
||||
|
||||
$result = restrictedArea($user, 'contact', $id, 'socpeople&societe');
|
||||
$object = new Contact($db);
|
||||
if ($id > 0) $object->fetch($id);
|
||||
if(empty($object->thirdparty)) $object->fetch_thirdparty();
|
||||
$socid = $object->thirdparty->id;
|
||||
|
||||
// Sort & Order fields
|
||||
$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit;
|
||||
$sortfield = GETPOST("sortfield",'alpha');
|
||||
$sortorder = GETPOST("sortorder",'alpha');
|
||||
$page = GETPOST("page",'int');
|
||||
if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1
|
||||
$offset = $limit * $page;
|
||||
$pageprev = $page - 1;
|
||||
$pagenext = $page + 1;
|
||||
if (! $sortorder) $sortorder='DESC';
|
||||
if (! $sortfield) $sortfield='dateprint';
|
||||
|
||||
// Search fields
|
||||
$sref=GETPOST("sref");
|
||||
$sprod_fulldescr=GETPOST("sprod_fulldescr");
|
||||
$month = GETPOST('month','int');
|
||||
$year = GETPOST('year','int');
|
||||
|
||||
// Clean up on purge search criteria ?
|
||||
if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // Both test are required to be compatible with all browsers
|
||||
{
|
||||
$sref='';
|
||||
$sprod_fulldescr='';
|
||||
$year='';
|
||||
$month='';
|
||||
}
|
||||
// Customer or supplier selected in drop box
|
||||
$thirdTypeSelect = GETPOST("third_select_id");
|
||||
$type_element = GETPOST('type_element')?GETPOST('type_element'):'';
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("companies", "bills", "orders", "suppliers", "propal", "interventions", "contracts", "products"));
|
||||
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$hookmanager->initHooks(array('consumptioncontact'));
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
$parameters=array('id'=>$id);
|
||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
$form = new Form($db);
|
||||
$formother = new FormOther($db);
|
||||
$productstatic=new Product($db);
|
||||
$objsoc = new Societe($db);
|
||||
|
||||
$title = (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses"));
|
||||
$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
|
||||
llxHeader('',$title,$help_url);
|
||||
|
||||
if (empty($id))
|
||||
{
|
||||
dol_print_error($db);
|
||||
exit;
|
||||
}
|
||||
|
||||
$head = contact_prepare_head($object);
|
||||
dol_fiche_head($head, 'consumption', $langs->trans("ContactsAddresses"), -1, 'contact');
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/contact/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
$morehtmlref='<div class="refidno">';
|
||||
if (empty($conf->global->SOCIETE_DISABLE_CONTACTS))
|
||||
{
|
||||
$objsoc->fetch($socid);
|
||||
// Thirdparty
|
||||
$morehtmlref.=$langs->trans('ThirdParty') . ' : ';
|
||||
if ($objsoc->id > 0) $morehtmlref.=$objsoc->getNomUrl(1, 'contact');
|
||||
else $morehtmlref.=$langs->trans("ContactNotLinkedToCompany");
|
||||
}
|
||||
$morehtmlref.='</div>';
|
||||
|
||||
dol_banner_tab($object, 'id', $linkback, ($user->societe_id?0:1), 'rowid', 'nom', $morehtmlref);
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Civility
|
||||
print '<tr><td class="titlefield">'.$langs->trans("UserTitle").'</td><td>';
|
||||
print $object->getCivilityLabel();
|
||||
print '</td></tr>';
|
||||
|
||||
if ($object->thirdparty->client)
|
||||
{
|
||||
$thirdTypeArray['customer']=$langs->trans("customer");
|
||||
if ($conf->propal->enabled && $user->rights->propal->lire) $elementTypeArray['propal']=$langs->transnoentitiesnoconv('Proposals');
|
||||
if ($conf->commande->enabled && $user->rights->commande->lire) $elementTypeArray['order']=$langs->transnoentitiesnoconv('Orders');
|
||||
if ($conf->facture->enabled && $user->rights->facture->lire) $elementTypeArray['invoice']=$langs->transnoentitiesnoconv('Invoices');
|
||||
if ($conf->contrat->enabled && $user->rights->contrat->lire) $elementTypeArray['contract']=$langs->transnoentitiesnoconv('Contracts');
|
||||
}
|
||||
|
||||
if ($conf->ficheinter->enabled && $user->rights->ficheinter->lire) $elementTypeArray['fichinter']=$langs->transnoentitiesnoconv('Interventions');
|
||||
|
||||
if ($object->thirdparty->fournisseur)
|
||||
{
|
||||
$thirdTypeArray['supplier']=$langs->trans("supplier");
|
||||
if ($conf->fournisseur->enabled && $user->rights->fournisseur->facture->lire) $elementTypeArray['supplier_invoice']=$langs->transnoentitiesnoconv('SuppliersInvoices');
|
||||
if ($conf->fournisseur->enabled && $user->rights->fournisseur->commande->lire) $elementTypeArray['supplier_order']=$langs->transnoentitiesnoconv('SuppliersOrders');
|
||||
|
||||
// There no contact type for supplier proposals
|
||||
// if ($conf->fournisseur->enabled && $user->rights->supplier_proposal->lire) $elementTypeArray['supplier_proposal']=$langs->transnoentitiesnoconv('SupplierProposals');
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '</div>';
|
||||
|
||||
dol_fiche_end();
|
||||
print '<br>';
|
||||
|
||||
|
||||
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'?id='.$id.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
|
||||
$sql_select='';
|
||||
if ($type_element == 'fichinter')
|
||||
{ // Customer : show products from invoices
|
||||
require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php';
|
||||
$documentstatic=new Fichinter($db);
|
||||
$sql_select = 'SELECT f.rowid as doc_id, f.ref as doc_number, \'1\' as doc_type, f.datec as dateprint, f.fk_statut as status, tc.libelle, ';
|
||||
$tables_from = MAIN_DB_PREFIX.'fichinterdet d';
|
||||
$tables_from.= ' LEFT JOIN '.MAIN_DB_PREFIX.'fichinter as f ON d.fk_fichinter=f.rowid';
|
||||
$tables_from.= ' INNER JOIN '.MAIN_DB_PREFIX.'element_contact ec ON ec.element_id=f.rowid';
|
||||
$tables_from.= ' INNER JOIN '.MAIN_DB_PREFIX."c_type_contact tc ON (ec.fk_c_type_contact=tc.rowid and tc.element='fichinter' and tc.source='external' and tc.active=1)";
|
||||
$where = ' WHERE f.entity IN ('.getEntity('ficheinter').')';
|
||||
$dateprint = 'f.datec';
|
||||
$doc_number='f.ref';
|
||||
}
|
||||
if ($type_element == 'invoice')
|
||||
{ // Customer : show products from invoices
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
$documentstatic=new Facture($db);
|
||||
$sql_select = 'SELECT f.rowid as doc_id, f.ref as doc_number, f.type as doc_type, f.datef as dateprint, f.fk_statut as status, f.paye as paid, tc.libelle, ';
|
||||
$tables_from = MAIN_DB_PREFIX.'facturedet d';
|
||||
$tables_from.= ' LEFT JOIN '.MAIN_DB_PREFIX.'facture as f ON d.fk_facture=f.rowid';
|
||||
$tables_from.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product p ON d.fk_product=p.rowid';
|
||||
$tables_from.= ' INNER JOIN '.MAIN_DB_PREFIX.'element_contact ec ON ec.element_id=f.rowid';
|
||||
$tables_from.= ' INNER JOIN '.MAIN_DB_PREFIX."c_type_contact tc ON (ec.fk_c_type_contact=tc.rowid and tc.element='facture' and tc.source='external' and tc.active=1)";
|
||||
$where = " WHERE f.entity IN (".getEntity('invoice').")";
|
||||
$dateprint = 'f.datef';
|
||||
$doc_number='f.ref';
|
||||
$thirdTypeSelect='customer';
|
||||
}
|
||||
if ($type_element == 'propal')
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
|
||||
$documentstatic=new Propal($db);
|
||||
$sql_select = 'SELECT c.rowid as doc_id, c.ref as doc_number, \'1\' as doc_type, c.datep as dateprint, c.fk_statut as status, tc.libelle, ';
|
||||
$tables_from = MAIN_DB_PREFIX.'propaldet d';
|
||||
$tables_from.= ' LEFT JOIN '.MAIN_DB_PREFIX.'propal as c ON d.fk_propal=c.rowid';
|
||||
$tables_from.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product p ON d.fk_product=p.rowid';
|
||||
$tables_from.= ' INNER JOIN '.MAIN_DB_PREFIX.'element_contact ec ON ec.element_id=c.rowid';
|
||||
$tables_from.= ' INNER JOIN '.MAIN_DB_PREFIX."c_type_contact tc ON (ec.fk_c_type_contact=tc.rowid and tc.element='propal' and tc.source='external' and tc.active=1)";
|
||||
$where = ' WHERE c.entity IN ('.getEntity('propal').')';
|
||||
$datePrint = 'c.datep';
|
||||
$doc_number='c.ref';
|
||||
$thirdTypeSelect='customer';
|
||||
}
|
||||
if ($type_element == 'order')
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
|
||||
$documentstatic=new Commande($db);
|
||||
$sql_select = 'SELECT c.rowid as doc_id, c.ref as doc_number, \'1\' as doc_type, c.date_commande as dateprint, c.fk_statut as status, tc.libelle, ';
|
||||
$tables_from = MAIN_DB_PREFIX.'commandedet d';
|
||||
$tables_from.= ' LEFT JOIN '.MAIN_DB_PREFIX.'commande as c ON d.fk_commande=c.rowid';
|
||||
$tables_from.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product p ON d.fk_product=p.rowid';
|
||||
$tables_from.= ' INNER JOIN '.MAIN_DB_PREFIX.'element_contact ec ON ec.element_id=c.rowid';
|
||||
$tables_from.= ' INNER JOIN '.MAIN_DB_PREFIX."c_type_contact tc ON (ec.fk_c_type_contact=tc.rowid and tc.element='commande' and tc.source='external' and tc.active=1)";
|
||||
$where = ' WHERE c.entity IN ('.getEntity('order').')';
|
||||
$dateprint = 'c.date_commande';
|
||||
$doc_number='c.ref';
|
||||
$thirdTypeSelect='customer';
|
||||
}
|
||||
if ($type_element == 'supplier_invoice')
|
||||
{ // Supplier : Show products from invoices.
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
|
||||
$documentstatic=new FactureFournisseur($db);
|
||||
$sql_select = 'SELECT f.rowid as doc_id, f.ref as doc_number, \'1\' as doc_type, f.datef as dateprint, f.fk_statut as status, f.paye as paid, tc.libelle, ';
|
||||
$tables_from = MAIN_DB_PREFIX.'facture_fourn_det d';
|
||||
$tables_from.= ' LEFT JOIN '.MAIN_DB_PREFIX.'facture_fourn as f ON d.fk_facture_fourn=f.rowid';
|
||||
$tables_from.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product p ON d.fk_product=p.rowid';
|
||||
$tables_from.= ' INNER JOIN '.MAIN_DB_PREFIX.'element_contact ec ON ec.element_id=f.rowid';
|
||||
$tables_from.= ' INNER JOIN '.MAIN_DB_PREFIX."c_type_contact tc ON (ec.fk_c_type_contact=tc.rowid and tc.element='invoice_supplier' and tc.source='external' and tc.active=1)";
|
||||
$where = ' WHERE f.entity IN ('.getEntity($documentstatic->element).')';
|
||||
$dateprint = 'f.datef';
|
||||
$doc_number='f.ref';
|
||||
$thirdTypeSelect='supplier';
|
||||
}
|
||||
//if ($type_element == 'supplier_proposal')
|
||||
//{
|
||||
// require_once DOL_DOCUMENT_ROOT.'/supplier_proposal/class/supplier_proposal.class.php';
|
||||
// $documentstatic=new SupplierProposal($db);
|
||||
// $sql_select = 'SELECT c.rowid as doc_id, c.ref as doc_number, \'1\' as doc_type, c.date_valid as dateprint, c.fk_statut as status, ';
|
||||
// $tables_from = MAIN_DB_PREFIX."supplier_proposal as c,".MAIN_DB_PREFIX."supplier_proposaldet as d";
|
||||
// $where = " WHERE c.fk_soc = s.rowid AND s.rowid = ".$socid;
|
||||
// $where.= " AND d.fk_supplier_proposal = c.rowid";
|
||||
// $where.= " AND c.entity = ".$conf->entity;
|
||||
// $dateprint = 'c.date_valid';
|
||||
// $doc_number='c.ref';
|
||||
// $thirdTypeSelect='supplier';
|
||||
//}
|
||||
if ($type_element == 'supplier_order')
|
||||
{ // Supplier : Show products from orders.
|
||||
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
|
||||
$documentstatic=new CommandeFournisseur($db);
|
||||
$sql_select = 'SELECT c.rowid as doc_id, c.ref as doc_number, \'1\' as doc_type, c.date_valid as dateprint, c.fk_statut as status, tc.libelle, ';
|
||||
$tables_from = MAIN_DB_PREFIX.'commande_fournisseurdet d';
|
||||
$tables_from.= ' LEFT JOIN '.MAIN_DB_PREFIX.'commande_fournisseur as c ON d.fk_commande=c.rowid';
|
||||
$tables_from.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product p ON d.fk_product=p.rowid';
|
||||
$tables_from.= ' INNER JOIN '.MAIN_DB_PREFIX.'element_contact ec ON ec.element_id=c.rowid';
|
||||
$tables_from.= ' INNER JOIN '.MAIN_DB_PREFIX."c_type_contact tc ON (ec.fk_c_type_contact=tc.rowid and tc.element='order_supplier' and tc.source='external' and tc.active=1)";
|
||||
$where = ' WHERE c.entity IN ('.getEntity($documentstatic->element).')';
|
||||
$dateprint = 'c.date_valid';
|
||||
$doc_number='c.ref';
|
||||
$thirdTypeSelect='supplier';
|
||||
}
|
||||
if ($type_element == 'contract')
|
||||
{ // Order
|
||||
require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
|
||||
$documentstatic=new Contrat($db);
|
||||
$documentstaticline=new ContratLigne($db);
|
||||
$sql_select = 'SELECT c.rowid as doc_id, c.ref as doc_number, \'1\' as doc_type, c.date_contrat as dateprint, d.statut as status, tc.libelle, ';
|
||||
$tables_from = MAIN_DB_PREFIX.'contratdet d';
|
||||
$tables_from.= ' LEFT JOIN '.MAIN_DB_PREFIX.'contrat as c ON d.fk_contrat=c.rowid';
|
||||
$tables_from.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product p ON d.fk_product=p.rowid';
|
||||
$tables_from.= ' INNER JOIN '.MAIN_DB_PREFIX.'element_contact ec ON ec.element_id=c.rowid';
|
||||
$tables_from.= ' INNER JOIN '.MAIN_DB_PREFIX."c_type_contact tc ON (ec.fk_c_type_contact=tc.rowid and tc.element='contrat' and tc.source='external' and tc.active=1)";
|
||||
$where = ' WHERE c.entity IN ('.getEntity('contrat').')';
|
||||
$dateprint = 'c.date_valid';
|
||||
$doc_number='c.ref';
|
||||
$thirdTypeSelect='customer';
|
||||
}
|
||||
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook
|
||||
|
||||
if (!empty($sql_select))
|
||||
{
|
||||
$sql = $sql_select;
|
||||
$sql.= ' d.description as description';
|
||||
if ($type_element != 'fichinter' && $type_element != 'contract' && $type_element != 'supplier_proposal') $sql.= ', d.label, d.fk_product as product_id, d.fk_product as fk_product, d.info_bits, d.date_start, d.date_end, d.qty, d.qty as prod_qty, d.total_ht as total_ht, ';
|
||||
if ($type_element == 'supplier_proposal') $sql.= ', d.label, d.fk_product as product_id, d.fk_product as fk_product, d.info_bits, d.qty, d.qty as prod_qty, d.total_ht as total_ht, ';
|
||||
if ($type_element == 'contract') $sql.= ', d.label, d.fk_product as product_id, d.fk_product as fk_product, d.info_bits, d.date_ouverture as date_start, d.date_cloture as date_end, d.qty, d.qty as prod_qty, d.total_ht as total_ht, ';
|
||||
if ($type_element != 'fichinter') $sql.= ' p.ref as ref, p.rowid as prod_id, p.rowid as fk_product, p.fk_product_type as prod_type, p.fk_product_type as fk_product_type, p.entity as pentity';
|
||||
$sql.= " ";
|
||||
if ($type_element != 'fichinter') $sql.= ", p.ref as prod_ref, p.label as product_label";
|
||||
$sql.= " FROM "/*.MAIN_DB_PREFIX."societe as s, "*/.$tables_from;
|
||||
// if ($type_element != 'fichinter') $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON d.fk_product = p.rowid ';
|
||||
$sql.= $where;
|
||||
if ($month > 0) {
|
||||
if ($year > 0) {
|
||||
$start = dol_mktime(0, 0, 0, $month, 1, $year);
|
||||
$end = dol_time_plus_duree($start,1,'m') - 1;
|
||||
$sql.= " AND ".$dateprint." BETWEEN '".$db->idate($start)."' AND '".$db->idate($end)."'";
|
||||
} else {
|
||||
$sql.= " AND date_format(".$dateprint.", '%m') = '".sprintf('%02d',$month)."'";
|
||||
}
|
||||
} elseif ($year > 0) {
|
||||
$start = dol_mktime(0, 0, 0, 1, 1, $year);
|
||||
$end = dol_time_plus_duree($start,1,'y') - 1;
|
||||
$sql.= " AND ".$dateprint." BETWEEN '".$db->idate($start)."' AND '".$db->idate($end)."'";
|
||||
}
|
||||
if ($sref) $sql.= " AND ".$doc_number." LIKE '%".$db->escape($sref)."%'";
|
||||
if ($sprod_fulldescr)
|
||||
{
|
||||
$sql.= " AND (d.description LIKE '%".$db->escape($sprod_fulldescr)."%'";
|
||||
if (GETPOST('type_element') != 'fichinter') $sql.= " OR p.ref LIKE '%".$db->escape($sprod_fulldescr)."%'";
|
||||
if (GETPOST('type_element') != 'fichinter') $sql.= " OR p.label LIKE '%".$db->escape($sprod_fulldescr)."%'";
|
||||
$sql.=")";
|
||||
}
|
||||
$sql.= $db->order($sortfield,$sortorder);
|
||||
//print ($sql);exit;
|
||||
$resql=$db->query($sql);
|
||||
$totalnboflines = $db->num_rows($resql);
|
||||
|
||||
$sql.= $db->plimit($limit + 1, $offset);
|
||||
//print $sql;
|
||||
}
|
||||
|
||||
$disabled=0;
|
||||
$showempty=2;
|
||||
if (empty($elementTypeArray) && ! $object->client && ! $object->fournisseur)
|
||||
{
|
||||
$showempty=$langs->trans("ThirdpartyNotCustomerNotSupplierSoNoRef");
|
||||
$disabled=1;
|
||||
}
|
||||
|
||||
// Define type of elements
|
||||
$typeElementString = $form->selectarray("type_element", $elementTypeArray, GETPOST('type_element'), $showempty, 0, 0, '', 0, 0, $disabled, '', 'maxwidth150onsmartphone');
|
||||
$button = '<input type="submit" class="button" name="button_third" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
||||
|
||||
$param='';
|
||||
$param.="&sref=".urlencode($sref);
|
||||
$param.="&month=".urlencode($month);
|
||||
$param.="&year=".urlencode($year);
|
||||
$param.="&sprod_fulldescr=".urlencode($sprod_fulldescr);
|
||||
$param.="&socid=".urlencode($socid);
|
||||
$param.="&type_element=".urlencode($type_element);
|
||||
|
||||
$total_qty=0;
|
||||
|
||||
if ($sql_select)
|
||||
{
|
||||
$resql=$db->query($sql);
|
||||
if (!$resql) dol_print_error($db);
|
||||
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
$param="&socid=".$socid."&type_element=".$type_element;
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
|
||||
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
|
||||
if ($sprod_fulldescr) $param.= "&sprod_fulldescr=".urlencode($sprod_fulldescr);
|
||||
if ($sref) $param.= "&sref=".urlencode($sref);
|
||||
if ($month) $param.= "&month=".$month;
|
||||
if ($year) $param.= "&year=".$year;
|
||||
if ($optioncss != '') $param.='&optioncss='.$optioncss;
|
||||
|
||||
print_barre_liste($langs->trans('ProductsIntoElements').' '.$typeElementString.' '.$button, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num, $totalnboflines, '', 0, '', '', $limit);
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table class="liste" width="100%">'."\n";
|
||||
|
||||
// Filters
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" type="text" name="sref" size="8" value="'.$sref.'">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre nowrap center">'; // date
|
||||
print $formother->select_month($month?$month:-1, 'month', 1, 0, 'valignmiddle');
|
||||
$formother->select_year($year?$year:-1,'year',1, 20, 1);
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" align="center">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" type="text" name="sprod_fulldescr" size="15" value="'.dol_escape_htmltag($sprod_fulldescr).'">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" align="center">'; // TODO: Add filters !
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" align="center">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" align="center">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" align="right">';
|
||||
$searchpicto=$form->showFilterAndCheckAddButtons(0);
|
||||
print $searchpicto;
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Titles with sort buttons
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre('Ref',$_SERVER['PHP_SELF'],'doc_number','',$param,'align="left"',$sortfield,$sortorder);
|
||||
print_liste_field_titre('Date',$_SERVER['PHP_SELF'],'dateprint','',$param,'align="center" width="150"',$sortfield,$sortorder);
|
||||
print_liste_field_titre('Status',$_SERVER['PHP_SELF'],'fk_statut','',$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre('Product',$_SERVER['PHP_SELF'],'','',$param,'align="left"',$sortfield,$sortorder);
|
||||
print_liste_field_titre('ContactType',$_SERVER['PHP_SELF'],'','',$param,'align="left"',$sortfield,$sortorder);
|
||||
print_liste_field_titre('Quantity',$_SERVER['PHP_SELF'],'prod_qty','',$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre('TotalHT',$_SERVER['PHP_SELF'],'total_ht','',$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre('UnitPrice',$_SERVER['PHP_SELF'],'','',$param,'align="right"',$sortfield,$sortorder);
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
$i = 0;
|
||||
while (($objp = $db->fetch_object($resql)) && $i < min($num, $limit))
|
||||
{
|
||||
$documentstatic->id=$objp->doc_id;
|
||||
$documentstatic->ref=$objp->doc_number;
|
||||
$documentstatic->type=$objp->doc_type;
|
||||
$documentstatic->fk_statut=$objp->status;
|
||||
$documentstatic->fk_status=$objp->status;
|
||||
$documentstatic->statut=$objp->status;
|
||||
$documentstatic->status=$objp->status;
|
||||
$documentstatic->paye=$objp->paid;
|
||||
|
||||
if (is_object($documentstaticline)) $documentstaticline->statut=$objp->status;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="nobordernopadding nowrap" width="100">';
|
||||
print $documentstatic->getNomUrl(1);
|
||||
print '</td>';
|
||||
print '<td align="center" width="80">'.dol_print_date($db->jdate($objp->dateprint),'day').'</td>';
|
||||
|
||||
// Status
|
||||
print '<td align="center">';
|
||||
if ($type_element == 'contract')
|
||||
{
|
||||
print $documentstaticline->getLibStatut(2);
|
||||
}
|
||||
else
|
||||
{
|
||||
print $documentstatic->getLibStatut(2);
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
print '<td>';
|
||||
|
||||
// Define text, description and type
|
||||
$text=''; $description=''; $type=0;
|
||||
|
||||
// Code to show product duplicated from commonobject->printObjectLine
|
||||
if ($objp->fk_product > 0)
|
||||
{
|
||||
$product_static = new Product($db);
|
||||
|
||||
$product_static->type=$objp->fk_product_type;
|
||||
$product_static->id=$objp->fk_product;
|
||||
$product_static->ref=$objp->ref;
|
||||
$product_static->entity=$objp->pentity;
|
||||
$text=$product_static->getNomUrl(1);
|
||||
}
|
||||
|
||||
// Product
|
||||
if ($objp->fk_product > 0)
|
||||
{
|
||||
// Define output language
|
||||
if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE))
|
||||
{
|
||||
$prod = new Product($db);
|
||||
$prod->fetch($objp->fk_product);
|
||||
|
||||
$outputlangs = $langs;
|
||||
$newlang='';
|
||||
if (empty($newlang) && GETPOST('lang_id','aZ09')) $newlang=GETPOST('lang_id','aZ09');
|
||||
if (empty($newlang)) $newlang=$object->default_lang;
|
||||
if (! empty($newlang))
|
||||
{
|
||||
$outputlangs = new Translate("",$conf);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
}
|
||||
|
||||
$label = (! empty($prod->multilangs[$outputlangs->defaultlang]["label"])) ? $prod->multilangs[$outputlangs->defaultlang]["label"] : $objp->product_label;
|
||||
}
|
||||
else
|
||||
{
|
||||
$label = $objp->product_label;
|
||||
}
|
||||
|
||||
$text.= ' - '.(! empty($objp->label)?$objp->label:$label);
|
||||
$description=(! empty($conf->global->PRODUIT_DESC_IN_FORM)?'':dol_htmlentitiesbr($objp->description));
|
||||
}
|
||||
|
||||
if (($objp->info_bits & 2) == 2) { ?>
|
||||
<a href="<?php echo DOL_URL_ROOT.'/comm/remx.php?id='.$object->id; ?>">
|
||||
<?php
|
||||
$txt='';
|
||||
print img_object($langs->trans("ShowReduc"),'reduc').' ';
|
||||
if ($objp->description == '(DEPOSIT)') $txt=$langs->trans("Deposit");
|
||||
elseif ($objp->description == '(EXCESS RECEIVED)') $txt=$langs->trans("ExcessReceived");
|
||||
elseif ($objp->description == '(EXCESS PAID)') $txt=$langs->trans("ExcessPaid");
|
||||
//else $txt=$langs->trans("Discount");
|
||||
print $txt;
|
||||
?>
|
||||
</a>
|
||||
<?php
|
||||
if ($objp->description)
|
||||
{
|
||||
if ($objp->description == '(CREDIT_NOTE)' && $objp->fk_remise_except > 0)
|
||||
{
|
||||
$discount=new DiscountAbsolute($db);
|
||||
$discount->fetch($objp->fk_remise_except);
|
||||
echo ($txt?' - ':'').$langs->transnoentities("DiscountFromCreditNote",$discount->getNomUrl(0));
|
||||
}
|
||||
if ($objp->description == '(EXCESS RECEIVED)' && $objp->fk_remise_except > 0)
|
||||
{
|
||||
$discount=new DiscountAbsolute($db);
|
||||
$discount->fetch($objp->fk_remise_except);
|
||||
echo ($txt?' - ':'').$langs->transnoentities("DiscountFromExcessReceived",$discount->getNomUrl(0));
|
||||
}
|
||||
elseif ($objp->description == '(EXCESS PAID)' && $objp->fk_remise_except > 0)
|
||||
{
|
||||
$discount=new DiscountAbsolute($db);
|
||||
$discount->fetch($objp->fk_remise_except);
|
||||
echo ($txt?' - ':'').$langs->transnoentities("DiscountFromExcessPaid",$discount->getNomUrl(0));
|
||||
}
|
||||
elseif ($objp->description == '(DEPOSIT)' && $objp->fk_remise_except > 0)
|
||||
{
|
||||
$discount=new DiscountAbsolute($db);
|
||||
$discount->fetch($objp->fk_remise_except);
|
||||
echo ($txt?' - ':'').$langs->transnoentities("DiscountFromDeposit",$discount->getNomUrl(0));
|
||||
// Add date of deposit
|
||||
if (! empty($conf->global->INVOICE_ADD_DEPOSIT_DATE)) echo ' ('.dol_print_date($discount->datec).')';
|
||||
}
|
||||
else
|
||||
{
|
||||
echo ($txt?' - ':'').dol_htmlentitiesbr($objp->description);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($objp->fk_product > 0) {
|
||||
|
||||
echo $form->textwithtooltip($text,$description,3,'','',$i,0,'');
|
||||
|
||||
// Show range
|
||||
echo get_date_range($objp->date_start, $objp->date_end);
|
||||
|
||||
// Add description in form
|
||||
if (! empty($conf->global->PRODUIT_DESC_IN_FORM))
|
||||
{
|
||||
print (! empty($objp->description) && $objp->description!=$objp->product_label)?'<br>'.dol_htmlentitiesbr($objp->description):'';
|
||||
}
|
||||
} else {
|
||||
|
||||
if (! empty($objp->label) || ! empty($objp->description))
|
||||
{
|
||||
if ($type==1) $text = img_object($langs->trans('Service'),'service');
|
||||
else $text = img_object($langs->trans('Product'),'product');
|
||||
|
||||
if (! empty($objp->label)) {
|
||||
$text.= ' <strong>'.$objp->label.'</strong>';
|
||||
echo $form->textwithtooltip($text,dol_htmlentitiesbr($objp->description),3,'','',$i,0,'');
|
||||
} else {
|
||||
echo $text.' '.dol_htmlentitiesbr($objp->description);
|
||||
}
|
||||
}
|
||||
|
||||
// Show range
|
||||
echo get_date_range($objp->date_start,$objp->date_end);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
$prodreftxt='';
|
||||
if ($objp->prod_id > 0)
|
||||
{
|
||||
$productstatic->id = $objp->prod_id;
|
||||
$productstatic->ref = $objp->prod_ref;
|
||||
$productstatic->status = $objp->prod_type;
|
||||
$prodreftxt = $productstatic->getNomUrl(0);
|
||||
if(!empty($objp->product_label)) $prodreftxt .= ' - '.$objp->product_label;
|
||||
}
|
||||
// Show range
|
||||
$prodreftxt .= get_date_range($objp->date_start, $objp->date_end);
|
||||
// Add description in form
|
||||
if (! empty($conf->global->PRODUIT_DESC_IN_FORM))
|
||||
{
|
||||
$prodreftxt .= (! empty($objp->description) && $objp->description!=$objp->product_label)?'<br>'.dol_htmlentitiesbr($objp->description):'';
|
||||
}
|
||||
*/
|
||||
print '</td>';
|
||||
|
||||
//print '<td class="left">'.$prodreftxt.'</td>';
|
||||
print '<td>'.$objp->libelle.'</td>';
|
||||
|
||||
print '<td align="right">'.$objp->prod_qty.'</td>';
|
||||
$total_qty+=$objp->prod_qty;
|
||||
|
||||
print '<td align="right">'.price($objp->total_ht).'</td>';
|
||||
$total_ht+=$objp->total_ht;
|
||||
|
||||
print '<td align="right">'.price($objp->total_ht/(empty($objp->prod_qty)?1:$objp->prod_qty)).'</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
|
||||
print '<tr class="liste_total">';
|
||||
print '<td>' . $langs->trans('Total') . '</td>';
|
||||
print '<td colspan="3"></td>';
|
||||
print '<td></td>';
|
||||
print '<td align="right">' . $total_qty . '</td>';
|
||||
print '<td align="right">' . price($total_ht) . '</td>';
|
||||
print '<td align="right">' . price($total_ht/(empty($total_qty)?1:$total_qty)) . '</td>';
|
||||
print "</table>";
|
||||
print '</div>';
|
||||
|
||||
if ($num > $limit) {
|
||||
print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num);
|
||||
}
|
||||
$db->free($resql);
|
||||
}
|
||||
elseif (empty($type_element) || $type_element == -1)
|
||||
{
|
||||
print_barre_liste($langs->trans('ProductsIntoElements').' '.$typeElementString.' '.$button, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num, '', '');
|
||||
|
||||
print '<table class="liste" width="100%">'."\n";
|
||||
// Titles with sort buttons
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre('Ref',$_SERVER['PHP_SELF'],'doc_number','',$param,'align="left"',$sortfield,$sortorder);
|
||||
print_liste_field_titre('Date',$_SERVER['PHP_SELF'],'dateprint','',$param,'align="center" width="150"',$sortfield,$sortorder);
|
||||
print_liste_field_titre('Status',$_SERVER['PHP_SELF'],'fk_status','',$param,'align="center"',$sortfield,$sortorder);
|
||||
print_liste_field_titre('Product',$_SERVER['PHP_SELF'],'','',$param,'align="left"',$sortfield,$sortorder);
|
||||
print_liste_field_titre('Quantity',$_SERVER['PHP_SELF'],'prod_qty','',$param,'align="right"',$sortfield,$sortorder);
|
||||
print "</tr>\n";
|
||||
|
||||
print '<tr class="oddeven"><td class="opacitymedium" colspan="5">'.$langs->trans("SelectElementAndClick", $langs->transnoentitiesnoconv("Search")).'</td></tr>';
|
||||
|
||||
print "</table>";
|
||||
}
|
||||
else {
|
||||
print_barre_liste($langs->trans('ProductsIntoElements').' '.$typeElementString.' '.$button, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num, '', '');
|
||||
|
||||
print '<table class="liste" width="100%">'."\n";
|
||||
|
||||
print '<tr class="oddeven"><td class="opacitymedium" colspan="5">'.$langs->trans("FeatureNotYetAvailable").'</td></tr>';
|
||||
|
||||
print "</table>";
|
||||
}
|
||||
|
||||
print "</form>";
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
$db->close();
|
||||
@ -66,19 +66,19 @@ if (! $error && $massaction == 'confirm_presend')
|
||||
$nbignored = 0;
|
||||
$langs->load("mails");
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
|
||||
|
||||
$listofobjectid=array();
|
||||
$listofobjectthirdparties=array();
|
||||
$listofobjectref=array();
|
||||
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$thirdparty=new Societe($db);
|
||||
|
||||
|
||||
$objecttmp=new $objectclass($db);
|
||||
if ($objecttmp->element == 'expensereport') $thirdparty=new User($db);
|
||||
if ($objecttmp->element == 'holiday') $thirdparty=new User($db);
|
||||
|
||||
|
||||
foreach($toselect as $toselectid)
|
||||
{
|
||||
$objecttmp=new $objectclass($db); // we must create new instance because instance is saved into $listofobjectref array for future use
|
||||
@ -86,19 +86,19 @@ if (! $error && $massaction == 'confirm_presend')
|
||||
if ($result > 0)
|
||||
{
|
||||
$listofobjectid[$toselectid]=$toselectid;
|
||||
|
||||
|
||||
$thirdpartyid=($objecttmp->fk_soc?$objecttmp->fk_soc:$objecttmp->socid);
|
||||
if ($objecttmp->element == 'societe') $thirdpartyid=$objecttmp->id;
|
||||
if ($objecttmp->element == 'expensereport') $thirdpartyid=$objecttmp->fk_user_author;
|
||||
if ($objecttmp->element == 'holiday') $thirdpartyid=$objecttmp->fk_user;
|
||||
if (empty($thirdpartyid)) $thirdpartyid=0;
|
||||
|
||||
|
||||
$listofobjectthirdparties[$thirdpartyid]=$thirdpartyid;
|
||||
$listofobjectref[$thirdpartyid][$toselectid]=$objecttmp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Check mandatory parameters
|
||||
if (GETPOST('fromtype','alpha') === 'user' && empty($user->email))
|
||||
{
|
||||
@ -106,7 +106,7 @@ if (! $error && $massaction == 'confirm_presend')
|
||||
setEventMessages($langs->trans("NoSenderEmailDefined"), null, 'warnings');
|
||||
$massaction='presend';
|
||||
}
|
||||
|
||||
|
||||
$receiver=$_POST['receiver'];
|
||||
if (! is_array($receiver))
|
||||
{
|
||||
@ -119,14 +119,14 @@ if (! $error && $massaction == 'confirm_presend')
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Recipient")), null, 'warnings');
|
||||
$massaction='presend';
|
||||
}
|
||||
|
||||
|
||||
if (! GETPOST('subject','none'))
|
||||
{
|
||||
$error++;
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("MailTopic")), null, 'warnings');
|
||||
$massaction='presend';
|
||||
}
|
||||
|
||||
|
||||
// Loop on each recipient/thirdparty
|
||||
if (! $error)
|
||||
{
|
||||
@ -138,12 +138,12 @@ if (! $error && $massaction == 'confirm_presend')
|
||||
dol_print_error($db);
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
$sendto='';
|
||||
$sendtocc='';
|
||||
$sendtobcc='';
|
||||
$sendtoid = array();
|
||||
|
||||
|
||||
// Define $sendto
|
||||
$tmparray=array();
|
||||
if (trim($_POST['sendto']))
|
||||
@ -168,7 +168,7 @@ if (! $error && $massaction == 'confirm_presend')
|
||||
}
|
||||
}
|
||||
$sendto=implode(',',$tmparray);
|
||||
|
||||
|
||||
// Define $sendtocc
|
||||
$receivercc=$_POST['receivercc'];
|
||||
if (! is_array($receivercc))
|
||||
@ -198,13 +198,13 @@ if (! $error && $massaction == 'confirm_presend')
|
||||
}
|
||||
}
|
||||
$sendtocc=implode(',',$tmparray);
|
||||
|
||||
|
||||
//var_dump($listofobjectref);exit;
|
||||
$attachedfiles=array('paths'=>array(), 'names'=>array(), 'mimes'=>array());
|
||||
$listofqualifiedobj=array();
|
||||
$listofqualifiedref=array();
|
||||
$thirdpartywithoutemail=array();
|
||||
|
||||
|
||||
foreach($listofobjectref[$thirdpartyid] as $objectid => $objectobj)
|
||||
{
|
||||
//var_dump($thirdpartyid.' - '.$objectid.' - '.$objectobj->statut);
|
||||
@ -229,7 +229,7 @@ if (! $error && $massaction == 'confirm_presend')
|
||||
$resaction.='<div class="error">'.$langs->trans('ErrorOnlyInvoiceValidatedCanBeSentInMassAction',$objectobj->ref).'</div><br>';
|
||||
continue; // Payment done or started or canceled
|
||||
}
|
||||
|
||||
|
||||
// Test recipient
|
||||
if (empty($sendto)) // For the case, no recipient were set (multi thirdparties send)
|
||||
{
|
||||
@ -251,7 +251,7 @@ if (! $error && $massaction == 'confirm_presend')
|
||||
$sendto = $objectobj->thirdparty->email;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (empty($sendto))
|
||||
{
|
||||
//print "No recipient for thirdparty ".$objectobj->thirdparty->name;
|
||||
@ -264,7 +264,7 @@ if (! $error && $massaction == 'confirm_presend')
|
||||
$thirdpartywithoutemail[$objectobj->thirdparty->id]=1;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if ($_POST['addmaindocfile'])
|
||||
{
|
||||
// TODO Use future field $objectobj->fullpathdoc to know where is stored default file
|
||||
@ -273,7 +273,7 @@ if (! $error && $massaction == 'confirm_presend')
|
||||
$filedir=$uploaddir . '/' . dol_sanitizeFileName($objectobj->ref);
|
||||
$file = $filedir . '/' . $filename;
|
||||
$mime = dol_mimetype($file);
|
||||
|
||||
|
||||
if (dol_is_file($file))
|
||||
{
|
||||
// Create form object
|
||||
@ -292,19 +292,19 @@ if (! $error && $massaction == 'confirm_presend')
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Object of thirdparty qualified, we add it
|
||||
$listofqualifiedobj[$objectid]=$objectobj;
|
||||
$listofqualifiedref[$objectid]=$objectobj->ref;
|
||||
|
||||
|
||||
//var_dump($listofqualifiedref);
|
||||
}
|
||||
|
||||
|
||||
// Send email if there is at least one qualified object for current thirdparty
|
||||
if (count($listofqualifiedobj) > 0)
|
||||
{
|
||||
$langs->load("commercial");
|
||||
|
||||
|
||||
$fromtype = GETPOST('fromtype');
|
||||
if ($fromtype === 'user') {
|
||||
$from = $user->getFullName($langs) .' <'.$user->email.'>';
|
||||
@ -332,11 +332,11 @@ if (! $error && $massaction == 'confirm_presend')
|
||||
else {
|
||||
$from = $_POST['fromname'] . ' <' . $_POST['frommail'] .'>';
|
||||
}
|
||||
|
||||
|
||||
$replyto = $from;
|
||||
$subject = GETPOST('subject','none');
|
||||
$message = GETPOST('message','none');
|
||||
|
||||
|
||||
$sendtobcc = GETPOST('sendtoccc');
|
||||
if ($objectclass == 'Propal') $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO) ? '' : (($sendtobcc?", ":"").$conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO));
|
||||
if ($objectclass == 'Commande') $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_ORDER_TO) ? '' : (($sendtobcc?", ":"").$conf->global->MAIN_MAIL_AUTOCOPY_ORDER_TO));
|
||||
@ -344,7 +344,7 @@ if (! $error && $massaction == 'confirm_presend')
|
||||
if ($objectclass == 'Supplier_Proposal') $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_PROPOSAL_TO) ? '' : (($sendtobcc?", ":"").$conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_PROPOSAL_TO));
|
||||
if ($objectclass == 'CommandeFournisseur') $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_ORDER_TO) ? '' : (($sendtobcc?", ":"").$conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_ORDER_TO));
|
||||
if ($objectclass == 'FactureFournisseur') $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_INVOICE_TO) ? '' : (($sendtobcc?", ":"").$conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_INVOICE_TO));
|
||||
|
||||
|
||||
// $listofqualifiedobj is array with key = object id and value is instance of qualified objects, for the current thirdparty (but thirdparty property is not loaded yet)
|
||||
// $looparray will be an array with number of email to send for the current thirdparty (so 1 or n if n object for same thirdparty)
|
||||
$oneemailperrecipient=(GETPOST('oneemailperrecipient','alpha')=='on'?1:0);
|
||||
@ -365,7 +365,7 @@ if (! $error && $massaction == 'confirm_presend')
|
||||
}
|
||||
//var_dump($looparray);exit;
|
||||
dol_syslog("We have set an array of ".count($looparray)." emails to send");
|
||||
|
||||
|
||||
foreach ($looparray as $objectid => $objecttmp) // $objecttmp is a real object or an empty object if we choose to send one email per thirdparty instead of one per object
|
||||
{
|
||||
// Make substitution in email content
|
||||
@ -374,25 +374,25 @@ if (! $error && $massaction == 'confirm_presend')
|
||||
$substitutionarray['__REF__'] = ($oneemailperrecipient ? join(', ',$listofqualifiedref) : $objecttmp->ref);
|
||||
$substitutionarray['__EMAIL__'] = $thirdparty->email;
|
||||
$substitutionarray['__CHECK_READ__'] = '<img src="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-read.php?tag='.$thirdparty->tag.'&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'" width="1" height="1" style="width:1px;height:1px" border="0"/>';
|
||||
|
||||
|
||||
$parameters=array('mode'=>'formemail');
|
||||
|
||||
|
||||
if ( ! empty( $listofobjectthirdparties ) ) {
|
||||
$parameters['listofobjectthirdparties'] = $listofobjectthirdparties;
|
||||
}
|
||||
if ( ! empty( $listofobjectref ) ) {
|
||||
$parameters['listofobjectref'] = $listofobjectref;
|
||||
}
|
||||
|
||||
|
||||
complete_substitutions_array($substitutionarray, $langs, $objecttmp, $parameters);
|
||||
|
||||
|
||||
$subject=make_substitutions($subject, $substitutionarray);
|
||||
$message=make_substitutions($message, $substitutionarray);
|
||||
|
||||
|
||||
$filepath = $attachedfiles['paths'];
|
||||
$filename = $attachedfiles['names'];
|
||||
$mimetype = $attachedfiles['mimes'];
|
||||
|
||||
|
||||
// Define the trackid when emails sent from the mass action
|
||||
if ($oneemailperrecipient)
|
||||
{
|
||||
@ -410,12 +410,12 @@ if (! $error && $massaction == 'confirm_presend')
|
||||
if (get_class($objecttmp)=='Supplier_Proposal') $trackid='spr';
|
||||
if (get_class($objecttmp)=='CommandeFournisseur') $trackid='sor';
|
||||
if (get_class($objecttmp)=='FactureFournisseur') $trackid='sin';
|
||||
|
||||
|
||||
$trackid.=$objecttmp->id;
|
||||
}
|
||||
//var_dump($filepath);
|
||||
//var_dump($trackid);exit;
|
||||
|
||||
|
||||
// Send mail (substitutionarray must be done just before this)
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
|
||||
$mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,$sendtobcc,$deliveryreceipt,-1,'','',$trackid);
|
||||
@ -429,23 +429,23 @@ if (! $error && $massaction == 'confirm_presend')
|
||||
if ($result)
|
||||
{
|
||||
$resaction.=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($from,2),$mailfile->getValidAddress($sendto,2)).'<br>'; // Must not contain "
|
||||
|
||||
|
||||
$error=0;
|
||||
|
||||
|
||||
// Insert logs into agenda
|
||||
foreach($listofqualifiedobj as $objid2 => $objectobj2)
|
||||
{
|
||||
if ((! $oneemailperrecipient) && $objid2 != $objectid) continue; // We discard this pass to avoid duplicate with other pass in looparray at higher level
|
||||
|
||||
|
||||
dol_syslog("Try to insert email event into agenda for objid=".$objid2." => objectobj=".get_class($objectobj2));
|
||||
|
||||
|
||||
/*if ($objectclass == 'Propale') $actiontypecode='AC_PROP';
|
||||
if ($objectclass == 'Commande') $actiontypecode='AC_COM';
|
||||
if ($objectclass == 'Facture') $actiontypecode='AC_FAC';
|
||||
if ($objectclass == 'Supplier_Proposal') $actiontypecode='AC_SUP_PRO';
|
||||
if ($objectclass == 'CommandeFournisseur') $actiontypecode='AC_SUP_ORD';
|
||||
if ($objectclass == 'FactureFournisseur') $actiontypecode='AC_SUP_INV';*/
|
||||
|
||||
|
||||
$actionmsg=$langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto;
|
||||
if ($message)
|
||||
{
|
||||
@ -455,14 +455,14 @@ if (! $error && $massaction == 'confirm_presend')
|
||||
$actionmsg = dol_concatdesc($actionmsg, $message);
|
||||
}
|
||||
$actionmsg2='';
|
||||
|
||||
|
||||
// Initialisation donnees
|
||||
$objectobj2->sendtoid = 0;
|
||||
$objectobj2->actionmsg = $actionmsg; // Long text
|
||||
$objectobj2->actionmsg2 = $actionmsg2; // Short text
|
||||
$objectobj2->fk_element = $objid2;
|
||||
$objectobj2->elementtype = $objectobj2->element;
|
||||
|
||||
|
||||
$triggername = strtoupper(get_class($objectobj2)) .'_SENTBYMAIL';
|
||||
if ($triggername == 'SOCIETE_SENTBYMAIL') $triggername = 'COMPANY_SENTBYMAIL';
|
||||
if ($triggername == 'CONTRAT_SENTBYMAIL') $triggername = 'CONTRACT_SENTBYMAIL';
|
||||
@ -472,7 +472,7 @@ if (! $error && $massaction == 'confirm_presend')
|
||||
if ($triggername == 'COMMANDEFOURNISSEUR_SENTBYMAIL') $triggername = 'ORDER_SUPPLIER_SENTBYMAIL';
|
||||
if ($triggername == 'FACTUREFOURNISSEUR_SENTBYMAIL') $triggername = 'BILL_SUPPLIER_SENTBYMAIL';
|
||||
if ($triggername == 'SUPPLIERPROPOSAL_SENTBYMAIL') $triggername = 'PROPOSAL_SUPPLIER_SENTBYMAIL';
|
||||
|
||||
|
||||
if (! empty($triggername))
|
||||
{
|
||||
// Appel des triggers
|
||||
@ -481,7 +481,7 @@ if (! $error && $massaction == 'confirm_presend')
|
||||
$result=$interface->run_triggers($triggername, $objectobj2, $user, $langs, $conf);
|
||||
if ($result < 0) { $error++; $errors=$interface->errors; }
|
||||
// Fin appel triggers
|
||||
|
||||
|
||||
if ($error)
|
||||
{
|
||||
setEventMessages($db->lasterror(), $errors, 'errors');
|
||||
@ -489,7 +489,7 @@ if (! $error && $massaction == 'confirm_presend')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$nbsent++; // Nb of email sent (may be lower than number of record selected if we group thirdparties)
|
||||
}
|
||||
else
|
||||
@ -509,13 +509,13 @@ if (! $error && $massaction == 'confirm_presend')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$resaction.=($resaction?'<br>':$resaction);
|
||||
$resaction.='<strong>'.$langs->trans("ResultOfMailSending").':</strong><br>'."\n";
|
||||
$resaction.=$langs->trans("NbSelected").': '.count($toselect)."\n<br>";
|
||||
$resaction.=$langs->trans("NbIgnored").': '.($nbignored?$nbignored:0)."\n<br>";
|
||||
$resaction.=$langs->trans("NbSent").': '.($nbsent?$nbsent:0)."\n<br>";
|
||||
|
||||
|
||||
if ($nbsent)
|
||||
{
|
||||
$action=''; // Do not show form post if there was at least one successfull sent
|
||||
@ -528,59 +528,59 @@ if (! $error && $massaction == 'confirm_presend')
|
||||
//setEventMessages($langs->trans("EMailSentToNRecipients", 0), null, 'warnings'); // May be object has no generated PDF file
|
||||
setEventMessages($resaction, null, 'warnings');
|
||||
}
|
||||
|
||||
|
||||
$action='list';
|
||||
$massaction='';
|
||||
}
|
||||
}
|
||||
|
||||
if ($massaction == 'confirm_createbills')
|
||||
if ($massaction == 'confirm_createbills') // Create bills from orders
|
||||
{
|
||||
$orders = GETPOST('toselect','array');
|
||||
$createbills_onebythird = GETPOST('createbills_onebythird', 'int');
|
||||
$validate_invoices = GETPOST('valdate_invoices', 'int');
|
||||
|
||||
|
||||
$TFact = array();
|
||||
$TFactThird = array();
|
||||
|
||||
|
||||
$nb_bills_created = 0;
|
||||
|
||||
|
||||
$db->begin();
|
||||
|
||||
|
||||
foreach($orders as $id_order)
|
||||
{
|
||||
$cmd = new Commande($db);
|
||||
if ($cmd->fetch($id_order) <= 0) continue;
|
||||
|
||||
|
||||
$objecttmp = new Facture($db);
|
||||
if (!empty($createbills_onebythird) && !empty($TFactThird[$cmd->socid])) $objecttmp = $TFactThird[$cmd->socid]; // If option "one bill per third" is set, we use already created order.
|
||||
else {
|
||||
// Load extrafields of order
|
||||
$cmd->fetch_optionals();
|
||||
|
||||
|
||||
$objecttmp->socid = $cmd->socid;
|
||||
$objecttmp->type = Facture::TYPE_STANDARD;
|
||||
$objecttmp->cond_reglement_id = $cmd->cond_reglement_id;
|
||||
$objecttmp->mode_reglement_id = $cmd->mode_reglement_id;
|
||||
$objecttmp->fk_project = $cmd->fk_project;
|
||||
|
||||
|
||||
$datefacture = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
|
||||
if (empty($datefacture))
|
||||
{
|
||||
$datefacture = dol_mktime(date("h"), date("M"), 0, date("m"), date("d"), date("Y"));
|
||||
}
|
||||
|
||||
|
||||
$objecttmp->date = $datefacture;
|
||||
$objecttmp->origin = 'commande';
|
||||
$objecttmp->origin_id = $id_order;
|
||||
|
||||
|
||||
$objecttmp->array_options = $cmd->array_options; // Copy extrafields
|
||||
|
||||
|
||||
$res = $objecttmp->create($user);
|
||||
|
||||
|
||||
if($res > 0) $nb_bills_created++;
|
||||
}
|
||||
|
||||
|
||||
if ($objecttmp->id > 0)
|
||||
{
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."element_element (";
|
||||
@ -594,12 +594,12 @@ if ($massaction == 'confirm_createbills')
|
||||
$sql.= ", ".$objecttmp->id;
|
||||
$sql.= ", '".$objecttmp->element."'";
|
||||
$sql.= ")";
|
||||
|
||||
|
||||
if (! $db->query($sql))
|
||||
{
|
||||
$error++;
|
||||
}
|
||||
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$lines = $cmd->lines;
|
||||
@ -608,10 +608,10 @@ if ($massaction == 'confirm_createbills')
|
||||
$cmd->fetch_lines();
|
||||
$lines = $cmd->lines;
|
||||
}
|
||||
|
||||
|
||||
$fk_parent_line=0;
|
||||
$num=count($lines);
|
||||
|
||||
|
||||
for ($i=0;$i<$num;$i++)
|
||||
{
|
||||
$desc=($lines[$i]->desc?$lines[$i]->desc:$lines[$i]->libelle);
|
||||
@ -658,13 +658,13 @@ if ($massaction == 'confirm_createbills')
|
||||
{
|
||||
$fk_parent_line = 0;
|
||||
}
|
||||
|
||||
|
||||
// Extrafields
|
||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) {
|
||||
$lines[$i]->fetch_optionals($lines[$i]->rowid);
|
||||
$array_options = $lines[$i]->array_options;
|
||||
}
|
||||
|
||||
|
||||
$result = $objecttmp->addline(
|
||||
$desc,
|
||||
$lines[$i]->subprice,
|
||||
@ -711,21 +711,21 @@ if ($massaction == 'confirm_createbills')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//$cmd->classifyBilled($user); // Disabled. This behavior must be set or not using the workflow module.
|
||||
|
||||
|
||||
if(!empty($createbills_onebythird) && empty($TFactThird[$cmd->socid])) $TFactThird[$cmd->socid] = $objecttmp;
|
||||
else $TFact[$objecttmp->id] = $objecttmp;
|
||||
}
|
||||
|
||||
|
||||
// Build doc with all invoices
|
||||
$TAllFact = empty($createbills_onebythird) ? $TFact : $TFactThird;
|
||||
$toselect = array();
|
||||
|
||||
|
||||
if (! $error && $validate_invoices)
|
||||
{
|
||||
$massaction = $action = 'builddoc';
|
||||
|
||||
|
||||
foreach($TAllFact as &$objecttmp)
|
||||
{
|
||||
$result = $objecttmp->validate($user);
|
||||
@ -735,30 +735,30 @@ if ($massaction == 'confirm_createbills')
|
||||
setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
$id = $objecttmp->id; // For builddoc action
|
||||
$object = $objecttmp;
|
||||
|
||||
|
||||
// Builddoc
|
||||
$donotredirect = 1;
|
||||
$upload_dir = $conf->facture->dir_output;
|
||||
$permissioncreate=$user->rights->facture->creer;
|
||||
|
||||
|
||||
// Call action to build doc
|
||||
$savobject = $object;
|
||||
$object = $objecttmp;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
|
||||
$object = $savobject;
|
||||
}
|
||||
|
||||
|
||||
$massaction = $action = 'confirm_createbills';
|
||||
}
|
||||
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$db->commit();
|
||||
setEventMessages($langs->trans('BillCreated', $nb_bills_created), null, 'mesgs');
|
||||
|
||||
|
||||
// Make a redirect to avoid to bill twice if we make a refresh or back
|
||||
$param='';
|
||||
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage);
|
||||
@ -784,7 +784,7 @@ if ($massaction == 'confirm_createbills')
|
||||
if ($show_files) $param.='&show_files=' .urlencode($show_files);
|
||||
if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss);
|
||||
if ($billed != '') $param.='&billed='.urlencode($billed);
|
||||
|
||||
|
||||
header("Location: ".$_SERVER['PHP_SELF'].'?'.$param);
|
||||
exit;
|
||||
}
|
||||
@ -801,20 +801,19 @@ if ($massaction == 'confirm_createbills')
|
||||
|
||||
if (!$error && $massaction == 'cancelorders')
|
||||
{
|
||||
|
||||
$db->begin();
|
||||
|
||||
|
||||
$nbok = 0;
|
||||
|
||||
|
||||
|
||||
|
||||
$orders = GETPOST('toselect', 'array');
|
||||
foreach ($orders as $id_order)
|
||||
{
|
||||
|
||||
|
||||
$cmd = new Commande($db);
|
||||
if ($cmd->fetch($id_order) <= 0)
|
||||
continue;
|
||||
|
||||
|
||||
if ($cmd->statut != Commande::STATUS_VALIDATED)
|
||||
{
|
||||
$langs->load('errors');
|
||||
@ -824,7 +823,7 @@ if (!$error && $massaction == 'cancelorders')
|
||||
}
|
||||
else
|
||||
$result = $cmd->cancel();
|
||||
|
||||
|
||||
if ($result < 0)
|
||||
{
|
||||
setEventMessages($cmd->error, $cmd->errors, 'errors');
|
||||
@ -856,11 +855,11 @@ if (! $error && $massaction == "builddoc" && $permtoread && ! GETPOST('button_se
|
||||
dol_print_error(null, 'include of actions_massactions.inc.php is done but var $diroutputmassaction was not defined');
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
|
||||
|
||||
$objecttmp=new $objectclass($db);
|
||||
$listofobjectid=array();
|
||||
$listofobjectthirdparties=array();
|
||||
@ -877,12 +876,12 @@ if (! $error && $massaction == "builddoc" && $permtoread && ! GETPOST('button_se
|
||||
$listofobjectref[$toselectid]=$objecttmp->ref;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$arrayofinclusion=array();
|
||||
foreach($listofobjectref as $tmppdf) $arrayofinclusion[]='^'.preg_quote(dol_sanitizeFileName($tmppdf),'/').'\.pdf$';
|
||||
foreach($listofobjectref as $tmppdf) $arrayofinclusion[]='^'.preg_quote(dol_sanitizeFileName($tmppdf),'/').'_[a-zA-Z0-9-_]+\.pdf$'; // To include PDF generated from ODX files
|
||||
$listoffiles = dol_dir_list($uploaddir,'all',1,implode('|',$arrayofinclusion),'\.meta$|\.png','date',SORT_DESC,0,true);
|
||||
|
||||
|
||||
// build list of files with full path
|
||||
$files = array();
|
||||
foreach($listofobjectref as $basename)
|
||||
@ -897,7 +896,7 @@ if (! $error && $massaction == "builddoc" && $permtoread && ! GETPOST('button_se
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Define output language (Here it is not used because we do only merging existing PDF)
|
||||
$outputlangs = $langs;
|
||||
$newlang='';
|
||||
@ -908,16 +907,16 @@ if (! $error && $massaction == "builddoc" && $permtoread && ! GETPOST('button_se
|
||||
$outputlangs = new Translate("",$conf);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
}
|
||||
|
||||
|
||||
if (!empty($conf->global->USE_PDFTK_FOR_PDF_CONCAT))
|
||||
{
|
||||
// Create output dir if not exists
|
||||
dol_mkdir($diroutputmassaction);
|
||||
|
||||
|
||||
// Defined name of merged file
|
||||
$filename=strtolower(dol_sanitizeFileName($langs->transnoentities($objectlabel)));
|
||||
$filename=preg_replace('/\s/','_',$filename);
|
||||
|
||||
|
||||
// Save merged file
|
||||
if (in_array($objecttmp->element, array('facture', 'facture_fournisseur')) && $search_status == Facture::STATUS_VALIDATED)
|
||||
{
|
||||
@ -926,23 +925,23 @@ if (! $error && $massaction == "builddoc" && $permtoread && ! GETPOST('button_se
|
||||
}
|
||||
if ($year) $filename.='_'.$year;
|
||||
if ($month) $filename.='_'.$month;
|
||||
|
||||
|
||||
if (count($files)>0)
|
||||
{
|
||||
$now=dol_now();
|
||||
$file=$diroutputmassaction.'/'.$filename.'_'.dol_print_date($now,'dayhourlog').'.pdf';
|
||||
|
||||
|
||||
$input_files = '';
|
||||
foreach($files as $f) {
|
||||
$input_files.=' '.escapeshellarg($f);
|
||||
}
|
||||
|
||||
|
||||
$cmd = 'pdftk '.escapeshellarg($input_files).' cat output '.escapeshellarg($file);
|
||||
exec($cmd);
|
||||
|
||||
|
||||
if (! empty($conf->global->MAIN_UMASK))
|
||||
@chmod($file, octdec($conf->global->MAIN_UMASK));
|
||||
|
||||
|
||||
$langs->load("exports");
|
||||
setEventMessages($langs->trans('FileSuccessfullyBuilt',$filename.'_'.dol_print_date($now,'dayhourlog')), null, 'mesgs');
|
||||
}
|
||||
@ -957,18 +956,18 @@ if (! $error && $massaction == "builddoc" && $permtoread && ! GETPOST('button_se
|
||||
$page_largeur = $formatarray['width'];
|
||||
$page_hauteur = $formatarray['height'];
|
||||
$format = array($page_largeur,$page_hauteur);
|
||||
|
||||
|
||||
$pdf=pdf_getInstance($format);
|
||||
|
||||
|
||||
if (class_exists('TCPDF'))
|
||||
{
|
||||
$pdf->setPrintHeader(false);
|
||||
$pdf->setPrintFooter(false);
|
||||
}
|
||||
$pdf->SetFont(pdf_getPDFFont($outputlangs));
|
||||
|
||||
|
||||
if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false);
|
||||
|
||||
|
||||
// Add all others
|
||||
foreach($files as $file)
|
||||
{
|
||||
@ -982,14 +981,14 @@ if (! $error && $massaction == "builddoc" && $permtoread && ! GETPOST('button_se
|
||||
$pdf->useTemplate($tplidx);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Create output dir if not exists
|
||||
dol_mkdir($diroutputmassaction);
|
||||
|
||||
|
||||
// Defined name of merged file
|
||||
$filename=strtolower(dol_sanitizeFileName($langs->transnoentities($objectlabel)));
|
||||
$filename=preg_replace('/\s/','_',$filename);
|
||||
|
||||
|
||||
// Save merged file
|
||||
if (in_array($objecttmp->element, array('facture', 'facture_fournisseur')) && $search_status == Facture::STATUS_VALIDATED)
|
||||
{
|
||||
@ -1005,7 +1004,7 @@ if (! $error && $massaction == "builddoc" && $permtoread && ! GETPOST('button_se
|
||||
$pdf->Output($file,'F');
|
||||
if (! empty($conf->global->MAIN_UMASK))
|
||||
@chmod($file, octdec($conf->global->MAIN_UMASK));
|
||||
|
||||
|
||||
$langs->load("exports");
|
||||
setEventMessages($langs->trans('FileSuccessfullyBuilt',$filename.'_'.dol_print_date($now,'dayhourlog')), null, 'mesgs');
|
||||
}
|
||||
@ -1020,7 +1019,7 @@ if (! $error && $massaction == "builddoc" && $permtoread && ! GETPOST('button_se
|
||||
if ($action == 'remove_file')
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
|
||||
|
||||
$langs->load("other");
|
||||
$upload_dir = $diroutputmassaction;
|
||||
$file = $upload_dir . '/' . GETPOST('file');
|
||||
@ -1034,7 +1033,7 @@ if ($action == 'remove_file')
|
||||
if (! $error && $massaction == 'validate' && $permtocreate)
|
||||
{
|
||||
$objecttmp=new $objectclass($db);
|
||||
|
||||
|
||||
if ($objecttmp->element == 'invoice' && ! empty($conf->stock->enabled) && ! empty($conf->global->STOCK_CALCULATE_ON_BILL))
|
||||
{
|
||||
$langs->load("errors");
|
||||
@ -1050,7 +1049,7 @@ if (! $error && $massaction == 'validate' && $permtocreate)
|
||||
if (! $error)
|
||||
{
|
||||
$db->begin();
|
||||
|
||||
|
||||
$nbok = 0;
|
||||
foreach($toselect as $toselectid)
|
||||
{
|
||||
@ -1082,7 +1081,7 @@ if (! $error && $massaction == 'validate' && $permtocreate)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
if ($nbok > 1) setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs');
|
||||
@ -1099,7 +1098,7 @@ if (! $error && $massaction == 'validate' && $permtocreate)
|
||||
// Closed records
|
||||
if (!$error && $massaction == 'closed' && $objectclass == "Propal" && $permtoclose) {
|
||||
$db->begin();
|
||||
|
||||
|
||||
$objecttmp = new $objectclass($db);
|
||||
$nbok = 0;
|
||||
foreach ($toselect as $toselectid) {
|
||||
@ -1119,7 +1118,7 @@ if (!$error && $massaction == 'closed' && $objectclass == "Propal" && $permtoclo
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!$error) {
|
||||
if ($nbok > 1)
|
||||
setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs');
|
||||
@ -1135,7 +1134,7 @@ if (!$error && $massaction == 'closed' && $objectclass == "Propal" && $permtoclo
|
||||
if (! $error && ($massaction == 'delete' || ($action == 'delete' && $confirm == 'yes')) && $permtodelete)
|
||||
{
|
||||
$db->begin();
|
||||
|
||||
|
||||
$objecttmp=new $objectclass($db);
|
||||
$nbok = 0;
|
||||
foreach($toselect as $toselectid)
|
||||
@ -1151,22 +1150,22 @@ if (! $error && ($massaction == 'delete' || ($action == 'delete' && $confirm ==
|
||||
$resaction.='<div class="error">'.$langs->trans('ErrorOnlyDraftStatusCanBeDeletedInMassAction',$objecttmp->ref).'</div><br>';
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if ($objectclass == "Task" && $objecttmp->hasChildren() > 0)
|
||||
{
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."projet_task SET fk_task_parent = 0 WHERE fk_task_parent = ".$objecttmp->id;
|
||||
$res = $db->query($sql);
|
||||
|
||||
|
||||
if (!$res)
|
||||
{
|
||||
setEventMessage('ErrorRecordParentingNotModified', 'errors');
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (in_array($objecttmp->element, array('societe', 'member'))) $result = $objecttmp->delete($objecttmp->id, $user, 1);
|
||||
else $result = $objecttmp->delete($user);
|
||||
|
||||
|
||||
if ($result <= 0)
|
||||
{
|
||||
setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
|
||||
@ -1182,7 +1181,7 @@ if (! $error && ($massaction == 'delete' || ($action == 'delete' && $confirm ==
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
if ($nbok > 1) setEventMessages($langs->trans("RecordsDeleted", $nbok), null, 'mesgs');
|
||||
@ -1201,7 +1200,7 @@ if (! $error && ($massaction == 'delete' || ($action == 'delete' && $confirm ==
|
||||
if (! $error && $massaction == 'generate_doc' && $permtoread)
|
||||
{
|
||||
$db->begin();
|
||||
|
||||
|
||||
$objecttmp=new $objectclass($db);
|
||||
$nbok = 0;
|
||||
foreach($toselect as $toselectid)
|
||||
@ -1211,7 +1210,7 @@ if (! $error && $massaction == 'generate_doc' && $permtoread)
|
||||
{
|
||||
$outputlangs = $langs;
|
||||
$newlang='';
|
||||
|
||||
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang=GETPOST('lang_id','aZ09');
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && isset($objecttmp->thirdparty->default_lang)) $newlang=$objecttmp->thirdparty->default_lang; // for proposal, order, invoice, ...
|
||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && isset($objecttmp->default_lang)) $newlang=$objecttmp->default_lang; // for thirdparty
|
||||
@ -1220,15 +1219,15 @@ if (! $error && $massaction == 'generate_doc' && $permtoread)
|
||||
$outputlangs = new Translate("",$conf);
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
}
|
||||
|
||||
|
||||
// To be sure vars is defined
|
||||
if (empty($hidedetails)) $hidedetails=0;
|
||||
if (empty($hidedesc)) $hidedesc=0;
|
||||
if (empty($hideref)) $hideref=0;
|
||||
if (empty($moreparams)) $moreparams=null;
|
||||
|
||||
|
||||
$result= $objecttmp->generateDocument($objecttmp->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams);
|
||||
|
||||
|
||||
if ($result <= 0)
|
||||
{
|
||||
setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
|
||||
@ -1244,7 +1243,7 @@ if (! $error && $massaction == 'generate_doc' && $permtoread)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
if ($nbok > 1) setEventMessages($langs->trans("RecordsGenerated", $nbok), null, 'mesgs');
|
||||
|
||||
@ -6355,10 +6355,13 @@ abstract class CommonObject
|
||||
// Show only the key field in params
|
||||
if (is_array($params) && array_key_exists('onlykey',$params) && $key != $params['onlykey']) continue;
|
||||
|
||||
// @TODO Add test also on 'enabled' (different than 'list' that is 'visibility')
|
||||
$enabled = 1;
|
||||
if ($enabled && isset($extrafields->attributes[$this->table_element]['list'][$key]))
|
||||
|
||||
$visibility = 1;
|
||||
if ($visibility && isset($extrafields->attributes[$this->table_element]['list'][$key]))
|
||||
{
|
||||
$enabled = dol_eval($extrafields->attributes[$this->table_element]['list'][$key], 1);
|
||||
$visibility = dol_eval($extrafields->attributes[$this->table_element]['list'][$key], 1);
|
||||
}
|
||||
|
||||
$perms = 1;
|
||||
@ -6367,7 +6370,7 @@ abstract class CommonObject
|
||||
$perms = dol_eval($extrafields->attributes[$this->table_element]['perms'][$key], 1);
|
||||
}
|
||||
|
||||
if (($mode == 'create' || $mode == 'edit') && abs($enabled) != 1 && abs($enabled) != 3) continue; // <> -1 and <> 1 and <> 3 = not visible on forms, only on list
|
||||
if (($mode == 'create' || $mode == 'edit') && abs($visibility) != 1 && abs($visibility) != 3) continue; // <> -1 and <> 1 and <> 3 = not visible on forms, only on list
|
||||
if (empty($perms)) continue;
|
||||
|
||||
// Load language if required
|
||||
|
||||
@ -2004,7 +2004,7 @@ class Form
|
||||
}
|
||||
else
|
||||
{
|
||||
print $this->select_produits_list($selected,$htmlname,$filtertype,$limit,$price_level,'',$status,$finished,0,$socid,$showempty,$forcecombo,$morecss,$hidepriceinlabel, $warehouseStatus);
|
||||
print $this->select_produits_list($selected, $htmlname, $filtertype, $limit, $price_level, '', $status, $finished, 0, $socid, $showempty, $forcecombo, $morecss, $hidepriceinlabel, $warehouseStatus);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2225,6 +2225,10 @@ class Form
|
||||
if ($showempty && ! is_numeric($showempty)) $textifempty=$langs->trans($showempty);
|
||||
else $textifempty.=$langs->trans("All");
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($showempty && ! is_numeric($showempty)) $textifempty=$langs->trans($showempty);
|
||||
}
|
||||
if ($showempty) $out.='<option value="0" selected>'.$textifempty.'</option>';
|
||||
|
||||
$i = 0;
|
||||
|
||||
@ -1358,18 +1358,23 @@ function complete_elementList_with_modules(&$elementList)
|
||||
*
|
||||
* @param array $tableau Array of constants array('key'=>array('type'=>type, 'label'=>label)
|
||||
* where type can be 'string', 'text', 'textarea', 'html', 'yesno', 'emailtemplate:xxx', ...
|
||||
* @param int $strictw3c 0=Include form into table (deprecated), 1=Form is outside table to respect W3C (no form into table), 2=No form nor button at all
|
||||
* @param int $strictw3c 0=Include form into table (deprecated), 1=Form is outside table to respect W3C (no form into table), 2=No form nor button at all (form is output by caller, recommanded)
|
||||
* @param string $helptext Help
|
||||
* @return void
|
||||
*/
|
||||
function form_constantes($tableau, $strictw3c = 0, $helptext = '')
|
||||
{
|
||||
global $db,$bc,$langs,$conf,$user;
|
||||
global $db,$langs,$conf,$user;
|
||||
global $_Avery_Labels;
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
if (! empty($strictw3c) && $strictw3c == 1) print "\n".'<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
if (! empty($strictw3c) && $strictw3c == 1)
|
||||
{
|
||||
print "\n".'<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="updateall">';
|
||||
}
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
@ -1382,7 +1387,6 @@ function form_constantes($tableau, $strictw3c = 0, $helptext = '')
|
||||
print "</tr>\n";
|
||||
|
||||
$label='';
|
||||
$listofparam=array();
|
||||
foreach($tableau as $key => $const) // Loop on each param
|
||||
{
|
||||
$label='';
|
||||
@ -1550,6 +1554,7 @@ function form_constantes($tableau, $strictw3c = 0, $helptext = '')
|
||||
print "</td>";
|
||||
}
|
||||
print "</tr>\n";
|
||||
|
||||
if (empty($strictw3c)) print "</form>\n";
|
||||
}
|
||||
}
|
||||
|
||||
@ -58,6 +58,15 @@ function contact_prepare_head(Contact $object)
|
||||
$head[$tab][2] = 'perso';
|
||||
$tab++;
|
||||
|
||||
// Related items
|
||||
if (! empty($conf->commande->enabled) || ! empty($conf->propal->enabled) || ! empty($conf->facture->enabled) || ! empty($conf->ficheinter->enabled) || ! empty($conf->fournisseur->enabled))
|
||||
{
|
||||
$head[$tab][0] = DOL_URL_ROOT.'/contact/consumption.php?id='.$object->id;
|
||||
$head[$tab][1] = $langs->trans("Referers");
|
||||
$head[$tab][2] = 'consumption';
|
||||
$tab++;
|
||||
}
|
||||
|
||||
// Show more tabs from modules
|
||||
// Entries must be declared in modules descriptor with line
|
||||
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
|
||||
|
||||
@ -1175,6 +1175,15 @@ function pdf_writelinedesc(&$pdf, $object, $i, $outputlangs, $w, $h, $posx, $pos
|
||||
if (empty($reshook))
|
||||
{
|
||||
$labelproductservice=pdf_getlinedesc($object,$i,$outputlangs,$hideref,$hidedesc,$issupplierline);
|
||||
|
||||
//var_dump($labelproductservice);exit;
|
||||
|
||||
// Fix bug of some HTML editors that replace links <img src="http://localhostgit/viewimage.php?modulepart=medias&file=image/efd.png" into <img src="http://localhostgit/viewimage.php?modulepart=medias&file=image/efd.png"
|
||||
// We make the reverse, so PDF generation has the real URL.
|
||||
$labelproductservice = preg_replace('/(<img[^>]*src=")([^"]*)(&)([^"]*")/', '\1\2&\4', $labelproductservice, -1, $nbrep);
|
||||
|
||||
//var_dump($labelproductservice);exit;
|
||||
|
||||
// Description
|
||||
$pdf->writeHTMLCell($w, $h, $posx, $posy, $outputlangs->convToOutputCharset($labelproductservice), 0, 1, false, true, 'J',true);
|
||||
$result.=$labelproductservice;
|
||||
|
||||
@ -216,23 +216,43 @@ class modUser extends DolibarrModules
|
||||
|
||||
$r++;
|
||||
$this->export_code[$r]=$this->rights_class.'_'.$r;
|
||||
$this->export_label[$r]='Liste des utilisateurs Dolibarr et attributs';
|
||||
$this->export_label[$r]='List of users and attributes';
|
||||
$this->export_permission[$r]=array(array("user","user","export"));
|
||||
$this->export_fields_array[$r]=array(
|
||||
'u.rowid'=>"Id",'u.login'=>"Login",'u.lastname'=>"Lastname",'u.firstname'=>"Firstname",'u.accountancy_code'=>"UserAccountancyCode",
|
||||
'u.office_phone'=>'Phone','u.office_fax'=>'Fax','u.email'=>'EMail','u.datec'=>"DateCreation",'u.tms'=>"DateLastModification",
|
||||
'u.admin'=>"Administrator",'u.statut'=>'Status','u.note'=>"Note",'u.datelastlogin'=>'LastConnexion','u.datepreviouslogin'=>'PreviousConnexion',
|
||||
'u.rowid'=>"Id",'u.login'=>"Login",'u.lastname'=>"Lastname",'u.firstname'=>"Firstname",'u.employee'=>"Employee",'u.job'=>"PostOrFunction",'u.gender'=>"Gender",
|
||||
'u.accountancy_code'=>"UserAccountancyCode",
|
||||
'u.address'=>"Address",'u.zip'=>"Zip",'u.town'=>"Town",
|
||||
'u.office_phone'=>'Phone','u.user_mobile'=>"Mobile",'u.office_fax'=>'Fax',
|
||||
'u.email'=>"Email",'u.note'=>"Note",'u.signature'=>'Signature',
|
||||
'u.fk_user'=>'Supervisor','u.thm'=>'THM','u.tjm'=>'TJM','u.weeklyhours'=>'WeeklyHours',
|
||||
'u.dateemployment'=>'DateEmployment','u.salary'=>'Salary','u.color'=>'Color','u.api_key'=>'ApiKey',
|
||||
'u.birth'=>'BirthdayDate',
|
||||
'u.datec'=>"DateCreation",'u.tms'=>"DateLastModification",
|
||||
'u.admin'=>"Administrator",'u.statut'=>'Status','u.datelastlogin'=>'LastConnexion','u.datepreviouslogin'=>'PreviousConnexion',
|
||||
'u.fk_socpeople'=>"IdContact",'u.fk_soc'=>"IdCompany",'u.fk_member'=>"MemberId"
|
||||
);
|
||||
$this->export_TypeFields_array[$r]=array(
|
||||
'u.login'=>"Text",'u.lastname'=>"Text",'u.firstname'=>"Text",'u.accountancy_code'=>'Text','u.office_phone'=>'Text','u.office_fax'=>'Text',
|
||||
'u.login'=>"Text",'u.lastname'=>"Text",'u.firstname'=>"Text",'u.employee'=>'Boolean','u.job'=>'Text',
|
||||
'u.accountancy_code'=>'Text',
|
||||
'u.address'=>"Text",'u.zip'=>"Text",'u.town'=>"Text",
|
||||
'u.office_phone'=>'Text','u.user_mobile'=>'Text','u.office_fax'=>'Text',
|
||||
'u.email'=>'Text','u.datec'=>"Date",'u.tms'=>"Date",'u.admin'=>"Boolean",'u.statut'=>'Status','u.note'=>"Text",'u.datelastlogin'=>'Date',
|
||||
'u.datepreviouslogin'=>'Date','u.fk_soc'=>"List:societe:nom:rowid",'u.fk_member'=>"List:adherent:firstname"
|
||||
'u.fk_user'=>"List:user:login",
|
||||
'u.birth'=>'Date',
|
||||
'u.datepreviouslogin'=>'Date','u.fk_soc'=>"List:societe:nom:rowid",'u.fk_member'=>"List:adherent:firstname"
|
||||
);
|
||||
$this->export_entities_array[$r]=array(
|
||||
'u.rowid'=>"user",'u.login'=>"user",'u.lastname'=>"user",'u.firstname'=>"user",'u.accountancy_code'=>'user','u.office_phone'=>'user',
|
||||
'u.office_fax'=>'user','u.email'=>'user','u.datec'=>"user",'u.tms'=>"user",'u.admin'=>"user",'u.statut'=>'user','u.note'=>"user",
|
||||
'u.datelastlogin'=>'user','u.datepreviouslogin'=>'user','u.fk_socpeople'=>"contact",'u.fk_soc'=>"company",'u.fk_member'=>"member"
|
||||
'u.rowid'=>"user",'u.login'=>"user",'u.lastname'=>"user",'u.firstname'=>"user",'u.employee'=>'user','u.job'=>'user','u.gender'=>'user',
|
||||
'u.accountancy_code'=>'user',
|
||||
'u.address'=>"user",'u.zip'=>"user",'u.town'=>"user",
|
||||
'u.office_phone'=>'user','u.user_mobile'=>'user','u.office_fax'=>'user',
|
||||
'u.email'=>'user','u.note'=>"user",'u.signature'=>'user',
|
||||
'u.fk_user'=>'user','u.thm'=>'user','u.tjm'=>'user','u.weeklyhours'=>'user',
|
||||
'u.dateemployment'=>'user','u.salary'=>'user','u.color'=>'user','u.api_key'=>'user',
|
||||
'u.birth'=>'user',
|
||||
'u.datec'=>"user",'u.tms'=>"user",
|
||||
'u.admin'=>"user",'u.statut'=>'user','u.datelastlogin'=>'user','u.datepreviouslogin'=>'user',
|
||||
'u.fk_socpeople'=>"contact",'u.fk_soc'=>"company",'u.fk_member'=>"member"
|
||||
);
|
||||
if (empty($conf->adherent->enabled))
|
||||
{
|
||||
@ -254,11 +274,17 @@ class modUser extends DolibarrModules
|
||||
$this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon
|
||||
$this->import_tables_array[$r]=array('u'=>MAIN_DB_PREFIX.'user','extra'=>MAIN_DB_PREFIX.'user_extrafields'); // List of tables to insert into (insert done in same order)
|
||||
$this->import_fields_array[$r]=array(
|
||||
'u.lastname'=>"Name*",'u.firstname'=>"Firstname",'u.employee'=>"Employee*",'u.job'=>"Job",'u.gender'=>"Gender",'u.login'=>"Login*",
|
||||
'u.login'=>"Login*",'u.lastname'=>"Name*",'u.firstname'=>"Firstname",'u.employee'=>"Employee*",'u.job'=>"PostOrFunction",'u.gender'=>"Gender",
|
||||
'u.accountancy_code'=>"UserAccountancyCode",
|
||||
'u.pass_crypted'=>"Password",'u.admin'=>"Administrator",'u.fk_soc'=>"Company*",'u.address'=>"Address",'u.zip'=>"Zip",'u.town'=>"Town",
|
||||
'u.fk_state'=>"StateId",'u.fk_country'=>"CountryCode",'u.office_phone'=>"Phone",'u.user_mobile'=>"Mobile",'u.office_fax'=>"Fax",
|
||||
'u.email'=>"Email",'u.note'=>"Note",'u.signature'=>'Signature','u.fk_user'=>'Supervisor','u.thm'=>'THM','u.tjm'=>'TJM',
|
||||
'u.dateemployment'=>'DateEmployment','u.salary'=>'Salary','u.color'=>'Color','u.api_key'=>'ApiKey','u.datec'=>"DateCreation"
|
||||
'u.fk_state'=>"StateId",'u.fk_country'=>"CountryCode",
|
||||
'u.office_phone'=>"Phone",'u.user_mobile'=>"Mobile",'u.office_fax'=>"Fax",
|
||||
'u.email'=>"Email",'u.note'=>"Note",'u.signature'=>'Signature',
|
||||
'u.fk_user'=>'Supervisor','u.thm'=>'THM','u.tjm'=>'TJM','u.weeklyhours'=>'WeeklyHours',
|
||||
'u.dateemployment'=>'DateEmployment','u.salary'=>'Salary','u.color'=>'Color','u.api_key'=>'ApiKey',
|
||||
'u.birth'=>'BirthdayDate',
|
||||
'u.datec'=>"DateCreation",
|
||||
'u.statut'=>'Status'
|
||||
);
|
||||
// Add extra fields
|
||||
$sql="SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'user' AND entity IN (0,".$conf->entity.")";
|
||||
@ -282,13 +308,16 @@ class modUser extends DolibarrModules
|
||||
//$this->import_convertvalue_array[$r]=array('s.fk_soc'=>array('rule'=>'lastrowid',table='t');
|
||||
$this->import_regex_array[$r]=array(
|
||||
'u.employee'=>'^[0|1]',
|
||||
'u.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]( [0-9][0-9]:[0-9][0-9]:[0-9][0-9])?$'
|
||||
'u.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]( [0-9][0-9]:[0-9][0-9]:[0-9][0-9])?$',
|
||||
'u.dateemployment'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$',
|
||||
'u.birth'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$'
|
||||
);
|
||||
$this->import_examplevalues_array[$r]=array(
|
||||
'u.lastname'=>"Doe",'u.firstname'=>'John','u.login'=>'jdoe','u.employee'=>'0 or 1','u.status'=>"0 (closed) or 1 (active)",
|
||||
'u.lastname'=>"Doe",'u.firstname'=>'John','u.login'=>'jdoe','u.employee'=>'0 or 1',
|
||||
'u.fk_soc'=>'0 (internal user) or company name (external user)','u.datec'=>dol_print_date(dol_now(),'%Y-%m-%d'),'u.address'=>"61 jump street",
|
||||
'u.zip'=>"123456",'u.town'=>"Big town",'u.fk_country'=>'US, FR, DE...','u.office_phone'=>"0101010101",'u.office_fax'=>"0101010102",
|
||||
'u.email'=>"test@mycompany.com",'u.salary'=>"10000",'u.note'=>"This is an example of note for record",'u.datec'=>"2015-01-01 or 2015-01-01 12:30:00"
|
||||
'u.email'=>"test@mycompany.com",'u.salary'=>"10000",'u.note'=>"This is an example of note for record",'u.datec'=>"2015-01-01 or 2015-01-01 12:30:00",
|
||||
'u.statut'=>"0 (closed) or 1 (active)",
|
||||
);
|
||||
$this->import_updatekeys_array[$r]=array('u.lastname'=>'Lastname','u.firstname'=>'Firstname','u.login'=>'Login');
|
||||
}
|
||||
|
||||
@ -39,7 +39,7 @@ $langs->load("modulebuilder");
|
||||
<!-- BEGIN PHP TEMPLATE admin_extrafields_view.tpl.php -->
|
||||
<?php
|
||||
|
||||
print $langs->trans("DefineHereComplementaryAttributes",$textobject).'<br>'."\n";
|
||||
print '<span class="opacitymedium">'.$langs->trans("DefineHereComplementaryAttributes",$textobject).'</span><br>'."\n";
|
||||
print '<br>';
|
||||
|
||||
// Load attribute_label
|
||||
|
||||
@ -74,7 +74,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
|
||||
$encoding = '';
|
||||
$action=GETPOST('action','alpha');
|
||||
$original_file=GETPOST('file','alpha'); // Do not use urldecode here ($_GET are already decoded by PHP).
|
||||
$original_file=GETPOST('file','alphanohtml'); // Do not use urldecode here ($_GET are already decoded by PHP).
|
||||
$hashp=GETPOST('hashp','aZ09');
|
||||
$modulepart=GETPOST('modulepart','alpha');
|
||||
$urlsource=GETPOST('urlsource','alpha');
|
||||
|
||||
@ -1751,7 +1751,7 @@ elseif ($id || $ref)
|
||||
print '<div class="fichehalfleft">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
print '<table class="border tableforfield" width="100%">';
|
||||
|
||||
// Linked documents
|
||||
if ($typeobject == 'commande' && $object->$typeobject->id && ! empty($conf->commande->enabled))
|
||||
|
||||
@ -73,6 +73,11 @@ class ProductFournisseur extends Product
|
||||
public $fourn_remise; // discount for quantity (amount)
|
||||
public $product_fourn_id; // product-supplier id
|
||||
|
||||
/**
|
||||
* @var int ID user_id - user who created/updated supplier price
|
||||
*/
|
||||
public $user_id;
|
||||
|
||||
/**
|
||||
* @var int ID availability delay - visible/used if option FOURN_PRODUCT_AVAILABILITY is on (duplicate information compared to delivery delay)
|
||||
*/
|
||||
@ -294,7 +299,32 @@ class ProductFournisseur extends Product
|
||||
|
||||
if ($this->product_fourn_price_id > 0)
|
||||
{
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."product_fournisseur_price";
|
||||
// check if price already logged, if not first log current price
|
||||
$logPrices = $this->listProductFournisseurPriceLog($this->product_fourn_price_id);
|
||||
if (is_array($logPrices) && count($logPrices) == 0)
|
||||
{
|
||||
$currentPfp = new self($this->db);
|
||||
$result = $currentPfp->fetch_product_fournisseur_price($this->product_fourn_price_id);
|
||||
if ($result > 0 && $currentPfp->fourn_price != 0)
|
||||
{
|
||||
$currentPfpUser = new User($this->db);
|
||||
$result = $currentPfpUser->fetch($currentPfp->user_id);
|
||||
if ($result > 0) {
|
||||
$currentPfp->logPrice(
|
||||
$currentPfpUser,
|
||||
$currentPfp->date_creation,
|
||||
$currentPfp->fourn_price,
|
||||
$currentPfp->fourn_qty,
|
||||
$currentPfp->fourn_multicurrency_price,
|
||||
$currentPfp->fourn_multicurrency_unitprice,
|
||||
$currentPfp->fourn_multicurrency_tx,
|
||||
$currentPfp->fourn_multicurrency_id,
|
||||
$currentPfp->fourn_multicurrency_code
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."product_fournisseur_price";
|
||||
$sql.= " SET fk_user = " . $user->id." ,";
|
||||
$sql.= " ref_fourn = '" . $this->db->escape($ref_fourn) . "',";
|
||||
$sql.= " desc_fourn = '" . $this->db->escape($desc_fourn) . "',";
|
||||
@ -332,8 +362,9 @@ class ProductFournisseur extends Product
|
||||
$result=$this->call_trigger('SUPPLIER_PRODUCT_BUYPRICE_UPDATE', $user);
|
||||
if ($result < 0) $error++;
|
||||
// End call triggers
|
||||
if (! $error && empty($conf->global->PRODUCT_PRICE_SUPPLIER_NO_LOG)) {
|
||||
$result = $this->logPrice($user, $now, $buyprice, $qty, $multicurrency_buyprice, $multicurrency_unitBuyPrice, $multicurrency_tx, $fk_multicurrency, $multicurrency_code);
|
||||
if (! $error && empty($conf->global->PRODUCT_PRICE_SUPPLIER_NO_LOG))
|
||||
{
|
||||
$result = $this->logPrice($user, $now, $buyprice, $qty, $multicurrency_buyprice, $multicurrency_unitBuyPrice, $multicurrency_tx, $fk_multicurrenc, $multicurrency_code);
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
}
|
||||
@ -457,7 +488,7 @@ class ProductFournisseur extends Product
|
||||
|
||||
$sql = "SELECT pfp.rowid, pfp.price, pfp.quantity, pfp.unitprice, pfp.remise_percent, pfp.remise, pfp.tva_tx, pfp.default_vat_code, pfp.info_bits as fourn_tva_npr, pfp.fk_availability,";
|
||||
$sql.= " pfp.fk_soc, pfp.ref_fourn, pfp.desc_fourn, pfp.fk_product, pfp.charges, pfp.fk_supplier_price_expression, pfp.delivery_time_days,";
|
||||
$sql.= " pfp.supplier_reputation";
|
||||
$sql.= " pfp.supplier_reputation, pfp.fk_user, pfp.datec";
|
||||
$sql.= " ,pfp.multicurrency_price, pfp.multicurrency_unitprice, pfp.multicurrency_tx, pfp.fk_multicurrency, pfp.multicurrency_code";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp";
|
||||
$sql.= " WHERE pfp.rowid = ".$rowid;
|
||||
@ -491,7 +522,8 @@ class ProductFournisseur extends Product
|
||||
$this->fk_supplier_price_expression = $obj->fk_supplier_price_expression;
|
||||
$this->supplier_reputation = $obj->supplier_reputation;
|
||||
$this->default_vat_code = $obj->default_vat_code;
|
||||
|
||||
$this->user_id = $obj->fk_user;
|
||||
$this->date_creation = $this->db->jdate($obj->datec);
|
||||
$this->fourn_multicurrency_price = $obj->multicurrency_price;
|
||||
$this->fourn_multicurrency_unitprice = $obj->multicurrency_unitprice;
|
||||
$this->fourn_multicurrency_tx = $obj->multicurrency_tx;
|
||||
@ -882,14 +914,14 @@ class ProductFournisseur extends Product
|
||||
/**
|
||||
* List supplier prices log of a supplier price
|
||||
*
|
||||
* @param int $fourn_id Id of supplier price
|
||||
* @param string $sortfield Sort field
|
||||
* @param string $sortorder Sort order
|
||||
* @param int $limit Limit
|
||||
* @param int $offset Offset
|
||||
* @return array Array of Log prices
|
||||
* @param int $product_fourn_price_id Id of supplier price
|
||||
* @param string $sortfield Sort field
|
||||
* @param string $sortorder Sort order
|
||||
* @param int $limit Limit
|
||||
* @param int $offset Offset
|
||||
* @return array Array of Log prices
|
||||
*/
|
||||
function listProductFournisseurPriceLog($fourn_id, $sortfield = '', $sortorder = '', $limit = 0, $offset = 0)
|
||||
function listProductFournisseurPriceLog($product_fourn_price_id, $sortfield = '', $sortorder = '', $limit = 0, $offset = 0)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
@ -902,7 +934,7 @@ class ProductFournisseur extends Product
|
||||
$sql.= " WHERE pfp.entity IN (".getEntity('productprice').")";
|
||||
$sql.= " AND pfpl.fk_user = u.rowid";
|
||||
$sql.= " AND pfp.rowid = pfpl.fk_product_fournisseur";
|
||||
$sql.= " AND pfpl.fk_product_fournisseur = ".$fourn_id;
|
||||
$sql.= " AND pfpl.fk_product_fournisseur = ".$product_fourn_price_id;
|
||||
if (empty($sortfield)) $sql.= " ORDER BY pfpl.datec";
|
||||
else $sql.= $this->db->order($sortfield, $sortorder);
|
||||
$sql.=$this->db->plimit($limit, $offset);
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 376 KiB |
@ -1853,4 +1853,5 @@ ConfirmUnactivation=Confirm module reset
|
||||
OnMobileOnly=On small screen (smartphone) only
|
||||
DisableProspectCustomerType=Disable the "Prospect + Customer" third party type (so third party must be Prospect or Customer but can't be both)
|
||||
MAIN_OPTIMIZEFORTEXTBROWSER=Simplify interface for blind person
|
||||
MAIN_OPTIMIZEFORTEXTBROWSERDesc=Enable this option if you are a blind person, or if you use the application from a text browser like Lynx or Links.
|
||||
MAIN_OPTIMIZEFORTEXTBROWSERDesc=Enable this option if you are a blind person, or if you use the application from a text browser like Lynx or Links.
|
||||
ThisValueCanOverwrittenOnUserLevel=This value can be overwritten by each user from its user page - tab '%s'
|
||||
@ -126,8 +126,8 @@ ThisIsContentOfYourMembershipWasValidated=We want to let you know that your memb
|
||||
ThisIsContentOfYourSubscriptionWasRecorded=We want to let you know that your new subscription was recorded.<br><br>
|
||||
ThisIsContentOfSubscriptionReminderEmail=We want to let you know that your subscription is about to expire or has already expired (__MEMBER_LAST_SUBSCRIPTION_DATE_END__). We hope you will renew it.<br><br>
|
||||
ThisIsContentOfYourCard=This is a summary of the information we have about you. Please contact us if anything is incorrect.<br><br>
|
||||
DescADHERENT_AUTOREGISTER_NOTIF_MAIL_SUBJECT=Subject of the email received in case of auto-inscription of a guest
|
||||
DescADHERENT_AUTOREGISTER_NOTIF_MAIL=Email received in case of auto-inscription of a guest
|
||||
DescADHERENT_AUTOREGISTER_NOTIF_MAIL_SUBJECT=Subject of the notification email received in case of auto-inscription of a guest
|
||||
DescADHERENT_AUTOREGISTER_NOTIF_MAIL=Content of the notification email received in case of auto-inscription of a guest
|
||||
DescADHERENT_EMAIL_TEMPLATE_AUTOREGISTER=Email template to use to send email to a member on member autosubscription
|
||||
DescADHERENT_EMAIL_TEMPLATE_MEMBER_VALIDATION=Email template to use to send email to a member on member validation
|
||||
DescADHERENT_EMAIL_TEMPLATE_SUBSCRIPTION=Email template to use to send email to a member on new subscription recording
|
||||
|
||||
@ -76,7 +76,7 @@ ListOfMenusEntries=List of menu entries
|
||||
ListOfPermissionsDefined=List of defined permissions
|
||||
SeeExamples=See examples here
|
||||
EnabledDesc=Condition to have this field active (Examples: 1 or $conf->global->MYMODULE_MYOPTION)
|
||||
VisibleDesc=Is the field visible ? (Examples: 0=Never visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only. Using a negative value means field is not shown by default on list but can be selected for viewing)
|
||||
VisibleDesc=Is the field visible ? (Examples: 0=Never visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only. Using a negative value means field is not shown by default on list but can be selected for viewing). It can be an expression, for example: preg_match('/public/', $_SERVER['PHP_SELF'])?0:1
|
||||
IsAMeasureDesc=Can the value of field be cumulated to get a total into list? (Examples: 1 or 0)
|
||||
SearchAllDesc=Is the field used to make a search from the quick search tool? (Examples: 1 or 0)
|
||||
SpecDefDesc=Enter here all documentation you want to provide with your module that is not already defined by other tabs. You can use .md or better, the rich .asciidoc syntax.
|
||||
|
||||
@ -124,7 +124,7 @@ CardContent=Contenu de votre fiche adhérent
|
||||
ThisIsContentOfYourMembershipRequestWasReceived=Nous vous informons que votre demande d'adhésion a bien été reçue.<br><br>
|
||||
ThisIsContentOfYourMembershipWasValidated=Nous vous informons que votre adhésion a été validé avec les informations suivantes:<br><br>
|
||||
ThisIsContentOfYourSubscriptionWasRecorded=Nous vous informons que votre nouvelle cotisation a été enregistrée.<br><br>
|
||||
ThisIsContentOfSubscriptionReminderEmail=Nous voulons vous informer que votre abonnement est sur le point d'expirer ou a déjà expiré (__MEMBER_LAST_SUBSCRIPTION_DATE_END__). Nous espérons que vous pourrez le renouveler, votre soutien nous ait précieux.<br> <br>
|
||||
ThisIsContentOfSubscriptionReminderEmail=Nous voulons vous informer que votre cotisation est sur le point d'expirer ou a déjà expiré (__MEMBER_LAST_SUBSCRIPTION_DATE_END__). Nous espérons que vous pourrez le renouveler, votre soutien nous ait précieux.<br> <br>
|
||||
ThisIsContentOfYourCard=Ceci est un rappel des informations que nous avons vous concernant. N'hésitez pas à nous contacter en cas d'erreur.<br><br>
|
||||
DescADHERENT_AUTOREGISTER_NOTIF_MAIL_SUBJECT=Sujet de l'email reçu en cas d'auto-inscription d'un invité
|
||||
DescADHERENT_AUTOREGISTER_NOTIF_MAIL=Email reçu en cas d'auto-inscription d'un invité
|
||||
|
||||
@ -82,7 +82,7 @@ AttachANewFile=Ajouter un nouveau fichier/document
|
||||
LinkedObject=Objet lié
|
||||
NbOfActiveNotifications=Nombre de notifications (nb de destinataires emails)
|
||||
PredefinedMailTest=__(Hello)__,\nCeci est un mail de test envoyé à __EMAIL__.\nLes deux lignes sont séparées par un saut de ligne.\n\n__USER_SIGNATURE__
|
||||
PredefinedMailTestHtml=__(Hello)__\nCeci est un message de <b>test</b> (le mot test doit être en gras).<br>Les 2 lignes sont séparées par un retour à la ligne.<br><br>__SIGNATURE__
|
||||
PredefinedMailTestHtml=__(Hello)__<br>Ceci est un message de <b>test</b> (le mot test doit être en gras).<br>Les 2 lignes sont séparées par un retour à la ligne.<br><br>__SIGNATURE__
|
||||
PredefinedMailContentContract=__(Hello)__\n\n\n__(Sincerely)__\n\n__USER_SIGNATURE__
|
||||
PredefinedMailContentSendInvoice=__(Bonjour)__\n\nVeuillez trouver la facture ci-jointe __REF__\n\n__ONLINE_PAYMENT_TEXT_AND_URL__\n\n__(Cordialement)__\n\n__USER_SIGNATURE__
|
||||
PredefinedMailContentSendInvoiceReminder=__(Bonjour)__\n\nNous tenons à vous avertir que la facture __REF__ ne semble pas avoir été payée. La facture est jointe, à titre de rappel.\n\n__ONLINE_PAYMENT_TEXT_AND_URL__\n\n__(Cordialement)__\n\n__USER_SIGNATURE__
|
||||
|
||||
@ -346,7 +346,7 @@ else
|
||||
print '<input type="hidden" name="id" value="'.$object->id.'">';
|
||||
print '<input type="hidden" name="ref" value="'.$object->ref.'">';
|
||||
|
||||
dol_fiche_head($head, 'delivery', $langs->trans("Shipment"), 0, 'sending');
|
||||
dol_fiche_head($head, 'delivery', $langs->trans("Shipment"), -1, 'sending');
|
||||
|
||||
/*
|
||||
* Confirmation de la suppression
|
||||
@ -434,7 +434,7 @@ else
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
print '<table class="border tableforfield" width="100%">';
|
||||
|
||||
// Shipment
|
||||
/*
|
||||
|
||||
@ -98,6 +98,7 @@ $extralabels_task=$extrafields_task->fetch_name_optionals_label($object->table_e
|
||||
*/
|
||||
|
||||
if (GETPOST('cancel','alpha')) { $action=''; }
|
||||
if (! GETPOST('confirmmassaction','alpha') && $massaction != 'presend' && $massaction != 'confirm_presend' && $massaction != 'confirm_generateinvoice') { $massaction=''; }
|
||||
|
||||
$parameters=array('socid'=>$socid, 'projectid'=>$projectid);
|
||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||
@ -300,7 +301,7 @@ elseif (GETPOST('project_ref','alpha'))
|
||||
$withproject=1;
|
||||
}
|
||||
|
||||
if ($massaction == 'generateinvoice')
|
||||
if ($massaction == 'confirm_generateinvoice')
|
||||
{
|
||||
if (! empty($projectstatic->socid)) $projectstatic->fetch_thirdparty();
|
||||
|
||||
@ -754,7 +755,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
|
||||
$arrayfields['t.note']=array('label'=>$langs->trans("Note"), 'checked'=>1);
|
||||
$arrayfields['t.task_duration']=array('label'=>$langs->trans("Duration"), 'checked'=>1);
|
||||
$arrayfields['value'] =array('label'=>$langs->trans("Value"), 'checked'=>1, 'enabled'=>(empty($conf->salaries->enabled)?0:1));
|
||||
$arrayfields['valuebilled'] =array('label'=>$langs->trans("Billed"), 'checked'=>1, 'enabled'=>((! empty($conf->global->PROJECT_HIDE_TASKS) || empty($conf->global->PROJECT_BILL_TIME_SPENT))?0:1));
|
||||
$arrayfields['valuebilled'] =array('label'=>$langs->trans("Billed"), 'checked'=>1, 'enabled'=>(((! empty($conf->global->PROJECT_HIDE_TASKS) || empty($conf->global->PROJECT_BILL_TIME_SPENT))?0:1) && $projectstatic->bill_time));
|
||||
// Extra fields
|
||||
if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label))
|
||||
{
|
||||
@ -771,7 +772,7 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
|
||||
//'builddoc'=>$langs->trans("PDFMerge"),
|
||||
);
|
||||
//if ($user->rights->projet->creer) $arrayofmassactions['predelete']=$langs->trans("Delete");
|
||||
if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array();
|
||||
if (in_array($massaction, array('presend','predelete','generateinvoice'))) $arrayofmassactions=array();
|
||||
$massactionbutton=$form->selectMassAction('', $arrayofmassactions);
|
||||
}
|
||||
|
||||
@ -810,6 +811,51 @@ if (($id > 0 || ! empty($ref)) || $projectidforalltimes > 0)
|
||||
print '<input type="hidden" name="projectid" value="'.$projectidforalltimes.'">';
|
||||
print '<input type="hidden" name="withproject" value="'.$withproject.'">';
|
||||
|
||||
if ($massaction == 'generateinvoice')
|
||||
{
|
||||
$langs->load("bills");
|
||||
|
||||
//var_dump($_REQUEST);
|
||||
print '<input type="hidden" name="massaction" value="confirm_createbills">';
|
||||
|
||||
print '<table class="noborder" width="100%" >';
|
||||
print '<tr>';
|
||||
print '<td class="titlefield">';
|
||||
print $langs->trans('DateInvoice');
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
print $form->selectDate('', '', '', '', '', '', 1, 1);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
if ($conf->service->enabled)
|
||||
{
|
||||
print '<tr>';
|
||||
print '<td>';
|
||||
print $langs->trans('Service');
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
print $form->select_produits('', 'productid', '1', 0, 0, 1, 2, '', 0, array(), 0, 'None', 0, 'maxwidth500');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
/*print '<tr>';
|
||||
print '<td>';
|
||||
print $langs->trans('ValidateInvoices');
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
print $form->selectyesno('valdate_invoices', 0, 1);
|
||||
print '</td>';
|
||||
print '</tr>';*/
|
||||
print '</table>';
|
||||
|
||||
print '<br>';
|
||||
print '<div class="center">';
|
||||
print '<input type="submit" class="button" id="createbills" name="createbills" value="'.$langs->trans('CreateInvoice').'"> ';
|
||||
print '<input type="submit" class="button" id="cancel" name="cancel" value="'.$langs->trans('Cancel').'">';
|
||||
print '</div>';
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
/*
|
||||
* List of time spent
|
||||
*/
|
||||
|
||||
@ -63,8 +63,25 @@ top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss);
|
||||
<?php
|
||||
$categorie = new Categorie($db);
|
||||
$categories = $categorie->get_full_arbo('product');
|
||||
|
||||
$maincategories = array_filter($categories, function ($item) {
|
||||
if (($item['level']==1) !== false) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
$subcategories = array_filter($categories, function ($item) {
|
||||
if (($item['level']!=1) !== false) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
?>
|
||||
|
||||
var categories = <?php echo json_encode($categories); ?>;
|
||||
var subcategories = <?php echo json_encode($subcategories); ?>;
|
||||
|
||||
var currentcat;
|
||||
var pageproducts=0;
|
||||
var pagecategories=0;
|
||||
@ -109,15 +126,27 @@ function MoreCategories(moreorless){
|
||||
}
|
||||
}
|
||||
|
||||
function LoadProducts(position){
|
||||
function LoadProducts(position, issubcat=false){
|
||||
$('#catimg'+position).animate({opacity: '0.5'}, 1);
|
||||
$('#catimg'+position).animate({opacity: '1'}, 100);
|
||||
currentcat=$('#catdiv'+position).data('rowid');
|
||||
if (issubcat==true) currentcat=$('#prodiv'+position).data('rowid');
|
||||
else currentcat=$('#catdiv'+position).data('rowid');
|
||||
if (currentcat=="") return;
|
||||
pageproducts=0;
|
||||
ishow=0; //product to show counter
|
||||
|
||||
jQuery.each(subcategories, function(i, val) {
|
||||
if (currentcat==val.fk_parent){
|
||||
$("#prodesc"+ishow).text(val.label);
|
||||
$("#proimg"+ishow).attr("src","genimg/?query=cat&w=55&h=50&id="+val.rowid);
|
||||
$("#prodiv"+ishow).data("rowid",val.rowid);
|
||||
$("#prodiv"+ishow).data("iscat",1);
|
||||
ishow++;
|
||||
}
|
||||
});
|
||||
|
||||
idata=0; //product data counter
|
||||
$.getJSON('./ajax.php?action=getProducts&category='+currentcat, function(data) {
|
||||
idata=0; //product data counter
|
||||
ishow=0; //product to show counter
|
||||
while (idata < 30) {
|
||||
if (typeof (data[idata]) == "undefined") {
|
||||
$("#prodesc"+ishow).text("");
|
||||
@ -130,6 +159,7 @@ function LoadProducts(position){
|
||||
$("#prodesc"+ishow).text(data[parseInt(idata)]['label']);
|
||||
$("#proimg"+ishow).attr("src","genimg/?query=pro&w=55&h=50&id="+data[idata]['id']);
|
||||
$("#prodiv"+ishow).data("rowid",data[idata]['id']);
|
||||
$("#prodiv"+ishow).data("iscat",0);
|
||||
ishow++; //Next product to show after print data product
|
||||
}
|
||||
idata++; //Next data everytime
|
||||
@ -168,6 +198,7 @@ function MoreProducts(moreorless){
|
||||
$("#prodesc"+ishow).text(data[parseInt(idata)]['label']);
|
||||
$("#proimg"+ishow).attr("src","genimg/?query=pro&w=55&h=50&id="+data[idata]['id']);
|
||||
$("#prodiv"+ishow).data("rowid",data[idata]['id']);
|
||||
$("#prodiv"+ishow).data("iscat",0);
|
||||
ishow++; //Next product to show after print data product
|
||||
}
|
||||
idata++; //Next data everytime
|
||||
@ -178,12 +209,16 @@ function MoreProducts(moreorless){
|
||||
function ClickProduct(position){
|
||||
$('#proimg'+position).animate({opacity: '0.5'}, 1);
|
||||
$('#proimg'+position).animate({opacity: '1'}, 100);
|
||||
idproduct=$('#prodiv'+position).data('rowid');
|
||||
if (idproduct=="") return;
|
||||
$("#poslines").load("invoice.php?action=addline&place="+place+"&idproduct="+idproduct, function() {
|
||||
$('#poslines').scrollTop($('#poslines')[0].scrollHeight);
|
||||
});
|
||||
|
||||
if ($('#prodiv'+position).data('iscat')==1){
|
||||
LoadProducts(position, true);
|
||||
}
|
||||
else{
|
||||
idproduct=$('#prodiv'+position).data('rowid');
|
||||
if (idproduct=="") return;
|
||||
$("#poslines").load("invoice.php?action=addline&place="+place+"&idproduct="+idproduct, function() {
|
||||
$('#poslines').scrollTop($('#poslines')[0].scrollHeight);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function deleteline(){
|
||||
@ -233,6 +268,7 @@ function Search2(){
|
||||
$("#prodesc"+i).text(data[parseInt(i)]['label']);
|
||||
$("#proimg"+i).attr("src","genimg/?query=pro&w=55&h=50&id="+data[i]['rowid']);
|
||||
$("#prodiv"+i).data("rowid",data[i]['rowid']);
|
||||
$("#prodiv"+ishow).data("iscat",0);
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -446,7 +482,7 @@ foreach($menus as $menu) {
|
||||
while ($count<16)
|
||||
{
|
||||
?>
|
||||
<div class='wrapper' <?php if ($count==14) echo 'onclick="MoreCategories(\'less\');"'; else if ($count==15) echo 'onclick="MoreCategories(\'more\');"'; else echo 'onclick="LoadProducts('.$count.');"';?> id='catdiv<?php echo $count;?>'>
|
||||
<div class='wrapper' <?php if ($count==14) echo 'onclick="MoreCategories(\'less\');"'; elseif ($count==15) echo 'onclick="MoreCategories(\'more\');"'; else echo 'onclick="LoadProducts('.$count.');"';?> id='catdiv<?php echo $count;?>'>
|
||||
<img class='imgwrapper' <?php if ($count==14) echo 'src="img/arrow-prev-top.png"'; if ($count==15) echo 'src="img/arrow-next-top.png"';?> width="98%" id='catimg<?php echo $count;?>'/>
|
||||
<div class='description'>
|
||||
<div class='description_content' id='catdesc<?php echo $count;?>'></div>
|
||||
|
||||
@ -9,6 +9,8 @@ CKEDITOR.editorConfig = function( config )
|
||||
// http://docs.cksource.com/CKEditor_3.x/Developers_Guide
|
||||
// http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html
|
||||
config.enterMode = CKEDITOR.ENTER_BR;
|
||||
//config.forceSimpleAmpersand = true; // When you put a <img src="x?a=a&b=b"> into the textarea, and go into "source", then ckeditor change the & into &. We don't want this. But this option does not fix this.
|
||||
//config.entities = false; // When you put a <img src="x?a=a&b=b"> into the textarea, and go into "source", then ckeditor change the & into &. We don't want this. But this option does not fix this.
|
||||
config.resize_enabled = false;
|
||||
//config.resize_maxHeight = 3000;
|
||||
//config.resize_maxWidth = 3000;
|
||||
|
||||
@ -84,7 +84,7 @@ require 'main.inc.php'; // Load $user and permissions
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
|
||||
$action=GETPOST('action','alpha');
|
||||
$original_file=GETPOST('file','alpha'); // Do not use urldecode here ($_GET are already decoded by PHP).
|
||||
$original_file=GETPOST('file','alphanohtml'); // Do not use urldecode here ($_GET are already decoded by PHP).
|
||||
$hashp=GETPOST('hashp','aZ09');
|
||||
$modulepart=GETPOST('modulepart','alpha');
|
||||
$urlsource=GETPOST('urlsource','alpha');
|
||||
|
||||
Loading…
Reference in New Issue
Block a user