Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Florian HENRY 2015-06-02 13:02:06 +02:00
commit 061e675b51
399 changed files with 7059 additions and 6240 deletions

View File

@ -128,7 +128,7 @@ script:
- php upgrade.php 3.6.0 3.7.0 ignoredbversion > upgrade360370.log - php upgrade.php 3.6.0 3.7.0 ignoredbversion > upgrade360370.log
- php upgrade2.php 3.6.0 3.7.0 ignoredbversion > upgrade360370-2.log - php upgrade2.php 3.6.0 3.7.0 ignoredbversion > upgrade360370-2.log
- php upgrade.php 3.7.0 3.8.0 ignoredbversion > upgrade370380.log - php upgrade.php 3.7.0 3.8.0 ignoredbversion > upgrade370380.log
- cat upgrade370380.log # - cat upgrade370380.log
- php upgrade2.php 3.7.0 3.8.0 ignoredbversion > upgrade370380-2.log - php upgrade2.php 3.7.0 3.8.0 ignoredbversion > upgrade370380-2.log
# - cat upgrade370380-2.log # - cat upgrade370380-2.log
- cd ../.. - cd ../..

View File

@ -8,7 +8,7 @@ This files describe steps made by Dolibarr packaging team to make a
beta version of Dolibarr, step by step. beta version of Dolibarr, step by step.
- Check all files are commited. - Check all files are commited.
- Update version/info in ChangeLog. To generate a changelog, you can do "git log `git merge-base x.y origin/develop`..x.y --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -i -e '^FIX\|NEW'" - Update version/info in ChangeLog. To generate a changelog, you can do "git log `git merge-base (x.y)-1 origin/develop`..x.y(.z) --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -i -e '^FIX\|NEW'"
- Update version number with x.y.z-w in htdocs/filefunc.inc.php - Update version number with x.y.z-w in htdocs/filefunc.inc.php
- Update version number with x.y.z-w in build/debian/changelog - Update version number with x.y.z-w in build/debian/changelog
- Commit all changes. - Commit all changes.
@ -29,7 +29,7 @@ This files describe steps made by Dolibarr packaging team to make a
complete release of Dolibarr, step by step. complete release of Dolibarr, step by step.
- Check all files are commited. - Check all files are commited.
- Update version/info in ChangeLog. To generate a changelog, you can do "git log `git merge-base x.y origin/develop`..x.y --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -i -e '^FIX\|NEW'" - Update version/info in ChangeLog. To generate a changelog, you can do "git log `git merge-base (x.y)-1 origin/develop`..x.y(.z) --no-merges --pretty=short --oneline | sed -e "s/^[0-9a-z]* //" | grep -i -e '^FIX\|NEW'"
- Update version number with x.y.z in htdocs/filefunc.inc.php - Update version number with x.y.z in htdocs/filefunc.inc.php
- Update version number with x.y.z in build/debian/changelog - Update version number with x.y.z in build/debian/changelog
- Commit all changes. - Commit all changes.

View File

@ -3,7 +3,7 @@
This is a quick tutorial: This is a quick tutorial:
* Install ansible: * Install ansible:
> apt-get install > apt-get install ansible
* Add ip of server to manage into * Add ip of server to manage into
/etc/ansible/hosts /etc/ansible/hosts

View File

@ -49,7 +49,7 @@ then
if [ -d $reflang ] if [ -d $reflang ]
then then
echo "***** Process language "$aa"_"$bb" - Search original into "$reflang echo "***** Process language "$aa"_"$bb" - Search original into "$reflang
echo $dirshort est une langue alternative de $reflang echo $dirshort is an alternative language of $reflang
echo ./dev/translation/strip_language_file.php $aa"_"$aaupper $aa"_"$bb $2 echo ./dev/translation/strip_language_file.php $aa"_"$aaupper $aa"_"$bb $2
./dev/translation/strip_language_file.php $aa"_"$aaupper $aa"_"$bb $2 ./dev/translation/strip_language_file.php $aa"_"$aaupper $aa"_"$bb $2
for fic in `ls htdocs/langs/${aa}_${bb}/*.delta`; do f=`echo $fic | sed -e 's/\.delta//'`; echo $f; mv $f.delta $f; done for fic in `ls htdocs/langs/${aa}_${bb}/*.delta`; do f=`echo $fic | sed -e 's/\.delta//'`; echo $f; mv $f.delta $f; done

View File

@ -314,7 +314,7 @@ foreach($filesToProcess as $fileToProcess)
continue; continue;
} }
// String exists in both files and does not match // String exists in both files and value into alternative language differs from main language but also from english files
if ( if (
(! empty($aSecondary[$key]) && $aSecondary[$key] != $aPrimary[$key] (! empty($aSecondary[$key]) && $aSecondary[$key] != $aPrimary[$key]
&& ! empty($aEnglish[$key]) && $aSecondary[$key] != $aEnglish[$key]) && ! empty($aEnglish[$key]) && $aSecondary[$key] != $aEnglish[$key])

View File

@ -1,6 +1,6 @@
<?PHP <?PHP
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com> /* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com> * Copyright (C) 2013-2015 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -128,7 +128,6 @@ else if ($action == 'delete')
/* /*
* View * View
*
*/ */
llxheader('', $langs->trans('AccountAccounting')); llxheader('', $langs->trans('AccountAccounting'));
@ -142,7 +141,9 @@ if ($action == 'create')
print '<form name="add" action="' . $_SERVER["PHP_SELF"] . '" method="POST">' . "\n"; print '<form name="add" action="' . $_SERVER["PHP_SELF"] . '" method="POST">' . "\n";
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
print '<input type="hidden" name="action" value="add">'; print '<input type="hidden" name="action" value="add">';
dol_fiche_head();
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
print '<tr><td width="25%">' . $langs->trans("AccountNumber") . '</td>'; print '<tr><td width="25%">' . $langs->trans("AccountNumber") . '</td>';
@ -163,8 +164,10 @@ if ($action == 'create')
print '</td></tr>'; print '</td></tr>';
print '</table>'; print '</table>';
print '<br><div class="center">'; dol_fiche_end();
print '<div class="center">';
print '<input class="button" type="submit" value="' . $langs->trans("Save") . '">'; print '<input class="button" type="submit" value="' . $langs->trans("Save") . '">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'; print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<input class="button" type="submit" name="cancel" value="' . $langs->trans("Cancel") . '">'; print '<input class="button" type="submit" name="cancel" value="' . $langs->trans("Cancel") . '">';
@ -216,16 +219,16 @@ else if ($id)
print '</td></tr>'; print '</td></tr>';
print '</table>'; print '</table>';
print '<br><div class="center">'; dol_fiche_end();
print '<div class="center">';
print '<input type="submit" class="button" value="' . $langs->trans("Save") . '">'; print '<input type="submit" class="button" value="' . $langs->trans("Save") . '">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'; print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<input type="submit" name="cancel" class="button" value="' . $langs->trans("Cancel") . '">'; print '<input type="submit" name="cancel" class="button" value="' . $langs->trans("Cancel") . '">';
print '</div>'; print '</div>';
print '</form>'; print '</form>';
print '</div>';
} }
else else
{ {
@ -268,8 +271,8 @@ else if ($id)
print '</td></tr>'; print '</td></tr>';
print '</table>'; print '</table>';
print '</div>'; dol_fiche_end();
/* /*
* Barre d'actions * Barre d'actions
@ -297,6 +300,6 @@ else if ($id)
dol_print_error($db); dol_print_error($db);
} }
} }
$db->close();
llxFooter(); llxFooter();
$db->close();

View File

@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2014 Alexandre Spangaro <alexandre.spangaro@gmail.com> /* Copyright (C) 2014-2015 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -176,6 +176,8 @@ if ($action == 'create')
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="add">'; print '<input type="hidden" name="action" value="add">';
dol_fiche_head();
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Label // Label
@ -199,8 +201,10 @@ if ($action == 'create')
print '</td></tr>'; print '</td></tr>';
print '</table>'; print '</table>';
dol_fiche_end();
print '<br><div class="center">'; print '<div class="center">';
print '<input class="button" type="submit" value="'.$langs->trans("Save").'">'; print '<input class="button" type="submit" value="'.$langs->trans("Save").'">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'; print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<input class="button" type="submit" name="cancel" value="'.$langs->trans("Cancel").'">'; print '<input class="button" type="submit" name="cancel" value="'.$langs->trans("Cancel").'">';

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com> /* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com> * Copyright (C) 2013-2015 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -205,36 +205,42 @@ if ($action == 'create') {
print '<form action="' . $_SERVER["PHP_SELF"] . '" name="create_mvt" method="POST">'; print '<form action="' . $_SERVER["PHP_SELF"] . '" name="create_mvt" method="POST">';
print '<input type="hidden" name="action" value="confirm_create">' . "\n"; print '<input type="hidden" name="action" value="confirm_create">' . "\n";
print '<input type="hidden" name="next_num_mvt" value="' . $next_num_mvt . '">' . "\n"; print '<input type="hidden" name="next_num_mvt" value="' . $next_num_mvt . '">' . "\n";
dol_fiche_head();
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
print '<tr class="pair">'; print '<tr>';
print '<td>' . $langs->trans("NumMvts") . '</td>'; print '<td>' . $langs->trans("NumMvts") . '</td>';
print '<td>' . $next_num_mvt . '</td>'; print '<td>' . $next_num_mvt . '</td>';
print '</tr>'; print '</tr>';
print '<tr class="impair">'; print '<tr>';
print '<td>' . $langs->trans("Docdate") . '</td>'; print '<td>' . $langs->trans("Docdate") . '</td>';
print '<td>'; print '<td>';
print $html->select_date('', 'doc_date', '', '', '', "create_mvt", 1, 1); print $html->select_date('', 'doc_date', '', '', '', "create_mvt", 1, 1);
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
print '<tr class="pair">'; print '<tr>';
print '<td>' . $langs->trans("Codejournal") . '</td>'; print '<td>' . $langs->trans("Codejournal") . '</td>';
print '<td>' . $html->selectarray('code_journal', $code_journal_array) . '</td>'; print '<td>' . $html->selectarray('code_journal', $code_journal_array) . '</td>';
print '</tr>'; print '</tr>';
print '<tr class="impair">'; print '<tr>';
print '<td>' . $langs->trans("Docref") . '</td>'; print '<td>' . $langs->trans("Docref") . '</td>';
print '<td><input type="text" size="20" name="doc_ref" value=""/></td>'; print '<td><input type="text" size="20" name="doc_ref" value=""/></td>';
print '</tr>'; print '</tr>';
print '<tr class="pair">'; print '<tr>';
print '<td>' . $langs->trans("Doctype") . '</td>'; print '<td>' . $langs->trans("Doctype") . '</td>';
print '<td><input type="text" size="20" name="doc_type" value=""/></td>'; print '<td><input type="text" size="20" name="doc_type" value=""/></td>';
print '</tr>'; print '</tr>';
print '</table>'; print '</table>';
print '<br>';
print '<input type="submit" class="butAction" value="' . $langs->trans("Save") . '">'; dol_fiche_end();
print '<div align="center"><input type="submit" class="butAction" value="' . $langs->trans("Save") . '">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="button" value="'.$langs->trans("Cancel").'" class="button" onclick="history.go(-1)" />';
print '</div>';
print '</form>'; print '</form>';
} }
else else

View File

@ -1,7 +1,7 @@
<?PHP <?PHP
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com> /* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com> * Copyright (C) 2013-2015 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -44,7 +44,6 @@ if ($user->societe_id > 0)
/* /*
* Actions * Actions
*/ */
if ($action == 'ventil' && $user->rights->accounting->ventilation->dispatch) { if ($action == 'ventil' && $user->rights->accounting->ventilation->dispatch) {
if (! GETPOST('cancel', 'alpha')) if (! GETPOST('cancel', 'alpha'))
{ {
@ -63,6 +62,10 @@ if ($action == 'ventil' && $user->rights->accounting->ventilation->dispatch) {
} }
} }
/*
* View
*/
llxHeader("", "", "FicheVentilation"); llxHeader("", "", "FicheVentilation");
if ($cancel == $langs->trans("Cancel")) { if ($cancel == $langs->trans("Cancel")) {
@ -108,6 +111,8 @@ if (! empty($id)) {
$linkback='<a href="'.DOL_URL_ROOT.'/accountancy/customer/lines.php">'.$langs->trans("Back").'</a>'; $linkback='<a href="'.DOL_URL_ROOT.'/accountancy/customer/lines.php">'.$langs->trans("Back").'</a>';
print_fiche_titre($langs->trans('CustomersVentilation'),$linkback,'title_setup'); print_fiche_titre($langs->trans('CustomersVentilation'),$linkback,'title_setup');
dol_fiche_head();
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Ref facture // Ref facture
@ -120,13 +125,13 @@ if (! empty($id)) {
print '<tr><td width="20%">' . $langs->trans("Line") . '</td>'; print '<tr><td width="20%">' . $langs->trans("Line") . '</td>';
print '<td>' . nl2br($objp->description) . '</td></tr>'; print '<td>' . nl2br($objp->description) . '</td></tr>';
print '<tr><td width="20%">' . $langs->trans("Account") . '</td><td>'; print '<tr><td width="20%">' . $langs->trans("Account") . '</td><td>';
print $objp->account_number . '-' . $objp->label;
print '<tr><td width="20%">' . $langs->trans("NewAccount") . '</td><td>';
print $formventilation->select_account($objp->fk_code_ventilation, 'codeventil', 1); print $formventilation->select_account($objp->fk_code_ventilation, 'codeventil', 1);
print '</td></tr>'; print '</td></tr>';
print '</table>'; print '</table>';
dol_fiche_end();
print '<br><div class="center">'; print '<div class="center">';
print '<input class="button" type="submit" value="' . $langs->trans("Save") . '">'; print '<input class="button" type="submit" value="' . $langs->trans("Save") . '">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'; print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<input class="button" type="submit" name="cancel" value="' . $langs->trans("Cancel") . '">'; print '<input class="button" type="submit" name="cancel" value="' . $langs->trans("Cancel") . '">';
@ -144,4 +149,4 @@ if (! empty($id)) {
} }
llxFooter(); llxFooter();
$db->close(); $db->close();

View File

@ -1,9 +1,9 @@
<?php <?php
/* Copyright (C) 2013 Olivier Geffroy <jeff@jeffinfo.com> /* Copyright (C) 2013 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com> * Copyright (C) 2013-2015 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr> * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -172,8 +172,8 @@ if ($resql) {
while ( $i < $num ) { while ( $i < $num ) {
$row = $db->fetch_row($resql); $row = $db->fetch_row($resql);
$var=!$var;
print '<tr><td>' . length_accountg($row[0]) . '</td>'; print '<tr '.$bc[$var].'><td>' . length_accountg($row[0]) . '</td>';
print '<td align="left">' . $row[1] . '</td>'; print '<td align="left">' . $row[1] . '</td>';
print '<td align="right">' . price($row[2]) . '</td>'; print '<td align="right">' . price($row[2]) . '</td>';
print '<td align="right">' . price($row[3]) . '</td>'; print '<td align="right">' . price($row[3]) . '</td>';

View File

@ -43,7 +43,7 @@ $search_facture = GETPOST('search_facture','alpha');
$search_label = GETPOST('search_label','alpha'); $search_label = GETPOST('search_label','alpha');
$search_desc = GETPOST('search_desc','alpha'); $search_desc = GETPOST('search_desc','alpha');
$search_amount = GETPOST('search_amount','alpha'); $search_amount = GETPOST('search_amount','alpha');
$search_acount = GETPOST('search_account','alpha'); $search_account = GETPOST('search_account','alpha');
// Security check // Security check
if ($user->societe_id > 0) if ($user->societe_id > 0)

View File

@ -555,9 +555,9 @@ else
$h=0; $h=0;
$head[$h][0] = $_SERVER["PHP_SELF"].'?id_account='.$id_accountancy_journal; $head[$h][0] = $_SERVER["PHP_SELF"].'?id_account='.$id_accountancy_journal;
$head[$h][1] = $langs->trans("Report"); $head[$h][1] = $langs->trans("Report");
$head[$h][2] = 'report'; $head[$h][2] = 'card';
dol_fiche_head($head, $hselected); dol_fiche_head($head, 'card', $langs->trans("BankJournal"), 0, 'payment');
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id_account='.$id_accountancy_journal.'">'; print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id_account='.$id_accountancy_journal.'">';
print '<table width="100%" class="border">'; print '<table width="100%" class="border">';

View File

@ -1,11 +1,11 @@
<?php <?php
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005 Simon TOSSER <simon@kornog-computing.com> * Copyright (C) 2005 Simon TOSSER <simon@kornog-computing.com>
* Copyright (C) 2013-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com> * Copyright (C) 2013-2015 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com> * Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr> * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -34,31 +34,32 @@ require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
require_once DOL_DOCUMENT_ROOT.'/accountancy/class/html.formventilation.class.php'; require_once DOL_DOCUMENT_ROOT.'/accountancy/class/html.formventilation.class.php';
// Langs // Langs
$langs->load("compta");
$langs->load("bills"); $langs->load("bills");
$langs->load("other");
$langs->load("main");
$langs->load("accountancy"); $langs->load("accountancy");
$action = GETPOST('action'); $action = GETPOST('action', 'alpha');
$id = GETPOST('id', 'int');
$codeventil = GETPOST('codeventil'); $codeventil = GETPOST('codeventil');
$id = GETPOST('id');
// Security check // Security check
if ($user->societe_id > 0) if ($user->societe_id > 0)
accessforbidden(); accessforbidden();
if ($action == 'ventil' && $user->rights->accounting->ventilation->dispatch) if ($action == 'ventil' && $user->rights->accounting->ventilation->dispatch) {
{ if (! GETPOST('cancel', 'alpha'))
$sql = " UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det"; {
$sql .= " SET fk_code_ventilation = " . $codeventil; $sql = " UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det";
$sql .= " WHERE rowid = " . $id; $sql .= " SET fk_code_ventilation = " . $codeventil;
$sql .= " WHERE rowid = " . $id;
dol_syslog('accountancy/journal/sellsjournal.php:: $sql=' . $sql);
dol_syslog('accountancy/supplier/card.php:: $sql=' . $sql);
$resql = $db->query($sql); $resql = $db->query($sql);
if (! $resql) { if (! $resql) {
setEventMessage($db->lasterror(), 'errors'); setEventMessage($db->lasterror(), 'errors');
}
} else {
header("Location: ./lines.php");
exit();
} }
} }
@ -78,7 +79,7 @@ $form = new Form($db);
$facturefournisseur_static = new FactureFournisseur($db); $facturefournisseur_static = new FactureFournisseur($db);
$formventilation = new FormVentilation($db); $formventilation = new FormVentilation($db);
if ($_GET["id"]) { if (! empty($id)) {
$sql = "SELECT f.ref as facnumber, f.rowid as facid, l.fk_product, l.description, l.rowid, l.fk_code_ventilation, "; $sql = "SELECT f.ref as facnumber, f.rowid as facid, l.fk_product, l.description, l.rowid, l.fk_code_ventilation, ";
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label"; $sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label";
$sql .= ", aa.account_number, aa.label"; $sql .= ", aa.account_number, aa.label";
@ -87,11 +88,14 @@ if ($_GET["id"]) {
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accountingaccount as aa ON l.fk_code_ventilation = aa.rowid"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accountingaccount as aa ON l.fk_code_ventilation = aa.rowid";
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "facture_fourn as f ON f.rowid = l.fk_facture_fourn "; $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "facture_fourn as f ON f.rowid = l.fk_facture_fourn ";
$sql .= " WHERE f.fk_statut > 0 AND l.rowid = " . $id; $sql .= " WHERE f.fk_statut > 0 AND l.rowid = " . $id;
if (! empty($conf->multicompany->enabled)) { if (! empty($conf->multicompany->enabled)) {
$sql .= " AND f.entity IN (" . getEntity("facture_fourn", 1) . ")"; $sql .= " AND f.entity IN (" . getEntity("facture_fourn", 1) . ")";
} }
dol_syslog("/accounting/supplier/card.php sql=" . $sql, LOG_DEBUG);
$result = $db->query($sql); $result = $db->query($sql);
if ($result) { if ($result) {
$num_lines = $db->num_rows($result); $num_lines = $db->num_rows($result);
$i = 0; $i = 0;
@ -103,7 +107,10 @@ if ($_GET["id"]) {
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
print '<input type="hidden" name="action" value="ventil">'; print '<input type="hidden" name="action" value="ventil">';
print_fiche_titre($langs->trans("SuppliersVentilation")); $linkback='<a href="'.DOL_URL_ROOT.'/accountancy/supplier/lines.php">'.$langs->trans("Back").'</a>';
print_fiche_titre($langs->trans('SuppliersVentilation'),$linkback,'title_setup');
dol_fiche_head();
print '<table class="border" width="100%" cellspacing="0" cellpadding="4">'; print '<table class="border" width="100%" cellspacing="0" cellpadding="4">';
@ -119,19 +126,24 @@ if ($_GET["id"]) {
print '<tr><td width="20%">' . $langs->trans("ProductLabel") . '</td>'; print '<tr><td width="20%">' . $langs->trans("ProductLabel") . '</td>';
print '<td>' . dol_trunc($objp->product_label, 24) . '</td>'; print '<td>' . dol_trunc($objp->product_label, 24) . '</td>';
print '<tr><td width="20%">' . $langs->trans("Account") . '</td><td>'; print '<tr><td width="20%">' . $langs->trans("Account") . '</td><td>';
print $objp->account_number . '-' . $objp->label;
print '<tr><td width="20%">' . $langs->trans("NewAccount") . '</td><td>';
print $formventilation->select_account($objp->fk_code_ventilation, 'codeventil', 1); print $formventilation->select_account($objp->fk_code_ventilation, 'codeventil', 1);
print '</td></tr>'; print '</td></tr>';
print '<tr><td>&nbsp;</td><td><input type="submit" class="button" value="' . $langs->trans("Update") . '"></td></tr>';
print '</table>'; print '</table>';
dol_fiche_end();
print '<div class="center">';
print '<input class="button" type="submit" value="' . $langs->trans("Save") . '">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<input class="button" type="submit" name="cancel" value="' . $langs->trans("Cancel") . '">';
print '</div>';
print '</form>'; print '</form>';
} else { } else {
print "Error 1"; print "Error";
} }
} else { } else {
print "Error 2"; print "Error";
} }
} else { } else {
print "Error ID incorrect"; print "Error ID incorrect";

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com> /* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com> * Copyright (C) 2013-2015 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -158,8 +158,8 @@ if ($resql) {
while ( $i < $num ) { while ( $i < $num ) {
$row = $db->fetch_row($resql); $row = $db->fetch_row($resql);
$var=!$var;
print '<tr><td>' . length_accountg($row[0]) . '</td>'; print '<tr '.$bc[$var].'><td>' . length_accountg($row[0]) . '</td>';
print '<td align="left">' . $row[1] . '</td>'; print '<td align="left">' . $row[1] . '</td>';
print '<td align="right">' . price($row[2]) . '</td>'; print '<td align="right">' . price($row[2]) . '</td>';
print '<td align="right">' . price($row[3]) . '</td>'; print '<td align="right">' . price($row[3]) . '</td>';

View File

@ -44,7 +44,7 @@ $search_facture = GETPOST('search_facture','alpha');
$search_label = GETPOST('search_label','alpha'); $search_label = GETPOST('search_label','alpha');
$search_desc = GETPOST('search_desc','alpha'); $search_desc = GETPOST('search_desc','alpha');
$search_amount = GETPOST('search_amount','alpha'); $search_amount = GETPOST('search_amount','alpha');
$search_acount = GETPOST('search_account','alpha'); $search_account = GETPOST('search_account','alpha');
// Security check // Security check
if ($user->societe_id > 0) if ($user->societe_id > 0)

View File

@ -5,6 +5,7 @@
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2012-2013 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2012-2013 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2015 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -45,6 +46,7 @@ $langs->load("users");
$langs->load('other'); $langs->load('other');
$action=GETPOST('action','alpha'); $action=GETPOST('action','alpha');
$cancel=GETPOST('cancel');
$backtopage=GETPOST('backtopage','alpha'); $backtopage=GETPOST('backtopage','alpha');
$confirm=GETPOST('confirm','alpha'); $confirm=GETPOST('confirm','alpha');
$rowid=GETPOST('rowid','int'); $rowid=GETPOST('rowid','int');
@ -113,7 +115,8 @@ $hookmanager->initHooks(array('membercard','globalcard'));
/* /*
* Actions * Actions
*/ */
if ($cancel) $action='';
$parameters=array('rowid'=>$rowid, 'objcanvas'=>$objcanvas); $parameters=array('rowid'=>$rowid, 'objcanvas'=>$objcanvas);
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
@ -236,7 +239,7 @@ if (empty($reshook))
} }
} }
if ($action == 'update' && ! $_POST["cancel"] && $user->rights->adherent->creer) if ($action == 'update' && $cancel='' && $user->rights->adherent->creer)
{ {
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
@ -725,7 +728,7 @@ else
{ {
/* ************************************************************************** */ /* ************************************************************************** */
/* */ /* */
/* Creation card */ /* Creation mode */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
$object->canvas=$canvas; $object->canvas=$canvas;
@ -779,7 +782,10 @@ else
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="add">'; print '<input type="hidden" name="action" value="add">';
dol_fiche_head('');
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
print '<tbody>';
// Login // Login
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED))
@ -868,13 +874,13 @@ else
print '</td></tr>'; print '</td></tr>';
} }
// Tel pro // Pro phone
print '<tr><td>'.$langs->trans("PhonePro").'</td><td><input type="text" name="phone" size="20" value="'.(GETPOST('phone','alpha')?GETPOST('phone','alpha'):$object->phone).'"></td></tr>'; print '<tr><td>'.$langs->trans("PhonePro").'</td><td><input type="text" name="phone" size="20" value="'.(GETPOST('phone','alpha')?GETPOST('phone','alpha'):$object->phone).'"></td></tr>';
// Tel perso // Personal phone
print '<tr><td>'.$langs->trans("PhonePerso").'</td><td><input type="text" name="phone_perso" size="20" value="'.(GETPOST('phone_perso','alpha')?GETPOST('phone_perso','alpha'):$object->phone_perso).'"></td></tr>'; print '<tr><td>'.$langs->trans("PhonePerso").'</td><td><input type="text" name="phone_perso" size="20" value="'.(GETPOST('phone_perso','alpha')?GETPOST('phone_perso','alpha'):$object->phone_perso).'"></td></tr>';
// Tel mobile // Mobile phone
print '<tr><td>'.$langs->trans("PhoneMobile").'</td><td><input type="text" name="phone_mobile" size="20" value="'.(GETPOST('phone_mobile','alpha')?GETPOST('phone_mobile','alpha'):$object->phone_mobile).'"></td></tr>'; print '<tr><td>'.$langs->trans("PhoneMobile").'</td><td><input type="text" name="phone_mobile" size="20" value="'.(GETPOST('phone_mobile','alpha')?GETPOST('phone_mobile','alpha'):$object->phone_mobile).'"></td></tr>';
// Skype // Skype
@ -888,7 +894,7 @@ else
$form->select_date(($object->birth ? $object->birth : -1),'birth','','',1,'formsoc'); $form->select_date(($object->birth ? $object->birth : -1),'birth','','',1,'formsoc');
print "</td></tr>\n"; print "</td></tr>\n";
// Profil public // Public profil
print "<tr><td>".$langs->trans("Public")."</td><td>\n"; print "<tr><td>".$langs->trans("Public")."</td><td>\n";
print $form->selectyesno("public",$object->public,1); print $form->selectyesno("public",$object->public,1);
print "</td></tr>\n"; print "</td></tr>\n";
@ -915,21 +921,25 @@ else
print $form->select_dolusers($object->user_id,'userid',1); print $form->select_dolusers($object->user_id,'userid',1);
print '</td></tr>'; print '</td></tr>';
*/ */
print '<tbody>';
print "</table>\n"; print "</table>\n";
print '<br>';
print '<div class="center"><input type="submit" class="button" value="'.$langs->trans("AddMember").'"></div>'; dol_fiche_end();
print '<div class="center">';
print '<input type="submit" name="button" class="button" value="'.$langs->trans("AddMember").'">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<input type="submit" name="cancel" class="button" value="'.$langs->trans("Cancel").'" onclick="history.go(-1)" />';
print '</div>';
print "</form>\n"; print "</form>\n";
} }
if ($action == 'edit') if ($action == 'edit')
{ {
/******************************************** /********************************************
* *
* Fiche en mode edition * Edition mode
* *
********************************************/ ********************************************/
@ -1027,6 +1037,7 @@ else
print '<tr><td><span class="fieldrequired">'.$langs->trans("Nature").'</span></td><td>'; print '<tr><td><span class="fieldrequired">'.$langs->trans("Nature").'</span></td><td>';
print $form->selectarray("morphy", $morphys, isset($_POST["morphy"])?$_POST["morphy"]:$object->morphy); print $form->selectarray("morphy", $morphys, isset($_POST["morphy"])?$_POST["morphy"]:$object->morphy);
print "</td>"; print "</td>";
// Photo // Photo
print '<td align="center" class="hideonsmartphone" valign="middle" width="25%" rowspan="'.$rowspan.'">'; print '<td align="center" class="hideonsmartphone" valign="middle" width="25%" rowspan="'.$rowspan.'">';
print $form->showphoto('memberphoto',$object)."\n"; print $form->showphoto('memberphoto',$object)."\n";
@ -1034,7 +1045,7 @@ else
{ {
if ($object->photo) print "<br>\n"; if ($object->photo) print "<br>\n";
print '<table class="nobordernopadding">'; print '<table class="nobordernopadding">';
if ($object->photo) print '<tr><td align="center"><input type="checkbox" class="flat" name="deletephoto" id="photodelete"> '.$langs->trans("Delete").'<br><br></td></tr>'; if ($object->photo) print '<tr><td align="center"><input type="checkbox" class="flat photodelete" name="deletephoto" id="photodelete"> '.$langs->trans("Delete").'<br><br></td></tr>';
print '<tr><td>'.$langs->trans("PhotoFile").'</td></tr>'; print '<tr><td>'.$langs->trans("PhotoFile").'</td></tr>';
print '<tr><td><input type="file" class="flat" name="photo" id="photoinput"></td></tr>'; print '<tr><td><input type="file" class="flat" name="photo" id="photoinput"></td></tr>';
print '</table>'; print '</table>';
@ -1107,13 +1118,13 @@ else
print '</td></tr>'; print '</td></tr>';
} }
// Tel // Pro phone
print '<tr><td>'.$langs->trans("PhonePro").'</td><td><input type="text" name="phone" size="20" value="'.(isset($_POST["phone"])?$_POST["phone"]:$object->phone).'"></td></tr>'; print '<tr><td>'.$langs->trans("PhonePro").'</td><td><input type="text" name="phone" size="20" value="'.(isset($_POST["phone"])?$_POST["phone"]:$object->phone).'"></td></tr>';
// Tel perso // Personal phone
print '<tr><td>'.$langs->trans("PhonePerso").'</td><td><input type="text" name="phone_perso" size="20" value="'.(isset($_POST["phone_perso"])?$_POST["phone_perso"]:$object->phone_perso).'"></td></tr>'; print '<tr><td>'.$langs->trans("PhonePerso").'</td><td><input type="text" name="phone_perso" size="20" value="'.(isset($_POST["phone_perso"])?$_POST["phone_perso"]:$object->phone_perso).'"></td></tr>';
// Tel mobile // Mobile phone
print '<tr><td>'.$langs->trans("PhoneMobile").'</td><td><input type="text" name="phone_mobile" size="20" value="'.(isset($_POST["phone_mobile"])?$_POST["phone_mobile"]:$object->phone_mobile).'"></td></tr>'; print '<tr><td>'.$langs->trans("PhoneMobile").'</td><td><input type="text" name="phone_mobile" size="20" value="'.(isset($_POST["phone_mobile"])?$_POST["phone_mobile"]:$object->phone_mobile).'"></td></tr>';
// Skype // Skype
@ -1127,7 +1138,7 @@ else
$form->select_date(($object->birth ? $object->birth : -1),'birth','','',1,'formsoc'); $form->select_date(($object->birth ? $object->birth : -1),'birth','','',1,'formsoc');
print "</td></tr>\n"; print "</td></tr>\n";
// Profil public // Public profil
print "<tr><td>".$langs->trans("Public")."</td><td>\n"; print "<tr><td>".$langs->trans("Public")."</td><td>\n";
print $form->selectyesno("public",(isset($_POST["public"])?$_POST["public"]:$object->public),1); print $form->selectyesno("public",(isset($_POST["public"])?$_POST["public"]:$object->public),1);
print "</td></tr>\n"; print "</td></tr>\n";
@ -1171,7 +1182,7 @@ else
print '<br><div class="center">'; print '<br><div class="center">';
print '<input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">'; print '<input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'; print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">'; print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'" onclick="history.go(-1)" />';
print '</div>'; print '</div>';
print '</form>'; print '</form>';
@ -1183,7 +1194,7 @@ else
{ {
/* ************************************************************************** */ /* ************************************************************************** */
/* */ /* */
/* Mode affichage */ /* View mode */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -1204,8 +1215,8 @@ else
/* /*
* Affichage onglets * Show tabs
*/ */
$head = member_prepare_head($object); $head = member_prepare_head($object);
dol_fiche_head($head, 'general', $langs->trans("Member"), 0, 'user'); dol_fiche_head($head, 'general', $langs->trans("Member"), 0, 'user');
@ -1296,7 +1307,7 @@ else
print $form->formconfirm("card.php?rowid=".$rowid,$langs->trans("SendCardByMail"),$langs->trans("ConfirmSendCardByMail",$object->email),"confirm_sendinfo",'',0,1); print $form->formconfirm("card.php?rowid=".$rowid,$langs->trans("SendCardByMail"),$langs->trans("ConfirmSendCardByMail",$object->email),"confirm_sendinfo",'',0,1);
} }
// Confirm resiliate // Confirm terminate
if ($action == 'resign') if ($action == 'resign')
{ {
$langs->load("mails"); $langs->load("mails");
@ -1536,9 +1547,8 @@ else
/* /*
* Barre d'actions * Hotbar
* */
*/
print '<div class="tabsAction">'; print '<div class="tabsAction">';
if ($action != 'valid' && $action != 'editlogin' && $action != 'editthirdparty') if ($action != 'valid' && $action != 'editlogin' && $action != 'editthirdparty')
@ -1553,7 +1563,7 @@ else
print '<div class="inline-block divButAction"><font class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("Modify").'</font></div>'; print '<div class="inline-block divButAction"><font class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("Modify").'</font></div>';
} }
// Valider // Validate
if ($object->statut == -1) if ($object->statut == -1)
{ {
if ($user->rights->adherent->creer) if ($user->rights->adherent->creer)
@ -1566,7 +1576,7 @@ else
} }
} }
// Reactiver // Reactivate
if ($object->statut == 0) if ($object->statut == 0)
{ {
if ($user->rights->adherent->creer) if ($user->rights->adherent->creer)
@ -1597,7 +1607,7 @@ else
print '<div class="inline-block divButAction"><font class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("SendCardByMail")."</font></div>"; print '<div class="inline-block divButAction"><font class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("SendCardByMail")."</font></div>";
} }
// Resilier // Terminate
if ($object->statut >= 1) if ($object->statut >= 1)
{ {
if ($user->rights->adherent->supprimer) if ($user->rights->adherent->supprimer)

View File

@ -3,6 +3,7 @@
* Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org> * Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2015 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -707,7 +708,7 @@ if ($rowid > 0)
/* /*
* Barre d'actions * Hotbar
*/ */
// Lien nouvelle cotisation si non brouillon et non resilie // Lien nouvelle cotisation si non brouillon et non resilie
@ -908,9 +909,13 @@ if ($rowid > 0)
print '<input type="hidden" name="rowid" value="'.$rowid.'">'; print '<input type="hidden" name="rowid" value="'.$rowid.'">';
print '<input type="hidden" name="memberlabel" id="memberlabel" value="'.dol_escape_htmltag($object->getFullName($langs)).'">'; print '<input type="hidden" name="memberlabel" id="memberlabel" value="'.dol_escape_htmltag($object->getFullName($langs)).'">';
print '<input type="hidden" name="thirdpartylabel" id="thirdpartylabel" value="'.dol_escape_htmltag($object->societe).'">'; print '<input type="hidden" name="thirdpartylabel" id="thirdpartylabel" value="'.dol_escape_htmltag($object->societe).'">';
print "<table class=\"border\" width=\"100%\">\n";
$today=dol_now(); dol_fiche_head('');
print "<table class=\"border\" width=\"100%\">\n";
print '<tbody>';
$today=dol_now();
$datefrom=0; $datefrom=0;
$dateto=0; $dateto=0;
$paymentdate=-1; $paymentdate=-1;
@ -1102,8 +1107,10 @@ if ($rowid > 0)
print $form->textwithpicto($tmp,$helpcontent,1,'help'); print $form->textwithpicto($tmp,$helpcontent,1,'help');
} }
print '</td></tr>'; print '</td></tr>';
print '</tbody>';
print '</table>'; print '</table>';
print '<br>';
dol_fiche_end();
print '<div class="center">'; print '<div class="center">';
print '<input type="submit" class="button" name="add" value="'.$langs->trans("AddSubscription").'">'; print '<input type="submit" class="button" name="add" value="'.$langs->trans("AddSubscription").'">';

View File

@ -8,6 +8,7 @@
* Copyright (C) 2014-2015 Alexandre Spangaro <alexandre.spangaro@gmail.com> * Copyright (C) 2014-2015 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Frederic France <frederic.france@free.fr> * Copyright (C) 2015 Frederic France <frederic.france@free.fr>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -31,6 +32,7 @@
require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
/** /**
@ -1584,7 +1586,8 @@ class Adherent extends CommonObject
} }
if ($option == 'category') if ($option == 'category')
{ {
$link = '<a href="'.DOL_URL_ROOT.'/categories/categorie.php?id='.$this->id.'&type=3'.$linkclose; $type = Categorie::TYPE_MEMBER;
$link = '<a href="'.DOL_URL_ROOT.'/categories/categorie.php?id='.$this->id.'&type='.$type.$linkclose;
$linkend='</a>'; $linkend='</a>';
} }

View File

@ -157,7 +157,7 @@ print "</table></form>";
if ($conf->use_javascript_ajax) if ($conf->use_javascript_ajax)
{ {
print '<br>'; print '<br>';
print '<table class="noborder" width="100%">'; print '<table class="noborder nohover" width="100%">';
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Statistics").'</td></tr>'; print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Statistics").'</td></tr>';
print '<tr '.$bc[0].'><td align="center" colspan="2">'; print '<tr '.$bc[0].'><td align="center" colspan="2">';

View File

@ -1,8 +1,8 @@
<?php <?php
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org> * Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2013 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr> * Copyright (C) 2013-2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -107,7 +107,7 @@ if ($sall)
foreach ($scrit as $crit) foreach ($scrit as $crit)
{ {
$sql.=" AND ("; $sql.=" AND (";
if (is_numeric($sall)) $sql.= "d.rowid = ".$sall." OR "; if (is_numeric($sall)) $sql.= "d.rowid = ".$db->escape($sall)." OR ";
$sql.=" d.firstname LIKE '%".$db->escape($sall)."%' OR d.lastname LIKE '%".$db->escape($sall)."%' OR d.societe LIKE '%".$db->escape($sall)."%'"; $sql.=" d.firstname LIKE '%".$db->escape($sall)."%' OR d.lastname LIKE '%".$db->escape($sall)."%' OR d.societe LIKE '%".$db->escape($sall)."%'";
$sql.=" OR d.email LIKE '%".$db->escape($sall)."%' OR d.login LIKE '%".$db->escape($sall)."%' OR d.address LIKE '%".$db->escape($sall)."%'"; $sql.=" OR d.email LIKE '%".$db->escape($sall)."%' OR d.login LIKE '%".$db->escape($sall)."%' OR d.address LIKE '%".$db->escape($sall)."%'";
$sql.=" OR d.town LIKE '%".$db->escape($sall)."%' OR d.note_public LIKE '%".$db->escape($sall)."%' OR d.note_private LIKE '%".$db->escape($sall)."%')"; $sql.=" OR d.town LIKE '%".$db->escape($sall)."%' OR d.note_public LIKE '%".$db->escape($sall)."%' OR d.note_private LIKE '%".$db->escape($sall)."%')";
@ -115,7 +115,7 @@ if ($sall)
} }
if ($type > 0) if ($type > 0)
{ {
$sql.=" AND t.rowid=".$type; $sql.=" AND t.rowid=".$db->escape($type);
} }
if (isset($_GET["statut"]) || isset($_POST["statut"])) if (isset($_GET["statut"]) || isset($_POST["statut"]))
{ {
@ -209,8 +209,9 @@ if ($resql)
$moreforfilter=''; $moreforfilter='';
if (! empty($conf->categorie->enabled)) if (! empty($conf->categorie->enabled))
{ {
require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
$moreforfilter.=$langs->trans('Categories'). ': '; $moreforfilter.=$langs->trans('Categories'). ': ';
$moreforfilter.=$formother->select_categories(3,$search_categ,'search_categ',1); $moreforfilter.=$formother->select_categories(Categorie::TYPE_MEMBER,$search_categ,'search_categ',1);
$moreforfilter.=' &nbsp; &nbsp; &nbsp; '; $moreforfilter.=' &nbsp; &nbsp; &nbsp; ';
} }
if ($moreforfilter) if ($moreforfilter)

View File

@ -4,6 +4,7 @@
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2015 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -26,6 +27,7 @@
*/ */
require '../main.inc.php'; require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/member.lib.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
@ -59,7 +61,7 @@ $extrafields = new ExtraFields($db);
// fetch optionals attributes and labels // fetch optionals attributes and labels
$extralabels=$extrafields->fetch_name_optionals_label('adherent_type'); $extralabels=$extrafields->fetch_name_optionals_label('adherent_type');
if (GETPOST('button_removefilter')) if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers
{ {
$search_lastname=""; $search_lastname="";
$search_login=""; $search_login="";
@ -79,21 +81,21 @@ if ($action == 'add' && $user->rights->adherent->configurer)
{ {
if ($_POST["button"] != $langs->trans("Cancel")) if ($_POST["button"] != $langs->trans("Cancel"))
{ {
$adht = new AdherentType($db); $object = new AdherentType($db);
$adht->libelle = trim($_POST["libelle"]); $object->libelle = trim($_POST["libelle"]);
$adht->cotisation = trim($_POST["cotisation"]); $object->cotisation = trim($_POST["cotisation"]);
$adht->note = trim($_POST["comment"]); $object->note = trim($_POST["comment"]);
$adht->mail_valid = trim($_POST["mail_valid"]); $object->mail_valid = trim($_POST["mail_valid"]);
$adht->vote = trim($_POST["vote"]); $object->vote = trim($_POST["vote"]);
// Fill array 'array_options' with data from add form // Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost($extralabels,$adht); $ret = $extrafields->setOptionalsFromPost($extralabels,$object);
if ($ret < 0) $error++; if ($ret < 0) $error++;
if ($adht->libelle) if ($object->libelle)
{ {
$id=$adht->create($user); $id=$object->create($user);
if ($id > 0) if ($id > 0)
{ {
header("Location: ".$_SERVER["PHP_SELF"]); header("Location: ".$_SERVER["PHP_SELF"]);
@ -101,7 +103,7 @@ if ($action == 'add' && $user->rights->adherent->configurer)
} }
else else
{ {
$mesg=$adht->error; $mesg=$object->error;
$action = 'create'; $action = 'create';
} }
} }
@ -117,19 +119,19 @@ if ($action == 'update' && $user->rights->adherent->configurer)
{ {
if ($_POST["button"] != $langs->trans("Cancel")) if ($_POST["button"] != $langs->trans("Cancel"))
{ {
$adht = new AdherentType($db); $object = new AdherentType($db);
$adht->id = $_POST["rowid"]; $object->id = $_POST["rowid"];
$adht->libelle = trim($_POST["libelle"]); $object->libelle = trim($_POST["libelle"]);
$adht->cotisation = trim($_POST["cotisation"]); $object->cotisation = trim($_POST["cotisation"]);
$adht->note = trim($_POST["comment"]); $object->note = trim($_POST["comment"]);
$adht->mail_valid = trim($_POST["mail_valid"]); $object->mail_valid = trim($_POST["mail_valid"]);
$adht->vote = trim($_POST["vote"]); $object->vote = trim($_POST["vote"]);
// Fill array 'array_options' with data from add form // Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost($extralabels,$adht); $ret = $extrafields->setOptionalsFromPost($extralabels,$object);
if ($ret < 0) $error++; if ($ret < 0) $error++;
$adht->update($user); $object->update($user);
header("Location: ".$_SERVER["PHP_SELF"]."?rowid=".$_POST["rowid"]); header("Location: ".$_SERVER["PHP_SELF"]."?rowid=".$_POST["rowid"]);
exit; exit;
@ -138,8 +140,8 @@ if ($action == 'update' && $user->rights->adherent->configurer)
if ($action == 'delete' && $user->rights->adherent->configurer) if ($action == 'delete' && $user->rights->adherent->configurer)
{ {
$adht = new AdherentType($db); $object = new AdherentType($db);
$adht->delete($rowid); $object->delete($rowid);
header("Location: ".$_SERVER["PHP_SELF"]); header("Location: ".$_SERVER["PHP_SELF"]);
exit; exit;
} }
@ -161,8 +163,7 @@ llxHeader('',$langs->trans("MembersTypeSetup"),'EN:Module_Foundations|FR:Module_
$form=new Form($db); $form=new Form($db);
// Liste of members type // List of members type
if (! $rowid && $action != 'create' && $action != 'edit') if (! $rowid && $action != 'create' && $action != 'edit')
{ {
@ -212,8 +213,7 @@ if (! $rowid && $action != 'create' && $action != 'edit')
/* /*
* Barre d'actions * Hotbar
*
*/ */
print '<div class="tabsAction">'; print '<div class="tabsAction">';
@ -230,19 +230,23 @@ if (! $rowid && $action != 'create' && $action != 'edit')
/* ************************************************************************** */ /* ************************************************************************** */
/* */ /* */
/* Creation d'un type adherent */ /* Creation mode */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
if ($action == 'create') if ($action == 'create')
{ {
$adht = new AdherentType($db); $object = new AdherentType($db);
print_fiche_titre($langs->trans("NewMemberType")); print_fiche_titre($langs->trans("NewMemberType"));
print '<form action="'.$_SERVER['PHP_SELF'].'" method="POST">'; print '<form action="'.$_SERVER['PHP_SELF'].'" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<table class="border" width="100%">';
dol_fiche_head('');
print '<table class="border" width="100%">';
print '<tbody>';
print '<input type="hidden" name="action" value="add">'; print '<input type="hidden" name="action" value="add">';
print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td><input type="text" name="libelle" size="40"></td></tr>'; print '<tr><td class="fieldrequired">'.$langs->trans("Label").'</td><td><input type="text" name="libelle" size="40"></td></tr>';
@ -260,7 +264,7 @@ if ($action == 'create')
print '<tr><td valign="top">'.$langs->trans("WelcomeEMail").'</td><td>'; print '<tr><td valign="top">'.$langs->trans("WelcomeEMail").'</td><td>';
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor=new DolEditor('mail_valid',$adht->mail_valid,'',280,'dolibarr_notes','',false,true,$conf->fckeditor->enabled,15,90); $doleditor=new DolEditor('mail_valid',$object->mail_valid,'',280,'dolibarr_notes','',false,true,$conf->fckeditor->enabled,15,90);
$doleditor->Create(); $doleditor->Create();
print '</td></tr>'; print '</td></tr>';
@ -269,11 +273,14 @@ if ($action == 'create')
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$act,$action); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$act,$action); // Note that $action and $object may have been modified by hook
if (empty($reshook) && ! empty($extrafields->attribute_label)) if (empty($reshook) && ! empty($extrafields->attribute_label))
{ {
print $adht->showOptionals($extrafields,'edit'); print $object->showOptionals($extrafields,'edit');
} }
print '<tbody>';
print "</table>\n"; print "</table>\n";
dol_fiche_end();
print '<br><div class="center">'; print '<div class="center">';
print '<input type="submit" name="button" class="button" value="'.$langs->trans("Add").'">'; print '<input type="submit" name="button" class="button" value="'.$langs->trans("Add").'">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'; print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<input type="submit" name="button" class="button" value="'.$langs->trans("Cancel").'">'; print '<input type="submit" name="button" class="button" value="'.$langs->trans("Cancel").'">';
@ -284,27 +291,21 @@ if ($action == 'create')
/* ************************************************************************** */ /* ************************************************************************** */
/* */ /* */
/* Edition de la fiche */ /* View mode */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
if ($rowid > 0) if ($rowid > 0)
{ {
if ($action != 'edit') if ($action != 'edit')
{ {
$adht = new AdherentType($db); $object = new AdherentType($db);
$adht->fetch($rowid); $object->fetch($rowid);
$adht->fetch_optionals($rowid,$extralabels); $object->fetch_optionals($rowid,$extralabels);
$h=0; $head = member_type_prepare_head($object);
$head[$h][0] = $_SERVER["PHP_SELF"].'?rowid='.$adht->id;
$head[$h][1] = $langs->trans("Card");
$head[$h][2] = 'card';
$h++;
dol_fiche_head($head, 'card', $langs->trans("MemberType"), 0, 'group'); dol_fiche_head($head, 'card', $langs->trans("MemberType"), 0, 'group');
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
$linkback = '<a href="'.DOL_URL_ROOT.'/adherents/type.php">'.$langs->trans("BackToList").'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/adherents/type.php">'.$langs->trans("BackToList").'</a>';
@ -312,25 +313,25 @@ if ($rowid > 0)
// Ref // Ref
print '<tr><td width="15%">'.$langs->trans("Ref").'</td>'; print '<tr><td width="15%">'.$langs->trans("Ref").'</td>';
print '<td>'; print '<td>';
print $form->showrefnav($adht, 'rowid', $linkback); print $form->showrefnav($object, 'rowid', $linkback);
print '</td></tr>'; print '</td></tr>';
// Label // Label
print '<tr><td width="15%">'.$langs->trans("Label").'</td><td>'.$adht->libelle.'</td></tr>'; print '<tr><td width="15%">'.$langs->trans("Label").'</td><td>'.$object->libelle.'</td></tr>';
print '<tr><td>'.$langs->trans("SubscriptionRequired").'</td><td>'; print '<tr><td>'.$langs->trans("SubscriptionRequired").'</td><td>';
print yn($adht->cotisation); print yn($object->cotisation);
print '</tr>'; print '</tr>';
print '<tr><td>'.$langs->trans("VoteAllowed").'</td><td>'; print '<tr><td>'.$langs->trans("VoteAllowed").'</td><td>';
print yn($adht->vote); print yn($object->vote);
print '</tr>'; print '</tr>';
print '<tr><td valign="top">'.$langs->trans("Description").'</td><td>'; print '<tr><td valign="top">'.$langs->trans("Description").'</td><td>';
print nl2br($adht->note)."</td></tr>"; print nl2br($object->note)."</td></tr>";
print '<tr><td valign="top">'.$langs->trans("WelcomeEMail").'</td><td>'; print '<tr><td valign="top">'.$langs->trans("WelcomeEMail").'</td><td>';
print nl2br($adht->mail_valid)."</td></tr>"; print nl2br($object->mail_valid)."</td></tr>";
// Other attributes // Other attributes
$parameters=array(); $parameters=array();
@ -338,31 +339,30 @@ if ($rowid > 0)
if (empty($reshook) && ! empty($extrafields->attribute_label)) if (empty($reshook) && ! empty($extrafields->attribute_label))
{ {
// View extrafields // View extrafields
print $adht->showOptionals($extrafields); print $object->showOptionals($extrafields);
} }
print '</table>'; print '</table>';
print '</div>'; print '</div>';
/* /*
* Barre d'actions * Hotbar
*
*/ */
print '<div class="tabsAction">'; print '<div class="tabsAction">';
// Edit // Edit
if ($user->rights->adherent->configurer) if ($user->rights->adherent->configurer)
{ {
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=edit&amp;rowid='.$adht->id.'">'.$langs->trans("Modify").'</a></div>'; print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=edit&amp;rowid='.$object->id.'">'.$langs->trans("Modify").'</a></div>';
} }
// Add // Add
print '<div class="inline-block divButAction"><a class="butAction" href="card.php?action=create&typeid='.$adht->id.'">'.$langs->trans("AddMember").'</a></div>'; print '<div class="inline-block divButAction"><a class="butAction" href="card.php?action=create&typeid='.$object->id.'">'.$langs->trans("AddMember").'</a></div>';
// Delete // Delete
if ($user->rights->adherent->configurer) if ($user->rights->adherent->configurer)
{ {
print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?action=delete&rowid='.$adht->id.'">'.$langs->trans("DeleteType").'</a></div>'; print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?action=delete&rowid='.$object->id.'">'.$langs->trans("DeleteType").'</a></div>';
} }
print "</div>"; print "</div>";
@ -381,7 +381,7 @@ if ($rowid > 0)
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."adherent_type as t"; $sql.= " FROM ".MAIN_DB_PREFIX."adherent as d, ".MAIN_DB_PREFIX."adherent_type as t";
$sql.= " WHERE d.fk_adherent_type = t.rowid "; $sql.= " WHERE d.fk_adherent_type = t.rowid ";
$sql.= " AND d.entity IN (".getEntity().")"; $sql.= " AND d.entity IN (".getEntity().")";
$sql.= " AND t.rowid = ".$adht->id; $sql.= " AND t.rowid = ".$object->id;
if ($sall) if ($sall)
{ {
$sql.= " AND (d.firstname LIKE '%".$sall."%' OR d.lastname LIKE '%".$sall."%' OR d.societe LIKE '%".$sall."%'"; $sql.= " AND (d.firstname LIKE '%".$sall."%' OR d.lastname LIKE '%".$sall."%' OR d.societe LIKE '%".$sall."%'";
@ -479,7 +479,7 @@ if ($rowid > 0)
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Name")." / ".$langs->trans("Company"),$_SERVER["PHP_SELF"],"d.lastname",$param,"","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Name")." / ".$langs->trans("Company"),$_SERVER["PHP_SELF"],"d.lastname",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Login"),$_SERVER["PHP_SELF"],"d.login",$param,"","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Login"),$_SERVER["PHP_SELF"],"d.login",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Person"),$_SERVER["PHP_SELF"],"d.morphy",$param,"","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Nature"),$_SERVER["PHP_SELF"],"d.morphy",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("EMail"),$_SERVER["PHP_SELF"],"d.email",$param,"","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("EMail"),$_SERVER["PHP_SELF"],"d.email",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"d.statut,d.datefin",$param,"","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"d.statut,d.datefin",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("EndSubscription"),$_SERVER["PHP_SELF"],"d.datefin",$param,"",'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("EndSubscription"),$_SERVER["PHP_SELF"],"d.datefin",$param,"",'align="center"',$sortfield,$sortorder);
@ -619,19 +619,20 @@ if ($rowid > 0)
} }
/* ************************************************************************** */
/* */
/* Edition mode */
/* */
/* ************************************************************************** */
if ($action == 'edit') if ($action == 'edit')
{ {
$adht = new AdherentType($db); $object = new AdherentType($db);
$adht->id = $rowid; $object->id = $rowid;
$adht->fetch($rowid); $object->fetch($rowid);
$adht->fetch_optionals($rowid,$extralabels); $object->fetch_optionals($rowid,$extralabels);
$h=0; $head = member_type_prepare_head($object);
$head[$h][0] = $_SERVER["PHP_SELF"].'?rowid='.$adht->id;
$head[$h][1] = $langs->trans("Card");
$head[$h][2] = 'card';
$h++;
dol_fiche_head($head, 'card', $langs->trans("MemberType"), 0, 'group'); dol_fiche_head($head, 'card', $langs->trans("MemberType"), 0, 'group');
@ -641,24 +642,24 @@ if ($rowid > 0)
print '<input type="hidden" name="action" value="update">'; print '<input type="hidden" name="action" value="update">';
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
print '<tr><td width="15%">'.$langs->trans("Ref").'</td><td>'.$adht->id.'</td></tr>'; print '<tr><td width="15%">'.$langs->trans("Ref").'</td><td>'.$object->id.'</td></tr>';
print '<tr><td>'.$langs->trans("Label").'</td><td><input type="text" name="libelle" size="40" value="'.$adht->libelle.'"></td></tr>'; print '<tr><td>'.$langs->trans("Label").'</td><td><input type="text" name="libelle" size="40" value="'.$object->libelle.'"></td></tr>';
print '<tr><td>'.$langs->trans("SubscriptionRequired").'</td><td>'; print '<tr><td>'.$langs->trans("SubscriptionRequired").'</td><td>';
print $form->selectyesno("cotisation",$adht->cotisation,1); print $form->selectyesno("cotisation",$object->cotisation,1);
print '</td></tr>'; print '</td></tr>';
print '<tr><td>'.$langs->trans("VoteAllowed").'</td><td>'; print '<tr><td>'.$langs->trans("VoteAllowed").'</td><td>';
print $form->selectyesno("vote",$adht->vote,1); print $form->selectyesno("vote",$object->vote,1);
print '</td></tr>'; print '</td></tr>';
print '<tr><td valign="top">'.$langs->trans("Description").'</td><td>'; print '<tr><td valign="top">'.$langs->trans("Description").'</td><td>';
print '<textarea name="comment" wrap="soft" cols="90" rows="3">'.$adht->note.'</textarea></td></tr>'; print '<textarea name="comment" wrap="soft" cols="90" rows="3">'.$object->note.'</textarea></td></tr>';
print '<tr><td valign="top">'.$langs->trans("WelcomeEMail").'</td><td>'; print '<tr><td valign="top">'.$langs->trans("WelcomeEMail").'</td><td>';
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor=new DolEditor('mail_valid',$adht->mail_valid,'',280,'dolibarr_notes','',false,true,$conf->fckeditor->enabled,15,90); $doleditor=new DolEditor('mail_valid',$object->mail_valid,'',280,'dolibarr_notes','',false,true,$conf->fckeditor->enabled,15,90);
$doleditor->Create(); $doleditor->Create();
print "</td></tr>"; print "</td></tr>";
@ -668,13 +669,13 @@ if ($rowid > 0)
print '</table>'; print '</table>';
//Extra field // Extra field
if (empty($reshook) && ! empty($extrafields->attribute_label)) if (empty($reshook) && ! empty($extrafields->attribute_label))
{ {
print '<br><br><table class="border" width="100%">'; print '<br><br><table class="border" width="100%">';
foreach($extrafields->attribute_label as $key=>$label) foreach($extrafields->attribute_label as $key=>$label)
{ {
$value=(isset($_POST["options_".$key])?$_POST["options_".$key]:(isset($adht->array_options['options_'.$key])?$adht->array_options['options_'.$key]:'')); $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:(isset($object->array_options['options_'.$key])?$object->array_options['options_'.$key]:''));
print '<tr><td width="30%">'.$label.'</td><td>'; print '<tr><td width="30%">'.$label.'</td><td>';
print $extrafields->showInputField($key,$value); print $extrafields->showInputField($key,$value);
print "</td></tr>\n"; print "</td></tr>\n";

View File

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

View File

@ -70,7 +70,7 @@ $hookmanager->initHooks(array('admin'));
// Put here declaration of dictionaries properties // Put here declaration of dictionaries properties
// Sort order to show dictionary (0 is space). All other dictionaries (added by modules) will be at end of this. // Sort order to show dictionary (0 is space). All other dictionaries (added by modules) will be at end of this.
$taborder=array(9,0,4,3,2,0,1,8,19,16,27,0,5,11,0,6,0,10,23,12,13,0,14,0,7,17,0,22,20,18,21,0,15,0,24,0,25,0,26); $taborder=array(9,0,4,3,2,0,1,8,19,16,27,0,5,11,0,6,0,10,23,12,13,0,14,0,7,17,24,0,22,20,18,21,0,15,0,25,0,26);
// Name of SQL tables of dictionaries // Name of SQL tables of dictionaries
$tabname=array(); $tabname=array();
@ -832,7 +832,7 @@ if ($id)
$fieldlist=explode(',',$tabfield[$id]); $fieldlist=explode(',',$tabfield[$id]);
// Line for title // Line for title
print '<tr class="liste_titre">'; print '<tr class="liste_titre nohover">';
foreach ($fieldlist as $field => $value) foreach ($fieldlist as $field => $value)
{ {
// Determine le nom du champ par rapport aux noms possibles // Determine le nom du champ par rapport aux noms possibles

View File

@ -78,10 +78,10 @@ if ($action == 'update')
dolibarr_set_const($db, "MAIN_MOTD", dol_htmlcleanlastbr($_POST["main_motd"]),'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_MOTD", dol_htmlcleanlastbr($_POST["main_motd"]),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_HOME", dol_htmlcleanlastbr($_POST["main_home"]),'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_HOME", dol_htmlcleanlastbr($_POST["main_home"]),'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "MAIN_HELP_DISABLELINK", $_POST["MAIN_HELP_DISABLELINK"],'chaine',0,'',0); // Param for all entities dolibarr_set_const($db, "MAIN_HELP_DISABLELINK", $_POST["MAIN_HELP_DISABLELINK"],'chaine',0,'',0); // Param for all entities
dolibarr_set_const($db, "MAIN_BUGTRACK_ENABLELINK", $_POST["MAIN_BUGTRACK_ENABLELINK"],'chaine',0,'',$conf->entity);
// This one is not always defined // This one is not always defined
if (isset($_POST["MAIN_USE_PREVIEW_TABS"])) dolibarr_set_const($db, "MAIN_USE_PREVIEW_TABS", $_POST["MAIN_USE_PREVIEW_TABS"],'chaine',0,'',$conf->entity); if (isset($_POST["MAIN_USE_PREVIEW_TABS"])) dolibarr_set_const($db, "MAIN_USE_PREVIEW_TABS", $_POST["MAIN_USE_PREVIEW_TABS"],'chaine',0,'',$conf->entity);
if (isset($_POST["MAIN_BUGTRACK_ENABLELINK"])) dolibarr_set_const($db, "MAIN_BUGTRACK_ENABLELINK", $_POST["MAIN_BUGTRACK_ENABLELINK"],'chaine',0,'',$conf->entity);
$_SESSION["mainmenu"]=""; // Le gestionnaire de menu a pu changer $_SESSION["mainmenu"]=""; // Le gestionnaire de menu a pu changer
@ -279,16 +279,13 @@ if ($action == 'edit') // Edit
print '<td width="20">&nbsp;</td>'; print '<td width="20">&nbsp;</td>';
print '</tr>'; print '</tr>';
if ($conf->global->MAIN_FEATURES_LEVEL >= 1 || ! empty($conf->global->MAIN_BUGTRACK_ENABLELINK)) // Show bugtrack link
{ $var=!$var;
// Show bugtrack link print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("ShowBugTrackLink", $langs->transnoentitiesnoconv("FindBug")).'</td><td>';
$var=!$var; print $form->selectyesno('MAIN_BUGTRACK_ENABLELINK',$conf->global->MAIN_BUGTRACK_ENABLELINK,1);
print '<tr '.$bc[$var].'><td width="35%">'.$langs->trans("ShowBugTrackLink").'</td><td>'; print '</td>';
print $form->selectyesno('MAIN_BUGTRACK_ENABLELINK',$conf->global->MAIN_BUGTRACK_ENABLELINK,1); print '<td width="20">&nbsp;</td>';
print '</td>'; print '</tr>';
print '<td width="20">&nbsp;</td>';
print '</tr>';
}
// Message on login page // Message on login page
$var=!$var; $var=!$var;
@ -465,15 +462,12 @@ else // Show
print yn((isset($conf->global->MAIN_HELP_DISABLELINK)?$conf->global->MAIN_HELP_DISABLELINK:0),1); print yn((isset($conf->global->MAIN_HELP_DISABLELINK)?$conf->global->MAIN_HELP_DISABLELINK:0),1);
print '</td></tr>'; print '</td></tr>';
if ($conf->global->MAIN_FEATURES_LEVEL >= 1 || ! empty($conf->global->MAIN_BUGTRACK_ENABLELINK)) // Show bugtrack link
{ $var=!$var;
// Show bugtrack link print '<tr '.$bc[$var].'"><td width="35%">'.$langs->trans("ShowBugTrackLink", $langs->transnoentitiesnoconv("FindBug")).'</td><td>';
$var=!$var; print yn($conf->global->MAIN_BUGTRACK_ENABLELINK)."</td>";
print '<tr '.$bc[$var].'"><td width="35%">'.$langs->trans("ShowBugTrackLink").'</td><td>'; print '<td width="20">&nbsp;</td>';
print yn($conf->global->MAIN_BUGTRACK_ENABLELINK)."</td>"; print "</tr>";
print '<td width="20">&nbsp;</td>';
print "</tr>";
}
// Message login // Message login
$var=!$var; $var=!$var;

View File

@ -121,7 +121,7 @@ if (! empty($_POST['removedfile']) || ! empty($_POST['removedfilehtml']))
$pathtodelete=$listofpaths[$keytodelete]; $pathtodelete=$listofpaths[$keytodelete];
$filetodelete=$listofnames[$keytodelete]; $filetodelete=$listofnames[$keytodelete];
$result = dol_delete_file($pathtodelete,1); $result = dol_delete_file($pathtodelete,1);
if ($result >= 0) if ($result)
{ {
setEventMessage($langs->trans("FileWasRemoved"), $filetodelete); setEventMessage($langs->trans("FileWasRemoved"), $filetodelete);

View File

@ -53,7 +53,9 @@ print '<br><br>';
// Show logo // Show logo
print '<div class="center"><div class="logo_setup"></div></div>'; //print '<div class="center"><div class="logo_setup"></div></div>';
print '<center><div class="logo_setup"></div></center>'; // For a reason I don't know, the div class="center does not works, we must keep the <center>
llxFooter(); llxFooter();
$db->close(); $db->close();

View File

@ -89,7 +89,7 @@ if ($action=='purge' && ! preg_match('/^confirm/i',$choice) && ($choice != 'allf
// If (file that is not logfile) or (if logfile with option logfile) // If (file that is not logfile) or (if logfile with option logfile)
if ($filesarray[$key]['fullname'] != $filelog || $choice=='logfile') if ($filesarray[$key]['fullname'] != $filelog || $choice=='logfile')
{ {
$count+=dol_delete_file($filesarray[$key]['fullname']); $count+=(dol_delete_file($filesarray[$key]['fullname'])?1:0);
} }
} }
} }

View File

@ -4,6 +4,7 @@
* Copyright (C) 2005-2014 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2014 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com> * Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -50,14 +51,14 @@ $parent=GETPOST('parent');
if ($origin) if ($origin)
{ {
if ($type == 0) $idProdOrigin = $origin; if ($type == Categorie::TYPE_PRODUCT) $idProdOrigin = $origin;
if ($type == 1) $idSupplierOrigin = $origin; if ($type == Categorie::TYPE_SUPPLIER) $idSupplierOrigin = $origin;
if ($type == 2) $idCompanyOrigin = $origin; if ($type == Categorie::TYPE_CUSTOMER) $idCompanyOrigin = $origin;
if ($type == 3) $idMemberOrigin = $origin; if ($type == Categorie::TYPE_MEMBER) $idMemberOrigin = $origin;
if ($type == 4) $idContactOrigin = $origin; if ($type == Categorie::TYPE_CONTACT) $idContactOrigin = $origin;
} }
if ($catorigin && $type == 0) $idCatOrigin = $catorigin; if ($catorigin && $type == Categorie::TYPE_PRODUCT) $idCatOrigin = $catorigin;
$object = new Categorie($db); $object = new Categorie($db);

View File

@ -6,6 +6,7 @@
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com> * Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -46,40 +47,40 @@ $dbtablename = '';
// For categories on third parties // For categories on third parties
if (! empty($socid)) $id = $socid; if (! empty($socid)) $id = $socid;
if (! isset($type)) $type = 0; if (! isset($type)) $type = Categorie::TYPE_PRODUCT;
if ($type == 1 || $type == 2) $socid = $id; if ($type == Categorie::TYPE_SUPPLIER || $type == Categorie::TYPE_CUSTOMER) $socid = $id;
if ($id || $ref) if ($id || $ref)
{ {
if ($type == 0) { if ($type == Categorie::TYPE_PRODUCT) {
$elementtype = 'product'; $elementtype = 'product';
$objecttype = 'produit|service&categorie'; $objecttype = 'produit|service&categorie';
$objectid = isset($id)?$id:(isset($ref)?$ref:''); $objectid = isset($id)?$id:(isset($ref)?$ref:'');
$dbtablename = 'product'; $dbtablename = 'product';
$fieldid = isset($ref)?'ref':'rowid'; $fieldid = isset($ref)?'ref':'rowid';
} }
elseif ($type == 1) { elseif ($type == Categorie::TYPE_SUPPLIER) {
$elementtype = 'fournisseur'; $elementtype = 'fournisseur';
$objecttype = 'societe&categorie'; $objecttype = 'societe&categorie';
$objectid = isset($id)?$id:(isset($socid)?$socid:''); $objectid = isset($id)?$id:(isset($socid)?$socid:'');
$dbtablename = '&societe'; $dbtablename = '&societe';
$fieldid = 'rowid'; $fieldid = 'rowid';
} }
elseif ($type == 2) { elseif ($type == Categorie::TYPE_CUSTOMER) {
$elementtype = 'societe'; $elementtype = 'societe';
$objecttype = 'societe&categorie'; $objecttype = 'societe&categorie';
$objectid = isset($id)?$id:(isset($socid)?$socid:''); $objectid = isset($id)?$id:(isset($socid)?$socid:'');
$dbtablename = '&societe'; $dbtablename = '&societe';
$fieldid = 'rowid'; $fieldid = 'rowid';
} }
elseif ($type == 3) { elseif ($type == Categorie::TYPE_MEMBER) {
$elementtype = 'member'; $elementtype = 'member';
$objecttype = 'adherent&categorie'; $objecttype = 'adherent&categorie';
$objectid = isset($id)?$id:(isset($ref)?$ref:''); $objectid = isset($id)?$id:(isset($ref)?$ref:'');
$dbtablename = 'adherent'; $dbtablename = 'adherent';
$fieldid = ! empty($ref)?'ref':'rowid'; $fieldid = ! empty($ref)?'ref':'rowid';
} }
elseif ($type == 4) { elseif ($type == Categorie::TYPE_CONTACT) {
$elementtype = 'societe'; $elementtype = 'societe';
$objecttype = 'contact'; $objecttype = 'contact';
$objectid = isset($id)?$id:(isset($ref)?$ref:''); $objectid = isset($id)?$id:(isset($ref)?$ref:'');
@ -109,34 +110,34 @@ if (empty($reshook))
// Remove element from category // Remove element from category
if ($removecat > 0) if ($removecat > 0)
{ {
if ($type==0 && ($user->rights->produit->creer || $user->rights->service->creer)) if ($type == Categorie::TYPE_PRODUCT && ($user->rights->produit->creer || $user->rights->service->creer))
{ {
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
$object = new Product($db); $object = new Product($db);
$result = $object->fetch($id, $ref); $result = $object->fetch($id, $ref);
$elementtype = 'product'; $elementtype = 'product';
} }
if ($type==1 && $user->rights->societe->creer) if ($type == Categorie::TYPE_SUPPLIER && $user->rights->societe->creer)
{ {
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php';
$object = new Fournisseur($db); $object = new Fournisseur($db);
$result = $object->fetch($objectid); $result = $object->fetch($objectid);
$elementtype = 'fournisseur'; $elementtype = 'fournisseur';
} }
if ($type==2 && $user->rights->societe->creer) if ($type == Categorie::TYPE_CUSTOMER && $user->rights->societe->creer)
{ {
$object = new Societe($db); $object = new Societe($db);
$result = $object->fetch($objectid); $result = $object->fetch($objectid);
$elementtype = 'societe'; $elementtype = 'societe';
} }
if ($type == 3 && $user->rights->adherent->creer) if ($type == Categorie::TYPE_MEMBER && $user->rights->adherent->creer)
{ {
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
$object = new Adherent($db); $object = new Adherent($db);
$result = $object->fetch($objectid); $result = $object->fetch($objectid);
$elementtype = 'member'; $elementtype = 'member';
} }
if ($type == 4 && $user->rights->societe->creer) if ($type == Categorie::TYPE_CONTACT && $user->rights->societe->creer)
{ {
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
$object = new Contact($db); $object = new Contact($db);
@ -157,34 +158,34 @@ if (empty($reshook))
// Add object into a category // Add object into a category
if ($parent > 0) if ($parent > 0)
{ {
if ($type==0 && ($user->rights->produit->creer || $user->rights->service->creer)) if ($type == Categorie::TYPE_PRODUCT && ($user->rights->produit->creer || $user->rights->service->creer))
{ {
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
$object = new Product($db); $object = new Product($db);
$result = $object->fetch($id, $ref); $result = $object->fetch($id, $ref);
$elementtype = 'product'; $elementtype = 'product';
} }
if ($type==1 && $user->rights->societe->creer) if ($type == Categorie::TYPE_SUPPLIER && $user->rights->societe->creer)
{ {
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php';
$object = new Fournisseur($db); $object = new Fournisseur($db);
$result = $object->fetch($objectid); $result = $object->fetch($objectid);
$elementtype = 'fournisseur'; $elementtype = 'fournisseur';
} }
if ($type==2 && $user->rights->societe->creer) if ($type == Categorie::TYPE_CUSTOMER && $user->rights->societe->creer)
{ {
$object = new Societe($db); $object = new Societe($db);
$result = $object->fetch($objectid); $result = $object->fetch($objectid);
$elementtype = 'societe'; $elementtype = 'societe';
} }
if ($type==3 && $user->rights->adherent->creer) if ($type == Categorie::TYPE_MEMBER && $user->rights->adherent->creer)
{ {
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
$object = new Adherent($db); $object = new Adherent($db);
$result = $object->fetch($objectid); $result = $object->fetch($objectid);
$elementtype = 'member'; $elementtype = 'member';
} }
if ($type == 4 && $user->rights->societe->creer) if ($type == Categorie::TYPE_CONTACT && $user->rights->societe->creer)
{ {
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
$object = new Contact($db); $object = new Contact($db);
@ -324,7 +325,7 @@ if ($socid)
} }
else if ($id || $ref) else if ($id || $ref)
{ {
if ($type == 0) if ($type == Categorie::TYPE_PRODUCT)
{ {
$langs->load("products"); $langs->load("products");
@ -377,7 +378,7 @@ else if ($id || $ref)
formCategory($db,$product,0,$socid,($user->rights->produit->creer || $user->rights->service->creer)); formCategory($db,$product,0,$socid,($user->rights->produit->creer || $user->rights->service->creer));
} }
if ($type == 3) if ($type == Categorie::TYPE_MEMBER)
{ {
$langs->load("members"); $langs->load("members");
@ -455,7 +456,7 @@ else if ($id || $ref)
formCategory($db,$member,3,0,$user->rights->adherent->creer); formCategory($db,$member,3,0,$user->rights->adherent->creer);
} }
if ($type == 4) if ($type == Categorie::TYPE_CONTACT)
{ {
$langs->load("contact"); $langs->load("contact");
@ -618,16 +619,16 @@ function formCategory($db,$object,$typeid,$socid=0,$showclassifyform=1)
{ {
global $user,$langs,$form,$bc; global $user,$langs,$form,$bc;
if ($typeid == 0) $title = $langs->trans("ProductsCategoriesShort"); if ($typeid == Categorie::TYPE_PRODUCT) $title = $langs->trans("ProductsCategoriesShort");
if ($typeid == 1) $title = $langs->trans("SuppliersCategoriesShort"); if ($typeid == Categorie::TYPE_SUPPLIER) $title = $langs->trans("SuppliersCategoriesShort");
if ($typeid == 2) $title = $langs->trans("CustomersProspectsCategoriesShort"); if ($typeid == Categorie::TYPE_CUSTOMER) $title = $langs->trans("CustomersProspectsCategoriesShort");
if ($typeid == 3) $title = $langs->trans("MembersCategoriesShort"); if ($typeid == Categorie::TYPE_MEMBER) $title = $langs->trans("MembersCategoriesShort");
if ($typeid == 4) $title = $langs->trans("ContactCategoriesShort"); if ($typeid == Categorie::TYPE_CONTACT) $title = $langs->trans("ContactCategoriesShort");
$linktocreate=''; $linktocreate='';
if ($showclassifyform && $user->rights->categorie->creer) if ($showclassifyform && $user->rights->categorie->creer)
{ {
$linktocreate='<a href="'.DOL_URL_ROOT.'/categories/card.php?action=create&amp;origin='.$object->id.'&type='.$typeid.'&urlfrom='.urlencode($_SERVER["PHP_SELF"].'?'.(($typeid==1||$typeid==2)?'socid':'id').'='.$object->id.'&type='.$typeid).'">'; $linktocreate='<a href="'.DOL_URL_ROOT.'/categories/card.php?action=create&amp;origin='.$object->id.'&type='.$typeid.'&urlfrom='.urlencode($_SERVER["PHP_SELF"].'?'.(($typeid==Categorie::TYPE_SUPPLIER||$typeid==Categorie::TYPE_CUSTOMER)?'socid':'id').'='.$object->id.'&type='.$typeid).'">';
$linktocreate.=$langs->trans("CreateCat").' '; $linktocreate.=$langs->trans("CreateCat").' ';
$linktocreate.=img_picto($langs->trans("Create"),'filenew'); $linktocreate.=img_picto($langs->trans("Create"),'filenew');
$linktocreate.="</a>"; $linktocreate.="</a>";
@ -662,11 +663,11 @@ function formCategory($db,$object,$typeid,$socid=0,$showclassifyform=1)
if (count($cats) > 0) if (count($cats) > 0)
{ {
if ($typeid == 0) $title=$langs->trans("ProductIsInCategories"); if ($typeid == Categorie::TYPE_PRODUCT) $title=$langs->trans("ProductIsInCategories");
if ($typeid == 1) $title=$langs->trans("CompanyIsInSuppliersCategories"); if ($typeid == Categorie::TYPE_SUPPLIER) $title=$langs->trans("CompanyIsInSuppliersCategories");
if ($typeid == 2) $title=$langs->trans("CompanyIsInCustomersCategories"); if ($typeid == Categorie::TYPE_CUSTOMER) $title=$langs->trans("CompanyIsInCustomersCategories");
if ($typeid == 3) $title=$langs->trans("MemberIsInCategories"); if ($typeid == Categorie::TYPE_MEMBER) $title=$langs->trans("MemberIsInCategories");
if ($typeid == 4) $title=$langs->trans("ContactIsInCategories"); if ($typeid == Categorie::TYPE_CONTACT) $title=$langs->trans("ContactIsInCategories");
print "\n"; print "\n";
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td colspan="2">'.$title.':</td></tr>'; print '<tr class="liste_titre"><td colspan="2">'.$title.':</td></tr>';
@ -687,11 +688,11 @@ function formCategory($db,$object,$typeid,$socid=0,$showclassifyform=1)
// Link to delete from category // Link to delete from category
print '<td align="right">'; print '<td align="right">';
$permission=0; $permission=0;
if ($typeid == 0) $permission=($user->rights->produit->creer || $user->rights->service->creer); if ($typeid == Categorie::TYPE_PRODUCT) $permission=($user->rights->produit->creer || $user->rights->service->creer);
if ($typeid == 1) $permission=$user->rights->societe->creer; if ($typeid == Categorie::TYPE_SUPPLIER) $permission=$user->rights->societe->creer;
if ($typeid == 2) $permission=$user->rights->societe->creer; if ($typeid == Categorie::TYPE_CUSTOMER) $permission=$user->rights->societe->creer;
if ($typeid == 3) $permission=$user->rights->adherent->creer; if ($typeid == Categorie::TYPE_MEMBER) $permission=$user->rights->adherent->creer;
if ($typeid == 4) $permission=$user->rights->societe->creer; if ($typeid == Categorie::TYPE_CONTACT) $permission=$user->rights->societe->creer;
if ($permission) if ($permission)
{ {
print "<a href= '".$_SERVER['PHP_SELF']."?".(empty($socid)?'id':'socid')."=".$object->id."&amp;type=".$typeid."&amp;removecat=".$cat->id."'>"; print "<a href= '".$_SERVER['PHP_SELF']."?".(empty($socid)?'id':'socid')."=".$object->id."&amp;type=".$typeid."&amp;removecat=".$cat->id."'>";
@ -715,18 +716,17 @@ function formCategory($db,$object,$typeid,$socid=0,$showclassifyform=1)
} }
else else
{ {
if ($typeid == 0) $title=$langs->trans("ProductHasNoCategory"); if ($typeid == Categorie::TYPE_PRODUCT) $title=$langs->trans("ProductHasNoCategory");
if ($typeid == 1) $title=$langs->trans("CompanyHasNoCategory"); if ($typeid == Categorie::TYPE_SUPPLIER) $title=$langs->trans("CompanyHasNoCategory");
if ($typeid == 2) $title=$langs->trans("CompanyHasNoCategory"); if ($typeid == Categorie::TYPE_CUSTOMER) $title=$langs->trans("CompanyHasNoCategory");
if ($typeid == 3) $title=$langs->trans("MemberHasNoCategory"); if ($typeid == Categorie::TYPE_MEMBER) $title=$langs->trans("MemberHasNoCategory");
if ($typeid == 4) $title=$langs->trans("ContactHasNoCategory"); if ($typeid == Categorie::TYPE_CONTACT) $title=$langs->trans("ContactHasNoCategory");
print $title; print $title;
print "<br/>"; print "<br/>";
} }
return 0; return 0;
} }
llxFooter(); llxFooter();
$db->close(); $db->close();

View File

@ -1,13 +1,14 @@
<?php <?php
/* Copyright (C) 2005 Matthieu Valleton <mv@seeschloss.org> /* Copyright (C) 2005 Matthieu Valleton <mv@seeschloss.org>
* Copyright (C) 2005 Davoleau Brice <brice.davoleau@gmail.com> * Copyright (C) 2005 Davoleau Brice <brice.davoleau@gmail.com>
* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> * Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2006-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2006-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2006-2012 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2006-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com> * Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2013 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -40,6 +41,13 @@ require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
*/ */
class Categorie extends CommonObject class Categorie extends CommonObject
{ {
// Categories types
const TYPE_PRODUCT = 0;
const TYPE_SUPPLIER = 1;
const TYPE_CUSTOMER = 2;
const TYPE_MEMBER = 3;
const TYPE_CONTACT = 4;
public $element='category'; public $element='category';
public $table_element='categories'; public $table_element='categories';
@ -472,7 +480,7 @@ class Categorie extends CommonObject
* Link an object to the category * Link an object to the category
* *
* @param Object $obj Object to link to category * @param Object $obj Object to link to category
* @param string $type Type of category ('member', 'customer', 'supplier', 'product', 'contact') * @param string $type Type of category ('societe', 'member', 'product', 'contact', 'fournisseur)
* @return int 1 : OK, -1 : erreur SQL, -2 : id not defined, -3 : Already linked * @return int 1 : OK, -1 : erreur SQL, -2 : id not defined, -3 : Already linked
*/ */
function add_type($obj,$type) function add_type($obj,$type)
@ -485,12 +493,22 @@ class Categorie extends CommonObject
// For backward compatibility // For backward compatibility
if ($type == 'company') $type='societe'; if ($type == 'company') $type='societe';
if ($type == 'customer') $type='societe'; elseif ($type == 'customer') $type='societe';
if ($type == 'supplier') $type='fournisseur'; elseif ($type == 'supplier') $type='fournisseur';
$column_name=$type; /**
if ($type=='contact') $column_name='socpeople'; * llx_categorie_contact => fk_socpeople
if ($type=='fournisseur') $column_name='societe'; * llx_categorie_fournisseur, llx_categorie_societe => fk_soc
* llx_categorie_member => fk_member
* llx_categorie_product => fk_product
*/
if ($type == 'contact') {
$column_name = 'socpeople';
} elseif ($type == 'fournisseur' || ($type == 'societe')) {
$column_name = 'soc';
} else {
$column_name = $type;
}
$this->db->begin(); $this->db->begin();
@ -1166,11 +1184,17 @@ class Categorie extends CommonObject
$cats = array(); $cats = array();
$typeid=-1; $table=''; $typeid=-1; $table='';
if ($type == '0' || $type == 'product') { $typeid=0; $table='product'; $type='product'; } if ($type == '0' || $type == 'product') {
else if ($type == '1' || $type == 'supplier') { $typeid=1; $table='soc'; $type='fournisseur'; } $typeid=self::TYPE_PRODUCT; $table='product'; $type='product';
else if ($type == '2' || $type == 'customer') { $typeid=2; $table='soc'; $type='societe'; } } else if ($type == '1' || $type == 'supplier') {
else if ($type == '3' || $type == 'member') { $typeid=3; $table='member'; $type='member'; } $typeid=self::TYPE_SUPPLIER; $table='soc'; $type='fournisseur';
else if ($type == '4' || $type == 'contact') { $typeid=4; $table='socpeople'; $type='contact'; } } else if ($type == '2' || $type == 'customer') {
$typeid=self::TYPE_CUSTOMER; $table='soc'; $type='societe';
} else if ($type == '3' || $type == 'member') {
$typeid=self::TYPE_MEMBER; $table='member'; $type='member';
} else if ($type == '4' || $type == 'contact') {
$typeid=self::TYPE_CONTACT; $table='socpeople'; $type='contact';
}
$sql = "SELECT ct.fk_categorie, c.label"; $sql = "SELECT ct.fk_categorie, c.label";
$sql.= " FROM ".MAIN_DB_PREFIX."categorie_".$type." as ct, ".MAIN_DB_PREFIX."categorie as c"; $sql.= " FROM ".MAIN_DB_PREFIX."categorie_".$type." as ct, ".MAIN_DB_PREFIX."categorie as c";
@ -1220,11 +1244,11 @@ class Categorie extends CommonObject
$cats = array(); $cats = array();
$typeid=-1; $typeid=-1;
if ($type == 0 || $type == 'product') { $typeid=0; } if ($type == 0 || $type == 'product') { $typeid=self::TYPE_PRODUCT; }
else if ($type == 1 || $type == 'supplier') { $typeid=1; } else if ($type == 1 || $type == 'supplier') { $typeid=self::TYPE_SUPPLIER; }
else if ($type == 2 || $type == 'customer') { $typeid=2; } else if ($type == 2 || $type == 'customer') { $typeid=self::TYPE_CUSTOMER; }
else if ($type == 3 || $type == 'member') { $typeid=3; } else if ($type == 3 || $type == 'member') { $typeid=self::TYPE_MEMBER; }
else if ($type == 4 || $type == 'contact') { $typeid=4; } else if ($type == 4 || $type == 'contact') { $typeid=self::TYPE_CONTACT; }
// Generation requete recherche // Generation requete recherche
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."categorie"; $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."categorie";
@ -1550,7 +1574,7 @@ class Categorie extends CommonObject
$this->specimen=1; $this->specimen=1;
$this->description = 'This is a description'; $this->description = 'This is a description';
$this->socid = 1; $this->socid = 1;
$this->type = 0; $this->type = self::TYPE_PRODUCT;
} }
/** /**

View File

@ -1,9 +1,10 @@
<?php <?php
/* Copyright (C) 2005 Matthieu Valleton <mv@seeschloss.org> /* Copyright (C) 2005 Matthieu Valleton <mv@seeschloss.org>
* Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com> * Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2006-2015 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2006-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com> * Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -35,7 +36,7 @@ $langs->load("categories");
if (! $user->rights->categorie->lire) accessforbidden(); if (! $user->rights->categorie->lire) accessforbidden();
$id=GETPOST('id','int'); $id=GETPOST('id','int');
$type=(GETPOST('type') ? GETPOST('type') : 0); $type=(GETPOST('type') ? GETPOST('type') : Categorie::TYPE_PRODUCT);
$catname=GETPOST('catname','alpha'); $catname=GETPOST('catname','alpha');
$section=(GETPOST('section')?GETPOST('section'):0); $section=(GETPOST('section')?GETPOST('section'):0);
@ -47,12 +48,12 @@ $section=(GETPOST('section')?GETPOST('section'):0);
$categstatic = new Categorie($db); $categstatic = new Categorie($db);
$form = new Form($db); $form = new Form($db);
if ($type == 0) $title=$langs->trans("ProductsCategoriesArea"); if ($type == Categorie::TYPE_PRODUCT) $title=$langs->trans("ProductsCategoriesArea");
elseif ($type == 1) $title=$langs->trans("SuppliersCategoriesArea"); elseif ($type == Categorie::TYPE_SUPPLIER) $title=$langs->trans("SuppliersCategoriesArea");
elseif ($type == 2) $title=$langs->trans("CustomersCategoriesArea"); elseif ($type == Categorie::TYPE_CUSTOMER) $title=$langs->trans("CustomersCategoriesArea");
elseif ($type == 3) $title=$langs->trans("MembersCategoriesArea"); elseif ($type == Categorie::TYPE_MEMBER) $title=$langs->trans("MembersCategoriesArea");
elseif ($type == 4) $title=$langs->trans("ContactsCategoriesArea"); elseif ($type == Categorie::TYPE_CONTACT) $title=$langs->trans("ContactsCategoriesArea");
else $title=$langs->trans("CategoriesArea"); else $title=$langs->trans("CategoriesArea");
$arrayofjs=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.js', '/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js'); $arrayofjs=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.js', '/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js');
$arrayofcss=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.css'); $arrayofcss=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.css');

View File

@ -1,9 +1,10 @@
<?php <?php
/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com> * Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2014 Jean-François Ferry <jfefe@aternatik.fr> * Copyright (C) 2014 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -93,11 +94,11 @@ $form = new Form($db);
if ($object->id) if ($object->id)
{ {
$title=$langs->trans("ProductsCategoryShort"); $title=$langs->trans("ProductsCategoryShort");
if ($type == 0) $title=$langs->trans("ProductsCategoryShort"); if ($type == Categorie::TYPE_PRODUCT) $title=$langs->trans("ProductsCategoryShort");
elseif ($type == 1) $title=$langs->trans("SuppliersCategoryShort"); elseif ($type == Categorie::TYPE_SUPPLIER) $title=$langs->trans("SuppliersCategoryShort");
elseif ($type == 2) $title=$langs->trans("CustomersCategoryShort"); elseif ($type == Categorie::TYPE_CUSTOMER) $title=$langs->trans("CustomersCategoryShort");
elseif ($type == 3) $title=$langs->trans("MembersCategoryShort"); elseif ($type == Categorie::TYPE_MEMBER) $title=$langs->trans("MembersCategoryShort");
elseif ($type == 4) $title=$langs->trans("ContactCategoriesShort"); elseif ($type == Categorie::TYPE_CONTACT) $title=$langs->trans("ContactCategoriesShort");
$head = categories_prepare_head($object,$type); $head = categories_prepare_head($object,$type);
dol_fiche_head($head, 'photos', $title, 0, 'category'); dol_fiche_head($head, 'photos', $title, 0, 'category');

View File

@ -1,7 +1,8 @@
<?php <?php
/* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> /* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2007 Rodolphe Quiedeville <rodolphe@quiedeville.org> * Copyright (C) 2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2010-2012 Destailleur Laurent <eldy@users.sourceforge.net> * Copyright (C) 2010-2012 Destailleur Laurent <eldy@users.sourceforge.net>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -143,12 +144,12 @@ llxHeader("","",$langs->trans("Translation"));
$form = new Form($db); $form = new Form($db);
$formadmin=new FormAdmin($db); $formadmin=new FormAdmin($db);
if ($type == 0) $title=$langs->trans("ProductsCategoryShort"); if ($type == Categorie::TYPE_PRODUCT) $title=$langs->trans("ProductsCategoryShort");
elseif ($type == 1) $title=$langs->trans("SuppliersCategoryShort"); elseif ($type == Categorie::TYPE_SUPPLIER) $title=$langs->trans("SuppliersCategoryShort");
elseif ($type == 2) $title=$langs->trans("CustomersCategoryShort"); elseif ($type == Categorie::TYPE_CUSTOMER) $title=$langs->trans("CustomersCategoryShort");
elseif ($type == 3) $title=$langs->trans("MembersCategoryShort"); elseif ($type == Categorie::TYPE_MEMBER) $title=$langs->trans("MembersCategoryShort");
elseif ($type == 4) $title=$langs->trans("ContactCategoriesShort"); elseif ($type == Categorie::TYPE_CONTACT) $title=$langs->trans("ContactCategoriesShort");
else $title=$langs->trans("Category"); else $title=$langs->trans("Category");
$head = categories_prepare_head($object,$type); $head = categories_prepare_head($object,$type);
dol_fiche_head($head, 'translation', $title, 0, 'category'); dol_fiche_head($head, 'translation', $title, 0, 'category');

View File

@ -1,8 +1,9 @@
<?php <?php
/* Copyright (C) 2005 Matthieu Valleton <mv@seeschloss.org> /* Copyright (C) 2005 Matthieu Valleton <mv@seeschloss.org>
* Copyright (C) 2006-2010 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2006-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com> * Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -70,33 +71,33 @@ $extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
// Remove element from category // Remove element from category
if ($id > 0 && $removeelem > 0) if ($id > 0 && $removeelem > 0)
{ {
if ($type==0 && ($user->rights->produit->creer || $user->rights->service->creer)) if ($type == Categorie::TYPE_PRODUCT && ($user->rights->produit->creer || $user->rights->service->creer))
{ {
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
$tmpobject = new Product($db); $tmpobject = new Product($db);
$result = $tmpobject->fetch($removeelem); $result = $tmpobject->fetch($removeelem);
$elementtype = 'product'; $elementtype = 'product';
} }
else if ($type==1 && $user->rights->societe->creer) else if ($type == Categorie::TYPE_SUPPLIER && $user->rights->societe->creer)
{ {
$tmpobject = new Societe($db); $tmpobject = new Societe($db);
$result = $tmpobject->fetch($removeelem); $result = $tmpobject->fetch($removeelem);
$elementtype = 'fournisseur'; $elementtype = 'fournisseur';
} }
else if ($type==2 && $user->rights->societe->creer) else if ($type == Categorie::TYPE_CUSTOMER && $user->rights->societe->creer)
{ {
$tmpobject = new Societe($db); $tmpobject = new Societe($db);
$result = $tmpobject->fetch($removeelem); $result = $tmpobject->fetch($removeelem);
$elementtype = 'societe'; $elementtype = 'societe';
} }
else if ($type == 3 && $user->rights->adherent->creer) else if ($type == Categorie::TYPE_MEMBER && $user->rights->adherent->creer)
{ {
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
$tmpobject = new Adherent($db); $tmpobject = new Adherent($db);
$result = $tmpobject->fetch($removeelem); $result = $tmpobject->fetch($removeelem);
$elementtype = 'member'; $elementtype = 'member';
} }
else if ($type == 4 && $user->rights->societe->creer) { else if ($type == Categorie::TYPE_CONTACT && $user->rights->societe->creer) {
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
$tmpobject = new Contact($db); $tmpobject = new Contact($db);
@ -121,7 +122,7 @@ if ($user->rights->categorie->supprimer && $action == 'confirm_delete' && $confi
} }
} }
if ($type==0 && $elemid && $action == 'addintocategory' && ($user->rights->produit->creer || $user->rights->service->creer)) if ($type == Categorie::TYPE_PRODUCT && $elemid && $action == 'addintocategory' && ($user->rights->produit->creer || $user->rights->service->creer))
{ {
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
$newobject = new Product($db); $newobject = new Product($db);
@ -158,12 +159,12 @@ $form = new Form($db);
llxHeader("","",$langs->trans("Categories")); llxHeader("","",$langs->trans("Categories"));
if ($type == 0) $title=$langs->trans("ProductsCategoryShort"); if ($type == Categorie::TYPE_PRODUCT) $title=$langs->trans("ProductsCategoryShort");
elseif ($type == 1) $title=$langs->trans("SuppliersCategoryShort"); elseif ($type == Categorie::TYPE_SUPPLIER) $title=$langs->trans("SuppliersCategoryShort");
elseif ($type == 2) $title=$langs->trans("CustomersCategoryShort"); elseif ($type == Categorie::TYPE_CUSTOMER) $title=$langs->trans("CustomersCategoryShort");
elseif ($type == 3) $title=$langs->trans("MembersCategoryShort"); elseif ($type == Categorie::TYPE_MEMBER) $title=$langs->trans("MembersCategoryShort");
elseif ($type == 4) $title=$langs->trans("ContactCategoriesShort"); elseif ($type == Categorie::TYPE_CONTACT) $title=$langs->trans("ContactCategoriesShort");
else $title=$langs->trans("Category"); else $title=$langs->trans("Category");
$head = categories_prepare_head($object,$type); $head = categories_prepare_head($object,$type);
@ -283,7 +284,7 @@ else
} }
// List of products or services (type is type of category) // List of products or services (type is type of category)
if ($object->type == 0) if ($object->type == Categorie::TYPE_PRODUCT)
{ {
$prods = $object->getObjectsInCateg("product"); $prods = $object->getObjectsInCateg("product");
if ($prods < 0) if ($prods < 0)
@ -292,7 +293,7 @@ if ($object->type == 0)
} }
else else
{ {
$showclassifyform=1; $typeid=0; $showclassifyform=1; $typeid=Categorie::TYPE_PRODUCT;
// Form to add record into a category // Form to add record into a category
if ($showclassifyform) if ($showclassifyform)
@ -334,10 +335,10 @@ if ($object->type == 0)
print '<td align="right">'; print '<td align="right">';
$typeid=$object->type; $typeid=$object->type;
$permission=0; $permission=0;
if ($typeid == 0) $permission=($user->rights->produit->creer || $user->rights->service->creer); if ($typeid == Categorie::TYPE_PRODUCT) $permission=($user->rights->produit->creer || $user->rights->service->creer);
if ($typeid == 1) $permission=$user->rights->societe->creer; if ($typeid == Categorie::TYPE_SUPPLIER) $permission=$user->rights->societe->creer;
if ($typeid == 2) $permission=$user->rights->societe->creer; if ($typeid == Categorie::TYPE_CUSTOMER) $permission=$user->rights->societe->creer;
if ($typeid == 3) $permission=$user->rights->adherent->creer; if ($typeid == Categorie::TYPE_MEMBER) $permission=$user->rights->adherent->creer;
if ($permission) if ($permission)
{ {
print "<a href= '".$_SERVER['PHP_SELF']."?".(empty($socid)?'id':'socid')."=".$object->id."&amp;type=".$typeid."&amp;removeelem=".$prod->id."'>"; print "<a href= '".$_SERVER['PHP_SELF']."?".(empty($socid)?'id':'socid')."=".$object->id."&amp;type=".$typeid."&amp;removeelem=".$prod->id."'>";
@ -356,7 +357,7 @@ if ($object->type == 0)
} }
} }
if ($object->type == 1) if ($object->type == Categorie::TYPE_SUPPLIER)
{ {
$socs = $object->getObjectsInCateg("supplier"); $socs = $object->getObjectsInCateg("supplier");
if ($socs < 0) if ($socs < 0)
@ -384,10 +385,10 @@ if ($object->type == 1)
print '<td align="right">'; print '<td align="right">';
$typeid=$object->type; $typeid=$object->type;
$permission=0; $permission=0;
if ($typeid == 0) $permission=($user->rights->produit->creer || $user->rights->service->creer); if ($typeid == Categorie::TYPE_PRODUCT) $permission=($user->rights->produit->creer || $user->rights->service->creer);
if ($typeid == 1) $permission=$user->rights->societe->creer; if ($typeid == Categorie::TYPE_SUPPLIER) $permission=$user->rights->societe->creer;
if ($typeid == 2) $permission=$user->rights->societe->creer; if ($typeid == Categorie::TYPE_CUSTOMER) $permission=$user->rights->societe->creer;
if ($typeid == 3) $permission=$user->rights->adherent->creer; if ($typeid == Categorie::TYPE_MEMBER) $permission=$user->rights->adherent->creer;
if ($permission) if ($permission)
{ {
print "<a href= '".$_SERVER['PHP_SELF']."?".(empty($socid)?'id':'socid')."=".$object->id."&amp;type=".$typeid."&amp;removeelem=".$soc->id."'>"; print "<a href= '".$_SERVER['PHP_SELF']."?".(empty($socid)?'id':'socid')."=".$object->id."&amp;type=".$typeid."&amp;removeelem=".$soc->id."'>";
@ -407,7 +408,7 @@ if ($object->type == 1)
} }
} }
if($object->type == 2) if($object->type == Categorie::TYPE_CUSTOMER)
{ {
$socs = $object->getObjectsInCateg("customer"); $socs = $object->getObjectsInCateg("customer");
if ($socs < 0) if ($socs < 0)
@ -438,10 +439,10 @@ if($object->type == 2)
print '<td align="right">'; print '<td align="right">';
$typeid=$object->type; $typeid=$object->type;
$permission=0; $permission=0;
if ($typeid == 0) $permission=($user->rights->produit->creer || $user->rights->service->creer); if ($typeid == Categorie::TYPE_PRODUCT) $permission=($user->rights->produit->creer || $user->rights->service->creer);
if ($typeid == 1) $permission=$user->rights->societe->creer; if ($typeid == Categorie::TYPE_SUPPLIER) $permission=$user->rights->societe->creer;
if ($typeid == 2) $permission=$user->rights->societe->creer; if ($typeid == Categorie::TYPE_CUSTOMER) $permission=$user->rights->societe->creer;
if ($typeid == 3) $permission=$user->rights->adherent->creer; if ($typeid == Categorie::TYPE_MEMBER) $permission=$user->rights->adherent->creer;
if ($permission) if ($permission)
{ {
print "<a href= '".$_SERVER['PHP_SELF']."?".(empty($socid)?'id':'socid')."=".$object->id."&amp;type=".$typeid."&amp;removeelem=".$soc->id."'>"; print "<a href= '".$_SERVER['PHP_SELF']."?".(empty($socid)?'id':'socid')."=".$object->id."&amp;type=".$typeid."&amp;removeelem=".$soc->id."'>";
@ -461,7 +462,7 @@ if($object->type == 2)
} }
// List of members // List of members
if ($object->type == 3) if ($object->type == Categorie::TYPE_MEMBER)
{ {
require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
@ -493,10 +494,10 @@ if ($object->type == 3)
print '<td align="right">'; print '<td align="right">';
$typeid=$object->type; $typeid=$object->type;
$permission=0; $permission=0;
if ($typeid == 0) $permission=($user->rights->produit->creer || $user->rights->service->creer); if ($typeid == Categorie::TYPE_PRODUCT) $permission=($user->rights->produit->creer || $user->rights->service->creer);
if ($typeid == 1) $permission=$user->rights->societe->creer; if ($typeid == Categorie::TYPE_SUPPLIER) $permission=$user->rights->societe->creer;
if ($typeid == 2) $permission=$user->rights->societe->creer; if ($typeid == Categorie::TYPE_CUSTOMER) $permission=$user->rights->societe->creer;
if ($typeid == 3) $permission=$user->rights->adherent->creer; if ($typeid == Categorie::TYPE_MEMBER) $permission=$user->rights->adherent->creer;
if ($permission) if ($permission)
{ {
print "<a href= '".$_SERVER['PHP_SELF']."?".(empty($socid)?'id':'socid')."=".$object->id."&amp;type=".$typeid."&amp;removeelem=".$member->id."'>"; print "<a href= '".$_SERVER['PHP_SELF']."?".(empty($socid)?'id':'socid')."=".$object->id."&amp;type=".$typeid."&amp;removeelem=".$member->id."'>";
@ -515,7 +516,7 @@ if ($object->type == 3)
} }
//Categorie contact //Categorie contact
if($object->type == 4) if($object->type == Categorie::TYPE_CONTACT)
{ {
$contacts = $object->getObjectsInCateg("contact"); $contacts = $object->getObjectsInCateg("contact");
if ($contacts < 0) if ($contacts < 0)
@ -544,11 +545,11 @@ if($object->type == 4)
print '<td align="right">'; print '<td align="right">';
$typeid=$object->type; $typeid=$object->type;
$permission=0; $permission=0;
if ($typeid == 0) $permission=($user->rights->produit->creer || $user->rights->service->creer); if ($typeid == Categorie::TYPE_PRODUCT) $permission=($user->rights->produit->creer || $user->rights->service->creer);
if ($typeid == 1) $permission=$user->rights->societe->creer; if ($typeid == Categorie::TYPE_SUPPLIER) $permission=$user->rights->societe->creer;
if ($typeid == 2) $permission=$user->rights->societe->creer; if ($typeid == Categorie::TYPE_CUSTOMER) $permission=$user->rights->societe->creer;
if ($typeid == 3) $permission=$user->rights->adherent->creer; if ($typeid == Categorie::TYPE_MEMBER) $permission=$user->rights->adherent->creer;
if ($typeid == 4) $permission=$user->rights->societe->creer; if ($typeid == Categorie::TYPE_CONTACT) $permission=$user->rights->societe->creer;
if ($permission) if ($permission)
{ {
print "<a href= '".$_SERVER['PHP_SELF']."?".(empty($socid)?'id':'socid')."=".$object->id."&amp;type=".$typeid."&amp;removeelem=".$contact->id."'>"; print "<a href= '".$_SERVER['PHP_SELF']."?".(empty($socid)?'id':'socid')."=".$object->id."&amp;type=".$typeid."&amp;removeelem=".$contact->id."'>";

View File

@ -1,11 +1,12 @@
<?php <?php
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Simon TOSSER <simon@kornog-computing.com> * Copyright (C) 2005 Simon TOSSER <simon@kornog-computing.com>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Cedric GROSS <c.gross@kreiz-it.fr> * Copyright (C) 2014 Cedric GROSS <c.gross@kreiz-it.fr>
* Copyright (C) 2015 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -150,7 +151,7 @@ if ($action == 'add')
exit; exit;
} }
$percentage=in_array(GETPOST('status'),array(-1,100))?GETPOST('status'):GETPOST("percentage"); // If status is -1 or 100, percentage is not defined and we must use status $percentage=in_array(GETPOST('status'),array(-1,100))?GETPOST('status'):(in_array(GETPOST('complete'),array(-1,100))?GETPOST('complete'):GETPOST("percentage")); // If status is -1 or 100, percentage is not defined and we must use status
// Clean parameters // Clean parameters
$datep=dol_mktime($fulldayevent?'00':GETPOST("aphour"), $fulldayevent?'00':GETPOST("apmin"), 0, GETPOST("apmonth"), GETPOST("apday"), GETPOST("apyear")); $datep=dol_mktime($fulldayevent?'00':GETPOST("aphour"), $fulldayevent?'00':GETPOST("apmin"), 0, GETPOST("apmonth"), GETPOST("apday"), GETPOST("apyear"));
@ -609,6 +610,8 @@ if ($action == 'create')
if (GETPOST("actioncode") == 'AC_RDV') print_fiche_titre($langs->trans("AddActionRendezVous")); if (GETPOST("actioncode") == 'AC_RDV') print_fiche_titre($langs->trans("AddActionRendezVous"));
else print_fiche_titre($langs->trans("AddAnAction")); else print_fiche_titre($langs->trans("AddAnAction"));
dol_fiche_head();
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Type of event // Type of event
@ -668,7 +671,7 @@ if ($action == 'create')
} }
// Assigned to // Assigned to
print '<tr><td class="nowrap">'.$langs->trans("ActionAffectedTo").'</td><td>'; print '<tr><td class="tdtop nowrap">'.$langs->trans("ActionAffectedTo").'</td><td>';
$listofuserid=array(); $listofuserid=array();
if (empty($donotclearsession)) if (empty($donotclearsession))
{ {
@ -724,7 +727,7 @@ if ($action == 'create')
print '</td></tr>'; print '</td></tr>';
print '<tr><td class="nowrap">'.$langs->trans("ActionOnContact").'</td><td>'; print '<tr><td class="nowrap">'.$langs->trans("ActionOnContact").'</td><td>';
$form->select_contacts(GETPOST('socid','int'),GETPOST('contactid'),'contactid',1); $form->select_contacts(GETPOST('socid','int'), GETPOST('contactid'), 'contactid', 1, '', '', 0, 'minwidth200');
print '</td></tr>'; print '</td></tr>';
@ -736,7 +739,7 @@ if ($action == 'create')
// Projet associe // Projet associe
$langs->load("projects"); $langs->load("projects");
print '<tr><td valign="top">'.$langs->trans("Project").'</td><td>'; print '<tr><td>'.$langs->trans("Project").'</td><td>';
$numproject=$formproject->select_projects((! empty($societe->id)?$societe->id:0),GETPOST("projectid")?GETPOST("projectid"):'','projectid'); $numproject=$formproject->select_projects((! empty($societe->id)?$societe->id:0),GETPOST("projectid")?GETPOST("projectid"):'','projectid');
if ($numproject==0) if ($numproject==0)
@ -765,7 +768,7 @@ if ($action == 'create')
print '</td></tr>'; print '</td></tr>';
// Description // Description
print '<tr><td valign="top">'.$langs->trans("Description").'</td><td>'; print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor=new DolEditor('note',(GETPOST('note')?GETPOST('note'):$object->note),'',180,'dolibarr_notes','In',true,true,$conf->fckeditor->enabled,ROWS_6,90); $doleditor=new DolEditor('note',(GETPOST('note')?GETPOST('note'):$object->note),'',180,'dolibarr_notes','In',true,true,$conf->fckeditor->enabled,ROWS_6,90);
$doleditor->Create(); $doleditor->Create();
@ -784,7 +787,9 @@ if ($action == 'create')
print '</table>'; print '</table>';
print '<br><div class="center">'; dol_fiche_end();
print '<div class="center">';
print '<input type="submit" class="button" value="'.$langs->trans("Add").'">'; print '<input type="submit" class="button" value="'.$langs->trans("Add").'">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'; print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">'; print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
@ -910,7 +915,7 @@ if ($id > 0)
} }
// Assigned to // Assigned to
print '<tr><td class="nowrap">'.$langs->trans("ActionAssignedTo").'</td><td colspan="3">'; print '<tr><td class="tdtop nowrap">'.$langs->trans("ActionAssignedTo").'</td><td colspan="3">';
$listofuserid=array(); $listofuserid=array();
if (empty($donotclearsession)) if (empty($donotclearsession))
{ {
@ -963,7 +968,7 @@ if ($id > 0)
// Contact // Contact
print '<td>'.$langs->trans("Contact").'</td><td width="30%">'; print '<td>'.$langs->trans("Contact").'</td><td width="30%">';
$form->select_contacts($object->socid, $object->contactid,'contactid',1); $form->select_contacts($object->socid, $object->contactid, 'contactid', 1, '', '', 0, 'minwidth200');
print '</td></tr>'; print '</td></tr>';
} }
@ -976,7 +981,7 @@ if ($id > 0)
// Projet associe // Projet associe
$langs->load("project"); $langs->load("project");
print '<tr><td width="30%" valign="top">'.$langs->trans("Project").'</td><td colspan="3">'; print '<tr><td width="30%">'.$langs->trans("Project").'</td><td colspan="3">';
$numprojet=$formproject->select_projects($object->socid,$object->fk_project,'projectid'); $numprojet=$formproject->select_projects($object->socid,$object->fk_project,'projectid');
if ($numprojet==0) if ($numprojet==0)
{ {
@ -999,7 +1004,7 @@ if ($id > 0)
} }
// Description // Description
print '<tr><td valign="top">'.$langs->trans("Description").'</td><td colspan="3">'; print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td colspan="3">';
// Editeur wysiwyg // Editeur wysiwyg
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor=new DolEditor('note',$object->note,'',240,'dolibarr_notes','In',true,true,$conf->fckeditor->enabled,ROWS_5,90); $doleditor=new DolEditor('note',$object->note,'',240,'dolibarr_notes','In',true,true,$conf->fckeditor->enabled,ROWS_5,90);
@ -1163,7 +1168,7 @@ if ($id > 0)
// Project // Project
if (! empty($conf->projet->enabled)) if (! empty($conf->projet->enabled))
{ {
print '<tr><td width="30%" valign="top">'.$langs->trans("Project").'</td><td colspan="3">'; print '<tr><td width="30%">'.$langs->trans("Project").'</td><td colspan="3">';
if ($object->fk_project) if ($object->fk_project)
{ {
$project=new Project($db); $project=new Project($db);
@ -1187,7 +1192,7 @@ if ($id > 0)
} }
// Description // Description
print '<tr><td valign="top">'.$langs->trans("Description").'</td><td colspan="3">'; print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td colspan="3">';
print dol_htmlentitiesbr($object->note); print dol_htmlentitiesbr($object->note);
print '</td></tr>'; print '</td></tr>';
@ -1262,7 +1267,7 @@ if ($id > 0)
print '<input type="hidden" name="month" value="'.dol_print_date($object->datep,'%m').'">'; print '<input type="hidden" name="month" value="'.dol_print_date($object->datep,'%m').'">';
print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">'; print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
//print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">'; //print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
print img_picto($langs->trans("ViewCal"),'object_calendar','class="hideonsmartphone"').' <input type="submit" style="min-width: 120px" class="button" name="viewcal" value="'.$langs->trans("ViewCal").'">'; print img_picto($langs->trans("ViewCal"),'object_calendar','class="hideonsmartphone pictoactionview"').' <input type="submit" style="min-width: 120px" class="button buttonactionview" name="viewcal" value="'.$langs->trans("ViewCal").'">';
print '</form>'."\n"; print '</form>'."\n";
print '<form name="listactionsfilterweek" action="'.DOL_URL_ROOT.'/comm/action/index.php" method="POST" style="float: left; padding-right: 10px;">'; print '<form name="listactionsfilterweek" action="'.DOL_URL_ROOT.'/comm/action/index.php" method="POST" style="float: left; padding-right: 10px;">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@ -1271,7 +1276,7 @@ if ($id > 0)
print '<input type="hidden" name="month" value="'.dol_print_date($object->datep,'%m').'">'; print '<input type="hidden" name="month" value="'.dol_print_date($object->datep,'%m').'">';
print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">'; print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
//print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">'; //print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
print img_picto($langs->trans("ViewCal"),'object_calendarweek','class="hideonsmartphone"').' <input type="submit" style="min-width: 120px" class="button" name="viewweek" value="'.$langs->trans("ViewWeek").'">'; print img_picto($langs->trans("ViewCal"),'object_calendarweek','class="hideonsmartphone pictoactionview"').' <input type="submit" style="min-width: 120px" class="button buttonactionview" name="viewweek" value="'.$langs->trans("ViewWeek").'">';
print '</form>'."\n"; print '</form>'."\n";
print '<form name="listactionsfilterday" action="'.DOL_URL_ROOT.'/comm/action/index.php" method="POST" style="float: left; padding-right: 10px;">'; print '<form name="listactionsfilterday" action="'.DOL_URL_ROOT.'/comm/action/index.php" method="POST" style="float: left; padding-right: 10px;">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@ -1280,7 +1285,7 @@ if ($id > 0)
print '<input type="hidden" name="month" value="'.dol_print_date($object->datep,'%m').'">'; print '<input type="hidden" name="month" value="'.dol_print_date($object->datep,'%m').'">';
print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">'; print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
//print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">'; //print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
print img_picto($langs->trans("ViewCal"),'object_calendarday','class="hideonsmartphone"').' <input type="submit" style="min-width: 120px" class="button" name="viewday" value="'.$langs->trans("ViewDay").'">'; print img_picto($langs->trans("ViewCal"),'object_calendarday','class="hideonsmartphone pictoactionview"').' <input type="submit" style="min-width: 120px" class="button buttonactionview" name="viewday" value="'.$langs->trans("ViewDay").'">';
print '</form>'."\n"; print '</form>'."\n";
print '<form name="listactionsfilterperuser" action="'.DOL_URL_ROOT.'/comm/action/peruser.php" method="POST" style="float: left; padding-right: 10px;">'; print '<form name="listactionsfilterperuser" action="'.DOL_URL_ROOT.'/comm/action/peruser.php" method="POST" style="float: left; padding-right: 10px;">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@ -1289,7 +1294,7 @@ if ($id > 0)
print '<input type="hidden" name="month" value="'.dol_print_date($object->datep,'%m').'">'; print '<input type="hidden" name="month" value="'.dol_print_date($object->datep,'%m').'">';
print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">'; print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
//print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">'; //print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
print img_picto($langs->trans("ViewCal"),'object_calendarperuser','class="hideonsmartphone"').' <input type="submit" style="min-width: 120px" class="button" name="viewperuser" value="'.$langs->trans("ViewPerUser").'">'; print img_picto($langs->trans("ViewCal"),'object_calendarperuser','class="hideonsmartphone pictoactionview"').' <input type="submit" style="min-width: 120px" class="button buttonactionview" name="viewperuser" value="'.$langs->trans("ViewPerUser").'">';
print '</form>'."\n"; print '</form>'."\n";
print '</div>'; print '</div>';

View File

@ -685,6 +685,10 @@ class ActionComm extends CommonObject
foreach($this->userassigned as $key => $val) foreach($this->userassigned as $key => $val)
{ {
if (! is_array($val)) // For backward compatibility when val=id
{
$val=array('id'=>$val);
}
$sql ="INSERT INTO ".MAIN_DB_PREFIX."actioncomm_resources(fk_actioncomm, element_type, fk_element, mandatory, transparency, answer_status)"; $sql ="INSERT INTO ".MAIN_DB_PREFIX."actioncomm_resources(fk_actioncomm, element_type, fk_element, mandatory, transparency, answer_status)";
$sql.=" VALUES(".$this->id.", 'user', ".$val['id'].", ".(empty($val['manadatory'])?'0':$val['manadatory']).", ".(empty($val['transparency'])?'0':$val['transparency']).", ".(empty($val['answer_status'])?'0':$val['answer_status']).")"; $sql.=" VALUES(".$this->id.", 'user', ".$val['id'].", ".(empty($val['manadatory'])?'0':$val['manadatory']).", ".(empty($val['transparency'])?'0':$val['transparency']).", ".(empty($val['answer_status'])?'0':$val['answer_status']).")";

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com> * Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2005 Simon TOSSER <simon@kornog-computing.com> * Copyright (C) 2005 Simon TOSSER <simon@kornog-computing.com>
@ -143,7 +143,7 @@ if ($object->id > 0)
print '<tr><td>'.$langs->trans("Title").'</td><td colspan="3">'.$object->label.'</td></tr>'; print '<tr><td>'.$langs->trans("Title").'</td><td colspan="3">'.$object->label.'</td></tr>';
// Full day event // Full day event
print '<tr><td>'.$langs->trans("EventOnFullDay").'</td><td colspan="3">'.yn($object->fulldayevent).'</td></tr>'; print '<tr><td>'.$langs->trans("EventOnFullDay").'</td><td colspan="3">'.yn($object->fulldayevent, 3).'</td></tr>';
// Date start // Date start
print '<tr><td width="30%">'.$langs->trans("DateActionStart").'</td><td colspan="3">'; print '<tr><td width="30%">'.$langs->trans("DateActionStart").'</td><td colspan="3">';
@ -235,7 +235,7 @@ if ($object->id > 0)
// Project // Project
if (! empty($conf->projet->enabled)) if (! empty($conf->projet->enabled))
{ {
print '<tr><td valign="top">'.$langs->trans("Project").'</td><td colspan="3">'; print '<tr><td class="tdtop">'.$langs->trans("Project").'</td><td colspan="3">';
if ($object->fk_project) if ($object->fk_project)
{ {
$project=new Project($db); $project=new Project($db);
@ -274,7 +274,7 @@ if ($object->id > 0)
} }
print '<tr><td width="30%" nowrap>'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>'; print '<tr><td width="30%" class="nowrap">'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>'; print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>';
print '</table>'; print '</table>';
@ -294,7 +294,7 @@ if ($object->id > 0)
print '<input type="hidden" name="month" value="'.dol_print_date($object->datep,'%m').'">'; print '<input type="hidden" name="month" value="'.dol_print_date($object->datep,'%m').'">';
print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">'; print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
//print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">'; //print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
print img_picto($langs->trans("ViewCal"),'object_calendar','class="hideonsmartphone"').' <input type="submit" style="min-width: 120px" class="button" name="viewcal" value="'.$langs->trans("ViewCal").'">'; print img_picto($langs->trans("ViewCal"),'object_calendar','class="hideonsmartphone pictoactionview"').' <input type="submit" style="min-width: 120px" class="button buttonactionview" name="viewcal" value="'.$langs->trans("ViewCal").'">';
print '</form>'."\n"; print '</form>'."\n";
print '<form name="listactionsfilterweek" action="'.DOL_URL_ROOT.'/comm/action/index.php" method="POST" style="float: left; padding-right: 10px;">'; print '<form name="listactionsfilterweek" action="'.DOL_URL_ROOT.'/comm/action/index.php" method="POST" style="float: left; padding-right: 10px;">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@ -303,7 +303,7 @@ if ($object->id > 0)
print '<input type="hidden" name="month" value="'.dol_print_date($object->datep,'%m').'">'; print '<input type="hidden" name="month" value="'.dol_print_date($object->datep,'%m').'">';
print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">'; print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
//print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">'; //print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
print img_picto($langs->trans("ViewCal"),'object_calendarweek','class="hideonsmartphone"').' <input type="submit" style="min-width: 120px" class="button" name="viewweek" value="'.$langs->trans("ViewWeek").'">'; print img_picto($langs->trans("ViewCal"),'object_calendarweek','class="hideonsmartphone pictoactionview"').' <input type="submit" style="min-width: 120px" class="button buttonactionview" name="viewweek" value="'.$langs->trans("ViewWeek").'">';
print '</form>'."\n"; print '</form>'."\n";
print '<form name="listactionsfilterday" action="'.DOL_URL_ROOT.'/comm/action/index.php" method="POST" style="float: left; padding-right: 10px;">'; print '<form name="listactionsfilterday" action="'.DOL_URL_ROOT.'/comm/action/index.php" method="POST" style="float: left; padding-right: 10px;">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@ -312,7 +312,7 @@ if ($object->id > 0)
print '<input type="hidden" name="month" value="'.dol_print_date($object->datep,'%m').'">'; print '<input type="hidden" name="month" value="'.dol_print_date($object->datep,'%m').'">';
print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">'; print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
//print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">'; //print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
print img_picto($langs->trans("ViewCal"),'object_calendarday','class="hideonsmartphone"').' <input type="submit" style="min-width: 120px" class="button" name="viewday" value="'.$langs->trans("ViewDay").'">'; print img_picto($langs->trans("ViewCal"),'object_calendarday','class="hideonsmartphone pictoactionview"').' <input type="submit" style="min-width: 120px" class="button buttonactionview" name="viewday" value="'.$langs->trans("ViewDay").'">';
print '</form>'."\n"; print '</form>'."\n";
print '<form name="listactionsfilterperuser" action="'.DOL_URL_ROOT.'/comm/action/peruser.php" method="POST" style="float: left; padding-right: 10px;">'; print '<form name="listactionsfilterperuser" action="'.DOL_URL_ROOT.'/comm/action/peruser.php" method="POST" style="float: left; padding-right: 10px;">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@ -321,7 +321,7 @@ if ($object->id > 0)
print '<input type="hidden" name="month" value="'.dol_print_date($object->datep,'%m').'">'; print '<input type="hidden" name="month" value="'.dol_print_date($object->datep,'%m').'">';
print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">'; print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
//print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">'; //print '<input type="hidden" name="day" value="'.dol_print_date($object->datep,'%d').'">';
print img_picto($langs->trans("ViewCal"),'object_calendarperuser','class="hideonsmartphone"').' <input type="submit" style="min-width: 120px" class="button" name="viewperuser" value="'.$langs->trans("ViewPerUser").'">'; print img_picto($langs->trans("ViewCal"),'object_calendarperuser','class="hideonsmartphone pictoactionview"').' <input type="submit" style="min-width: 120px" class="button buttonactionview" name="viewperuser" value="'.$langs->trans("ViewPerUser").'">';
print '</form>'."\n"; print '</form>'."\n";
print '</div>'; print '</div>';

View File

@ -1737,7 +1737,7 @@ if ($action == 'create')
$ref = dol_sanitizeFileName($object->ref); $ref = dol_sanitizeFileName($object->ref);
include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
$fileparams = dol_most_recent_file($conf->askpricesupplier->dir_output . '/' . $ref, preg_quote($ref, '/')); $fileparams = dol_most_recent_file($conf->askpricesupplier->dir_output . '/' . $ref, preg_quote($ref, '/'));
$file = $fileparams ['fullname']; $file = $fileparams['fullname'];
// Define output language // Define output language
$outputlangs = $langs; $outputlangs = $langs;
@ -1763,7 +1763,7 @@ if ($action == 'create')
exit(); exit();
} }
$fileparams = dol_most_recent_file($conf->askpricesupplier->dir_output . '/' . $ref, preg_quote($ref, '/')); $fileparams = dol_most_recent_file($conf->askpricesupplier->dir_output . '/' . $ref, preg_quote($ref, '/'));
$file = $fileparams ['fullname']; $file = $fileparams['fullname'];
} }
print '<br>'; print '<br>';

View File

@ -675,6 +675,8 @@ if ($action == 'create')
print_fiche_titre($langs->trans("NewMailing")); print_fiche_titre($langs->trans("NewMailing"));
dol_fiche_head();
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
print '<tr><td width="25%" class="fieldrequired">'.$langs->trans("MailTitle").'</td><td><input class="flat" name="titre" size="40" value="'.$_POST['titre'].'"></td></tr>'; print '<tr><td width="25%" class="fieldrequired">'.$langs->trans("MailTitle").'</td><td><input class="flat" name="titre" size="40" value="'.$_POST['titre'].'"></td></tr>';
print '<tr><td width="25%" class="fieldrequired">'.$langs->trans("MailFrom").'</td><td><input class="flat" name="from" size="40" value="'.$conf->global->MAILING_EMAIL_FROM.'"></td></tr>'; print '<tr><td width="25%" class="fieldrequired">'.$langs->trans("MailFrom").'</td><td><input class="flat" name="from" size="40" value="'.$conf->global->MAILING_EMAIL_FROM.'"></td></tr>';
@ -706,12 +708,14 @@ if ($action == 'create')
print '<td>'; print '<td>';
// Editeur wysiwyg // Editeur wysiwyg
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
$doleditor=new DolEditor('body',$_POST['body'],'',320,'dolibarr_mailings','',true,true,$conf->global->FCKEDITOR_ENABLE_MAILING,20,70); $doleditor=new DolEditor('body',$_POST['body'],'',320,'dolibarr_mailings','',true,true,$conf->global->FCKEDITOR_ENABLE_MAILING,20,'90%');
$doleditor->Create(); $doleditor->Create();
print '</td></tr>'; print '</td></tr>';
print '</table>'; print '</table>';
print '<br><div class="center"><input type="submit" class="button" value="'.$langs->trans("CreateMailing").'"></div>'; dol_fiche_end();
print '<div class="center"><input type="submit" class="button" value="'.$langs->trans("CreateMailing").'"></div>';
print '</form>'; print '</form>';
} }

View File

@ -640,7 +640,6 @@ if (empty($reshook))
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
// Go back to draft // Go back to draft
if ($action == 'modif' && $user->rights->propal->creer) if ($action == 'modif' && $user->rights->propal->creer)
{ {
@ -2312,7 +2311,7 @@ if ($action == 'create')
$ref = dol_sanitizeFileName($object->ref); $ref = dol_sanitizeFileName($object->ref);
include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
$fileparams = dol_most_recent_file($conf->propal->dir_output . '/' . $ref, preg_quote($ref, '/')); $fileparams = dol_most_recent_file($conf->propal->dir_output . '/' . $ref, preg_quote($ref, '/'));
$file = $fileparams ['fullname']; $file = $fileparams['fullname'];
// Define output language // Define output language
$outputlangs = $langs; $outputlangs = $langs;
@ -2337,7 +2336,7 @@ if ($action == 'create')
exit(); exit();
} }
$fileparams = dol_most_recent_file($conf->propal->dir_output . '/' . $ref, preg_quote($ref, '/')); $fileparams = dol_most_recent_file($conf->propal->dir_output . '/' . $ref, preg_quote($ref, '/'));
$file = $fileparams ['fullname']; $file = $fileparams['fullname'];
} }
print '<br>'; print '<br>';

View File

@ -115,7 +115,7 @@ if ($resql)
} }
$db->free($resql); $db->free($resql);
print '<table class="noborder" width="100%">'; print '<table class="noborder nohover" width="100%">';
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Statistics").' - '.$langs->trans("Proposals").'</td></tr>'."\n"; print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Statistics").' - '.$langs->trans("Proposals").'</td></tr>'."\n";
$var=true; $var=true;
$listofstatus=array(0,1,2,3,4); $listofstatus=array(0,1,2,3,4);

View File

@ -1,11 +1,12 @@
<?php <?php
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2011 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2011 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr> * Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr> * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -219,34 +220,23 @@ $sql.= " AND s.client IN (2, 3)";
$sql.= ' AND s.entity IN ('.getEntity('societe', 1).')'; $sql.= ' AND s.entity IN ('.getEntity('societe', 1).')';
if ((!$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc"; if ((!$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc";
if ($socid) $sql.= " AND s.rowid = " .$socid; if ($socid) $sql.= " AND s.rowid = " .$socid;
if ($search_stcomm != '') $sql.= " AND s.fk_stcomm=".$search_stcomm; if ($search_stcomm != '') $sql.= natural_search("s.fk_stcomm",$search_stcomm,2);
if ($catid > 0) $sql.= " AND cs.fk_categorie = ".$catid; if ($catid > 0) $sql.= " AND cs.fk_categorie = ".$catid;
if ($catid == -2) $sql.= " AND cs.fk_categorie IS NULL"; if ($catid == -2) $sql.= " AND cs.fk_categorie IS NULL";
if ($search_categ > 0) $sql.= " AND cs.fk_categorie = ".$search_categ; if ($search_categ > 0) $sql.= " AND cs.fk_categorie = ".$search_categ;
if ($search_categ == -2) $sql.= " AND cs.fk_categorie IS NULL"; if ($search_categ == -2) $sql.= " AND cs.fk_categorie IS NULL";
if ($search_nom) { if ($search_nom) $sql .= natural_search('s.nom', $search_nom);
$sql .= natural_search('s.nom', $search_nom);
}
if ($search_zipcode) $sql .= " AND s.zip LIKE '".$db->escape(strtolower($search_zipcode))."%'"; if ($search_zipcode) $sql .= " AND s.zip LIKE '".$db->escape(strtolower($search_zipcode))."%'";
if ($search_town) { if ($search_town) $sql .= natural_search('s.town', $search_town);
$sql .= natural_search('s.town', $search_town); if ($search_state) $sql .= natural_search('d.nom', $search_state);
} if ($search_datec) $sql .= " AND s.datec LIKE '%".$db->escape($search_datec)."%'";
if ($search_state) {
$sql .= natural_search('d.nom', $search_state);
}
if ($search_datec) $sql .= " AND s.datec LIKE '%".$db->escape($search_datec)."%'";
if ($search_status!='') $sql .= " AND s.status = ".$db->escape($search_status); if ($search_status!='') $sql .= " AND s.status = ".$db->escape($search_status);
// Insert levels filters // Insert levels filters
if ($search_levels) if ($search_levels) $sql .= " AND s.fk_prospectlevel IN (".$search_levels.')';
{
$sql .= " AND s.fk_prospectlevel IN (".$search_levels.')';
}
// Insert sale filter // Insert sale filter
if ($search_sale > 0) if ($search_sale > 0) $sql .= " AND sc.fk_user = ".$db->escape($search_sale);
if ($socname)
{ {
$sql .= " AND sc.fk_user = ".$db->escape($search_sale);
}
if ($socname) {
$sql .= natural_search('s.nom', $search_nom); $sql .= natural_search('s.nom', $search_nom);
$sortfield = "s.nom"; $sortfield = "s.nom";
$sortorder = "ASC"; $sortorder = "ASC";
@ -309,8 +299,9 @@ if ($resql)
$moreforfilter=''; $moreforfilter='';
if (! empty($conf->categorie->enabled)) if (! empty($conf->categorie->enabled))
{ {
require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
$moreforfilter.=$langs->trans('Categories'). ': '; $moreforfilter.=$langs->trans('Categories'). ': ';
$moreforfilter.=$formother->select_categories(2,$search_categ,'search_categ',1); $moreforfilter.=$formother->select_categories(Categorie::TYPE_CUSTOMER,$search_categ,'search_categ',1);
$moreforfilter.=' &nbsp; &nbsp; &nbsp; '; $moreforfilter.=' &nbsp; &nbsp; &nbsp; ';
} }
// If the user can view prospects other than his' // If the user can view prospects other than his'
@ -362,22 +353,17 @@ if ($resql)
print '<input class="flat" type="text" size="10" name="search_datec" value="'.$search_datec.'">'; print '<input class="flat" type="text" size="10" name="search_datec" value="'.$search_datec.'">';
print '</td>'; print '</td>';
// Added by Matelli // Prospect levelt
print '<td class="liste_titre" align="center">'; print '<td class="liste_titre" align="center">';
// Generate in $options_from the list of each option sorted $options_from = '<option value="">&nbsp;</option>'; // Generate in $options_from the list of each option sorted
$options_from = '<option value="">&nbsp;</option>';
foreach ($tab_level as $tab_level_sortorder => $tab_level_label) foreach ($tab_level as $tab_level_sortorder => $tab_level_label)
{ {
$options_from .= '<option value="'.$tab_level_sortorder.'"'.($search_level_from == $tab_level_sortorder ? ' selected':'').'>'; $options_from .= '<option value="'.$tab_level_sortorder.'"'.($search_level_from == $tab_level_sortorder ? ' selected':'').'>';
$options_from .= $langs->trans($tab_level_label); $options_from .= $langs->trans($tab_level_label);
$options_from .= '</option>'; $options_from .= '</option>';
} }
array_reverse($tab_level, true); // Reverse the list
// Reverse the list $options_to = '<option value="">&nbsp;</option>'; // Generate in $options_to the list of each option sorted in the reversed order
array_reverse($tab_level, true);
// Generate in $options_to the list of each option sorted in the reversed order
$options_to = '<option value="">&nbsp;</option>';
foreach ($tab_level as $tab_level_sortorder => $tab_level_label) foreach ($tab_level as $tab_level_sortorder => $tab_level_label)
{ {
$options_to .= '<option value="'.$tab_level_sortorder.'"'.($search_level_to == $tab_level_sortorder ? ' selected':'').'>'; $options_to .= '<option value="'.$tab_level_sortorder.'"'.($search_level_to == $tab_level_sortorder ? ' selected':'').'>';
@ -392,8 +378,11 @@ if ($resql)
print '</td>'; print '</td>';
// Prospect status
print '<td class="liste_titre" align="center">'; print '<td class="liste_titre" align="center">';
print '&nbsp;'; // TODO Add here a list of prospect status
//print $form->selectarray($htmlname, $array, $search_stcomm);
//print '&nbsp;';
print '</td>'; print '</td>';
print '<td class="liste_titre" align="center">'; print '<td class="liste_titre" align="center">';

View File

@ -2325,7 +2325,7 @@ if ($action == 'create' && $user->rights->commande->creer)
$ref = dol_sanitizeFileName($object->ref); $ref = dol_sanitizeFileName($object->ref);
include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
$fileparams = dol_most_recent_file($conf->commande->dir_output . '/' . $ref, preg_quote($ref, '/')); $fileparams = dol_most_recent_file($conf->commande->dir_output . '/' . $ref, preg_quote($ref, '/'));
$file = $fileparams ['fullname']; $file = $fileparams['fullname'];
// Define output language // Define output language
$outputlangs = $langs; $outputlangs = $langs;
@ -2350,7 +2350,7 @@ if ($action == 'create' && $user->rights->commande->creer)
exit(); exit();
} }
$fileparams = dol_most_recent_file($conf->commande->dir_output . '/' . $ref, preg_quote($ref, '/')); $fileparams = dol_most_recent_file($conf->commande->dir_output . '/' . $ref, preg_quote($ref, '/'));
$file = $fileparams ['fullname']; $file = $fileparams['fullname'];
} }
print '<br>'; print '<br>';

View File

@ -115,7 +115,7 @@ if ($resql)
$i++; $i++;
} }
$db->free($resql); $db->free($resql);
print '<table class="noborder" width="100%">'; print '<table class="noborder nohover" width="100%">';
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Statistics").' - '.$langs->trans("CustomersOrders").'</td></tr>'."\n"; print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Statistics").' - '.$langs->trans("CustomersOrders").'</td></tr>'."\n";
$listofstatus=array(0,1,2,3,3,-1); $listofstatus=array(0,1,2,3,3,-1);
$bool=false; $bool=false;

View File

@ -1759,10 +1759,8 @@ if (empty($reshook))
$upload_dir = $conf->facture->dir_output; $upload_dir = $conf->facture->dir_output;
$file = $upload_dir . '/' . GETPOST('file'); $file = $upload_dir . '/' . GETPOST('file');
$ret = dol_delete_file($file, 0, 0, 0, $object); $ret = dol_delete_file($file, 0, 0, 0, $object);
if ($ret) if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile')));
setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile'))); else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors');
else
setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors');
$action = ''; $action = '';
} }
} }
@ -2479,7 +2477,7 @@ if ($action == 'create')
// Button "Create Draft" // Button "Create Draft"
print '<div class="center">'; print '<div class="center">';
print '<input type="submit" class="button" name="bouton" value="' . $langs->trans('CreateDraft') . '">'; print '<input type="submit" class="button" name="bouton" value="' . $langs->trans('CreateDraft') . '">';
print '&nbsp; &nbsp; &nbsp;'; print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<input type="button" class="button" value="' . $langs->trans("Cancel") . '" onClick="javascript:history.go(-1)">'; print '<input type="button" class="button" value="' . $langs->trans("Cancel") . '" onClick="javascript:history.go(-1)">';
print '</div>'; print '</div>';
@ -3754,7 +3752,7 @@ if ($action == 'create')
} }
print '<br>'; print '<br>';
//Select mail models is same action as presend // Select mail models is same action as presend
if (GETPOST('modelselected')) { if (GETPOST('modelselected')) {
$action = 'presend'; $action = 'presend';
} }
@ -3834,7 +3832,7 @@ if ($action == 'create')
$i ++; $i ++;
} }
print '</table>'; print '</table>';
print '<div class="center"><input type="submit" class="button" value="' . $langs->trans('ToLink') . '"> &nbsp; <input type="submit" class="button" name="cancel" value="' . $langs->trans('Cancel') . '"></div>'; print '<div class="center"><input type="submit" class="button" value="' . $langs->trans('ToLink') . '">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="submit" class="button" name="cancel" value="' . $langs->trans('Cancel') . '"></div>';
print '</form>'; print '</form>';
$db->free($resqlorderlist); $db->free($resqlorderlist);
} else { } else {
@ -3887,7 +3885,7 @@ if ($action == 'create')
$ref = dol_sanitizeFileName($object->ref); $ref = dol_sanitizeFileName($object->ref);
include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
$fileparams = dol_most_recent_file($conf->facture->dir_output . '/' . $ref, preg_quote($ref, '/')); $fileparams = dol_most_recent_file($conf->facture->dir_output . '/' . $ref, preg_quote($ref, '/'));
$file = $fileparams ['fullname']; $file = $fileparams['fullname'];
// Define output language // Define output language
$outputlangs = $langs; $outputlangs = $langs;
@ -3912,13 +3910,15 @@ if ($action == 'create')
exit(); exit();
} }
$fileparams = dol_most_recent_file($conf->facture->dir_output . '/' . $ref, preg_quote($ref, '/')); $fileparams = dol_most_recent_file($conf->facture->dir_output . '/' . $ref, preg_quote($ref, '/'));
$file = $fileparams ['fullname']; $file = $fileparams['fullname'];
} }
print '<br>'; print '<br>';
print_titre($langs->trans($titreform)); print_titre($langs->trans($titreform));
// Cree l'objet formulaire mail // Cree l'objet formulaire mail
dol_fiche_head();
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php'; include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
$formmail = new FormMail($db); $formmail = new FormMail($db);
$formmail->param['langsmodels']=(empty($newlang)?$langs->defaultlang:$newlang); $formmail->param['langsmodels']=(empty($newlang)?$langs->defaultlang:$newlang);
@ -3990,7 +3990,7 @@ if ($action == 'create')
print $formmail->get_form(); print $formmail->get_form();
print '<br>'; dol_fiche_end();
} }
} }

View File

@ -3203,7 +3203,7 @@ class Facture extends CommonInvoice
$response = new WorkboardResponse(); $response = new WorkboardResponse();
$response->warning_delay=$conf->facture->client->warning_delay/60/60/24; $response->warning_delay=$conf->facture->client->warning_delay/60/60/24;
$response->label=$langs->trans("CustomerBillsUnpaid"); $response->label=$langs->trans("CustomerBillsUnpaid");
$response->url=DOL_URL_ROOT.'/compta/facture/impayees.php'; $response->url=DOL_URL_ROOT.'/compta/facture/list.php?search_status=1';
$response->img=img_object($langs->trans("Bills"),"bill"); $response->img=img_object($langs->trans("Bills"),"bill");
while ($obj=$this->db->fetch_object($resql)) while ($obj=$this->db->fetch_object($resql))

View File

@ -84,6 +84,8 @@ class FactureStats extends Stats
$this->where.=" AND f.fk_soc = ".$this->socid; $this->where.=" AND f.fk_soc = ".$this->socid;
} }
if ($this->userid > 0) $this->where.=' AND f.fk_user_author = '.$this->userid; if ($this->userid > 0) $this->where.=' AND f.fk_user_author = '.$this->userid;
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $this->where.= " AND f.type IN (0,1,2)";
else $this->where.= " AND f.type IN (0,1,2,3)";
} }
@ -206,7 +208,7 @@ class FactureStats extends Stats
$sql = "SELECT product.ref, COUNT(product.ref) as nb, SUM(tl.".$this->field_line.") as total, AVG(tl.".$this->field_line.") as avg"; $sql = "SELECT product.ref, COUNT(product.ref) as nb, SUM(tl.".$this->field_line.") as total, AVG(tl.".$this->field_line.") as avg";
$sql.= " FROM ".$this->from.", ".$this->from_line.", ".MAIN_DB_PREFIX."product as product"; $sql.= " FROM ".$this->from.", ".$this->from_line.", ".MAIN_DB_PREFIX."product as product";
//if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; if (!$user->rights->societe->client->voir && !$this->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE ".$this->where; $sql.= " WHERE ".$this->where;
$sql.= " AND f.rowid = tl.fk_facture AND tl.fk_product = product.rowid"; $sql.= " AND f.rowid = tl.fk_facture AND tl.fk_product = product.rowid";
$sql.= " AND f.datef BETWEEN '".$this->db->idate(dol_get_first_day($year,1,false))."' AND '".$this->db->idate(dol_get_last_day($year,12,false))."'"; $sql.= " AND f.datef BETWEEN '".$this->db->idate(dol_get_first_day($year,1,false))."' AND '".$this->db->idate(dol_get_last_day($year,12,false))."'";

View File

@ -2,10 +2,11 @@
/* Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr> * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr> * Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2015 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -128,6 +129,8 @@ if ($action == 'create')
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="add">'; print '<input type="hidden" name="action" value="add">';
print '<input type="hidden" name="facid" value="'.$object->id.'">'; print '<input type="hidden" name="facid" value="'.$object->id.'">';
dol_fiche_head();
$rowspan=4; $rowspan=4;
if (! empty($conf->projet->enabled) && $object->fk_project > 0) $rowspan++; if (! empty($conf->projet->enabled) && $object->fk_project > 0) $rowspan++;
@ -139,7 +142,7 @@ if ($action == 'create')
// Third party // Third party
print '<tr><td>'.$langs->trans("Customer").'</td><td>'.$object->client->getNomUrl(1,'customer').'</td>'; print '<tr><td>'.$langs->trans("Customer").'</td><td>'.$object->client->getNomUrl(1,'customer').'</td>';
print '<td>'; print '<td>';
//print $langs->trans("NotePrivate"); print $langs->trans("Comment");
print '</td></tr>'; print '</td></tr>';
// Title // Title
@ -371,10 +374,15 @@ if ($action == 'create')
print '</select>'; print '</select>';
print '</td></tr>'; print '</td></tr>';
} }
print '<tr><td colspan="3" align="center"><br><input type="submit" class="button" value="'.$langs->trans("Create").'"></td></tr>';
print "</form>\n";
print "</table>\n"; print "</table>\n";
dol_fiche_end();
print '<div align="center"><input type="submit" class="button" value="'.$langs->trans("Create").'">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
print '<input type="button" class="button" value="' . $langs->trans("Cancel") . '" onClick="javascript:history.go(-1)">';
print '</div>';
print "</form>\n";
} }
else else
{ {
@ -432,7 +440,7 @@ else
$form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id,'none'); $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id,'none');
print "</td></tr>"; print "</td></tr>";
print '<tr><td>'.$langs->trans("Note").'</td><td colspan="3">'.nl2br($object->note_private)."</td></tr>"; print '<tr><td>'.$langs->trans("Comment").'</td><td colspan="3">'.nl2br($object->note_private)."</td></tr>";
print "</table>"; print "</table>";

View File

@ -775,7 +775,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
$i = 0; $i = 0;
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("BillsCustomersUnpaid",$num).' <a href="'.DOL_URL_ROOT.'/compta/facture/impayees.php"><span class="badge">'.$num.'</span></a></td>'; print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("BillsCustomersUnpaid",$num).' <a href="'.DOL_URL_ROOT.'/compta/facture/list.php?search_status=1"><span class="badge">'.$num.'</span></a></td>';
if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) print '<td align="right">'.$langs->trans("AmountHT").'</td>'; if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) print '<td align="right">'.$langs->trans("AmountHT").'</td>';
print '<td align="right">'.$langs->trans("AmountTTC").'</td>'; print '<td align="right">'.$langs->trans("AmountTTC").'</td>';
print '<td align="right">'.$langs->trans("Received").'</td>'; print '<td align="right">'.$langs->trans("Received").'</td>';

View File

@ -6,7 +6,7 @@
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be> * Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be>
* Copyright (C) 2012 Cédric Salvador <csalvador@gpcsolutions.fr> * Copyright (C) 2012 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr> * Copyright (C) 2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2014 Teddy Andreotti <125155@supinfo.com> * Copyright (C) 2014 Teddy Andreotti <125155@supinfo.com>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -403,6 +403,8 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
print '<input type="hidden" name="type" id="invoice_type" value="'.$facture->type.'">'; print '<input type="hidden" name="type" id="invoice_type" value="'.$facture->type.'">';
print '<input type="hidden" name="thirdpartylabel" id="thirdpartylabel" value="'.dol_escape_htmltag($facture->client->name).'">'; print '<input type="hidden" name="thirdpartylabel" id="thirdpartylabel" value="'.dol_escape_htmltag($facture->client->name).'">';
dol_fiche_head();
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Third party // Third party
@ -462,6 +464,8 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
print '</table>'; print '</table>';
dol_fiche_end();
/* /*
* List of unpaid invoices * List of unpaid invoices
*/ */

View File

@ -4,6 +4,7 @@
* Copyright (C) 2009-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2009-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2013 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2015 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -347,7 +348,9 @@ if ($action == 'new')
print '<form class="nocellnopadd" action="'.$_SERVER["PHP_SELF"].'" method="POST">'; print '<form class="nocellnopadd" action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<input type="hidden" name="action" value="new">'; print '<input type="hidden" name="action" value="new">';
//print '<fieldset><legend>aaa</legend>';
dol_fiche_head();
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
//print '<tr><td width="30%">'.$langs->trans('Date').'</td><td width="70%">'.dol_print_date($now,'day').'</td></tr>'; //print '<tr><td width="30%">'.$langs->trans('Date').'</td><td width="70%">'.dol_print_date($now,'day').'</td></tr>';
// Filter // Filter
@ -358,6 +361,9 @@ if ($action == 'new')
$form->select_comptes($filteraccountid,'accountid',0,'courant <> 2',1); $form->select_comptes($filteraccountid,'accountid',0,'courant <> 2',1);
print '</td></tr>'; print '</td></tr>';
print '</table>'; print '</table>';
dol_fiche_end();
print '<div class="center">'; print '<div class="center">';
print '<input type="submit" class="button" name="filter" value="'.dol_escape_htmltag($langs->trans("ToFilter")).'">'; print '<input type="submit" class="button" name="filter" value="'.dol_escape_htmltag($langs->trans("ToFilter")).'">';
if ($filterdate || $filteraccountid > 0) if ($filterdate || $filteraccountid > 0)
@ -366,8 +372,7 @@ if ($action == 'new')
print '<input type="submit" class="button" name="removefilter" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">'; print '<input type="submit" class="button" name="removefilter" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
} }
print '</div>'; print '</div>';
//print '</fieldset>'; print '</form>';
print '</form>';
print '<br>'; print '<br>';
$sql = "SELECT ba.rowid as bid, b.datec as datec, b.dateo as date, b.rowid as chqid, "; $sql = "SELECT ba.rowid as bid, b.datec as datec, b.dateo as date, b.rowid as chqid, ";

View File

@ -0,0 +1,136 @@
<?php
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2005 Simon TOSSER <simon@kornog-computing.com>
* Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2015 Alexandre Spangaro <alexandre.spangaro@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* or see http://www.gnu.org/
*/
/**
* \file htdocs/compta/salaries/document.php
* \ingroup salaries
* \brief Page of linked files onto salaries
*/
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/salaries.lib.php';
require_once DOL_DOCUMENT_ROOT.'/compta/salaries/class/paymentsalary.class.php';
$langs->load("other");
$langs->load("salaries");
$langs->load("companies");
$id = GETPOST('id','int');
$ref = GETPOST('ref', 'alpha');
$action = GETPOST('action','alpha');
$confirm = GETPOST('confirm','alpha');
// Security check
if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'salaries', $id, '');
// Get parameters
$sortfield = GETPOST('sortfield','alpha');
$sortorder = GETPOST('sortorder','alpha');
$page = GETPOST('page','int');
if ($page == -1) { $page = 0; }
$offset = $conf->liste_limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (! $sortorder) $sortorder="ASC";
if (! $sortfield) $sortfield="name";
$object = new PaymentSalary($db);
$object->fetch($id, $ref);
$upload_dir = $conf->salaries->dir_output.'/'.dol_sanitizeFileName($object->id);
$modulepart='salaries';
/*
* Actions
*/
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_pre_headers.tpl.php';
/*
* View
*/
$form = new Form($db);
llxHeader("","",$langs->trans("SalaryPayment"));
if ($object->id)
{
$object->fetch_thirdparty();
$head=salaries_prepare_head($object);
dol_fiche_head($head, 'documents', $langs->trans("SalaryPayment"), 0, 'payment');
// Construit liste des fichiers
$filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
$totalsize=0;
foreach($filearray as $key => $file)
{
$totalsize+=$file['size'];
}
print '<table class="border" width="100%">';
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/salaries/index.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
// Ref
print '<tr><td width="30%">'.$langs->trans("Ref").'</td><td>';
print $form->showrefnav($object, 'id', $linkback, 1, 'rowid', 'ref', '');
print '</td></tr>';
// Societe
//print "<tr><td>".$langs->trans("Company")."</td><td>".$object->client->getNomUrl(1)."</td></tr>";
print '<tr><td>'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>';
print '</table>';
print '</div>';
$modulepart = 'salaries';
$permission = $user->rights->salaries->write;
$param = '&id=' . $object->id;
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php';
}
else
{
print $langs->trans("ErrorUnknown");
}
llxFooter();
$db->close();

View File

@ -501,7 +501,7 @@ if ($id > 0)
} }
// Emettre paiement // Emettre paiement
if ($object->paye == 0 && ((price2num($object->amount) < 0 && round($resteapayer) < 0) || (price2num($object->amount) > 0 && round($resteapayer) > 0)) && $user->rights->tax->charges->creer) if ($object->paye == 0 && ((price2num($object->amount) < 0 && price2num($resteapayer, 'MT') < 0) || (price2num($object->amount) > 0 && price2num($resteapayer, 'MT') > 0)) && $user->rights->tax->charges->creer)
{ {
print "<a class=\"butAction\" href=\"".DOL_URL_ROOT."/compta/paiement_charge.php?id=$object->id&amp;action=create\">".$langs->trans("DoPayment")."</a>"; print "<a class=\"butAction\" href=\"".DOL_URL_ROOT."/compta/paiement_charge.php?id=$object->id&amp;action=create\">".$langs->trans("DoPayment")."</a>";
} }

View File

@ -1,6 +1,7 @@
<?php <?php
/* Copyright (C) 2013 Antoine Iauch <aiauch@gpcsolutions.fr> /* Copyright (C) 2013 Antoine Iauch <aiauch@gpcsolutions.fr>
* Copyright (C) 2013 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -26,6 +27,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/tax.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/tax.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
$langs->load("products"); $langs->load("products");
$langs->load("categories"); $langs->load("categories");
@ -245,7 +247,7 @@ if ($modecompta == 'CREANCES-DETTES')
// Category filter // Category filter
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td>'; print '<td>';
print $langs->trans("Category") . ': ' . $formother->select_categories(0, $selected_cat, 'search_categ', true); print $langs->trans("Category") . ': ' . $formother->select_categories(Categorie::TYPE_PRODUCT, $selected_cat, 'search_categ', true);
print ' '; print ' ';
print $langs->trans("SubCats") . '? '; print $langs->trans("SubCats") . '? ';
print '<input type="checkbox" name="subcat" value="yes"'; print '<input type="checkbox" name="subcat" value="yes"';

View File

@ -1,9 +1,10 @@
<?php <?php
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be> * Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be>
* Copyright (C) 2013 Antoine Iauch <aiauch@gpcsolutions.fr> * Copyright (C) 2013 Antoine Iauch <aiauch@gpcsolutions.fr>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -29,6 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/tax.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/tax.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
$langs->load("companies"); $langs->load("companies");
$langs->load("categories"); $langs->load("categories");
@ -313,7 +315,7 @@ print "<table class=\"noborder\" width=\"100%\">";
// Category filter // Category filter
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td>'; print '<td>';
print $langs->trans("Category") . ': ' . $formother->select_categories(2, $selected_cat, 'search_categ', true); print $langs->trans("Category") . ': ' . $formother->select_categories(Categorie::TYPE_CUSTOMER, $selected_cat, 'search_categ', true);
print ' '; print ' ';
print $langs->trans("SubCats") . '? '; print $langs->trans("SubCats") . '? ';
print '<input type="checkbox" name="subcat" value="yes"'; print '<input type="checkbox" name="subcat" value="yes"';

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2013 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2013 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2015 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -187,6 +188,8 @@ if ($action == 'create')
print_fiche_titre($langs->trans("NewVATPayment")); print_fiche_titre($langs->trans("NewVATPayment"));
dol_fiche_head();
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
print "<tr>"; print "<tr>";
@ -228,7 +231,7 @@ if ($action == 'create')
print '</table>'; print '</table>';
print "<br>"; dol_fiche_end();
print '<div class="center">'; print '<div class="center">';
print '<input type="submit" class="button" value="'.$langs->trans("Save").'">'; print '<input type="submit" class="button" value="'.$langs->trans("Save").'">';

View File

@ -201,8 +201,12 @@ if (empty($reshook))
// Fill array 'array_options' with data from add form // Fill array 'array_options' with data from add form
$ret = $extrafields->setOptionalsFromPost($extralabels,$object); $ret = $extrafields->setOptionalsFromPost($extralabels,$object);
if ($ret < 0) $error++; if ($ret < 0)
{
$error++;
$action = 'create';
}
if (! GETPOST("lastname")) if (! GETPOST("lastname"))
{ {
$error++; $errors[]=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Lastname").' / '.$langs->transnoentities("Label")); $error++; $errors[]=$langs->trans("ErrorFieldRequired",$langs->transnoentities("Lastname").' / '.$langs->transnoentities("Label"));
@ -812,7 +816,7 @@ else
// Statut // Statut
print '<tr><td>'.$langs->trans("Status").'</td>'; print '<tr><td>'.$langs->trans("Status").'</td>';
print '<td>'; print '<td>';
print $object->getLibStatut(5); print $object->getLibStatut(4);
print '</td></tr>'; print '</td></tr>';
// Other attributes // Other attributes
@ -1036,7 +1040,7 @@ else
// Statut // Statut
print '<tr><td>'.$langs->trans("Status").'</td>'; print '<tr><td>'.$langs->trans("Status").'</td>';
print '<td>'; print '<td>';
print $object->getLibStatut(5); print $object->getLibStatut(4);
print '</td>'; print '</td>';
print '</tr>'."\n"; print '</tr>'."\n";
// Other attributes // Other attributes

View File

@ -629,6 +629,13 @@ class Contact extends CommonObject
} }
} }
// Retreive all extrafield for contact
// fetch optionals attributes and labels
require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php');
$extrafields=new ExtraFields($this->db);
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
$this->fetch_optionals($this->id,$extralabels);
return 1; return 1;
} }
else else
@ -970,7 +977,7 @@ class Contact extends CommonObject
} }
elseif ($mode == 4) elseif ($mode == 4)
{ {
if ($statut==0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('StatusContactDraft'); if ($statut==0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled');
elseif ($statut==1 || $statut==4) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled'); elseif ($statut==1 || $statut==4) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled');
} }
elseif ($mode == 5) elseif ($mode == 5)
@ -1101,4 +1108,4 @@ class Contact extends CommonObject
return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables); return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables);
} }
} }

View File

@ -1,12 +1,12 @@
<?php <?php
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 Eric Seigne <erics@rycks.com> * Copyright (C) 2003 Eric Seigne <erics@rycks.com>
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2013 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr> * Copyright (C) 2013-2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr> * Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2013 Alexandre Spangaro <alexandre.spangaro@gmail.com> * Copyright (C) 2013 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr> * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -159,7 +159,7 @@ else
if ($search_priv == '1') $sql .= " AND (p.priv='1' AND p.fk_user_creat=".$user->id.")"; if ($search_priv == '1') $sql .= " AND (p.priv='1' AND p.fk_user_creat=".$user->id.")";
} }
if ($search_categ > 0) $sql.= " AND cs.fk_categorie = ".$search_categ; if ($search_categ > 0) $sql.= " AND cs.fk_categorie = ".$db->escape($search_categ);
if ($search_categ == -2) $sql.= " AND cs.fk_categorie IS NULL"; if ($search_categ == -2) $sql.= " AND cs.fk_categorie IS NULL";
if ($search_firstlast_only) { if ($search_firstlast_only) {
@ -256,11 +256,11 @@ if ($result)
{ {
$contactstatic=new Contact($db); $contactstatic=new Contact($db);
$param ='&begin='.urlencode($begin).'&view='.urlencode($view).'&userid='.urlencode($userid).'&contactname='.urlencode($sall); $param ='&begin='.htmlspecialchars($begin).'&view='.htmlspecialchars($view).'&userid='.htmlspecialchars($userid).'&contactname='.htmlspecialchars($sall);
$param.='&type='.urlencode($type).'&view='.urlencode($view).'&search_lastname='.urlencode($search_lastname).'&search_firstname='.urlencode($search_firstname).'&search_societe='.urlencode($search_societe).'&search_email='.urlencode($search_email); $param.='&type='.htmlspecialchars($type).'&view='.htmlspecialchars($view).'&search_lastname='.htmlspecialchars($search_lastname).'&search_firstname='.htmlspecialchars($search_firstname).'&search_societe='.htmlspecialchars($search_societe).'&search_email='.htmlspecialchars($search_email);
if (!empty($search_categ)) $param.='&search_categ='.$search_categ; if (!empty($search_categ)) $param.='&search_categ='.htmlspecialchars($search_categ);
if ($search_status != '') $param.='&amp;search_status='.$search_status; if ($search_status != '') $param.='&amp;search_status='.htmlspecialchars($search_status);
if ($search_priv == '0' || $search_priv == '1') $param.="&search_priv=".urlencode($search_priv); if ($search_priv == '0' || $search_priv == '1') $param.="&search_priv=".htmlspecialchars($search_priv);
$num = $db->num_rows($result); $num = $db->num_rows($result);
$i = 0; $i = 0;
@ -269,14 +269,15 @@ if ($result)
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">'; print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="view" value="'.$view.'">'; print '<input type="hidden" name="view" value="'.htmlspecialchars($view).'">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">'; print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">'; print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
if (! empty($conf->categorie->enabled)) if (! empty($conf->categorie->enabled))
{ {
require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
$moreforfilter.=$langs->trans('Categories'). ': '; $moreforfilter.=$langs->trans('Categories'). ': ';
$moreforfilter.=$formother->select_categories(4,$search_categ,'search_categ',1); $moreforfilter.=$formother->select_categories(Categorie::TYPE_CONTACT,$search_categ,'search_categ',1);
$moreforfilter.=' &nbsp; &nbsp; &nbsp; '; $moreforfilter.=' &nbsp; &nbsp; &nbsp; ';
} }
if ($moreforfilter) if ($moreforfilter)
@ -316,36 +317,36 @@ if ($result)
// Ligne des champs de filtres // Ligne des champs de filtres
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '<input class="flat" type="text" name="search_lastname" size="9" value="'.$search_lastname.'">'; print '<input class="flat" type="text" name="search_lastname" size="9" value="'.dol_escape_htmltag($search_lastname).'">';
print '</td>'; print '</td>';
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '<input class="flat" type="text" name="search_firstname" size="9" value="'.$search_firstname.'">'; print '<input class="flat" type="text" name="search_firstname" size="9" value="'.dol_escape_htmltag($search_firstname).'">';
print '</td>'; print '</td>';
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '<input class="flat" type="text" name="search_poste" size="9" value="'.$search_poste.'">'; print '<input class="flat" type="text" name="search_poste" size="9" value="'.dol_escape_htmltag($search_poste).'">';
print '</td>'; print '</td>';
if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) if (empty($conf->global->SOCIETE_DISABLE_CONTACTS))
{ {
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '<input class="flat" type="text" name="search_societe" size="9" value="'.$search_societe.'">'; print '<input class="flat" type="text" name="search_societe" size="9" value="'.dol_escape_htmltag($search_societe).'">';
print '</td>'; print '</td>';
} }
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '<input class="flat" type="text" name="search_phonepro" size="8" value="'.$search_phonepro.'">'; print '<input class="flat" type="text" name="search_phonepro" size="8" value="'.dol_escape_htmltag($search_phonepro).'">';
print '</td>'; print '</td>';
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '<input class="flat" type="text" name="search_phonemob" size="8" value="'.$search_phonemob.'">'; print '<input class="flat" type="text" name="search_phonemob" size="8" value="'.dol_escape_htmltag($search_phonemob).'">';
print '</td>'; print '</td>';
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '<input class="flat" type="text" name="search_fax" size="8" value="'.$search_fax.'">'; print '<input class="flat" type="text" name="search_fax" size="8" value="'.dol_escape_htmltag($search_fax).'">';
print '</td>'; print '</td>';
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '<input class="flat" type="text" name="search_email" size="8" value="'.$search_email.'">'; print '<input class="flat" type="text" name="search_email" size="8" value="'.dol_escape_htmltag($search_email).'">';
print '</td>'; print '</td>';
if (! empty($conf->skype->enabled)) if (! empty($conf->skype->enabled))
{ {
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '<input class="flat" type="text" name="search_skype" size="8" value="'.$search_skype.'">'; print '<input class="flat" type="text" name="search_skype" size="8" value="'.dol_escape_htmltag($search_skype).'">';
print '</td>'; print '</td>';
} }
print '<td class="liste_titre">&nbsp;</td>'; print '<td class="liste_titre">&nbsp;</td>';

View File

@ -823,10 +823,8 @@ else if ($action == 'remove_file' && $user->rights->contrat->creer) {
$upload_dir = $conf->contrat->dir_output; $upload_dir = $conf->contrat->dir_output;
$file = $upload_dir . '/' . GETPOST('file'); $file = $upload_dir . '/' . GETPOST('file');
$ret = dol_delete_file($file, 0, 0, 0, $object); $ret = dol_delete_file($file, 0, 0, 0, $object);
if ($ret) if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('file')));
setEventMessage($langs->trans("FileWasRemoved", GETPOST('file'))); else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('file')), 'errors');
else
setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('file')), 'errors');
} }
} }

View File

@ -177,7 +177,7 @@ else
} }
print '<table class="noborder" width="100%">'; print '<table class="noborder nohover" width="100%">';
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Statistics").' - '.$langs->trans("Services").'</td></tr>'."\n"; print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Statistics").' - '.$langs->trans("Services").'</td></tr>'."\n";
$var=true; $var=true;
$listofstatus=array(0,4,4,5); $bool=false; $listofstatus=array(0,4,4,5); $bool=false;

View File

@ -100,7 +100,8 @@ $sql.= ", ".MAIN_DB_PREFIX."contrat as c";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."contratdet as cd ON c.rowid = cd.fk_contrat"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."contratdet as cd ON c.rowid = cd.fk_contrat";
$sql.= " WHERE c.fk_soc = s.rowid "; $sql.= " WHERE c.fk_soc = s.rowid ";
$sql.= " AND c.entity = ".$conf->entity; $sql.= " AND c.entity = ".$conf->entity;
if ($socid) $sql.= " AND s.rowid = ".$socid; if ($socid) $sql.= " AND s.rowid = ".$db->escape($socid);
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
if ($search_name) { if ($search_name) {
$sql .= natural_search('s.nom', $search_name); $sql .= natural_search('s.nom', $search_name);
@ -112,7 +113,7 @@ if (!empty($search_ref_supplier)) {
$sql .= natural_search(array('c.ref_supplier'), $search_ref_supplier); $sql .= natural_search(array('c.ref_supplier'), $search_ref_supplier);
} }
if ($search_sale > 0) if ($search_sale > 0)
{ {
$sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$search_sale; $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$search_sale;
} }
@ -131,7 +132,7 @@ if ($resql)
$i = 0; $i = 0;
print_barre_liste($langs->trans("ListOfContracts"), $page, $_SERVER["PHP_SELF"], '&search_contract='.$search_contract.'&search_name='.$search_name, $sortfield, $sortorder,'',$num,$totalnboflines,'title_commercial.png'); print_barre_liste($langs->trans("ListOfContracts"), $page, $_SERVER["PHP_SELF"], '&search_contract='.$search_contract.'&search_name='.$search_name, $sortfield, $sortorder,'',$num,$totalnboflines,'title_commercial.png');
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">'; print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
print '<table class="liste" width="100%">'; print '<table class="liste" width="100%">';
@ -144,7 +145,7 @@ if ($resql)
$moreforfilter.=$formother->select_salesrepresentatives($search_sale,'search_sale',$user); $moreforfilter.=$formother->select_salesrepresentatives($search_sale,'search_sale',$user);
$moreforfilter.=' &nbsp; &nbsp; &nbsp; '; $moreforfilter.=' &nbsp; &nbsp; &nbsp; ';
} }
if ($moreforfilter) if ($moreforfilter)
{ {
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
@ -152,13 +153,14 @@ if ($resql)
print $moreforfilter; print $moreforfilter;
print '</td></tr>'; print '</td></tr>';
} }
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
$param='&amp;search_contract='.$search_contract;
$param.='&amp;search_name='.$search_name; $param='&search_contract='.$search_contract;
$param.='&amp;search_ref_supplier='.$search_ref_supplier; $param.='&search_name='.$search_name;
$param.='&search_ref_supplier='.$search_ref_supplier;
$param.='&search_sale=' .$search_sale; $param.='&search_sale=' .$search_sale;
print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "c.rowid","","$param",'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "c.rowid","","$param",'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("RefCustomer"), $_SERVER["PHP_SELF"], "c.ref_supplier","","$param",'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("RefCustomer"), $_SERVER["PHP_SELF"], "c.ref_supplier","","$param",'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Company"), $_SERVER["PHP_SELF"], "s.nom","","$param",'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Company"), $_SERVER["PHP_SELF"], "s.nom","","$param",'',$sortfield,$sortorder);
@ -175,13 +177,13 @@ if ($resql)
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '<input type="text" class="flat" size="3" name="search_contract" value="'.$search_contract.'">'; print '<input type="text" class="flat" size="3" name="search_contract" value="'.dol_escape_htmltag($search_contract).'">';
print '</td>'; print '</td>';
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '<input type="text" class="flat" size="7" name="search_ref_supplier value="'.$search_ref_supplier.'">'; print '<input type="text" class="flat" size="7" name="search_ref_supplier value="'.dol_escape_htmltag($search_ref_supplier).'">';
print '</td>'; print '</td>';
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '<input type="text" class="flat" size="24" name="search_name" value="'.$search_name.'">'; print '<input type="text" class="flat" size="24" name="search_name" value="'.dol_escape_htmltag($search_name).'">';
print '</td>'; print '</td>';
print '<td class="liste_titre">&nbsp;</td>'; print '<td class="liste_titre">&nbsp;</td>';
//print '<td class="liste_titre">&nbsp;</td>'; //print '<td class="liste_titre">&nbsp;</td>';
@ -202,7 +204,7 @@ if ($resql)
print '<td>'.$obj->ref_supplier.'</td>'; print '<td>'.$obj->ref_supplier.'</td>';
print '<td><a href="../comm/card.php?socid='.$obj->socid.'">'.img_object($langs->trans("ShowCompany"),"company").' '.$obj->name.'</a></td>'; print '<td><a href="../comm/card.php?socid='.$obj->socid.'">'.img_object($langs->trans("ShowCompany"),"company").' '.$obj->name.'</a></td>';
//print '<td align="center">'.dol_print_date($obj->datec).'</td>'; //print '<td align="center">'.dol_print_date($obj->datec).'</td>';
// Sales Rapresentatives // Sales Rapresentatives
print '<td>'; print '<td>';
if($obj->socid) if($obj->socid)
@ -237,8 +239,8 @@ if ($resql)
print '&nbsp'; print '&nbsp';
} }
print '</td>'; print '</td>';
print '<td align="center">'.dol_print_date($db->jdate($obj->date_contrat)).'</td>'; print '<td align="center">'.dol_print_date($db->jdate($obj->date_contrat)).'</td>';
//print '<td align="center">'.$staticcontrat->LibStatut($obj->statut,3).'</td>'; //print '<td align="center">'.$staticcontrat->LibStatut($obj->statut,3).'</td>';
print '<td align="center">'.($obj->nb_initial>0?$obj->nb_initial:'').'</td>'; print '<td align="center">'.($obj->nb_initial>0?$obj->nb_initial:'').'</td>';

View File

@ -418,7 +418,7 @@ abstract class CommonObject
/** /**
* Get array of all contacts for an object * Get array of all contacts for an object
* *
* @param int $statut Status of lines to get (-1=all) * @param int $statut Status of links to get (-1=all)
* @param string $source Source of contact: external or thirdparty (llx_socpeople) or internal (llx_user) * @param string $source Source of contact: external or thirdparty (llx_socpeople) or internal (llx_user)
* @param int $list 0:Return array contains all properties, 1:Return array contains just id * @param int $list 0:Return array contains all properties, 1:Return array contains just id
* @return array Array of contacts * @return array Array of contacts
@ -429,9 +429,9 @@ abstract class CommonObject
$tab=array(); $tab=array();
$sql = "SELECT ec.rowid, ec.statut, ec.fk_socpeople as id, ec.fk_c_type_contact"; // This field contains id of llx_socpeople or id of llx_user $sql = "SELECT ec.rowid, ec.statut as statuslink, ec.fk_socpeople as id, ec.fk_c_type_contact"; // This field contains id of llx_socpeople or id of llx_user
if ($source == 'internal') $sql.=", '-1' as socid"; if ($source == 'internal') $sql.=", '-1' as socid, t.statut as statuscontact";
if ($source == 'external' || $source == 'thirdparty') $sql.=", t.fk_soc as socid"; if ($source == 'external' || $source == 'thirdparty') $sql.=", t.fk_soc as socid, t.statut as statuscontact";
$sql.= ", t.civility as civility, t.lastname as lastname, t.firstname, t.email"; $sql.= ", t.civility as civility, t.lastname as lastname, t.firstname, t.email";
$sql.= ", tc.source, tc.element, tc.code, tc.libelle"; $sql.= ", tc.source, tc.element, tc.code, tc.libelle";
$sql.= " FROM ".MAIN_DB_PREFIX."c_type_contact tc"; $sql.= " FROM ".MAIN_DB_PREFIX."c_type_contact tc";
@ -463,8 +463,8 @@ abstract class CommonObject
$libelle_type=($langs->trans($transkey)!=$transkey ? $langs->trans($transkey) : $obj->libelle); $libelle_type=($langs->trans($transkey)!=$transkey ? $langs->trans($transkey) : $obj->libelle);
$tab[$i]=array('source'=>$obj->source,'socid'=>$obj->socid,'id'=>$obj->id, $tab[$i]=array('source'=>$obj->source,'socid'=>$obj->socid,'id'=>$obj->id,
'nom'=>$obj->lastname, // For backward compatibility 'nom'=>$obj->lastname, // For backward compatibility
'civility'=>$obj->civility, 'lastname'=>$obj->lastname, 'firstname'=>$obj->firstname, 'email'=>$obj->email, 'civility'=>$obj->civility, 'lastname'=>$obj->lastname, 'firstname'=>$obj->firstname, 'email'=>$obj->email, 'statuscontact'=>$obj->statuscontact,
'rowid'=>$obj->rowid,'code'=>$obj->code,'libelle'=>$libelle_type,'status'=>$obj->statut, 'fk_c_type_contact' => $obj->fk_c_type_contact); 'rowid'=>$obj->rowid, 'code'=>$obj->code, 'libelle'=>$libelle_type, 'status'=>$obj->statuslink, 'fk_c_type_contact'=>$obj->fk_c_type_contact);
} }
else else
{ {
@ -525,9 +525,9 @@ abstract class CommonObject
* Return array with list of possible values for type of contacts * Return array with list of possible values for type of contacts
* *
* @param string $source 'internal', 'external' or 'all' * @param string $source 'internal', 'external' or 'all'
* @param string $order Sort order by : 'code' or 'rowid' * @param string $order Sort order by 'code' or 'rowid'
* @param string $option 0=Return array id->label, 1=Return array code->label * @param int $option 0=Return array id->label, 1=Return array code->label
* @param string $activeonly 0=all status of contact, 1=only the active * @param int $activeonly 0=all status of contact, 1=only the active
* @param string $code Type of contact (Example: 'CUSTOMER', 'SERVICE') * @param string $code Type of contact (Example: 'CUSTOMER', 'SERVICE')
* @return array Array list of type of contacts (id->label if option=0, code->label if option=1) * @return array Array list of type of contacts (id->label if option=0, code->label if option=1)
*/ */
@ -541,7 +541,7 @@ abstract class CommonObject
$sql = "SELECT DISTINCT tc.rowid, tc.code, tc.libelle"; $sql = "SELECT DISTINCT tc.rowid, tc.code, tc.libelle";
$sql.= " FROM ".MAIN_DB_PREFIX."c_type_contact as tc"; $sql.= " FROM ".MAIN_DB_PREFIX."c_type_contact as tc";
$sql.= " WHERE tc.element='".$this->element."'"; $sql.= " WHERE tc.element='".$this->element."'";
if ($activeonly == 1) $sql.= " AND tc.active=1"; // only the active type if ($activeonly == 1) $sql.= " AND tc.active=1"; // only the active types
if (! empty($source) && $source != 'all') $sql.= " AND tc.source='".$source."'"; if (! empty($source) && $source != 'all') $sql.= " AND tc.source='".$source."'";
if (! empty($code)) $sql.= " AND tc.code='".$code."'"; if (! empty($code)) $sql.= " AND tc.code='".$code."'";
$sql.= " ORDER by tc.".$order; $sql.= " ORDER by tc.".$order;
@ -626,12 +626,12 @@ abstract class CommonObject
} }
/** /**
* Charge le contact d'id $id dans this->contact * Load object contact with id=$this->contactid into $this->contact
* *
* @param int $contactid Id du contact. Use this->contactid if empty. * @param int $contactid Id du contact. Use this->contactid if empty.
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function fetch_contact($contactid='') function fetch_contact($contactid=null)
{ {
if (empty($contactid)) $contactid=$this->contactid; if (empty($contactid)) $contactid=$this->contactid;
@ -858,14 +858,14 @@ abstract class CommonObject
/** /**
* Update a specific field into database * Update a specific field into database
* *
* @param string $field Field to update * @param string $field Field to update
* @param mixed $value New value * @param mixed $value New value
* @param string $table To force other table element or element line (should not be used) * @param string $table To force other table element or element line (should not be used)
* @param int $id To force other object id (should not be used) * @param int $id To force other object id (should not be used)
* @param string $format Data format ('text', 'date'). 'text' is used if not defined * @param string $format Data format ('text', 'date'). 'text' is used if not defined
* @param string $id_field To force rowid field name. 'rowid' is used it not defined * @param string $id_field To force rowid field name. 'rowid' is used it not defined
* @param string $user Update last update fields also if user object provided * @param User|string $user Update last update fields also if user object provided
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function setValueFrom($field, $value, $table='', $id='', $format='', $id_field='', $user='') function setValueFrom($field, $value, $table='', $id='', $format='', $id_field='', $user='')
{ {
@ -1655,10 +1655,10 @@ abstract class CommonObject
* @param int $exclspec >0 = Exclude special product (product_type=9) * @param int $exclspec >0 = Exclude special product (product_type=9)
* @param string $roundingadjust 'none'=Do nothing, 'auto'=Use default method (MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND if defined, or '0'), '0'=Force use total of rounding, '1'=Force use rounding of total * @param string $roundingadjust 'none'=Do nothing, 'auto'=Use default method (MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND if defined, or '0'), '0'=Force use total of rounding, '1'=Force use rounding of total
* @param int $nodatabaseupdate 1=Do not update database. Update only properties of object. * @param int $nodatabaseupdate 1=Do not update database. Update only properties of object.
* @param Societe $seller If roundingadjust is '0' or '1', it means we recalculate total for lines before calculating total for object. For this, we need seller object. * @param Societe $seller If roundingadjust is '0' or '1', it means we recalculate total for lines before calculating total for object and for this, we need seller object.
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
*/ */
function update_price($exclspec=0,$roundingadjust='none',$nodatabaseupdate=0,$seller='') function update_price($exclspec=0,$roundingadjust='none',$nodatabaseupdate=0,$seller=null)
{ {
global $conf; global $conf;
@ -2684,9 +2684,9 @@ abstract class CommonObject
* But for the moment we don't know if it'st possible as we keep a method available on overloaded objects. * But for the moment we don't know if it'st possible as we keep a method available on overloaded objects.
* *
* @param string $action Action code * @param string $action Action code
* @param string $seller Object of seller third party * @param Societe $seller Object of seller third party
* @param string $buyer Object of buyer third party * @param Societe $buyer Object of buyer third party
* @param string $selected Object line selected * @param int $selected Object line selected
* @param int $dateSelector 1=Show also date range input fields * @param int $dateSelector 1=Show also date range input fields
* @return void * @return void
*/ */
@ -2799,16 +2799,16 @@ abstract class CommonObject
* Return HTML content of a detail line * Return HTML content of a detail line
* TODO Move this into an output class file (htmlline.class.php) * TODO Move this into an output class file (htmlline.class.php)
* *
* @param string $action GET/POST action * @param string $action GET/POST action
* @param CommonObjectLine $line Selected object line to output * @param CommonObjectLine $line Selected object line to output
* @param string $var Is it a an odd line (true) * @param string $var Is it a an odd line (true)
* @param int $num Number of line (0) * @param int $num Number of line (0)
* @param int $i I * @param int $i I
* @param int $dateSelector 1=Show also date range input fields * @param int $dateSelector 1=Show also date range input fields
* @param string $seller Object of seller third party * @param Societe $seller Object of seller third party
* @param string $buyer Object of buyer third party * @param Societe $buyer Object of buyer third party
* @param string $selected Object line selected * @param int $selected Object line selected
* @param object $extrafieldsline Object of extrafield line attribute * @param object $extrafieldsline Object of extrafield line attribute
* @return void * @return void
*/ */
function printObjectLine($action,$line,$var,$num,$i,$dateSelector,$seller,$buyer,$selected=0,$extrafieldsline=0) function printObjectLine($action,$line,$var,$num,$i,$dateSelector,$seller,$buyer,$selected=0,$extrafieldsline=0)
@ -3086,7 +3086,7 @@ abstract class CommonObject
/** /**
* get Margin info * get Margin info
* *
* @param string $force_price True of not * @param boolean $force_price True of not
* @return mixed Array with info * @return mixed Array with info
*/ */
function getMarginInfos($force_price=false) function getMarginInfos($force_price=false)
@ -3212,7 +3212,7 @@ abstract class CommonObject
/** /**
* Show the array with all margin infos * Show the array with all margin infos
* *
* @param string $force_price Force price * @param boolean $force_price Force price
* @return void * @return void
*/ */
function displayMarginInfos($force_price=false) function displayMarginInfos($force_price=false)
@ -3304,7 +3304,7 @@ abstract class CommonObject
/** /**
* Add resources to the current object : add entry into llx_element_resources * Add resources to the current object : add entry into llx_element_resources
*Need $this->element & $this->id * Need $this->element & $this->id
* *
* @param int $resource_id Resource id * @param int $resource_id Resource id
* @param string $resource_element Resource element * @param string $resource_element Resource element
@ -3726,7 +3726,7 @@ abstract class CommonObject
{ {
$attributeKey = substr($key,8); // Remove 'options_' prefix $attributeKey = substr($key,8); // Remove 'options_' prefix
$attributeType = $extrafields->attribute_type[$attributeKey]; $attributeType = $extrafields->attribute_type[$attributeKey];
$attributeSize = $extrafields->attribute_size[$attributeKey]; //$attributeSize = $extrafields->attribute_size[$attributeKey]; Not required to insert an extrafield value. Only used for definition.
$attributeLabel = $extrafields->attribute_label[$attributeKey]; $attributeLabel = $extrafields->attribute_label[$attributeKey];
$attributeParam = $extrafields->attribute_param[$attributeKey]; $attributeParam = $extrafields->attribute_param[$attributeKey];
switch ($attributeType) switch ($attributeType)
@ -3751,19 +3751,19 @@ abstract class CommonObject
case 'datetime': case 'datetime':
$this->array_options[$key]=$this->db->idate($this->array_options[$key]); $this->array_options[$key]=$this->db->idate($this->array_options[$key]);
break; break;
case 'link': case 'link':
$param_list=array_keys($attributeParam ['options']); $param_list=array_keys($attributeParam ['options']);
// 0 : ObjectName // 0 : ObjectName
// 1 : classPath // 1 : classPath
$InfoFieldList = explode(":", $param_list[0]); $InfoFieldList = explode(":", $param_list[0]);
dol_include_once($InfoFieldList[1]); dol_include_once($InfoFieldList[1]);
$object = new $InfoFieldList[0]($this->db); $object = new $InfoFieldList[0]($this->db);
if ($value) if ($value)
{ {
$object->fetch(0,$value); $object->fetch(0,$value);
$this->array_options[$key]=$object->id; $this->array_options[$key]=$object->id;
} }
break; break;
} }
} }
$this->db->begin(); $this->db->begin();
@ -3771,6 +3771,7 @@ abstract class CommonObject
$sql_del = "DELETE FROM ".MAIN_DB_PREFIX.$this->table_element."_extrafields WHERE fk_object = ".$this->id; $sql_del = "DELETE FROM ".MAIN_DB_PREFIX.$this->table_element."_extrafields WHERE fk_object = ".$this->id;
dol_syslog(get_class($this)."::insertExtraFields delete", LOG_DEBUG); dol_syslog(get_class($this)."::insertExtraFields delete", LOG_DEBUG);
$this->db->query($sql_del); $this->db->query($sql_del);
$sql = "INSERT INTO ".MAIN_DB_PREFIX.$this->table_element."_extrafields (fk_object"; $sql = "INSERT INTO ".MAIN_DB_PREFIX.$this->table_element."_extrafields (fk_object";
foreach($this->array_options as $key => $value) foreach($this->array_options as $key => $value)
{ {
@ -3825,7 +3826,7 @@ abstract class CommonObject
* *
* @return string * @return string
*/ */
function showOptionals($extrafields, $mode='view', $params=0, $keyprefix='') function showOptionals($extrafields, $mode='view', $params=null, $keyprefix='')
{ {
global $_POST, $conf; global $_POST, $conf;

View File

@ -91,7 +91,14 @@ class dolprintIPP
} }
} }
// Getting Jobs // Getting Jobs
$ipp->getJobs(false,0,'completed',false); try {
$ipp->getJobs(false,0,'completed',false); // May return errors if setup not correct
}
catch(Exception $e)
{
print $e->getMessage();
}
print '<table width="100%" class="noborder">'; print '<table width="100%" class="noborder">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print "<td>Id</td>"; print "<td>Id</td>";
@ -102,19 +109,22 @@ class dolprintIPP
print "<td>Cancel</td>"; print "<td>Cancel</td>";
print "</tr>\n"; print "</tr>\n";
$jobs = $ipp->jobs_attributes; $jobs = $ipp->jobs_attributes;
$var = True; $var = true;
//print '<pre>'.print_r($jobs,true).'</pre>'; //print '<pre>'.print_r($jobs,true).'</pre>';
foreach ($jobs as $value ) if (is_array($jobs))
{ {
$var=!$var; foreach ($jobs as $value)
print "<tr ".$bc[$var].">"; {
print '<td>'.$value->job_id->_value0.'</td>'; $var=!$var;
print '<td>'.$value->job_originating_user_name->_value0.'</td>'; print "<tr ".$bc[$var].">";
print '<td>'.$value->printer_uri->_value0.'</td>'; print '<td>'.$value->job_id->_value0.'</td>';
print '<td>'.$value->job_name->_value0.'</td>'; print '<td>'.$value->job_originating_user_name->_value0.'</td>';
print '<td>'.$value->job_state->_value0.'</td>'; print '<td>'.$value->printer_uri->_value0.'</td>';
print '<td>'.$value->job_uri->_value0.'</td>'; print '<td>'.$value->job_name->_value0.'</td>';
print '</tr>'; print '<td>'.$value->job_state->_value0.'</td>';
print '<td>'.$value->job_uri->_value0.'</td>';
print '</tr>';
}
} }
print "</table>"; print "</table>";
} }

View File

@ -39,7 +39,7 @@ class ExtraFields
var $attribute_type; var $attribute_type;
// Tableau contenant le nom des champs en clef et le label de ces champs en value // Tableau contenant le nom des champs en clef et le label de ces champs en value
var $attribute_label; var $attribute_label;
// Tableau contenant le nom des champs en clef et la taille de ces champs en value // Tableau contenant le nom des champs en clef et la taille/longueur max de ces champs en value
var $attribute_size; var $attribute_size;
// Tableau contenant le nom des choix en clef et la valeur de ces choix en value // Tableau contenant le nom des choix en clef et la valeur de ces choix en value
var $attribute_choice; var $attribute_choice;
@ -124,6 +124,7 @@ class ExtraFields
if (empty($label)) return -1; if (empty($label)) return -1;
if ($elementtype == 'thirdparty') $elementtype='societe'; if ($elementtype == 'thirdparty') $elementtype='societe';
if ($elementtype == 'contact') $elementtype='socpeople';
// Create field into database except for separator type which is not stored in database // Create field into database except for separator type which is not stored in database
if ($type != 'separate') if ($type != 'separate')
@ -169,6 +170,7 @@ class ExtraFields
private function create($attrname, $type='varchar', $length=255, $elementtype='member', $unique=0, $required=0, $default_value='',$param='', $perms='', $list=0) private function create($attrname, $type='varchar', $length=255, $elementtype='member', $unique=0, $required=0, $default_value='',$param='', $perms='', $list=0)
{ {
if ($elementtype == 'thirdparty') $elementtype='societe'; if ($elementtype == 'thirdparty') $elementtype='societe';
if ($elementtype == 'contact') $elementtype='socpeople';
$table=$elementtype.'_extrafields'; $table=$elementtype.'_extrafields';
@ -248,6 +250,7 @@ class ExtraFields
global $conf; global $conf;
if ($elementtype == 'thirdparty') $elementtype='societe'; if ($elementtype == 'thirdparty') $elementtype='societe';
if ($elementtype == 'contact') $elementtype='socpeople';
// Clean parameters // Clean parameters
if (empty($pos)) $pos=0; if (empty($pos)) $pos=0;
@ -308,6 +311,7 @@ class ExtraFields
function delete($attrname, $elementtype='member') function delete($attrname, $elementtype='member')
{ {
if ($elementtype == 'thirdparty') $elementtype='societe'; if ($elementtype == 'thirdparty') $elementtype='societe';
if ($elementtype == 'contact') $elementtype='socpeople';
$table=$elementtype.'_extrafields'; $table=$elementtype.'_extrafields';
@ -342,6 +346,7 @@ class ExtraFields
global $conf; global $conf;
if ($elementtype == 'thirdparty') $elementtype='societe'; if ($elementtype == 'thirdparty') $elementtype='societe';
if ($elementtype == 'contact') $elementtype='socpeople';
if (isset($attrname) && $attrname != '' && preg_match("/^\w[a-zA-Z0-9-_]*$/",$attrname)) if (isset($attrname) && $attrname != '' && preg_match("/^\w[a-zA-Z0-9-_]*$/",$attrname))
{ {
@ -389,6 +394,7 @@ class ExtraFields
function update($attrname,$label,$type,$length,$elementtype,$unique=0,$required=0,$pos=0,$param='',$alwayseditable=0, $perms='',$list='') function update($attrname,$label,$type,$length,$elementtype,$unique=0,$required=0,$pos=0,$param='',$alwayseditable=0, $perms='',$list='')
{ {
if ($elementtype == 'thirdparty') $elementtype='societe'; if ($elementtype == 'thirdparty') $elementtype='societe';
if ($elementtype == 'contact') $elementtype='socpeople';
$table=$elementtype.'_extrafields'; $table=$elementtype.'_extrafields';
@ -486,6 +492,8 @@ class ExtraFields
// Clean parameters // Clean parameters
if ($elementtype == 'thirdparty') $elementtype='societe'; if ($elementtype == 'thirdparty') $elementtype='societe';
if ($elementtype == 'contact') $elementtype='socpeople';
if (empty($list)) $list=0; if (empty($list)) $list=0;
if (isset($attrname) && $attrname != '' && preg_match("/^\w[a-zA-Z0-9-_]*$/",$attrname)) if (isset($attrname) && $attrname != '' && preg_match("/^\w[a-zA-Z0-9-_]*$/",$attrname))
@ -570,6 +578,7 @@ class ExtraFields
if ( empty($elementtype) ) return array(); if ( empty($elementtype) ) return array();
if ($elementtype == 'thirdparty') $elementtype='societe'; if ($elementtype == 'thirdparty') $elementtype='societe';
if ($elementtype == 'contact') $elementtype='socpeople';
$array_name_label=array(); $array_name_label=array();

View File

@ -116,9 +116,9 @@ class HookManager
* @param array $parameters Array of parameters * @param array $parameters Array of parameters
* @param Object $object Object to use hooks on * @param Object $object Object to use hooks on
* @param string $action Action code on calling page ('create', 'edit', 'view', 'add', 'update', 'delete'...) * @param string $action Action code on calling page ('create', 'edit', 'view', 'add', 'update', 'delete'...)
* @return mixed For doActions,formObjectOptions,pdf_xxx: Return 0 if we want to keep standard actions, >0 if we want to stop standard actions, <0 means KO. * @return mixed For 'addreplace hooks (doActions,formObjectOptions,pdf_xxx,...): Return 0 if we want to keep standard actions, >0 if we want to stop standard actions, <0 if KO.
* For printSearchForm,printLeftBlock,printTopRightMenu,formAddObjectLine,...: Return HTML string. TODO Deprecated. Must always return an int and things to print into ->resprints. * For 'output' hooks (printLeftBlock, formAddObjectLine, formBuilddocOptions, ...): Return 0, <0 if KO. Things to print are returned into ->resprints and set into ->resPrint.
* Can also return some values into an array ->results. * All types can also return some values into an array ->results.
* $this->error or this->errors are also defined by class called by this function if error. * $this->error or this->errors are also defined by class called by this function if error.
*/ */
function executeHooks($method, $parameters=false, &$object='', &$action='') function executeHooks($method, $parameters=false, &$object='', &$action='')
@ -135,7 +135,8 @@ class HookManager
array( array(
'addMoreActionsButtons', 'addMoreActionsButtons',
'addStatisticLine', 'addStatisticLine',
'doActions', 'deleteFile',
'doActions',
'formCreateThirdpartyOptions', 'formCreateThirdpartyOptions',
'formObjectOptions', 'formObjectOptions',
'formattachOptions', 'formattachOptions',
@ -147,7 +148,7 @@ class HookManager
'formatEvent' 'formatEvent'
) )
)) $hooktype='addreplace'; )) $hooktype='addreplace';
// Deprecated hook types // Deprecated hook types ('returnvalue')
if (preg_match('/^pdf_/',$method) && $method != 'pdf_writelinedesc') $hooktype='returnvalue'; // pdf_xxx except pdf_writelinedesc are 'returnvalue' hooks. When there is 2 hooks of this type, only last one win. TODO Move them into 'output' or 'addreplace' hooks. if (preg_match('/^pdf_/',$method) && $method != 'pdf_writelinedesc') $hooktype='returnvalue'; // pdf_xxx except pdf_writelinedesc are 'returnvalue' hooks. When there is 2 hooks of this type, only last one win. TODO Move them into 'output' or 'addreplace' hooks.
if ($method == 'insertExtraFields') if ($method == 'insertExtraFields')
{ {
@ -195,7 +196,7 @@ class HookManager
if (isset($actionclassinstance->results) && is_array($actionclassinstance->results)) $this->resArray =array_merge($this->resArray, $actionclassinstance->results); if (isset($actionclassinstance->results) && is_array($actionclassinstance->results)) $this->resArray =array_merge($this->resArray, $actionclassinstance->results);
if (! empty($actionclassinstance->resprints)) $this->resPrint.=$actionclassinstance->resprints; if (! empty($actionclassinstance->resprints)) $this->resPrint.=$actionclassinstance->resprints;
} }
// Generic hooks that return a string or array (printSearchForm, printLeftBlock, formAddObjectLine, formBuilddocOptions, ...) // Generic hooks that return a string or array (printLeftBlock, formAddObjectLine, formBuilddocOptions, ...)
else else
{ {
// TODO. this should be done into the method of hook by returning nothing // TODO. this should be done into the method of hook by returning nothing

View File

@ -1,21 +1,21 @@
<?php <?php
/* Copyright (c) 2002-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (c) 2002-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be> * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org> * Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com> * Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005-2014 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2014 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr> * Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2006 Marc Barilley/Ocebo <marc@ocebo.com> * Copyright (C) 2006 Marc Barilley/Ocebo <marc@ocebo.com>
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerker@telenet.be> * Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerker@telenet.be>
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com> * Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2010-2014 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2010-2014 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2011 Herve Prot <herve.prot@symeos.com> * Copyright (C) 2011 Herve Prot <herve.prot@symeos.com>
* Copyright (C) 2012-2014 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2012-2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr> * Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2012-2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr> * Copyright (C) 2012-2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2014 Alexandre Spangaro <alexandre.spangaro@gmail.com> * Copyright (C) 2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -415,7 +415,7 @@ class Form
if ($direction > 0) { if ($direction > 0) {
$s.='<'.$tag.$paramfortooltipimg; $s.='<'.$tag.$paramfortooltipimg;
if ($tag == 'td') { if ($tag == 'td') {
$s .= ' valign="top" width="14"'; $s .= ' valign="middle" width="14"';
} }
$s.= '>'.$img.'</'.$tag.'>'; $s.= '>'.$img.'</'.$tag.'>';
} }
@ -503,7 +503,7 @@ class Form
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql)
{ {
$out.= '<select id="select'.$htmlname.'" class="flat selectcountry" name="'.$htmlname.'" '.$htmloption.'>'; $out.= '<select id="select'.$htmlname.'" class="flat selectcountry minwidth300" name="'.$htmlname.'" '.$htmloption.'>';
$num = $this->db->num_rows($resql); $num = $this->db->num_rows($resql);
$i = 0; $i = 0;
if ($num) if ($num)
@ -531,7 +531,7 @@ class Form
if (empty($row['favorite']) && $atleastonefavorite) if (empty($row['favorite']) && $atleastonefavorite)
{ {
$atleastonefavorite=0; $atleastonefavorite=0;
$out.= '<option value="" disabled>----------------------</option>'; $out.= '<option value="" disabled class="selectoptiondisabledwhite">----------------------</option>';
} }
if ($selected && $selected != '-1' && ($selected == $row['rowid'] || $selected == $row['code_iso'] || $selected == $row['code_iso3'] || $selected == $row['label']) ) if ($selected && $selected != '-1' && ($selected == $row['rowid'] || $selected == $row['code_iso'] || $selected == $row['code_iso3'] || $selected == $row['label']) )
{ {
@ -554,6 +554,10 @@ class Form
dol_print_error($this->db); dol_print_error($this->db);
} }
// Make select dynamic
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
$out .= ajax_combobox('select'.$htmlname);
return $out; return $out;
} }
@ -1451,7 +1455,7 @@ class Form
$out.='<input type="hidden" class="removedassignedhidden" name="removedassigned" value="">'; $out.='<input type="hidden" class="removedassignedhidden" name="removedassigned" value="">';
$out.='<script type="text/javascript" language="javascript">jQuery(document).ready(function () { jQuery(".removedassigned").click(function() { jQuery(".removedassignedhidden").val(jQuery(this).val()); });})</script>'; $out.='<script type="text/javascript" language="javascript">jQuery(document).ready(function () { jQuery(".removedassigned").click(function() { jQuery(".removedassignedhidden").val(jQuery(this).val()); });})</script>';
$out.=$this->select_dolusers('', $htmlname, $show_empty, $exclude, $disabled, $include, $enableonly, $force_entity, $maxlength, $showstatus, $morefilter); $out.=$this->select_dolusers('', $htmlname, $show_empty, $exclude, $disabled, $include, $enableonly, $force_entity, $maxlength, $showstatus, $morefilter);
$out.='<input type="submit" class="button" name="'.$action.'assignedtouser" value="'.dol_escape_htmltag($langs->trans("Add")).'">'; $out.=' <input type="submit" class="button" name="'.$action.'assignedtouser" value="'.dol_escape_htmltag($langs->trans("Add")).'">';
} }
$assignedtouser=array(); $assignedtouser=array();
if (!empty($_SESSION['assignedtouser'])) if (!empty($_SESSION['assignedtouser']))
@ -2825,7 +2829,7 @@ class Form
/** /**
* Creates HTML units selector (code => label) * Creates HTML units selector (code => label)
* *
* @param string $selected Preselected code ('km', 'm', 'l', 'p', ...) * @param string $selected Preselected Unit ID
* @param string $htmlname Select name * @param string $htmlname Select name
* @param int $showempty Add a nempty line * @param int $showempty Add a nempty line
* @return string HTML select * @return string HTML select
@ -2846,13 +2850,13 @@ class Form
while($res = $this->db->fetch_object($resql)) while($res = $this->db->fetch_object($resql))
{ {
if ($selected == $res[0]) if ($selected == $res->rowid)
{ {
$return.='<option value="'.$res->code.'" selected>'.$langs->trans($res->label).'</option>'; $return.='<option value="'.$res->rowid.'" selected>'.$langs->trans($res->label).'</option>';
} }
else else
{ {
$return.='<option value="'.$res->code.'">'.$langs->trans($res->label).'</option>'; $return.='<option value="'.$res->rowid.'">'.$langs->trans($res->label).'</option>';
} }
} }
$return.='</select>'; $return.='</select>';
@ -4304,43 +4308,47 @@ class Form
/** /**
* Return a HTML select string, built from an array of key+value. * Return a HTML select string, built from an array of key+value.
* Note: Do not use returned string into a langs->trans function, content may be entity encoded twice. * Note: Do not apply langs->trans function on returned content, content may be entity encoded twice.
* *
* @param string $htmlname Name of html select area * @param string $htmlname Name of html select area. Must start with "multi" if this is a multiselect
* @param array $array Array with key+value * @param array $array Array with key+value
* @param string $id Preselected key * @param string|string[] $id Preselected key or preselected keys for multiselect
* @param int $show_empty 0 no empty value allowed, 1 to add an empty value into list (value is '' or '&nbsp;'). * @param int $show_empty 0 no empty value allowed, 1 to add an empty value into list (value is '' or '&nbsp;').
* @param int $key_in_label 1 pour afficher la key dans la valeur "[key] value" * @param int $key_in_label 1 pour afficher la key dans la valeur "[key] value"
* @param int $value_as_key 1 to use value as key * @param int $value_as_key 1 to use value as key
* @param string $moreparam Add more parameters onto the select tag * @param string $moreparam Add more parameters onto the select tag
* @param int $translate Translate and encode value * @param int $translate Translate and encode value
* @param int $maxlen Length maximum for labels * @param int $maxlen Length maximum for labels
* @param int $disabled Html select box is disabled * @param int $disabled Html select box is disabled
* @param int $sort 'ASC' or 'DESC' = Sort on label, '' or 'NONE' = Do not sort * @param int $sort 'ASC' or 'DESC' = Sort on label, '' or 'NONE' = Do not sort
* @param string $morecss Add more class to css styles * @param string $morecss Add more class to css styles
* @param int $addjscombo Add js combo * @param int $addjscombo Add js combo
* @return string HTML select string. * @return string HTML select string.
* @see multiselectarray * @see multiselectarray
*/ */
static function selectarray($htmlname, $array, $id='', $show_empty=0, $key_in_label=0, $value_as_key=0, $moreparam='', $translate=0, $maxlen=0, $disabled=0, $sort='', $morecss='', $addjscombo=0) static function selectarray($htmlname, $array, $id='', $show_empty=0, $key_in_label=0, $value_as_key=0, $moreparam='', $translate=0, $maxlen=0, $disabled=0, $sort='', $morecss='', $addjscombo=0)
{ {
global $conf, $langs; global $conf, $langs;
// Do we want a multiselect ?
$multiselect = 0;
if (preg_match('/^multi/',$htmlname)) $multiselect = 1;
if ($value_as_key) $array=array_combine($array, $array); if ($value_as_key) $array=array_combine($array, $array);
$out=''; $out='';
// Add code for jquery to use multiselect // Add code for jquery to use multiselect
if ($addjscombo && empty($conf->dol_use_jmobile) && (! empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) || defined('REQUIRE_JQUERY_MULTISELECT'))) if ($addjscombo && empty($conf->dol_use_jmobile) && $multiselect)
{ {
$tmpplugin=empty($conf->global->MAIN_USE_JQUERY_MULTISELECT)?constant('REQUIRE_JQUERY_MULTISELECT'):$conf->global->MAIN_USE_JQUERY_MULTISELECT; $tmpplugin=empty($conf->global->MAIN_USE_JQUERY_MULTISELECT)?constant('REQUIRE_JQUERY_MULTISELECT')?constant('REQUIRE_JQUERY_MULTISELECT'):'select2':$conf->global->MAIN_USE_JQUERY_MULTISELECT;
$out.='<!-- JS CODE TO ENABLE '.$tmpplugin.' for id '.$htmlname.' --> $out.='<!-- JS CODE TO ENABLE '.$tmpplugin.' for id '.$htmlname.' -->
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function () { $(document).ready(function () {
$(\''.(preg_match('/^\./',$htmlname)?$htmlname:'#'.$htmlname).'\').'.$tmpplugin.'({ $(\''.(preg_match('/^\./',$htmlname)?$htmlname:'#'.$htmlname).'\').'.$tmpplugin.'({
dir: \'ltr\', dir: \'ltr\',
width: \'off\', width: \'resolve\', /* off or resolve */
minimumInputLength: 0 minimumInputLength: '.$minLengthToAutocomplete.'
}); });
}); });
</script>'; </script>';
@ -4393,12 +4401,11 @@ class Form
/** /**
* Return a HTML select string, built from an array of key+value. * Return a HTML select string, built from an array of key+value but content returned into select come from an Ajax call of an URL.
* Note: Do not use returned string into a langs->trans function, content may be entity encoded twice. * Note: Do not apply langs->trans function on returned content, content may be entity encoded twice.
* *
* @param string $url Url
* @param string $htmlname Name of html select area * @param string $htmlname Name of html select area
* @param array $array Array with key+value * @param string $url Url
* @param string $id Preselected key * @param string $id Preselected key
* @param int $show_empty 0 no empty value allowed, 1 to add an empty value into list (value is '' or '&nbsp;'). * @param int $show_empty 0 no empty value allowed, 1 to add an empty value into list (value is '' or '&nbsp;').
* @param int $key_in_label 1 pour afficher la key dans la valeur "[key] value" * @param int $key_in_label 1 pour afficher la key dans la valeur "[key] value"
@ -4412,7 +4419,7 @@ class Form
* @param int $addjscombo Add js combo * @param int $addjscombo Add js combo
* @return string HTML select string. * @return string HTML select string.
*/ */
static function selectArrayAjax($url, $htmlname, $array, $id='', $show_empty=0, $key_in_label=0, $value_as_key=0, $moreparam='', $translate=0, $maxlen=0, $disabled=0, $sort='', $morecss='', $addjscombo=0) static function selectArrayAjax($htmlname, $url, $id='', $show_empty=0, $key_in_label=0, $value_as_key=0, $moreparam='', $translate=0, $maxlen=0, $disabled=0, $sort='', $morecss='', $addjscombo=0)
{ {
$out = ''; $out = '';
@ -4455,7 +4462,7 @@ class Form
} }
else else
{ {
// TODO get values from ajax page to use a standard already completed array // TODO get all values from $url into $array
} }
@ -4590,7 +4597,7 @@ class Form
if ($rendermode == 0) if ($rendermode == 0)
{ {
$cate_arbo = $this->select_all_categories(0, '', 'parent', 64, 0, 1); $cate_arbo = $this->select_all_categories(Categorie::TYPE_PRODUCT, '', 'parent', 64, 0, 1);
foreach($categories as $c) { foreach($categories as $c) {
$arrayselected[] = $c->id; $arrayselected[] = $c->id;
} }
@ -4698,15 +4705,15 @@ class Form
* To add a particular filter on select, you must set $object->next_prev_filter to SQL criteria. * To add a particular filter on select, you must set $object->next_prev_filter to SQL criteria.
* *
* @param object $object Object to show * @param object $object Object to show
* @param string $paramid Name of parameter to use to name the id into the URL link * @param string $paramid Name of parameter to use to name the id into the URL link
* @param string $morehtml More html content to output just before the nav bar * @param string $morehtml More html content to output just before the nav bar
* @param int $shownav Show Condition (navigation is shown if value is 1) * @param int $shownav Show Condition (navigation is shown if value is 1)
* @param string $fieldid Nom du champ en base a utiliser pour select next et previous * @param string $fieldid Nom du champ en base a utiliser pour select next et previous
* @param string $fieldref Nom du champ objet ref (object->ref) a utiliser pour select next et previous * @param string $fieldref Nom du champ objet ref (object->ref) a utiliser pour select next et previous
* @param string $morehtmlref Code html supplementaire a afficher apres ref * @param string $morehtmlref Code html supplementaire a afficher apres ref
* @param string $moreparam More param to add in nav link url. * @param string $moreparam More param to add in nav link url.
* @param int $nodbprefix Do not include DB prefix to forge table name * @param int $nodbprefix Do not include DB prefix to forge table name
* @return string Portion HTML avec ref + boutons nav * @return string Portion HTML avec ref + boutons nav
*/ */
function showrefnav($object,$paramid,$morehtml='',$shownav=1,$fieldid='rowid',$fieldref='ref',$morehtmlref='',$moreparam='',$nodbprefix=0) function showrefnav($object,$paramid,$morehtml='',$shownav=1,$fieldid='rowid',$fieldref='ref',$morehtmlref='',$moreparam='',$nodbprefix=0)
{ {
@ -4785,11 +4792,14 @@ class Form
* @param string $modulepart Key to define module concerned ('societe', 'userphoto', 'memberphoto') * @param string $modulepart Key to define module concerned ('societe', 'userphoto', 'memberphoto')
* @param object $object Object containing data to retrieve file name * @param object $object Object containing data to retrieve file name
* @param int $width Width of photo * @param int $width Width of photo
* @param int $height Height of photo (auto if 0)
* @param int $caneditfield Add edit fields
* @param string $cssclass CSS name to use on img for photo
* @return string HTML code to output photo * @return string HTML code to output photo
*/ */
static function showphoto($modulepart,$object,$width=100) static function showphoto($modulepart, $object, $width=100, $height=0, $caneditfield=0, $cssclass='photowithmargin')
{ {
global $conf; global $conf,$langs;
$entity = (! empty($object->entity) ? $object->entity : $conf->entity); $entity = (! empty($object->entity) ? $object->entity : $conf->entity);
$id = (! empty($object->id) ? $object->id : $object->rowid); $id = (! empty($object->id) ? $object->id : $object->rowid);
@ -4816,7 +4826,7 @@ class Form
if ($object->photo) $file=get_exdir($id, 2, 0, 0, $object, 'invoice_supplier').'photos/'.$object->photo; if ($object->photo) $file=get_exdir($id, 2, 0, 0, $object, 'invoice_supplier').'photos/'.$object->photo;
if (! empty($conf->global->MAIN_OLD_IMAGE_LINKS)) $altfile=$object->id.".jpg"; // For backward compatibility if (! empty($conf->global->MAIN_OLD_IMAGE_LINKS)) $altfile=$object->id.".jpg"; // For backward compatibility
$email=$object->email; $email=$object->email;
}else { } else {
$dir=$conf->$modulepart->dir_output; $dir=$conf->$modulepart->dir_output;
if ($object->photo) $file=get_exdir($id, 2, 0, 0, $adherent, 'member').'photos/'.$object->photo; if ($object->photo) $file=get_exdir($id, 2, 0, 0, $adherent, 'member').'photos/'.$object->photo;
if (! empty($conf->global->MAIN_OLD_IMAGE_LINKS)) $altfile=$object->id.".jpg"; // For backward compatibility if (! empty($conf->global->MAIN_OLD_IMAGE_LINKS)) $altfile=$object->id.".jpg"; // For backward compatibility
@ -4830,28 +4840,47 @@ class Form
{ {
// TODO Link to large image // TODO Link to large image
$ret.='<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($file).'&cache='.$cache.'">'; $ret.='<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($file).'&cache='.$cache.'">';
$ret.='<img alt="Photo" id="photologo'.(preg_replace('/[^a-z]/i','_',$file)).'" class="photologo" border="0" width="'.$width.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($file).'&cache='.$cache.'">'; $ret.='<img alt="Photo" id="photologo'.(preg_replace('/[^a-z]/i','_',$file)).'" class="'.$cssclass.'" '.($width?' width="'.$width.'"':'').($height?' height="'.$height.'"':'').' src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($file).'&cache='.$cache.'">';
$ret.='</a>'; $ret.='</a>';
} }
else if ($altfile && file_exists($dir."/".$altfile)) else if ($altfile && file_exists($dir."/".$altfile))
{ {
$ret.='<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($file).'&cache='.$cache.'">'; $ret.='<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($file).'&cache='.$cache.'">';
$ret.='<img alt="Photo alt" id="photologo'.(preg_replace('/[^a-z]/i','_',$file)).'" class="photologo" border="0" width="'.$width.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($altfile).'&cache='.$cache.'">'; $ret.='<img alt="Photo alt" id="photologo'.(preg_replace('/[^a-z]/i','_',$file)).'" class="'.$cssclass.'" '.($width?' width="'.$width.'"':'').($height?' height="'.$height.'"':'').' src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$entity.'&file='.urlencode($altfile).'&cache='.$cache.'">';
$ret.='</a>'; $ret.='</a>';
} }
else else
{ {
if (! empty($conf->gravatar->enabled) && $email) $nophoto='/theme/common/nophoto.jpg';
if (in_array($modulepart,array('userphoto','contact'))) // For module thar are "physical" users
{
$nophoto='/theme/common/user_anonymous.png';
if ($object->gender == 'man') $nophoto='/theme/common/user_man.png';
if ($object->gender == 'woman') $nophoto='/theme/common/user_woman.png';
}
if (! empty($conf->gravatar->enabled) && $email)
{ {
global $dolibarr_main_url_root; global $dolibarr_main_url_root;
$ret.='<!-- Put link to gravatar -->'; $ret.='<!-- Put link to gravatar -->';
$ret.='<img alt="Photo found on Gravatar" title="Photo Gravatar.com - email '.$email.'" border="0" width="'.$width.'" src="http://www.gravatar.com/avatar/'.dol_hash($email,3).'?s='.$width.'&d='.urlencode(dol_buildpath('/theme/common/nophoto.jpg',2)).'">'; // gravatar need md5 hash $ret.='<img class="photo'.$modulepart.'" alt="Photo found on Gravatar" title="Photo Gravatar.com - email '.$email.'" border="0"'.($width?' width="'.$width.'"':'').($height?' height="'.$height.'"':'').' src="http://www.gravatar.com/avatar/'.dol_hash($email,3).'?s='.$width.'&d='.urlencode(dol_buildpath($nophoto,2)).'">'; // gravatar need md5 hash
} }
else else
{ {
$ret.='<img alt="No photo" border="0" width="'.$width.'" src="'.DOL_URL_ROOT.'/theme/common/nophoto.jpg">'; $ret.='<img class="photo'.$modulepart.'" alt="No photo" border="0"'.($width?' width="'.$width.'"':'').($height?' height="'.$height.'"':'').' src="'.DOL_URL_ROOT.$nophoto.'">';
} }
} }
if ($caneditfield)
{
if ($object->photo) $ret.="<br>\n";
$ret.='<table class="nobordernopadding hideonsmartphone">';
if ($object->photo) $ret.='<tr><td align="center"><input type="checkbox" class="flat photodelete" name="deletephoto" id="photodelete"> '.$langs->trans("Delete").'<br><br></td></tr>';
$ret.='<tr><td>'.$langs->trans("PhotoFile").'</td></tr>';
$ret.='<tr><td><input type="file" class="flat" name="photo" id="photoinput"></td></tr>';
$ret.='</table>';
}
} }
else dol_print_error('','Call of showphoto with wrong parameters'); else dol_print_error('','Call of showphoto with wrong parameters');

View File

@ -105,6 +105,10 @@ class FormAdmin
} }
$out.= '</select>'; $out.= '</select>';
// Make select dynamic
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
$out.= ajax_combobox($htmlname);
return $out; return $out;
} }

View File

@ -210,6 +210,7 @@ class FormCompany
* @param string $country_codeid Country code or id: 0=list for all countries, otherwise country code or country rowid to show * @param string $country_codeid Country code or id: 0=list for all countries, otherwise country code or country rowid to show
* @param string $htmlname Id of department * @param string $htmlname Id of department
* @return string String with HTML select * @return string String with HTML select
* @see select_country
*/ */
function select_state($selected='',$country_codeid=0, $htmlname='state_id') function select_state($selected='',$country_codeid=0, $htmlname='state_id')
{ {
@ -234,7 +235,7 @@ class FormCompany
$result=$this->db->query($sql); $result=$this->db->query($sql);
if ($result) if ($result)
{ {
if (!empty($htmlname)) $out.= '<select id="'.$htmlname.'" class="flat" name="'.$htmlname.'">'; if (!empty($htmlname)) $out.= '<select id="'.$htmlname.'" class="flat minwidth300" name="'.$htmlname.'">';
if ($country_codeid) $out.= '<option value="0">&nbsp;</option>'; if ($country_codeid) $out.= '<option value="0">&nbsp;</option>';
$num = $this->db->num_rows($result); $num = $this->db->num_rows($result);
$i = 0; $i = 0;
@ -277,13 +278,17 @@ class FormCompany
} }
} }
if (! empty($htmlname)) $out.= '</select>'; if (! empty($htmlname)) $out.= '</select>';
if (! empty($htmlname) && $user->admin) $out.= info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); if (! empty($htmlname) && $user->admin) $out.= ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
} }
else else
{ {
dol_print_error($this->db); dol_print_error($this->db);
} }
// Make select dynamic
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
$out .= ajax_combobox($htmlname);
return $out; return $out;
} }
@ -431,9 +436,10 @@ class FormCompany
* @param string $selected Preselected code of juridical type * @param string $selected Preselected code of juridical type
* @param int $country_codeid 0=list for all countries, otherwise list only country requested * @param int $country_codeid 0=list for all countries, otherwise list only country requested
* @param string $filter Add a SQL filter on list * @param string $filter Add a SQL filter on list
* @param string $htmlname HTML name of select
* @return string String with HTML select * @return string String with HTML select
*/ */
function select_juridicalstatus($selected='', $country_codeid=0, $filter='') function select_juridicalstatus($selected='', $country_codeid=0, $filter='', $htmlname='forme_juridique_code')
{ {
global $conf,$langs,$user; global $conf,$langs,$user;
$langs->load("dict"); $langs->load("dict");
@ -454,7 +460,7 @@ class FormCompany
if ($resql) if ($resql)
{ {
$out.= '<div id="particulier2" class="visible">'; $out.= '<div id="particulier2" class="visible">';
$out.= '<select class="flat" name="forme_juridique_code" id="legal_form">'; $out.= '<select class="flat minwidth200" name="'.$htmlname.'" id="'.$htmlname.'">';
if ($country_codeid) $out.= '<option value="0">&nbsp;</option>'; // When country_codeid is set, we force to add an empty line because it does not appears from select. When not set, we already get the empty line from select. if ($country_codeid) $out.= '<option value="0">&nbsp;</option>'; // When country_codeid is set, we force to add an empty line because it does not appears from select. When not set, we already get the empty line from select.
$num = $this->db->num_rows($resql); $num = $this->db->num_rows($resql);
@ -488,7 +494,7 @@ class FormCompany
// Show break when we are in multi country mode // Show break when we are in multi country mode
if (empty($country_codeid) && $val['country_code']) if (empty($country_codeid) && $val['country_code'])
{ {
$out.= '<option value="0">----- '.$val['country']." -----</option>\n"; $out.= '<option value="0" disabled class="selectoptiondisabledwhite">----- '.$val['country']." -----</option>\n";
$country=$val['country']; $country=$val['country'];
} }
} }
@ -508,6 +514,11 @@ class FormCompany
} }
$out.= '</select>'; $out.= '</select>';
if ($user->admin) $out.= info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); if ($user->admin) $out.= info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
// Make select dynamic
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
$out .= ajax_combobox($htmlname);
$out.= '</div>'; $out.= '</div>';
} }
else else

View File

@ -118,7 +118,7 @@ class FormFile
$out .= '<input class="flat" type="file" name="userfile" size="'.$maxlength.'"'; $out .= '<input class="flat" type="file" name="userfile" size="'.$maxlength.'"';
$out .= (empty($conf->global->MAIN_UPLOAD_DOC) || empty($perm)?' disabled':''); $out .= (empty($conf->global->MAIN_UPLOAD_DOC) || empty($perm)?' disabled':'');
$out .= '>'; $out .= '>';
$out .= ' &nbsp; '; $out .= '&nbsp;';
$out .= '<input type="submit" class="button" name="sendit" value="'.$langs->trans("Upload").'"'; $out .= '<input type="submit" class="button" name="sendit" value="'.$langs->trans("Upload").'"';
$out .= (empty($conf->global->MAIN_UPLOAD_DOC) || empty($perm)?' disabled':''); $out .= (empty($conf->global->MAIN_UPLOAD_DOC) || empty($perm)?' disabled':'');
$out .= '>'; $out .= '>';
@ -183,6 +183,7 @@ class FormFile
$out .= '<input type="text" name="label" id="label">'; $out .= '<input type="text" name="label" id="label">';
$out .= '<input type="hidden" name="objecttype" value="' . $object->element . '">'; $out .= '<input type="hidden" name="objecttype" value="' . $object->element . '">';
$out .= '<input type="hidden" name="objectid" value="' . $object->id . '">'; $out .= '<input type="hidden" name="objectid" value="' . $object->id . '">';
$out .= '&nbsp;';
$out .= '<input type="submit" class="button" name="linkit" value="'.$langs->trans("ToLink").'"'; $out .= '<input type="submit" class="button" name="linkit" value="'.$langs->trans("ToLink").'"';
$out .= (empty($conf->global->MAIN_UPLOAD_DOC) || empty($perm)?' disabled':''); $out .= (empty($conf->global->MAIN_UPLOAD_DOC) || empty($perm)?' disabled':'');
$out .= '>'; $out .= '>';

View File

@ -384,7 +384,7 @@ class FormOther
} }
// Select each sales and print them in a select input // Select each sales and print them in a select input
$out.='<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'"'.$nodatarole.'>'; $out.='<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'"'.$nodatarole.'>';
if ($showempty) $out.='<option value="-1">&nbsp;</option>'; if ($showempty) $out.='<option value="0">&nbsp;</option>';
// Get list of users allowed to be viewed // Get list of users allowed to be viewed
$sql_usr = "SELECT u.rowid, u.lastname, u.firstname, u.statut, u.login"; $sql_usr = "SELECT u.rowid, u.lastname, u.firstname, u.statut, u.login";

View File

@ -28,6 +28,8 @@ require_once DOL_DOCUMENT_ROOT .'/core/db/DoliDB.class.php';
/** /**
* Class to manage Dolibarr database access for a MySQL database using the mysql extension * Class to manage Dolibarr database access for a MySQL database using the mysql extension
*
* @deprecated Use DoliDBMysqli
*/ */
class DoliDBMysql extends DoliDB class DoliDBMysql extends DoliDB
{ {

View File

@ -421,6 +421,15 @@ function actions_prepare_head($object)
$head[$h][2] = 'card'; $head[$h][2] = 'card';
$h++; $h++;
// Tab to link resources
if ($conf->resource->enabled)
{
$head[$h][0] = DOL_URL_ROOT.'/resource/element_resource.php?element=action&element_id='.$object->id;
$head[$h][1] = $langs->trans("Resources");
$head[$h][2] = 'resources';
$h++;
}
// Attached files // Attached files
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$upload_dir = $conf->agenda->dir_output . "/" . $object->id; $upload_dir = $conf->agenda->dir_output . "/" . $object->id;

View File

@ -328,14 +328,17 @@ function ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $
if (empty($minLengthToAutocomplete)) $minLengthToAutocomplete=0; if (empty($minLengthToAutocomplete)) $minLengthToAutocomplete=0;
$msg = '<script type="text/javascript"> $tmpplugin='select2';
$(document).ready(function() { $msg='<!-- JS CODE TO ENABLE '.$tmpplugin.' for id '.$htmlname.' -->
$(\'#'.$htmlname.'\').select2({ <script type="text/javascript">
width: \'resolve\', $(document).ready(function () {
minimumInputLength: '.$minLengthToAutocomplete.', $(\''.(preg_match('/^\./',$htmlname)?$htmlname:'#'.$htmlname).'\').'.$tmpplugin.'({
})'; dir: \'ltr\',
width: \'resolve\', /* off or resolve */
minimumInputLength: '.$minLengthToAutocomplete.'
})';
if ($forcefocus) $msg.= '.select2(\'focus\')'; if ($forcefocus) $msg.= '.select2(\'focus\')';
$msg.= ';'; $msg.= ';'."\n";
if (count($event)) if (count($event))
{ {

View File

@ -1,13 +1,14 @@
<?php <?php
/* Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2006 Rodolphe Quiedeville <rodolphe@quiedeville.org> * Copyright (C) 2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com> * Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2010-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2014 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2013-2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Christophe Battarel <contact@altairis.fr> * Copyright (C) 2013 Christophe Battarel <contact@altairis.fr>
* Copyright (C) 2013 Alexandre Spangaro <alexandre.spangaro@gmail.com> * Copyright (C) 2013 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* Copyright (C) 2015 Frederic France <frederic.france@free.fr> * Copyright (C) 2015 Frederic France <frederic.france@free.fr>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -83,14 +84,24 @@ function societe_prepare_head(Societe $object)
//show categorie tab //show categorie tab
if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire)) if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire))
{ {
$type = 2; require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
if ($object->fournisseur) $type = 1; $type = Categorie::TYPE_CUSTOMER;
if ($object->fournisseur) $type = Categorie::TYPE_SUPPLIER;
$head[$h][0] = DOL_URL_ROOT.'/categories/categorie.php?socid='.$object->id."&type=".$type; $head[$h][0] = DOL_URL_ROOT.'/categories/categorie.php?socid='.$object->id."&type=".$type;
$head[$h][1] = $langs->trans('Categories'); $head[$h][1] = $langs->trans('Categories');
$head[$h][2] = 'category'; $head[$h][2] = 'category';
$h++; $h++;
} }
// Tab to link resources
if ($conf->resource->enabled && ! empty($conf->global->RESOURCE_ON_THIRDPARTIES))
{
$head[$h][0] = DOL_URL_ROOT.'/resource/element_resource.php?element=societe&element_id='.$object->id;
$head[$h][1] = $langs->trans("Resources");
$head[$h][2] = 'resources';
$h++;
}
// Show more tabs from modules // Show more tabs from modules
// Entries must be declared in modules descriptor with line // 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 // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab

View File

@ -1,7 +1,8 @@
<?php <?php
/* Copyright (C) 2006-2010 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2006-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2010-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2015 Frederic France <frederic.france@free.fr> * Copyright (C) 2015 Frederic France <frederic.france@free.fr>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -88,7 +89,8 @@ function contact_prepare_head(Contact $object)
if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire)) if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire))
{ {
$type = 4; require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
$type = Categorie::TYPE_CONTACT;
$head[$tab][0] = DOL_URL_ROOT.'/categories/categorie.php?id='.$object->id."&type=".$type; $head[$tab][0] = DOL_URL_ROOT.'/categories/categorie.php?id='.$object->id."&type=".$type;
$head[$tab][1] = $langs->trans('Categories'); $head[$tab][1] = $langs->trans('Categories');
$head[$tab][2] = 'category'; $head[$tab][2] = 'category';

View File

@ -793,12 +793,12 @@ function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disable
/** /**
* Remove a file or several files with a mask * Remove a file or several files with a mask
* *
* @param string $file File to delete or mask of file to delete * @param string $file File to delete or mask of files to delete
* @param int $disableglob Disable usage of glob like * * @param int $disableglob Disable usage of glob like * so function is an exact delete function that will return error if no file found
* @param int $nophperrors Disable all PHP output errors * @param int $nophperrors Disable all PHP output errors
* @param int $nohook Disable all hooks * @param int $nohook Disable all hooks
* @param object $object Current object in use * @param object $object Current object in use
* @return boolean True if file is deleted (or if glob is used and there's nothing to delete), False if error * @return boolean True if no error (file is deleted or if glob is used and there's nothing to delete), False if error
*/ */
function dol_delete_file($file,$disableglob=0,$nophperrors=0,$nohook=0,$object=null) function dol_delete_file($file,$disableglob=0,$nophperrors=0,$nohook=0,$object=null)
{ {
@ -823,19 +823,20 @@ function dol_delete_file($file,$disableglob=0,$nophperrors=0,$nohook=0,$object=n
$reshook=$hookmanager->executeHooks('deleteFile', $parameters, $object); $reshook=$hookmanager->executeHooks('deleteFile', $parameters, $object);
} }
if (empty($nohook) && isset($reshook) && $reshook != '') // 0:not deleted, 1:deleted, null or '' for bypass if (empty($nohook) && $reshook != 0) // reshook = 0 to do standard actions, 1 = ok, -1 = ko
{ {
return $reshook; if ($reshook < 0) return false;
return true;
} }
else else
{ {
$error=0; $error=0;
//print "x".$file." ".$disableglob;exit; //print "x".$file." ".$disableglob;exit;
$ok=true;
$file_osencoded=dol_osencode($file); // New filename encoded in OS filesystem encoding charset $file_osencoded=dol_osencode($file); // New filename encoded in OS filesystem encoding charset
if (empty($disableglob) && ! empty($file_osencoded)) if (empty($disableglob) && ! empty($file_osencoded))
{ {
$ok=true;
$globencoded=str_replace('[','\[',$file_osencoded); $globencoded=str_replace('[','\[',$file_osencoded);
$globencoded=str_replace(']','\]',$globencoded); $globencoded=str_replace(']','\]',$globencoded);
$listofdir=glob($globencoded); $listofdir=glob($globencoded);
@ -853,6 +854,7 @@ function dol_delete_file($file,$disableglob=0,$nophperrors=0,$nohook=0,$object=n
} }
else else
{ {
$ok=false;
if ($nophperrors) $ok=@unlink($file_osencoded); if ($nophperrors) $ok=@unlink($file_osencoded);
else $ok=unlink($file_osencoded); else $ok=unlink($file_osencoded);
if ($ok) dol_syslog("Removed file ".$file_osencoded, LOG_DEBUG); if ($ok) dol_syslog("Removed file ".$file_osencoded, LOG_DEBUG);
@ -958,9 +960,9 @@ function dol_delete_preview($object)
if (file_exists($file) && is_writable($file)) if (file_exists($file) && is_writable($file))
{ {
if ( ! dol_delete_file($file,1) ) if (! dol_delete_file($file,1))
{ {
$object->error=$langs->trans("ErrorFailedToOpenFile",$file); $object->error=$langs->trans("ErrorFailedToDeleteFile",$file);
return 0; return 0;
} }
} }

View File

@ -541,7 +541,7 @@ function dol_escape_js($stringtoescape, $mode=0, $noescapebackslashn=0)
/** /**
* Returns text escaped for inclusion in HTML alt or title tags * Returns text escaped for inclusion in HTML alt or title tags, or into values of HTMPL input fields
* *
* @param string $stringtoescape String to escape * @param string $stringtoescape String to escape
* @param int $keepb Do not clean b tags * @param int $keepb Do not clean b tags
@ -740,7 +740,7 @@ function dol_get_fiche_head($links=array(), $active='0', $title='', $notab=0, $p
else else
$isactive=false; $isactive=false;
if ($i <=$limittoshow || $isactive ) if ($i <= $limittoshow || $isactive )
{ {
$out.='<div class="inline-block tabsElem'.($isactive ? ' tabsElemActive' : '').((! $isactive && ! empty($conf->global->MAIN_HIDE_INACTIVETAB_ON_PRINT))?' hideonprint':'').'"><!-- id tab = '.(empty($links[$i][2])?'':$links[$i][2]).' -->'; $out.='<div class="inline-block tabsElem'.($isactive ? ' tabsElemActive' : '').((! $isactive && ! empty($conf->global->MAIN_HIDE_INACTIVETAB_ON_PRINT))?' hideonprint':'').'"><!-- id tab = '.(empty($links[$i][2])?'':$links[$i][2]).' -->';
if (isset($links[$i][2]) && $links[$i][2] == 'image') if (isset($links[$i][2]) && $links[$i][2] == 'image')
@ -774,13 +774,13 @@ function dol_get_fiche_head($links=array(), $active='0', $title='', $notab=0, $p
if (isset($links[$i][2]) && $links[$i][2] == 'image') if (isset($links[$i][2]) && $links[$i][2] == 'image')
{ {
if (!empty($links[$i][0])) if (!empty($links[$i][0]))
$outmore.='<a class="tabimage" href="'.$links[$i][0].'">'.$links[$i][1].'</a>'."\n"; $outmore.='<a class="tabimage" href="'.$links[$i][0].'">'.$links[$i][1].'</a>'."\n";
else else
$outmore.='<span class="tabspan">'.$links[$i][1].'</span>'."\n"; $outmore.='<span class="tabspan">'.$links[$i][1].'</span>'."\n";
} }
else if (! empty($links[$i][1])) else if (! empty($links[$i][1]))
$outmore.='<a "'.(! empty($links[$i][2])?' id="'.$links[$i][2].'"':'').' class="inline-block" href="'.$links[$i][0].'">'.$links[$i][1].'</a>'."\n"; $outmore.='<a'.(! empty($links[$i][2])?' id="'.$links[$i][2].'"':'').' class="inline-block" href="'.$links[$i][0].'">'.$links[$i][1].'</a>'."\n";
$outmore.='</div>'; $outmore.='</div>';
} }
@ -789,14 +789,15 @@ function dol_get_fiche_head($links=array(), $active='0', $title='', $notab=0, $p
if ($displaytab > $limittoshow) if ($displaytab > $limittoshow)
{ {
$out.='<div id="moretabs" class="inline-block tabsElem">'; $tabsname=str_replace("@", "", $picto);
$out.='<div id="moretabs'.$tabsname.'" class="inline-block tabsElem">';
$out.='<a href="" data-role="button" style="background-color: #f0f0f0;" class="tab inline-block">'.$langs->trans("More").'...</a>'; $out.='<a href="" data-role="button" style="background-color: #f0f0f0;" class="tab inline-block">'.$langs->trans("More").'...</a>';
$out.='<div id="moretabsList" style="position: absolute; left: -999em;text-align: left;margin:0px;padding:2px">'.$outmore.'</div>'; $out.='<div id="moretabsList'.$tabsname.'" style="position: absolute; left: -999em;text-align: left;margin:0px;padding:2px">'.$outmore.'</div>';
$out.="</div>\n"; $out.="</div>\n";
$out.="<script>"; $out.="<script>";
$out.="$('#moretabs').mouseenter( function() { $('#moretabsList').css('left','auto');});"; $out.="$('#moretabs".$tabsname.").mouseenter( function() { $('#moretabsList".$tabsname.").css('left','auto');});";
$out.="$('#moretabs').mouseleave( function() { $('#moretabsList').css('left','-999em');});"; $out.="$('#moretabs".$tabsname.").mouseleave( function() { $('#moretabsList".$tabsname.").css('left','-999em');});";
$out.="</script>"; $out.="</script>";
} }
@ -2216,7 +2217,7 @@ function img_warning($titlealt = 'default', $float = 0)
if ($titlealt == 'default') $titlealt = $langs->trans('Warning'); if ($titlealt == 'default') $titlealt = $langs->trans('Warning');
return img_picto($titlealt, 'warning.png', ($float ? 'style="float: right"' : '')); return img_picto($titlealt, 'warning.png', 'class="pictowarning"'.($float ? ' style="float: right"' : ''));
} }
/** /**
@ -2821,34 +2822,34 @@ function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $so
if ($cpt>=1) if ($cpt>=1)
{ {
$pagelist.= '<li class="pagination"><a href="'.$file.'?page=0'.$options.'&amp;sortfield='.$sortfield.'&amp;sortorder='.$sortorder.'">1</a></li>'; $pagelist.= '<li'.(empty($conf->dol_use_jmobile)?' class="pagination"':'').'><a '.(empty($conf->dol_use_jmobile)?'':'data-role="button" ').'href="'.$file.'?page=0'.$options.'&amp;sortfield='.$sortfield.'&amp;sortorder='.$sortorder.'">1</a></li>';
if ($cpt >= 2) $pagelist.='<li><span class="inactive">...</span></li>'; if ($cpt >= 2) $pagelist.='<li><span class="inactive">...</span></li>';
} }
do do
{ {
if ($cpt==$page) if ($cpt==$page)
{ {
$pagelist.= '<li class="pagination"><span class="active">'.($page+1).'</span></li>'; $pagelist.= '<li'.(empty($conf->dol_use_jmobile)?' class="pagination"':'').'><span '.(empty($conf->dol_use_jmobile)?'class="active"':'data-role="button"').'>'.($page+1).'</span></li>';
} }
else else
{ {
$pagelist.= '<li class="pagination"><a href="'.$file.'?page='.$cpt.$options.'&amp;sortfield='.$sortfield.'&amp;sortorder='.$sortorder.'">'.($cpt+1).'</a></li>'; $pagelist.= '<li'.(empty($conf->dol_use_jmobile)?' class="pagination"':'').'><a '.(empty($conf->dol_use_jmobile)?'':'data-role="button" ').'href="'.$file.'?page='.$cpt.$options.'&amp;sortfield='.$sortfield.'&amp;sortorder='.$sortorder.'">'.($cpt+1).'</a></li>';
} }
$cpt++; $cpt++;
} }
while ($cpt < $nbpages && $cpt<=$page+$maxnbofpage); while ($cpt < $nbpages && $cpt<=$page+$maxnbofpage);
if ($cpt<$nbpages) if ($cpt<$nbpages)
{ {
if ($cpt<$nbpages-1) $pagelist.= '<li class="pagination"><span class="inactive">...</span></li>'; if ($cpt<$nbpages-1) $pagelist.= '<li'.(empty($conf->dol_use_jmobile)?' class="pagination"':'').'><span '.(empty($conf->dol_use_jmobile)?'class="inactive"':'data-role="button"').'>...</span></li>';
$pagelist.= '<li class="pagination"><a href="'.$file.'?page='.($nbpages-1).$options.'&amp;sortfield='.$sortfield.'&amp;sortorder='.$sortorder.'">'.$nbpages.'</a></li>'; $pagelist.= '<li'.(empty($conf->dol_use_jmobile)?' class="pagination"':'').'><a '.(empty($conf->dol_use_jmobile)?'':'data-role="button" ').'href="'.$file.'?page='.($nbpages-1).$options.'&amp;sortfield='.$sortfield.'&amp;sortorder='.$sortorder.'">'.$nbpages.'</a></li>';
} }
} }
else else
{ {
$pagelist.= '<li class="pagination"><span class="active">'.($page+1)."</li>"; $pagelist.= '<li'.(empty($conf->dol_use_jmobile)?' class="pagination"':'').'><span '.(empty($conf->dol_use_jmobile)?'class="active"':'data-role="button"').'>'.($page+1)."</li>";
} }
} }
print_fleche_navigation($page,$file,$options,$nextpage,$pagelist,$morehtml); print_fleche_navigation($page,$file,$options,$nextpage,$pagelist,$morehtml); // output the div and ul for previous/last completed with page numbers into $pagelist
print '</td>'; print '</td>';
print '</tr></table>'."\n"; print '</tr></table>'."\n";
@ -4974,21 +4975,22 @@ function dol_getmypid()
/** /**
* Generate natural SQL search string * Generate natural SQL search string for a criteria (this criteria can be tested on one or several fields)
* *
* @param string|string[] $fields String or array of strings, filled with the name of fields in the SQL query * @param string|string[] $fields String or array of strings, filled with the name of all fields in the SQL query we must check (combined with a OR)
* @param string $value The value to look for. * @param string $value The value to look for.
* If param $numeric is 0, can contains several keywords separated with a space, like "keyword1 keyword2" = We want record field like keyword1 and field like keyword2 * If param $mode is 0, can contains several keywords separated with a space, like "keyword1 keyword2" = We want record field like keyword1 and field like keyword2
* If param $numeric is 1, can contains an operator <>= like "<10" or ">=100.5 < 1000" * If param $mode is 1, can contains an operator <, > or = like "<10" or ">=100.5 < 1000"
* @param integer $numeric 0=value is list of keywords, 1=value is a numeric test * If param $mode is 2, can contains a list of id separated by comma like "1,3,4"
* @param integer $mode 0=value is list of keywords, 1=value is a numeric test (Example ">5.5 <10"), 2=value is a list of id separated with comma (Example '1,3,4')
* @param integer $nofinaland 1=Do now output the final 'AND' * @param integer $nofinaland 1=Do now output the final 'AND'
* @return string $res The statement to append to the SQL query * @return string $res The statement to append to the SQL query
*/ */
function natural_search($fields, $value, $numeric=0, $nofinaland=0) function natural_search($fields, $value, $mode=0, $nofinaland=0)
{ {
global $db,$langs; global $db,$langs;
if ($numeric) if ($mode == 1)
{ {
$value=preg_replace('/([<>=]+)\s+([0-9'.preg_quote($langs->trans("DecimalSeparator"),'/').'\-])/','\1\2',$value); // Clean string '< 10' into '<10' so we can the explode on space to get all tests to do $value=preg_replace('/([<>=]+)\s+([0-9'.preg_quote($langs->trans("DecimalSeparator"),'/').'\-])/','\1\2',$value); // Clean string '< 10' into '<10' so we can the explode on space to get all tests to do
} }
@ -5005,7 +5007,7 @@ function natural_search($fields, $value, $numeric=0, $nofinaland=0)
$newres = ''; $newres = '';
foreach ($fields as $field) foreach ($fields as $field)
{ {
if ($numeric) if ($mode == 1)
{ {
$operator='='; $operator='=';
$newcrit = preg_replace('/([<>=]+)/','',trim($crit)); $newcrit = preg_replace('/([<>=]+)/','',trim($crit));
@ -5029,8 +5031,13 @@ function natural_search($fields, $value, $numeric=0, $nofinaland=0)
$i2++; // a criteria was added to string $i2++; // a criteria was added to string
} }
} }
else else if ($mode == 2)
{ {
$newres .= ($i2 > 0 ? ' OR ' : '') . $field . " IN (" . $db->escape(trim($crit)) . ")";
$i2++; // a criteria was added to string
}
else
{
$newres .= ($i2 > 0 ? ' OR ' : '') . $field . " LIKE '%" . $db->escape(trim($crit)) . "%'"; $newres .= ($i2 > 0 ? ' OR ' : '') . $field . " LIKE '%" . $db->escape(trim($crit)) . "%'";
$i2++; // a criteria was added to string $i2++; // a criteria was added to string
} }

View File

@ -637,10 +637,21 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m
//$date=dol_mktime(12, 0, 0, 1, 1, 1900); //$date=dol_mktime(12, 0, 0, 1, 1, 1900);
//$date=dol_stringtotime('20130101'); //$date=dol_stringtotime('20130101');
$hasglobalcounter=false;
// Extract value for mask counter, mask raz and mask offset // Extract value for mask counter, mask raz and mask offset
if (! preg_match('/\{(0+)([@\+][0-9\-\+\=]+)?([@\+][0-9\-\+\=]+)?\}/i',$mask,$reg)) return 'ErrorBadMask'; if (preg_match('/\{(0+)([@\+][0-9\-\+\=]+)?([@\+][0-9\-\+\=]+)?\}/i',$mask,$reg))
$masktri=$reg[1].(! empty($reg[2])?$reg[2]:'').(! empty($reg[3])?$reg[3]:''); {
$maskcounter=$reg[1]; $masktri=$reg[1].(! empty($reg[2])?$reg[2]:'').(! empty($reg[3])?$reg[3]:'');
$maskcounter=$reg[1];
$hasglobalcounter=true;
}
else
{
// setting some defaults so the rest of the code won't fail if there is a third party counter
$masktri='00000';
$maskcounter='00000';
}
$maskraz=-1; $maskraz=-1;
$maskoffset=0; $maskoffset=0;
$resetEveryMonth=false; $resetEveryMonth=false;
@ -659,6 +670,12 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m
if (dol_strlen($maskrefclient_maskcounter) > 0 && dol_strlen($maskrefclient_maskcounter) < 3) return 'ErrorCounterMustHaveMoreThan3Digits'; if (dol_strlen($maskrefclient_maskcounter) > 0 && dol_strlen($maskrefclient_maskcounter) < 3) return 'ErrorCounterMustHaveMoreThan3Digits';
} }
else $maskrefclient=''; else $maskrefclient='';
// fail if there is neither a global nor a third party counter
if (! $hasglobalcounter && ($maskrefclient_maskcounter == ''))
{
return 'ErrorBadMask';
}
// Extract value for third party type // Extract value for third party type
if (preg_match('/\{(t+)\}/i',$mask,$regType)) if (preg_match('/\{(t+)\}/i',$mask,$regType))
@ -993,10 +1010,21 @@ function check_value($mask,$value)
{ {
$result=0; $result=0;
$hasglobalcounter=false;
// Extract value for mask counter, mask raz and mask offset // Extract value for mask counter, mask raz and mask offset
if (! preg_match('/\{(0+)([@\+][0-9]+)?([@\+][0-9]+)?\}/i',$mask,$reg)) return 'ErrorBadMask'; if (preg_match('/\{(0+)([@\+][0-9]+)?([@\+][0-9]+)?\}/i',$mask,$reg))
$masktri=$reg[1].(isset($reg[2])?$reg[2]:'').(isset($reg[3])?$reg[3]:''); {
$maskcounter=$reg[1]; $masktri=$reg[1].(isset($reg[2])?$reg[2]:'').(isset($reg[3])?$reg[3]:'');
$maskcounter=$reg[1];
$hasglobalcounter=true;
}
else
{
// setting some defaults so the rest of the code won't fail if there is a third party counter
$masktri='00000';
$maskcounter='00000';
}
$maskraz=-1; $maskraz=-1;
$maskoffset=0; $maskoffset=0;
if (dol_strlen($maskcounter) < 3) return 'ErrorCounterMustHaveMoreThan3Digits'; if (dol_strlen($maskcounter) < 3) return 'ErrorCounterMustHaveMoreThan3Digits';
@ -1015,6 +1043,12 @@ function check_value($mask,$value)
} }
else $maskrefclient=''; else $maskrefclient='';
// fail if there is neither a global nor a third party counter
if (! $hasglobalcounter && ($maskrefclient_maskcounter == ''))
{
return 'ErrorBadMask';
}
$maskwithonlyymcode=$mask; $maskwithonlyymcode=$mask;
$maskwithonlyymcode=preg_replace('/\{(0+)([@\+][0-9]+)?([@\+][0-9]+)?\}/i',$maskcounter,$maskwithonlyymcode); $maskwithonlyymcode=preg_replace('/\{(0+)([@\+][0-9]+)?([@\+][0-9]+)?\}/i',$maskcounter,$maskwithonlyymcode);
$maskwithonlyymcode=preg_replace('/\{dd\}/i','dd',$maskwithonlyymcode); $maskwithonlyymcode=preg_replace('/\{dd\}/i','dd',$maskwithonlyymcode);

View File

@ -1,5 +1,7 @@
<?php <?php
/* Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2015 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -69,7 +71,9 @@ function member_prepare_head(Adherent $object)
// Show category tab // Show category tab
if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire)) if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire))
{ {
$head[$h][0] = DOL_URL_ROOT."/categories/categorie.php?id=".$object->id.'&type=3'; require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
$type = Categorie::TYPE_MEMBER;
$head[$h][0] = DOL_URL_ROOT."/categories/categorie.php?id=".$object->id.'&type='.$type;
$head[$h][1] = $langs->trans('Categories'); $head[$h][1] = $langs->trans('Categories');
$head[$h][2] = 'category'; $head[$h][2] = 'category';
$h++; $h++;
@ -107,6 +111,34 @@ function member_prepare_head(Adherent $object)
return $head; return $head;
} }
/**
* Return array head with list of tabs to view object informations
*
* @param Adherent $object Member
* @return array head
*/
function member_type_prepare_head(AdherentType $object)
{
global $langs, $conf, $user;
$h=0;
$head = array();
$head[$h][0] = DOL_URL_ROOT.'/adherents/type.php?rowid='.$object->id;
$head[$h][1] = $langs->trans("Card");
$head[$h][2] = 'card';
$h++;
// 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
// $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab
complete_head_from_modules($conf,$langs,$object,$head,$h,'membertype');
complete_head_from_modules($conf,$langs,$object,$head,$h,'membertype','remove');
return $head;
}
/** /**
* Return array head with list of tabs to view object informations * Return array head with list of tabs to view object informations

View File

@ -6,7 +6,7 @@
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr> * Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2012 Cédric Salvador <csalvador@gpcsolutions.fr> * Copyright (C) 2012 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2012-2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr> * Copyright (C) 2012-2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2014 Cedric GROSS <c.gross@kreiz-it.fr> * Copyright (C) 2014 Cedric GROSS <c.gross@kreiz-it.fr>
* Copyright (C) 2014 Teddy Andreotti <125155@supinfo.com> * Copyright (C) 2014 Teddy Andreotti <125155@supinfo.com>
* *
@ -1099,7 +1099,7 @@ function pdf_getlinedesc($object,$i,$outputlangs,$hideref=0,$hidedesc=0,$issuppl
include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; include_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
$categstatic=new Categorie($db); $categstatic=new Categorie($db);
// recovering the list of all the categories linked to product // recovering the list of all the categories linked to product
$tblcateg=$categstatic->containing($idprod,0); $tblcateg=$categstatic->containing($idprod, Categorie::TYPE_PRODUCT);
foreach ($tblcateg as $cate) foreach ($tblcateg as $cate)
{ {
// Adding the descriptions if they are filled // Adding the descriptions if they are filled

View File

@ -1,7 +1,8 @@
<?php <?php
/* Copyright (C) 2006-2008 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2006-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2007 Rodolphe Quiedeville <rodolphe@quiedeville.org> * Copyright (C) 2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2009-2010 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2009-2010 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -60,7 +61,9 @@ function product_prepare_head($object)
/* No more required. Replaced with new multiselect component /* No more required. Replaced with new multiselect component
if (! empty($conf->categorie->enabled) && $user->rights->categorie->lire) if (! empty($conf->categorie->enabled) && $user->rights->categorie->lire)
{ {
$head[$h][0] = DOL_URL_ROOT."/categories/categorie.php?id=".$object->id.'&type=0'; require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
$type = Categorie::TYPE_PRODUCT;
$head[$h][0] = DOL_URL_ROOT."/categories/categorie.php?id=".$object->id.'&type='.$type;
$head[$h][1] = $langs->trans('Categories'); $head[$h][1] = $langs->trans('Categories');
$head[$h][2] = 'category'; $head[$h][2] = 'category';
$h++; $h++;

View File

@ -42,6 +42,15 @@ function salaries_prepare_head($object) {
// $this->tabs = array('entity:-tabname); to remove a tab // $this->tabs = array('entity:-tabname); to remove a tab
complete_head_from_modules($conf,$langs,$object,$head,$h,'salaries'); complete_head_from_modules($conf,$langs,$object,$head,$h,'salaries');
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$upload_dir = $conf->salaries->dir_output . "/" . dol_sanitizeFileName($object->ref);
$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$'));
$head[$h][0] = DOL_URL_ROOT.'/compta/salaries/document.php?id='.$object->id;
$head[$h][1] = $langs->trans('Documents');
if($nbFiles > 0) $head[$h][1].= ' <span class="badge">'.$nbFiles.'</span>';
$head[$h][2] = 'documents';
$h++;
/* /*
$head[$h][0] = DOL_URL_ROOT.'/compta/salaries/info.php?id='.$object->id; $head[$h][0] = DOL_URL_ROOT.'/compta/salaries/info.php?id='.$object->id;
$head[$h][1] = $langs->trans("Info"); $head[$h][1] = $langs->trans("Info");

View File

@ -340,7 +340,7 @@ function restrictedArea($user, $features, $objectid=0, $tableandshare='', $featu
/** /**
* Check access by user to object * Check access by user to object
* *
* @param User $user User to check * @param User $user User to check
* @param array $featuresarray Features/modules to check * @param array $featuresarray Features/modules to check
* @param int $objectid Object ID if we want to check a particular record (optional) is linked to a owned thirdparty (optional). * @param int $objectid Object ID if we want to check a particular record (optional) is linked to a owned thirdparty (optional).
@ -348,18 +348,18 @@ function restrictedArea($user, $features, $objectid=0, $tableandshare='', $featu
* @param string $feature2 Feature to check, second level of permission (optional). Can be or check with 'level1|level2'. * @param string $feature2 Feature to check, second level of permission (optional). Can be or check with 'level1|level2'.
* @param string $dbt_keyfield Field name for socid foreign key if not fk_soc. Not used if objectid is null (optional) * @param string $dbt_keyfield Field name for socid foreign key if not fk_soc. Not used if objectid is null (optional)
* @param string $dbt_select Field name for select if not rowid. Not used if objectid is null (optional) * @param string $dbt_select Field name for select if not rowid. Not used if objectid is null (optional)
* *
* @return bool True if user has access, False otherwise * @return bool True if user has access, False otherwise
*/ */
function checkUserAccessToObject($user, $featuresarray, $objectid=0, $tableandshare='', $feature2='', $dbt_keyfield='', $dbt_select='') function checkUserAccessToObject($user, $featuresarray, $objectid=0, $tableandshare='', $feature2='', $dbt_keyfield='', $dbt_select='')
{ {
global $db, $conf; global $db, $conf;
// More parameters // More parameters
$params = explode('&', $tableandshare); $params = explode('&', $tableandshare);
$dbtablename=(! empty($params[0]) ? $params[0] : ''); $dbtablename=(! empty($params[0]) ? $params[0] : '');
$sharedelement=(! empty($params[1]) ? $params[1] : $dbtablename); $sharedelement=(! empty($params[1]) ? $params[1] : $dbtablename);
foreach ($featuresarray as $feature) foreach ($featuresarray as $feature)
{ {
$sql=''; $sql='';

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2007-2014 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2007-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2007-2009 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2007-2015 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -58,6 +58,7 @@ function check_user_password_dolibarr($usertotest,$passwordtotest,$entitytotest=
$sql.=' WHERE ('.$usernamecol1." = '".$db->escape($usertotest)."'"; $sql.=' WHERE ('.$usernamecol1." = '".$db->escape($usertotest)."'";
if (preg_match('/@/',$usertotest)) $sql.=' OR '.$usernamecol2." = '".$db->escape($usertotest)."'"; if (preg_match('/@/',$usertotest)) $sql.=' OR '.$usernamecol2." = '".$db->escape($usertotest)."'";
$sql.=') AND '.$entitycol." IN (0," . ($entity ? $entity : 1) . ")"; $sql.=') AND '.$entitycol." IN (0," . ($entity ? $entity : 1) . ")";
$sql.=' AND statut = 1';
$resql=$db->query($sql); $resql=$db->query($sql);
if ($resql) if ($resql)

View File

@ -583,11 +583,11 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
$langs->load("commercial"); $langs->load("commercial");
$newmenu->add("/comm/prospect/list.php?leftmenu=prospects", $langs->trans("ListProspectsShort"), 1, $user->rights->societe->lire, '', $mainmenu, 'prospects'); $newmenu->add("/comm/prospect/list.php?leftmenu=prospects", $langs->trans("ListProspectsShort"), 1, $user->rights->societe->lire, '', $mainmenu, 'prospects');
if (empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/comm/prospect/list.php?sortfield=s.datec&amp;sortorder=desc&amp;begin=&amp;stcomm=-1", $langs->trans("LastProspectDoNotContact"), 2, $user->rights->societe->lire); if (empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/comm/prospect/list.php?sortfield=s.datec&amp;sortorder=desc&amp;begin=&amp;search_stcomm=-1", $langs->trans("LastProspectDoNotContact"), 2, $user->rights->societe->lire);
if (empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/comm/prospect/list.php?sortfield=s.datec&amp;sortorder=desc&amp;begin=&amp;stcomm=0", $langs->trans("LastProspectNeverContacted"), 2, $user->rights->societe->lire); if (empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/comm/prospect/list.php?sortfield=s.datec&amp;sortorder=desc&amp;begin=&amp;search_stcomm=0", $langs->trans("LastProspectNeverContacted"), 2, $user->rights->societe->lire);
if (empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/comm/prospect/list.php?sortfield=s.datec&amp;sortorder=desc&amp;begin=&amp;stcomm=1", $langs->trans("LastProspectToContact"), 2, $user->rights->societe->lire); if (empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/comm/prospect/list.php?sortfield=s.datec&amp;sortorder=desc&amp;begin=&amp;search_stcomm=1", $langs->trans("LastProspectToContact"), 2, $user->rights->societe->lire);
if (empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/comm/prospect/list.php?sortfield=s.datec&amp;sortorder=desc&amp;begin=&amp;stcomm=2", $langs->trans("LastProspectContactInProcess"), 2, $user->rights->societe->lire); if (empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/comm/prospect/list.php?sortfield=s.datec&amp;sortorder=desc&amp;begin=&amp;search_stcomm=2", $langs->trans("LastProspectContactInProcess"), 2, $user->rights->societe->lire);
if (empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/comm/prospect/list.php?sortfield=s.datec&amp;sortorder=desc&amp;begin=&amp;stcomm=3", $langs->trans("LastProspectContactDone"), 2, $user->rights->societe->lire); if (empty($leftmenu) || $leftmenu=="prospects") $newmenu->add("/comm/prospect/list.php?sortfield=s.datec&amp;sortorder=desc&amp;begin=&amp;search_stcomm=3", $langs->trans("LastProspectContactDone"), 2, $user->rights->societe->lire);
$newmenu->add("/societe/soc.php?leftmenu=prospects&amp;action=create&amp;type=p", $langs->trans("MenuNewProspect"), 2, $user->rights->societe->creer); $newmenu->add("/societe/soc.php?leftmenu=prospects&amp;action=create&amp;type=p", $langs->trans("MenuNewProspect"), 2, $user->rights->societe->creer);
//$newmenu->add("/contact/list.php?leftmenu=customers&amp;type=p", $langs->trans("Contacts"), 2, $user->rights->societe->contact->lire); //$newmenu->add("/contact/list.php?leftmenu=customers&amp;type=p", $langs->trans("Contacts"), 2, $user->rights->societe->contact->lire);

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2005-2008 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2005-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2015 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -127,10 +127,10 @@ class mod_facture_mars extends ModeleNumRefFactures
*/ */
function getNextValue($objsoc,$facture,$mode='next') function getNextValue($objsoc,$facture,$mode='next')
{ {
global $db,$conf; global $db;
$prefix=$this->prefixinvoice; $prefix=$this->prefixinvoice;
if ($facture->type == 1) $prefix=$this->prefixreplacement; if ($facture->type == 1) $prefix=$this->prefixreplacement;
else if ($facture->type == 2) $prefix=$this->prefixcreditnote; else if ($facture->type == 2) $prefix=$this->prefixcreditnote;
else if ($facture->type == 3) $prefix=$this->prefixdeposit; else if ($facture->type == 3) $prefix=$this->prefixdeposit;
@ -141,7 +141,7 @@ class mod_facture_mars extends ModeleNumRefFactures
$sql = "SELECT MAX(CAST(SUBSTRING(facnumber FROM ".$posindice.") AS SIGNED)) as max"; // This is standard SQL $sql = "SELECT MAX(CAST(SUBSTRING(facnumber FROM ".$posindice.") AS SIGNED)) as max"; // This is standard SQL
$sql.= " FROM ".MAIN_DB_PREFIX."facture"; $sql.= " FROM ".MAIN_DB_PREFIX."facture";
$sql.= " WHERE facnumber LIKE '".$prefix."____-%'"; $sql.= " WHERE facnumber LIKE '".$prefix."____-%'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity IN (".getEntity('facture', 1).")";
$resql=$db->query($sql); $resql=$db->query($sql);
dol_syslog(get_class($this)."::getNextValue", LOG_DEBUG); dol_syslog(get_class($this)."::getNextValue", LOG_DEBUG);
@ -165,7 +165,7 @@ class mod_facture_mars extends ModeleNumRefFactures
$sql = "SELECT facnumber as ref"; $sql = "SELECT facnumber as ref";
$sql.= " FROM ".MAIN_DB_PREFIX."facture"; $sql.= " FROM ".MAIN_DB_PREFIX."facture";
$sql.= " WHERE facnumber LIKE '".$prefix."____-".$num."'"; $sql.= " WHERE facnumber LIKE '".$prefix."____-".$num."'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity IN (".getEntity('facture', 1).")";
dol_syslog(get_class($this)."::getNextValue", LOG_DEBUG); dol_syslog(get_class($this)."::getNextValue", LOG_DEBUG);
$resql=$db->query($sql); $resql=$db->query($sql);

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2005-2008 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2005-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2015 Regis Houssin <regis.houssin@capnetworks.com>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -111,7 +111,7 @@ class mod_facture_terre extends ModeleNumRefFactures
$this->error=$langs->trans('ErrorNumRefModel',$max); $this->error=$langs->trans('ErrorNumRefModel',$max);
return false; return false;
} }
// Check deposit num // Check deposit num
$fayymm=''; $fayymm='';
@ -146,7 +146,7 @@ class mod_facture_terre extends ModeleNumRefFactures
*/ */
function getNextValue($objsoc,$facture,$mode='next') function getNextValue($objsoc,$facture,$mode='next')
{ {
global $db,$conf; global $db;
if ($facture->type == 2) $prefix=$this->prefixcreditnote; if ($facture->type == 2) $prefix=$this->prefixcreditnote;
else if ($facture->type == 3) $prefix=$this->prefixdeposit; else if ($facture->type == 3) $prefix=$this->prefixdeposit;
@ -157,7 +157,7 @@ class mod_facture_terre extends ModeleNumRefFactures
$sql = "SELECT MAX(CAST(SUBSTRING(facnumber FROM ".$posindice.") AS SIGNED)) as max"; // This is standard SQL $sql = "SELECT MAX(CAST(SUBSTRING(facnumber FROM ".$posindice.") AS SIGNED)) as max"; // This is standard SQL
$sql.= " FROM ".MAIN_DB_PREFIX."facture"; $sql.= " FROM ".MAIN_DB_PREFIX."facture";
$sql.= " WHERE facnumber LIKE '".$prefix."____-%'"; $sql.= " WHERE facnumber LIKE '".$prefix."____-%'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity IN (".getEntity('facture', 1).")";
$resql=$db->query($sql); $resql=$db->query($sql);
dol_syslog(get_class($this)."::getNextValue", LOG_DEBUG); dol_syslog(get_class($this)."::getNextValue", LOG_DEBUG);
@ -181,7 +181,7 @@ class mod_facture_terre extends ModeleNumRefFactures
$sql = "SELECT facnumber as ref"; $sql = "SELECT facnumber as ref";
$sql.= " FROM ".MAIN_DB_PREFIX."facture"; $sql.= " FROM ".MAIN_DB_PREFIX."facture";
$sql.= " WHERE facnumber LIKE '".$prefix."____-".$num."'"; $sql.= " WHERE facnumber LIKE '".$prefix."____-".$num."'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity IN (".getEntity('facture', 1).")";
dol_syslog(get_class($this)."::getNextValue", LOG_DEBUG); dol_syslog(get_class($this)."::getNextValue", LOG_DEBUG);
$resql=$db->query($sql); $resql=$db->query($sql);

View File

@ -6,6 +6,7 @@
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be> * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2009-2011 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2009-2011 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2013 Cedric Gross <c.gross@kreiz-it.fr> * Copyright (C) 2013 Cedric Gross <c.gross@kreiz-it.fr>
* Copyright (C) 2015 Bahfir Abbes <bafbes@gmail.com>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -90,6 +91,7 @@ class modAgenda extends DolibarrModules
$this->const[12] = array("MAIN_AGENDA_ACTIONAUTO_SHIPPING_VALIDATE","chaine","1"); $this->const[12] = array("MAIN_AGENDA_ACTIONAUTO_SHIPPING_VALIDATE","chaine","1");
$this->const[13] = array("MAIN_AGENDA_ACTIONAUTO_SHIPPING_SENTBYMAIL","chaine","1"); $this->const[13] = array("MAIN_AGENDA_ACTIONAUTO_SHIPPING_SENTBYMAIL","chaine","1");
$this->const[14] = array("MAIN_AGENDA_ACTIONAUTO_BILL_UNVALIDATE","chaine","1"); $this->const[14] = array("MAIN_AGENDA_ACTIONAUTO_BILL_UNVALIDATE","chaine","1");
$this->const[15] = array("MAIN_AGENDA_ACTIONAUTO_BILL_SUPPLIER_UNVALIDATE","chaine","1");
// New pages on tabs // New pages on tabs
// ----------------- // -----------------

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -62,7 +62,7 @@ class modGravatar extends DolibarrModules
// Name of image file used for this module. // Name of image file used for this module.
// If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue' // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue'
// If file is in module/images directory, use this->picto=DOL_URL_ROOT.'/module/images/file.png' // If file is in module/images directory, use this->picto=DOL_URL_ROOT.'/module/images/file.png'
$this->picto='technic'; $this->picto='gravatar';
// Data directories to create when module is enabled. // Data directories to create when module is enabled.
// Example: this->dirs = array("/mymodule/temp"); // Example: this->dirs = array("/mymodule/temp");

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2014 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2014-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2014 Frederic France <frederic.france@free.fr> * Copyright (C) 2014 Frederic France <frederic.france@free.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -16,22 +16,21 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
/** \defgroup printing Module printing /** \defgroup printing Module printing
* \brief Module for activation of printing icon * \brief Module for activation of printing icon to make direct printing
*/ */
/** /**
* \file htdocs/core/modules/modPrinting.class.php * \file htdocs/core/modules/modPrinting.class.php
* \ingroup printing * \ingroup printing
* \brief Fichier de description et activation du module Printing * \brief File of class to describe and activate module Direct Printing
*/ */
include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php'; include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php';
/** /**
* \class modPrinting * Class to describe and activate module Direct Printing
* \brief Classe de description et activation du module Printing
*/ */
class modPrinting extends DolibarrModules class modPrinting extends DolibarrModules
{ {
@ -47,7 +46,7 @@ class modPrinting extends DolibarrModules
$this->numero = 64000; $this->numero = 64000;
// Family can be 'crm','financial','hr','projects','products','ecm','technic','other' // Family can be 'crm','financial','hr','projects','products','ecm','technic','other'
// It is used to group modules in module setup page // It is used to group modules in module setup page
$this->family = "other"; $this->family = "technic";
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
$this->name = preg_replace('/^mod/i','',get_class($this)); $this->name = preg_replace('/^mod/i','',get_class($this));
// Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module) // Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module)
@ -59,7 +58,7 @@ class modPrinting extends DolibarrModules
// Name of image file used for this module. // Name of image file used for this module.
// If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue' // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue'
// If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module' // If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module'
$this->picto = 'technic'; $this->picto = 'printer';
// Data directories to create when module is enabled. // Data directories to create when module is enabled.
$this->dirs = array(); $this->dirs = array();

View File

@ -1,6 +1,5 @@
<?php <?php
/* Module to manage resources into Dolibarr ERP/CRM /* Copyright (C) 2013-2014 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2013-2014 Jean-François Ferry <jfefe@aternatik.fr>
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -14,6 +13,8 @@
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Module to manage resources into Dolibarr ERP/CRM
*/ */
/** /**
@ -51,7 +52,7 @@ class modResource extends DolibarrModules
// Family can be 'crm','financial','hr','projects','products','ecm','technic','other' // Family can be 'crm','financial','hr','projects','products','ecm','technic','other'
// It is used to group modules in module setup page // It is used to group modules in module setup page
$this->family = "hr"; $this->family = "projects";
// Module label (no space allowed) // Module label (no space allowed)
// used if translation string 'ModuleXXXName' not found // used if translation string 'ModuleXXXName' not found
// (where XXX is value of numeric property 'numero' of module) // (where XXX is value of numeric property 'numero' of module)
@ -67,7 +68,7 @@ class modResource extends DolibarrModules
$this->const_name = 'MAIN_MODULE_' . strtoupper($this->name); $this->const_name = 'MAIN_MODULE_' . strtoupper($this->name);
// Where to store the module in setup page // Where to store the module in setup page
// (0=common,1=interface,2=others,3=very specific) // (0=common,1=interface,2=others,3=very specific)
$this->special = 0; $this->special = 2;
// Name of image file used for this module. // Name of image file used for this module.
// If file is in theme/yourtheme/img directory under name object_pictovalue.png // If file is in theme/yourtheme/img directory under name object_pictovalue.png
// use this->picto='pictovalue' // use this->picto='pictovalue'
@ -151,8 +152,7 @@ class modResource extends DolibarrModules
// (reresource 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member) // (reresource 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member)
$this->tabs = array( $this->tabs = array(
'action:+resources:Resources:resource:$user->rights->resource->read:/resource/element_resource.php?element=action&element_id=__ID__', // 'thirdparty:+resources:Resources:resource:$user->rights->resource->read:/resource/element_resource.php?element=societe&element_id=__ID__'
'thirdparty:+resources:Resources:resource:$user->rights->resource->read:/resource/element_resource.php?element=societe&element_id=__ID__'
); );
// Boxes // Boxes

View File

@ -136,15 +136,15 @@ class modSalaries extends DolibarrModules
$r++; $r++;
$this->export_code[$r]=$this->rights_class.'_'.$r; $this->export_code[$r]=$this->rights_class.'_'.$r;
$this->export_label[$r]='Salaries and payments'; $this->export_label[$r]='Salaries and payments';
$this->export_permission[$r]=array(array("salary","export")); $this->export_permission[$r]=array(array("salaries","export"));
$this->export_fields_array[$r]=array('u.firstname'=>"Firstname",'u.lastname'=>"Lastname",'u.login'=>"Login",'u.salary'=>'CurrentSalary','p.rowid'=>'PaymentId','p.datep'=>'DatePayment','p.datesp'=>'DateStartPeriod','p.dateep'=>'DateEndPeriod','p.amount'=>'AmountPayment','p.num_paiement'=>'Numero','p.label'=>'Label','p.note'=>'Note'); $this->export_fields_array[$r]=array('u.firstname'=>"Firstname",'u.lastname'=>"Lastname",'u.login'=>"Login",'u.salary'=>'CurrentSalary','p.datep'=>'DatePayment','p.datesp'=>'DateStartPeriod','p.dateep'=>'DateEndPeriod','p.amount'=>'AmountPayment','p.num_payment'=>'Numero','p.label'=>'Label','p.note'=>'Note');
$this->export_TypeFields_array[$r]=array('u.firstname'=>"Text",'u.lastname'=>"Text",'u.login'=>'Text','u.salary'=>"Number",'p.datep'=>'Date','p.datesp'=>'Date','p.dateep'=>'Date','p.amount'=>'Number','p.num_paiement'=>'Number','p.label'=>'Text'); $this->export_TypeFields_array[$r]=array('u.firstname'=>"Text",'u.lastname'=>"Text",'u.login'=>'Text','u.salary'=>"Number",'p.datep'=>'Date','p.datesp'=>'Date','p.dateep'=>'Date','p.amount'=>'Number','p.num_payment'=>'Number','p.label'=>'Text');
$this->export_entities_array[$r]=array('u.firstname'=>'user','u.lastname'=>'user','u.login'=>'user','u.salary'=>'user','p.datep'=>'payment','p.datesp'=>'payment','p.dateep'=>'payment','p.amount'=>'payment','p.label'=>'payment','p.note'=>'payment','p.num_paiement'=>'payment'); $this->export_entities_array[$r]=array('u.firstname'=>'user','u.lastname'=>'user','u.login'=>'user','u.salary'=>'user','p.datep'=>'payment','p.datesp'=>'payment','p.dateep'=>'payment','p.amount'=>'payment','p.label'=>'payment','p.note'=>'payment','p.num_payment'=>'payment');
$this->export_sql_start[$r]='SELECT DISTINCT '; $this->export_sql_start[$r]='SELECT DISTINCT ';
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'user as u'; $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'user as u';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'paiementsalary as p ON p.fk_user = u.rowid'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'payment_salary as p ON p.fk_user = u.rowid';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as cp ON p.fk_typepaiement = cp.rowid'; $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as cp ON p.fk_typepayment = cp.id';
$this->export_sql_end[$r] .=' AND u.entity IN ('.getEntity('user',1).')'; $this->export_sql_end[$r] .=' AND u.entity IN ('.getEntity('user',1).')';
} }

View File

@ -25,7 +25,7 @@
include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php'; include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php';
/** /**
* Class to describe a WebServices module * Class to describe a sync supplier web services module
*/ */
class modSyncSupplierWebServices extends DolibarrModules class modSyncSupplierWebServices extends DolibarrModules
{ {

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com> /* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2013-2014 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2013-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -164,6 +164,8 @@ $userstatic=new User($db);
</div> </div>
<div class="tagtd"> <div class="tagtd">
<?php <?php
$statusofcontact = $tab[$i]['status'];
if ($tab[$i]['source']=='internal') if ($tab[$i]['source']=='internal')
{ {
$userstatic->id=$tab[$i]['id']; $userstatic->id=$tab[$i]['id'];
@ -182,24 +184,24 @@ $userstatic=new User($db);
</div> </div>
<div class="tagtd"><?php echo $tab[$i]['libelle']; ?></div> <div class="tagtd"><?php echo $tab[$i]['libelle']; ?></div>
<div class="tagtd" align="center"> <div class="tagtd" align="center">
<?php if ($object->statut >= 0) echo '<a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;action=swapstatut&amp;ligne='.$tab[$i]['rowid'].'">'; ?> <?php //if ($object->statut >= 0) echo '<a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;action=swapstatut&amp;ligne='.$tab[$i]['rowid'].'">'; ?>
<?php <?php
if ($tab[$i]['source']=='internal') if ($tab[$i]['source']=='internal')
{ {
$userstatic->id=$tab[$i]['id']; $userstatic->id=$tab[$i]['id'];
$userstatic->lastname=$tab[$i]['lastname']; $userstatic->lastname=$tab[$i]['lastname'];
$userstatic->firstname=$tab[$i]['firstname']; $userstatic->firstname=$tab[$i]['firstname'];
//echo $userstatic->LibStatut($tab[$i]['status'],3); echo $userstatic->LibStatut($tab[$i]['statuscontact'],3);
} }
if ($tab[$i]['source']=='external') if ($tab[$i]['source']=='external')
{ {
$contactstatic->id=$tab[$i]['id']; $contactstatic->id=$tab[$i]['id'];
$contactstatic->lastname=$tab[$i]['lastname']; $contactstatic->lastname=$tab[$i]['lastname'];
$contactstatic->firstname=$tab[$i]['firstname']; $contactstatic->firstname=$tab[$i]['firstname'];
echo $contactstatic->LibStatut($tab[$i]['status'],3); echo $contactstatic->LibStatut($tab[$i]['statuscontact'],3);
} }
?> ?>
<?php if ($object->statut >= 0) echo '</a>'; ?> <?php //if ($object->statut >= 0) echo '</a>'; ?>
</div> </div>
<div class="tagtd nowrap" align="right"> <div class="tagtd nowrap" align="right">
<?php if ($permission) { ?> <?php if ($permission) { ?>

View File

@ -59,11 +59,8 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes')
if ($urlfile) if ($urlfile)
{ {
$ret = dol_delete_file($file, 0, 0, 0, $object); $ret = dol_delete_file($file, 0, 0, 0, $object);
if ($ret) { if ($ret) setEventMessage($langs->trans("FileWasRemoved", $urlfile));
setEventMessage($langs->trans("FileWasRemoved", $urlfile)); else setEventMessage($langs->trans("ErrorFailToDeleteFile", $urlfile), 'errors');
} else {
setEventMessage($langs->trans("ErrorFailToDeleteFile", $urlfile), 'errors');
}
} }
elseif ($linkid) elseif ($linkid)
{ {

View File

@ -1,14 +1,13 @@
<?php <?php
// BEGIN TPL RESOURCE_ADD.TPL.PHP
//$langs->load($resource_type); require_once(DOL_DOCUMENT_ROOT.'/resource/class/html.formresource.class.php');
$form = new Form($db); $form = new Form($db);
if(!class_exists('FormResource'))
require_once(DOL_DOCUMENT_ROOT.'/resource/class/html.formresource.class.php');
$formresources = new FormResource($db); $formresources = new FormResource($db);
$out .= '<div class="tagtable centpercent border allwidth">'; $out .= '<div class="tagtable centpercent border allwidth nohover">';
$out .= '<form class="tagtr '.($var==true?'pair':'impair').'" action="'.$_SERVER["PHP_SELF"].'" method="POST">'; $out .= '<form class="tagtr '.($var==true?'pair':'impair').'" action="'.$_SERVER["PHP_SELF"].'" method="POST">';
$out .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; $out .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
@ -27,10 +26,8 @@ $out .= '</div>';
$out .= '<div class="tagtd"><label>'.$langs->trans('Busy').'</label> '.$form->selectyesno('busy',$linked_resource['busy']?1:0,1).'</div>'; $out .= '<div class="tagtd"><label>'.$langs->trans('Busy').'</label> '.$form->selectyesno('busy',$linked_resource['busy']?1:0,1).'</div>';
$out .= '<div class="tagtd"><label>'.$langs->trans('Mandatory').'</label> '.$form->selectyesno('mandatory',$linked_resource['mandatory']?1:0,1).'</div>'; $out .= '<div class="tagtd"><label>'.$langs->trans('Mandatory').'</label> '.$form->selectyesno('mandatory',$linked_resource['mandatory']?1:0,1).'</div>';
$out .= '<div class="tagtd">'; $out .= '<div class="tagtd" align="right">';
$out .='<input type="submit" id="add-resource-place" class="button" value="'.$langs->trans("Add").'"'; $out .='<input type="submit" id="add-resource-place" class="button" value="'.$langs->trans("Add").'"/>';
$out .=' />';
$out .='<input type="submit" name="cancel" class="button" value="'.$langs->trans("Cancel").'" />';
$out .= '</div>'; $out .= '</div>';
$out .='</form>'; $out .='</form>';
@ -40,6 +37,4 @@ $out .= '<br />';
print $out; print $out;
// FIN DU TPL // FIN DU TPL

View File

@ -6,36 +6,32 @@ $form= new Form($db);
if( (array) $linked_resources && count($linked_resources) > 0) if( (array) $linked_resources && count($linked_resources) > 0)
{ {
$var=false; $var=true;
// TODO: DEBUT DU TPL // TODO: DEBUT DU TPL
if($mode == 'edit' ) if($mode == 'edit' )
{ {
print '<div class="tagtable centpercent noborder allwidth">'; print '<div class="tagtable centpercent noborder allwidth">';
print '<form class="tagtr liste_titre">'; print '<form class="tagtr liste_titre">';
print '<div class="tagtd">'.$langs->trans('Type').'</div>'; print '<div class="tagtd">'.$langs->trans('Type').'</div>';
print '<div class="tagtd">'.$langs->trans('Resource').'</div>'; print '<div class="tagtd">'.$langs->trans('Resource').'</div>';
print '<div class="tagtd">'.$langs->trans('Busy').'</div>'; print '<div class="tagtd" align="center">'.$langs->trans('Busy').'</div>';
print '<div class="tagtd">'.$langs->trans('Mandatory').'</div>'; print '<div class="tagtd" align="center">'.$langs->trans('Mandatory').'</div>';
print '<div class="tagtd">'.$langs->trans('Edit').'</div>'; print '<div class="tagtd"></div>';
print '</form>'; print '</form>';
//print '</div>'; //print '</div>';
} }
else else
{ {
print '<div class="tagtable centpercent noborder allwidth">'; print '<div class="tagtable centpercent noborder allwidth">';
print '<form class="tagtr liste_titre">'; print '<form class="tagtr liste_titre">';
print '<div class="tagtd">'.$langs->trans('Type').'</div>'; print '<div class="tagtd">'.$langs->trans('Type').'</div>';
print '<div class="tagtd">'.$langs->trans('Resource').'</div>'; print '<div class="tagtd">'.$langs->trans('Resource').'</div>';
print '<div class="tagtd">'.$langs->trans('Busy').'</div>'; print '<div class="tagtd" align="center">'.$langs->trans('Busy').'</div>';
print '<div class="tagtd">'.$langs->trans('Mandatory').'</div>'; print '<div class="tagtd" align="center">'.$langs->trans('Mandatory').'</div>';
print '<div class="tagtd">'.$langs->trans('Action').'</div>'; print '<div class="tagtd"></div>';
print '</form>'; print '</form>';
//print '</div>'; //print '</div>';
} }
@ -55,7 +51,7 @@ if( (array) $linked_resources && count($linked_resources) > 0)
print '<div class="tagtd">'.$object_resource->type_label.'</div>'; print '<div class="tagtd">'.$object_resource->type_label.'</div>';
print '<div class="tagtd">'.$object_resource->getNomUrl(1).'</div>'; print '<div class="tagtd">'.$object_resource->getNomUrl(1).'</div>';
print '<div class="tagtd">'.$form->selectyesno('busy',$linked_resource['busy']?1:0,1).'</div>'; print '<div class="tagtd" align="center">'.$form->selectyesno('busy',$linked_resource['busy']?1:0,1).'</div>';
print '<div class="tagtd">'.$form->selectyesno('mandatory',$linked_resource['mandatory']?1:0,1).'</div>'; print '<div class="tagtd">'.$form->selectyesno('mandatory',$linked_resource['mandatory']?1:0,1).'</div>';
print '<div class="tagtd"><input type="submit" class="button" value="'.$langs->trans("Update").'"></div>'; print '<div class="tagtd"><input type="submit" class="button" value="'.$langs->trans("Update").'"></div>';
print '</form>'; print '</form>';
@ -77,20 +73,20 @@ if( (array) $linked_resources && count($linked_resources) > 0)
print $object_resource->getNomUrl(1); print $object_resource->getNomUrl(1);
print '</div class="tagtd">'; print '</div class="tagtd">';
print '<div class="tagtd">'; print '<div class="tagtd" align="center">';
print $linked_resource['busy']?1:0; print yn($linked_resource['busy']);
print '</div>'; print '</div>';
print '<div class="tagtd">'; print '<div class="tagtd" align="center">';
print $linked_resource['mandatory']?1:0; print yn($linked_resource['mandatory']);
print '</div>'; print '</div>';
print '<div class="tagtd">'; print '<div class="tagtd" align="right">';
print '<a href="'.$_SERVER['PHP_SELF'].'?mode=edit&resource_type='.$linked_resource['resource_type'].'&element='.$element.'&element_id='.$element_id.'&lineid='.$linked_resource['rowid'].'">'; print '<a href="'.$_SERVER['PHP_SELF'].'?mode=edit&resource_type='.$linked_resource['resource_type'].'&element='.$element.'&element_id='.$element_id.'&lineid='.$linked_resource['rowid'].'">';
print img_edit(); print img_edit();
print '</a>'; print '</a>';
print '&nbsp;'; print '&nbsp;';
print '<a href="'.$_SERVER['PHP_SELF'].'?action=delete_resource&id='.$linked_resource['resource_id'].'&element='.$element.'&element_id='.$element_id.'&lineid='.$linked_resource['rowid'].'">'; print '<a href="'.$_SERVER['PHP_SELF'].'?action=delete_resource&id='.$linked_resource['resource_id'].'&element='.$element.'&element_id='.$element_id.'&lineid='.$linked_resource['rowid'].'">';
print img_delete(); print img_delete();
print '</a>'; print '</a>';
print '</div>'; print '</div>';

View File

@ -4,6 +4,7 @@
* Copyright (C) 2011-2014 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011-2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Cedric GROSS <c.gross@kreiz-it.fr> * Copyright (C) 2013 Cedric GROSS <c.gross@kreiz-it.fr>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Bahfir Abbes <bafbes@gmail.com>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -493,6 +494,18 @@ class InterfaceActionsAuto extends DolibarrTriggers
$object->actionmsg=$langs->transnoentities("InvoiceValidatedInDolibarr",($object->newref?$object->newref:$object->ref)); $object->actionmsg=$langs->transnoentities("InvoiceValidatedInDolibarr",($object->newref?$object->newref:$object->ref));
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
$object->sendtoid=0;
}
elseif ($action == 'BILL_SUPPLIER_UNVALIDATE')
{
$langs->load("other");
$langs->load("bills");
$object->actiontypecode='AC_OTH_AUTO';
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoiceBackToDraftInDolibarr",$object->ref);
$object->actionmsg=$langs->transnoentities("InvoiceBackToDraftInDolibarr",$object->ref);
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
$object->sendtoid=0; $object->sendtoid=0;
} }
elseif ($action == 'BILL_SUPPLIER_SENTBYMAIL') elseif ($action == 'BILL_SUPPLIER_SENTBYMAIL')

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2005-2014 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2005-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2014 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2014 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Bahfir Abbes <bafbes@gmail.com>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -197,6 +198,7 @@ class InterfaceDemo extends DolibarrTriggers
case 'BILL_SUPPLIER_PAYED': case 'BILL_SUPPLIER_PAYED':
case 'BILL_SUPPLIER_UNPAYED': case 'BILL_SUPPLIER_UNPAYED':
case 'BILL_SUPPLIER_VALIDATE': case 'BILL_SUPPLIER_VALIDATE':
case 'BILL_SUPPLIER_UNVALIDATE':
case 'LINEBILL_SUPPLIER_CREATE': case 'LINEBILL_SUPPLIER_CREATE':
case 'LINEBILL_SUPPLIER_UPDATE': case 'LINEBILL_SUPPLIER_UPDATE':
case 'LINEBILL_SUPPLIER_DELETE': case 'LINEBILL_SUPPLIER_DELETE':

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