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

This commit is contained in:
MAxime Kohlhaas 2014-10-25 16:51:13 +02:00
commit c8378b6b84
902 changed files with 17467 additions and 18924 deletions

View File

@ -272,12 +272,6 @@ source_file = htdocs/langs/en_US/sendings.lang
source_lang = en_US source_lang = en_US
type = MOZILLAPROPERTIES type = MOZILLAPROPERTIES
[dolibarr.shop]
file_filter = htdocs/langs/<lang>/shop.lang
source_file = htdocs/langs/en_US/shop.lang
source_lang = en_US
type = MOZILLAPROPERTIES
[dolibarr.sms] [dolibarr.sms]
file_filter = htdocs/langs/<lang>/sms.lang file_filter = htdocs/langs/<lang>/sms.lang
source_file = htdocs/langs/en_US/sms.lang source_file = htdocs/langs/en_US/sms.lang

View File

@ -5,6 +5,14 @@ English Dolibarr ChangeLog
***** ChangeLog for 3.7 compared to 3.6.* ***** ***** ChangeLog for 3.7 compared to 3.6.* *****
For users: For users:
- New: Module notification has been enhanced:
EMail use now language of target contact.
Can also define a fixed email for notifications.
- New: Feature to link manually an order to an invoice does not disappear once
link has been done.
- New: Can set a color on user card (visible into agenda view).
- New: extrafields for projects and tasks are exported to ODT documents.
- New: Add number of active notification into tab title (like we do for notes and documents)
- New: Can add product into category from category card. - New: Can add product into category from category card.
- New: PDF event report show project and status of event. - New: PDF event report show project and status of event.
- New: Can filter on status on interventions. - New: Can filter on status on interventions.
@ -60,9 +68,14 @@ For users:
- New: Add option MAIN_GENERATE_INVOICES_WITH_PICTURE to show picture - New: Add option MAIN_GENERATE_INVOICES_WITH_PICTURE to show picture
onto PDF like MAIN_GENERATE_PROPOSALS_WITH_PICTURE dir for proposals. onto PDF like MAIN_GENERATE_PROPOSALS_WITH_PICTURE dir for proposals.
- New: Add more search field in list of cheque deposits. - New: Add more search field in list of cheque deposits.
- New: Add feature to order to invoice on supplier part - New: Add feature to order to invoice on supplier part.
- New : Use of MAIN_USE_FILECACHE_EXPORT_EXCEL_DIR to use disk cache for big excel export.
- New: Direct invoice creation from predefined invoice.
- New: Add dunning into accountancy report.
- New: Add favorite button into country dictionary to put value on top select list
- Upgrade phpexcel lib to 1.7.8 - Upgrade phpexcel lib to 1.7.8
- New : Use of MAIN_USE_FILECACHE_EXPORT_EXCEL_DIR to use disk cache for big excel export - New : Use of MAIN_USE_FILECACHE_EXPORT_EXCEL_DIR to use disk cache for big excel export
- New : Option on extrafields to have them always editable regardless of the document status
- Fix: [ bug #1487 ] PAYMENT_DELETE trigger does not intercept trigger action - Fix: [ bug #1487 ] PAYMENT_DELETE trigger does not intercept trigger action
- Fix: [ bug #1470, #1472, #1473] User trigger problem - Fix: [ bug #1470, #1472, #1473] User trigger problem
- Fix: [ bug #1489, #1491 ] Intervention trigger problem - Fix: [ bug #1489, #1491 ] Intervention trigger problem
@ -80,9 +93,8 @@ For users:
- Fix: [ bug #1506, #1507 ] ECM trigger error problem - Fix: [ bug #1506, #1507 ] ECM trigger error problem
- Fix: [ bug #1469 ] Triggers CONTACT_MODIFY and CONTACT_DELETE duplicates error message - Fix: [ bug #1469 ] Triggers CONTACT_MODIFY and CONTACT_DELETE duplicates error message
- Fix: [ bug #1537 ] Difference between societe.nom and adherent.societe. - Fix: [ bug #1537 ] Difference between societe.nom and adherent.societe.
- New: Direct invoice creation from predefined invoice
- New: Add dunning into accountancy report For users, new experimental module (need to set feature level of instance to experimental to see them):
For users, new experimental module:
- New: Module Accounting Expert to manage accountancy - New: Module Accounting Expert to manage accountancy
Special Thanks to developpers : Special Thanks to developpers :
Olivier Geffroy Olivier Geffroy
@ -96,6 +108,7 @@ For users, new experimental module:
Hydroflex 120 euros Hydroflex 120 euros
Asysteo 120 euros Asysteo 120 euros
Fournisseur médical 120 euros Fournisseur médical 120 euros
- Removed: unmaintained OScommerce module
For translators: For translators:
- Update language files. - Update language files.
@ -117,6 +130,8 @@ For developers:
- New: renamed table llx_c_pays to llx_c_country & libelle field to label. - New: renamed table llx_c_pays to llx_c_country & libelle field to label.
- New: Added hook "formConfirm" and "doActions" for fichinter card - New: Added hook "formConfirm" and "doActions" for fichinter card
- New: Can search list of thirdparties from web service on part of name. - New: Can search list of thirdparties from web service on part of name.
- New: Function getCurrencyAmount is marked as deprecated. Use function price to output a price
including currency symbol.
- Qual: Renamed table llx_c_civilite into llx_c_civility, - Qual: Renamed table llx_c_civilite into llx_c_civility,
field civilite into label in the same table, field civilite into label in the same table,
and field civilite into civility in other table. and field civilite into civility in other table.
@ -128,6 +143,7 @@ For developers:
WARNING: Following changes may create regression for some external modules, but was necessary to make WARNING: Following changes may create regression for some external modules, but was necessary to make
Dolibarr better: Dolibarr better:
- Deprecated module "oscommerce" were removed.
- Changed the way parameters are provided to scripts sync_xxx_ldap2dolibarr.php - Changed the way parameters are provided to scripts sync_xxx_ldap2dolibarr.php
- Some field into database were renamed from "libelle" to "label". - Some field into database were renamed from "libelle" to "label".
- Table llx_c_pays were renamed into llx_c_country. - Table llx_c_pays were renamed into llx_c_country.
@ -135,7 +151,17 @@ Dolibarr better:
creation of a pdf or odt, hook "afterPDFCreation" or "afterODTCreation" must be used instead. creation of a pdf or odt, hook "afterPDFCreation" or "afterODTCreation" must be used instead.
- A lot of pages called fiche.php were renamed into card.php - A lot of pages called fiche.php were renamed into card.php
- A lot of pages called liste.php were renamed into list.php - A lot of pages called liste.php were renamed into list.php
***** ChangeLog for 3.6.2 compared to 3.6.1 *****
- Fix: fix ErrorBadValueForParamNotAString error message in price customer multiprice
- Fix: bug 1588 : relative discount
- Fix: label of input method not tranlated.
- Fix: box of customer and propsects were not correctly disabled.
- Fix: right and error management #1961
- Fix: Fix Error when trying to clone an Order #1943
***** ChangeLog for 3.6.1 compared to 3.6.* ***** ***** ChangeLog for 3.6.1 compared to 3.6.* *****
For users: For users:
- Fix: Can upload files on services. - Fix: Can upload files on services.
@ -154,7 +180,13 @@ For users:
- Fix: Extrafield feature select from table should try to translate multiple column when not needed - Fix: Extrafield feature select from table should try to translate multiple column when not needed
- Fix: cents for indian ruppes are calle paisa and paise. - Fix: cents for indian ruppes are calle paisa and paise.
- Fix: Invoices payments may be older than invoices. - Fix: Invoices payments may be older than invoices.
- Fix: Withdrawal total amount is double
- Fix: [ bug #1593 ] Spanish Localtax IRPF not being calculated since 3.6.0 in supplier invoices when adding a line - Fix: [ bug #1593 ] Spanish Localtax IRPF not being calculated since 3.6.0 in supplier invoices when adding a line
- Fix: Web service categorie WDSL declaration is correct
- Fix: ErrorBadValueForParamNotAString was displayed in virtual product if no base price defined
- Fix: Category creation failed and no message output
- Fix: Lanf for Payment Type
- Fix: PHPCheckstyle 1.5.5
***** ChangeLog for 3.6 compared to 3.5.* ***** ***** ChangeLog for 3.6 compared to 3.5.* *****
For users: For users:

View File

@ -442,6 +442,7 @@ if ($nboftargetok) {
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/nltechno*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/nltechno*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/pos*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/pos*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/public/test`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/public/test`;
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/teclib*`;
$ret=`rm -fr $BUILDROOT/$PROJECT/test`; $ret=`rm -fr $BUILDROOT/$PROJECT/test`;
$ret=`rm -fr $BUILDROOT/$PROJECT/Thumbs.db $BUILDROOT/$PROJECT/*/Thumbs.db $BUILDROOT/$PROJECT/*/*/Thumbs.db $BUILDROOT/$PROJECT/*/*/*/Thumbs.db $BUILDROOT/$PROJECT/*/*/*/*/Thumbs.db`; $ret=`rm -fr $BUILDROOT/$PROJECT/Thumbs.db $BUILDROOT/$PROJECT/*/Thumbs.db $BUILDROOT/$PROJECT/*/*/Thumbs.db $BUILDROOT/$PROJECT/*/*/*/Thumbs.db $BUILDROOT/$PROJECT/*/*/*/*/Thumbs.db`;
$ret=`rm -f $BUILDROOT/$PROJECT/.cvsignore $BUILDROOT/$PROJECT/*/.cvsignore $BUILDROOT/$PROJECT/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/*/*/*/.cvsignore`; $ret=`rm -f $BUILDROOT/$PROJECT/.cvsignore $BUILDROOT/$PROJECT/*/.cvsignore $BUILDROOT/$PROJECT/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/*/*/.cvsignore $BUILDROOT/$PROJECT/*/*/*/*/*/*/.cvsignore`;

View File

@ -162,7 +162,6 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/asterisk %_datadir/dolibarr/htdocs/asterisk
%_datadir/dolibarr/htdocs/barcode %_datadir/dolibarr/htdocs/barcode
%_datadir/dolibarr/htdocs/bookmarks %_datadir/dolibarr/htdocs/bookmarks
%_datadir/dolibarr/htdocs/boutique
%_datadir/dolibarr/htdocs/cashdesk %_datadir/dolibarr/htdocs/cashdesk
%_datadir/dolibarr/htdocs/categories %_datadir/dolibarr/htdocs/categories
%_datadir/dolibarr/htdocs/comm %_datadir/dolibarr/htdocs/comm

View File

@ -242,7 +242,6 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/asterisk %_datadir/dolibarr/htdocs/asterisk
%_datadir/dolibarr/htdocs/barcode %_datadir/dolibarr/htdocs/barcode
%_datadir/dolibarr/htdocs/bookmarks %_datadir/dolibarr/htdocs/bookmarks
%_datadir/dolibarr/htdocs/boutique
%_datadir/dolibarr/htdocs/cashdesk %_datadir/dolibarr/htdocs/cashdesk
%_datadir/dolibarr/htdocs/categories %_datadir/dolibarr/htdocs/categories
%_datadir/dolibarr/htdocs/comm %_datadir/dolibarr/htdocs/comm

View File

@ -159,7 +159,6 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/asterisk %_datadir/dolibarr/htdocs/asterisk
%_datadir/dolibarr/htdocs/barcode %_datadir/dolibarr/htdocs/barcode
%_datadir/dolibarr/htdocs/bookmarks %_datadir/dolibarr/htdocs/bookmarks
%_datadir/dolibarr/htdocs/boutique
%_datadir/dolibarr/htdocs/cashdesk %_datadir/dolibarr/htdocs/cashdesk
%_datadir/dolibarr/htdocs/categories %_datadir/dolibarr/htdocs/categories
%_datadir/dolibarr/htdocs/comm %_datadir/dolibarr/htdocs/comm

View File

@ -170,7 +170,6 @@ done >>%{name}.lang
%_datadir/dolibarr/htdocs/asterisk %_datadir/dolibarr/htdocs/asterisk
%_datadir/dolibarr/htdocs/barcode %_datadir/dolibarr/htdocs/barcode
%_datadir/dolibarr/htdocs/bookmarks %_datadir/dolibarr/htdocs/bookmarks
%_datadir/dolibarr/htdocs/boutique
%_datadir/dolibarr/htdocs/cashdesk %_datadir/dolibarr/htdocs/cashdesk
%_datadir/dolibarr/htdocs/categories %_datadir/dolibarr/htdocs/categories
%_datadir/dolibarr/htdocs/comm %_datadir/dolibarr/htdocs/comm

View File

@ -25,4 +25,6 @@ then
find ./htdocs -type f -iname "*.php" -exec chmod a-x {} \; find ./htdocs -type f -iname "*.php" -exec chmod a-x {} \;
chmod a+x ./scripts/*/*.php chmod a+x ./scripts/*/*.php
chmod a+x ./scripts/*/*.sh chmod a+x ./scripts/*/*.sh
chmod g-w ./scripts/*/*.php
chmod g-w ./scripts/*/*.sh
fi fi

View File

@ -65,8 +65,7 @@ if ($action == 'delete') {
$accounting = new AccountingAccount($db); $accounting = new AccountingAccount($db);
if ($action == 'disable') { if ($action == 'disable') {
$accounting = $accounting->fetch($id); if ($accounting->fetch($id)) {
if (! empty($accounting->id)) {
$result = $accounting->account_desactivate($id); $result = $accounting->account_desactivate($id);
} }
@ -75,10 +74,7 @@ if ($action == 'disable') {
setEventMessage($accounting->error, 'errors'); setEventMessage($accounting->error, 'errors');
} }
} else if ($action == 'enable') { } else if ($action == 'enable') {
if ($accounting->fetch($id)) {
$accounting = $accounting->fetch($id);
if (! empty($accounting->id)) {
$result = $accounting->account_activate($id); $result = $accounting->account_activate($id);
} }
$action = 'update'; $action = 'update';
@ -160,7 +156,7 @@ if ($result) {
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
$var = True; $var = true;
while ( $i < min($num, $limit) ) { while ( $i < min($num, $limit) ) {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);

View File

@ -99,7 +99,7 @@ print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'
print '<input type="hidden" name="action" value="update">'; print '<input type="hidden" name="action" value="update">';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
$var = True; $var = true;
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td colspan="2">' . $langs->trans("Modelcsv") . '</td>'; print '<td colspan="2">' . $langs->trans("Modelcsv") . '</td>';

View File

@ -135,7 +135,7 @@ if ($result) {
print '<form action="' . $_SERVER["PHP_SELF"] . '" method="POST">' . "\n"; print '<form action="' . $_SERVER["PHP_SELF"] . '" method="POST">' . "\n";
print '<input type="hidden" name="action" value="import">'; print '<input type="hidden" name="action" value="import">';
$var = True; $var = true;
while ( $i < min($num_lines, $limit) ) { while ( $i < min($num_lines, $limit) ) {
$objp = $db->fetch_object($result); $objp = $db->fetch_object($result);
$var = ! $var; $var = ! $var;

View File

@ -191,7 +191,7 @@ print "<br>\n";
* Define Chart of accounts * Define Chart of accounts
*/ */
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
$var = True; $var = true;
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td colspan="3">'; print '<td colspan="3">';
@ -211,7 +211,7 @@ $sql .= " AND fk_pays = " . $mysoc->country_id;
dol_syslog('accountancy/admin/index.php:: $sql=' . $sql); dol_syslog('accountancy/admin/index.php:: $sql=' . $sql);
$resql = $db->query($sql); $resql = $db->query($sql);
$var = True; $var = true;
if ($resql) { if ($resql) {
$num = $db->num_rows($resql); $num = $db->num_rows($resql);

View File

@ -89,7 +89,7 @@ if ($resql) {
print '<td align="left">' . $langs->trans("Accountancy_code_sell") . '</td>'; print '<td align="left">' . $langs->trans("Accountancy_code_sell") . '</td>';
print '<td align="left">' . $langs->trans("Accountancy_code_sell_suggest") . '</td>'; print '<td align="left">' . $langs->trans("Accountancy_code_sell_suggest") . '</td>';
$var = True; $var = true;
while ( $i < min($num, 250) ) { while ( $i < min($num, 250) ) {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);

View File

@ -227,9 +227,8 @@ if ($result) {
$i ++; $i ++;
} }
print '<tr><td colspan="8">&nbsp;</td></tr><tr><td colspan="8" align="center"><input type="submit" class="butAction" value="' . $langs->trans("Ventilate") . '"></td></tr>';
print '</table>'; print '</table>';
print '<br><div align="center"><input type="submit" class="butAction" value="' . $langs->trans("Ventilate") . '"></div>';
print '</form>'; print '</form>';
} else { } else {
print $db->error(); print $db->error();

View File

@ -208,10 +208,8 @@ if ($result) {
$i ++; $i ++;
} }
print '<tr><td colspan="8">&nbsp;</td></tr><tr><td colspan="8" align="center"><input type="submit" class="butAction" value="' . $langs->trans("Ventiler") . '"></td></tr>'; print '</table>';
print '<br><div align="center"><input type="submit" class="butAction" value="' . $langs->trans("Ventilate") . '"></div>';
print "</table>";
print '</form>'; print '</form>';
} else { } else {
print $db->error(); print $db->error();

View File

@ -159,7 +159,7 @@ if ($conf->use_javascript_ajax)
print '<br>'; print '<br>';
print '<table class="noborder" width="100%">'; print '<table class="noborder" 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><td align="center">'; print '<tr '.$bc[0].'><td align="center" colspan="2">';
$SommeA=0; $SommeA=0;
$SommeB=0; $SommeB=0;

View File

@ -154,7 +154,7 @@ print '<tr class="liste_titre">';
print '<td colspan="2">'.$langs->trans("ActionsEvents").'</td>'; print '<td colspan="2">'.$langs->trans("ActionsEvents").'</td>';
print '<td><a href="'.$_SERVER["PHP_SELF"].'?action=selectall">'.$langs->trans("All").'</a>/<a href="'.$_SERVER["PHP_SELF"].'?action=selectnone">'.$langs->trans("None").'</a>'; print '<td><a href="'.$_SERVER["PHP_SELF"].'?action=selectall">'.$langs->trans("All").'</a>/<a href="'.$_SERVER["PHP_SELF"].'?action=selectnone">'.$langs->trans("None").'</a>';
print '</tr>'."\n"; print '</tr>'."\n";
// Show each trigger // Show each trigger (list is in c_action_trigger)
if (! empty($triggers)) if (! empty($triggers))
{ {
foreach ($triggers as $trigger) foreach ($triggers as $trigger)

View File

@ -117,7 +117,7 @@ if ( ($action == 'update' && empty($_POST["cancel"]))
} }
else dol_syslog($imgThumbMini); else dol_syslog($imgThumbMini);
} }
else dol_syslog($langs->trans("ErrorImageFormatNotSupported"),LOG_WARNING); else dol_syslog("ErrorImageFormatNotSupported",LOG_WARNING);
} }
else if (preg_match('/^ErrorFileIsInfectedWithAVirus/',$result)) else if (preg_match('/^ErrorFileIsInfectedWithAVirus/',$result))
{ {
@ -133,9 +133,10 @@ if ( ($action == 'update' && empty($_POST["cancel"]))
} }
} }
else else
{ {
$error++; $error++;
setEventMessage($langs->trans("ErrorOnlyPngJpgSupported"),'errors'); $langs->load("errors");
setEventMessage($langs->trans("ErrorBadImageFormat"),'errors');
} }
} }
} }
@ -158,7 +159,7 @@ if ( ($action == 'update' && empty($_POST["cancel"]))
// Local taxes // Local taxes
dolibarr_set_const($db, "FACTURE_LOCAL_TAX1_OPTION",$_POST["optionlocaltax1"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "FACTURE_LOCAL_TAX1_OPTION",$_POST["optionlocaltax1"],'chaine',0,'',$conf->entity);
dolibarr_set_const($db, "FACTURE_LOCAL_TAX2_OPTION",$_POST["optionlocaltax2"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "FACTURE_LOCAL_TAX2_OPTION",$_POST["optionlocaltax2"],'chaine',0,'',$conf->entity);
if($_POST["optionlocaltax1"]=="localtax1on") if($_POST["optionlocaltax1"]=="localtax1on")
{ {
if(!isset($_REQUEST['lt1'])) if(!isset($_REQUEST['lt1']))
@ -226,13 +227,15 @@ if ($action == 'addthumb')
else else
{ {
$error++; $error++;
setEventMessage($langs->trans("ErrorImageFormatNotSupported"),'errors'); $langs->load("errors");
dol_syslog($langs->transnoentities("ErrorImageFormatNotSupported"),LOG_WARNING); setEventMessage($langs->trans("ErrorBadImageFormat"),'errors');
dol_syslog($langs->transnoentities("ErrorBadImageFormat"),LOG_WARNING);
} }
} }
else else
{ {
$error++; $error++;
$langs->load("errors");
setEventMessage($langs->trans("ErrorFileDoesNotExists",$_GET["file"]),'errors'); setEventMessage($langs->trans("ErrorFileDoesNotExists",$_GET["file"]),'errors');
dol_syslog($langs->transnoentities("ErrorFileDoesNotExists",$_GET["file"]),LOG_WARNING); dol_syslog($langs->transnoentities("ErrorFileDoesNotExists",$_GET["file"]),LOG_WARNING);
} }
@ -601,7 +604,7 @@ if ($action == 'edit' || $action == 'updateedit')
$formcompany->select_localtax(1,$conf->global->MAIN_INFO_VALUE_LOCALTAX1, "lt1"); $formcompany->select_localtax(1,$conf->global->MAIN_INFO_VALUE_LOCALTAX1, "lt1");
} }
print '</td></tr>'; print '</td></tr>';
print '<tr><td align="left"></label for="clt1">'.$langs->trans("CalcLocaltax").'</label>: '; print '<tr><td align="left"></label for="clt1">'.$langs->trans("CalcLocaltax").'</label>: ';
$opcions=array($langs->transcountry("CalcLocaltax1",$mysoc->country_code),$langs->transcountry("CalcLocaltax2",$mysoc->country_code),$langs->transcountry("CalcLocaltax3",$mysoc->country_code)); $opcions=array($langs->transcountry("CalcLocaltax1",$mysoc->country_code),$langs->transcountry("CalcLocaltax2",$mysoc->country_code),$langs->transcountry("CalcLocaltax3",$mysoc->country_code));
print $form->selectarray("clt1", $opcions, $conf->global->MAIN_INFO_LOCALTAX_CALC1); print $form->selectarray("clt1", $opcions, $conf->global->MAIN_INFO_LOCALTAX_CALC1);
@ -1003,7 +1006,7 @@ else
if($conf->global->MAIN_INFO_VALUE_LOCALTAX1!=0) if($conf->global->MAIN_INFO_VALUE_LOCALTAX1!=0)
{ {
print '<tr><td>'.$langs->trans("LTRate").': '. $conf->global->MAIN_INFO_VALUE_LOCALTAX1 .'</td></tr>'; print '<tr><td>'.$langs->trans("LTRate").': '. $conf->global->MAIN_INFO_VALUE_LOCALTAX1 .'</td></tr>';
} }
print '<tr><td align="left">'.$langs->trans("CalcLocaltax").': '; print '<tr><td align="left">'.$langs->trans("CalcLocaltax").': ';
if($conf->global->MAIN_INFO_LOCALTAX_CALC1==0) if($conf->global->MAIN_INFO_LOCALTAX_CALC1==0)
{ {
@ -1016,7 +1019,7 @@ else
else if($conf->global->MAIN_INFO_LOCALTAX_CALC1==2){ else if($conf->global->MAIN_INFO_LOCALTAX_CALC1==2){
print $langs->transcountry("CalcLocaltax3",$mysoc->country_code); print $langs->transcountry("CalcLocaltax3",$mysoc->country_code);
} }
print '</td></tr>'; print '</td></tr>';
print "</table>"; print "</table>";
print "</td></tr>\n"; print "</td></tr>\n";
@ -1054,7 +1057,7 @@ else
if($conf->global->MAIN_INFO_VALUE_LOCALTAX2!=0) if($conf->global->MAIN_INFO_VALUE_LOCALTAX2!=0)
{ {
print '<tr><td>'.$langs->trans("LTRate").': '. $conf->global->MAIN_INFO_VALUE_LOCALTAX2 .'</td></tr>'; print '<tr><td>'.$langs->trans("LTRate").': '. $conf->global->MAIN_INFO_VALUE_LOCALTAX2 .'</td></tr>';
} }
print '<tr><td align="left">'.$langs->trans("CalcLocaltax").': '; print '<tr><td align="left">'.$langs->trans("CalcLocaltax").': ';
if($conf->global->MAIN_INFO_LOCALTAX_CALC2==0) if($conf->global->MAIN_INFO_LOCALTAX_CALC2==0)
{ {
@ -1068,7 +1071,7 @@ else
{ {
print $langs->transcountry("CalcLocaltax3",$mysoc->country_code); print $langs->transcountry("CalcLocaltax3",$mysoc->country_code);
} }
print '</td></tr>'; print '</td></tr>';
print "</table>"; print "</table>";
print "</td></tr>\n"; print "</td></tr>\n";

View File

@ -131,7 +131,7 @@ $tabsql=array();
$tabsql[1] = "SELECT f.rowid as rowid, f.code, f.libelle, c.code as country_code, c.label as country, f.active FROM ".MAIN_DB_PREFIX."c_forme_juridique as f, ".MAIN_DB_PREFIX."c_country as c WHERE f.fk_pays=c.rowid"; $tabsql[1] = "SELECT f.rowid as rowid, f.code, f.libelle, c.code as country_code, c.label as country, f.active FROM ".MAIN_DB_PREFIX."c_forme_juridique as f, ".MAIN_DB_PREFIX."c_country as c WHERE f.fk_pays=c.rowid";
$tabsql[2] = "SELECT d.rowid as rowid, d.code_departement as code, d.nom as libelle, d.fk_region as region_id, r.nom as region, c.code as country_code, c.label as country, d.active FROM ".MAIN_DB_PREFIX."c_departements as d, ".MAIN_DB_PREFIX."c_regions as r, ".MAIN_DB_PREFIX."c_country as c WHERE d.fk_region=r.code_region and r.fk_pays=c.rowid and r.active=1 and c.active=1"; $tabsql[2] = "SELECT d.rowid as rowid, d.code_departement as code, d.nom as libelle, d.fk_region as region_id, r.nom as region, c.code as country_code, c.label as country, d.active FROM ".MAIN_DB_PREFIX."c_departements as d, ".MAIN_DB_PREFIX."c_regions as r, ".MAIN_DB_PREFIX."c_country as c WHERE d.fk_region=r.code_region and r.fk_pays=c.rowid and r.active=1 and c.active=1";
$tabsql[3] = "SELECT r.rowid as rowid, r.code_region as code, r.nom as libelle, r.fk_pays as country_id, c.code as country_code, c.label as country, r.active FROM ".MAIN_DB_PREFIX."c_regions as r, ".MAIN_DB_PREFIX."c_country as c WHERE r.fk_pays=c.rowid and c.active=1"; $tabsql[3] = "SELECT r.rowid as rowid, r.code_region as code, r.nom as libelle, r.fk_pays as country_id, c.code as country_code, c.label as country, r.active FROM ".MAIN_DB_PREFIX."c_regions as r, ".MAIN_DB_PREFIX."c_country as c WHERE r.fk_pays=c.rowid and c.active=1";
$tabsql[4] = "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_country"; $tabsql[4] = "SELECT rowid as rowid, code, label, active, favorite FROM ".MAIN_DB_PREFIX."c_country";
$tabsql[5] = "SELECT c.rowid as rowid, c.code as code, c.label, c.active FROM ".MAIN_DB_PREFIX."c_civility AS c"; $tabsql[5] = "SELECT c.rowid as rowid, c.code as code, c.label, c.active FROM ".MAIN_DB_PREFIX."c_civility AS c";
$tabsql[6] = "SELECT a.id as rowid, a.code as code, a.libelle AS libelle, a.type, a.active, a.module, a.color, a.position FROM ".MAIN_DB_PREFIX."c_actioncomm AS a"; $tabsql[6] = "SELECT a.id as rowid, a.code as code, a.libelle AS libelle, a.type, a.active, a.module, a.color, a.position FROM ".MAIN_DB_PREFIX."c_actioncomm AS a";
$tabsql[7] = "SELECT a.id as rowid, a.code as code, a.libelle AS libelle, a.accountancy_code as accountancy_code, a.deductible, c.code as country_code, c.label as country, a.fk_pays as country_id, a.active FROM ".MAIN_DB_PREFIX."c_chargesociales AS a, ".MAIN_DB_PREFIX."c_country as c WHERE a.fk_pays=c.rowid and c.active=1"; $tabsql[7] = "SELECT a.id as rowid, a.code as code, a.libelle AS libelle, a.accountancy_code as accountancy_code, a.deductible, c.code as country_code, c.label as country, a.fk_pays as country_id, a.active FROM ".MAIN_DB_PREFIX."c_chargesociales AS a, ".MAIN_DB_PREFIX."c_country as c WHERE a.fk_pays=c.rowid and c.active=1";
@ -387,13 +387,14 @@ if ($id == 11)
$langs->load("bills"); $langs->load("bills");
$langs->load("interventions"); $langs->load("interventions");
$elementList = array( $elementList = array(
'proposal' => $langs->trans('Proposal'), '' => '',
'order' => $langs->trans('Order'), // 'proposal' => $langs->trans('Proposal'),
'invoice' => $langs->trans('Bill'), // 'order' => $langs->trans('Order'),
// 'invoice' => $langs->trans('Bill'),
'invoice_supplier' => $langs->trans('SupplierBill'), 'invoice_supplier' => $langs->trans('SupplierBill'),
'order_supplier' => $langs->trans('SupplierOrder'), 'order_supplier' => $langs->trans('SupplierOrder'),
'intervention' => $langs->trans('InterventionCard'), // 'intervention' => $langs->trans('InterventionCard'),
'contract' => $langs->trans('Contract'), // 'contract' => $langs->trans('Contract'),
'project' => $langs->trans('Project'), 'project' => $langs->trans('Project'),
'project_task' => $langs->trans('Task'), 'project_task' => $langs->trans('Task'),
'agenda' => $langs->trans('Agenda'), 'agenda' => $langs->trans('Agenda'),
@ -402,10 +403,11 @@ if ($id == 11)
'propal' => $langs->trans('Proposal'), 'propal' => $langs->trans('Proposal'),
'commande' => $langs->trans('Order'), 'commande' => $langs->trans('Order'),
'facture' => $langs->trans('Bill'), 'facture' => $langs->trans('Bill'),
'facture_fourn' => $langs->trans('SupplierBill'), // 'facture_fourn' => $langs->trans('SupplierBill'),
'fichinter' => $langs->trans('InterventionCard') 'fichinter' => $langs->trans('InterventionCard')
); );
if (! empty($conf->global->MAIN_SUPPORT_SHARED_CONTACT_BETWEEN_THIRDPARTIES)) $elementList["societe"] = $langs->trans('ThirdParty'); if (! empty($conf->global->MAIN_SUPPORT_SHARED_CONTACT_BETWEEN_THIRDPARTIES)) $elementList["societe"] = $langs->trans('ThirdParty');
asort($elementList);
$sourceList = array( $sourceList = array(
'internal' => $langs->trans('Internal'), 'internal' => $langs->trans('Internal'),
'external' => $langs->trans('External') 'external' => $langs->trans('External')
@ -677,6 +679,46 @@ if ($action == $acts[1])
} }
} }
// favorite
if ($action == 'activate_favorite')
{
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
else { $rowidcol="rowid"; }
if ($rowid) {
$sql = "UPDATE ".$tabname[$id]." SET favorite = 1 WHERE ".$rowidcol."='".$rowid."'";
}
elseif ($_GET["code"]) {
$sql = "UPDATE ".$tabname[$id]." SET favorite = 1 WHERE code='".$_GET["code"]."'";
}
$result = $db->query($sql);
if (!$result)
{
dol_print_error($db);
}
}
// disable favorite
if ($action == 'disable_favorite')
{
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
else { $rowidcol="rowid"; }
if ($rowid) {
$sql = "UPDATE ".$tabname[$id]." SET favorite = 0 WHERE ".$rowidcol."='".$rowid."'";
}
elseif ($_GET["code"]) {
$sql = "UPDATE ".$tabname[$id]." SET favorite = 0 WHERE code='".$_GET["code"]."'";
}
$result = $db->query($sql);
if (!$result)
{
dol_print_error($db);
}
}
/* /*
* View * View
@ -709,6 +751,7 @@ if ($action == 'delete')
{ {
print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.$rowid.'&code='.$_GET["code"].'&id='.$id, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete','',0,1); print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.$rowid.'&code='.$_GET["code"].'&id='.$id, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete','',0,1);
} }
//var_dump($elementList);
/* /*
* Show a dictionary * Show a dictionary
@ -813,7 +856,7 @@ if ($id)
} }
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') $alabelisused=1; if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') $alabelisused=1;
} }
print '<td colspan="3">'; print '<td colspan="4">';
print '<input type="hidden" name="id" value="'.$id.'">'; print '<input type="hidden" name="id" value="'.$id.'">';
print '&nbsp;</td>'; print '&nbsp;</td>';
print '</tr>'; print '</tr>';
@ -928,8 +971,11 @@ if ($id)
print getTitleFieldOfList($valuetoshow,0,$_SERVER["PHP_SELF"],($sortable?$fieldlist[$field]:''),($page?'page='.$page.'&':'').'&id='.$id,"","align=".$align,$sortfield,$sortorder); print getTitleFieldOfList($valuetoshow,0,$_SERVER["PHP_SELF"],($sortable?$fieldlist[$field]:''),($page?'page='.$page.'&':'').'&id='.$id,"","align=".$align,$sortfield,$sortorder);
} }
} }
print getTitleFieldOfList($langs->trans("Status"),0,$_SERVER["PHP_SELF"],"active",($page?'page='.$page.'&':'').'&id='.$id,"",'align="center"',$sortfield,$sortorder); // Favorite - Only activated on country dictionary
print '<td colspan="2" class="liste_titre">&nbsp;</td>'; if ($id == 4) print getTitleFieldOfList($langs->trans("Favorite"),0,$_SERVER["PHP_SELF"],"favorite",($page?'page='.$page.'&':'').'&id='.$id,"",'align="center"',$sortfield,$sortorder);
print getTitleFieldOfList($langs->trans("Status"),0,$_SERVER["PHP_SELF"],"active",($page?'page='.$page.'&':'').'&id='.$id,"",'align="center"',$sortfield,$sortorder);
print '<td colspan="3" class="liste_titre">&nbsp;</td>';
print '</tr>'; print '</tr>';
// Lines with values // Lines with values
@ -1142,6 +1188,16 @@ if ($id)
$url = $_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(! empty($obj->rowid)?$obj->rowid:(! empty($obj->code)?$obj->code:'')).'&amp;code='.(! empty($obj->code)?$obj->code:'').'&amp;id='.$id.'&amp;'; $url = $_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(! empty($obj->rowid)?$obj->rowid:(! empty($obj->code)?$obj->code:'')).'&amp;code='.(! empty($obj->code)?$obj->code:'').'&amp;id='.$id.'&amp;';
// Favorite
// Only activated on country dictionary
if ($id == 4)
{
print '<td align="center" class="nowrap">';
if ($iserasable) print '<a href="'.$url.'action='.$acts[$obj->favorite].'_favorite">'.$actl[$obj->favorite].'</a>';
else print $langs->trans("AlwaysActive");
print '</td>';
}
// Active // Active
print '<td align="center" class="nowrap">'; print '<td align="center" class="nowrap">';
if ($isdisable) print '<a href="'.$url.'action='.$acts[$obj->active].'">'.$actl[$obj->active].'</a>'; if ($isdisable) print '<a href="'.$url.'action='.$acts[$obj->active].'">'.$actl[$obj->active].'</a>';

View File

@ -219,6 +219,10 @@ if (function_exists("ldap_connect"))
$info=$object->_load_ldap_info(); $info=$object->_load_ldap_info();
$dn=$object->_load_ldap_dn($info); $dn=$object->_load_ldap_dn($info);
// Get a gid number for objectclass PosixGroup
if(in_array('posixGroup',$info['objectclass']))
$info['gidNumber'] = $ldap->getNextGroupGid();
$result1=$ldap->delete($dn); // To be sure to delete existing records $result1=$ldap->delete($dn); // To be sure to delete existing records
$result2=$ldap->add($dn,$info,$user); // Now the test $result2=$ldap->add($dn,$info,$user); // Now the test
$result3=$ldap->delete($dn); // Clean what we did $result3=$ldap->delete($dn); // Clean what we did

View File

@ -32,6 +32,7 @@ $langs->load("other");
$langs->load("orders"); $langs->load("orders");
$langs->load("propal"); $langs->load("propal");
$langs->load("bills"); $langs->load("bills");
$langs->load("errors");
// Security check // Security check
if (!$user->admin) if (!$user->admin)
@ -39,19 +40,32 @@ if (!$user->admin)
$action = GETPOST("action"); $action = GETPOST("action");
/* /*
* Actions * Actions
*/ */
if ($action == 'setvalue' && $user->admin) if ($action == 'setvalue' && $user->admin)
{ {
$result=dolibarr_set_const($db, "NOTIFICATION_EMAIL_FROM",$_POST["email_from"],'chaine',0,'',$conf->entity); $result=dolibarr_set_const($db, "NOTIFICATION_EMAIL_FROM", $_POST["email_from"], 'chaine', 0, '', $conf->entity);
if ($result >= 0) if ($result < 0) $error++;
if (! $error)
{
foreach($_POST as $key => $val)
{
if (! preg_match('/^NOTIFICATION_FIXEDEMAIL_/',$key)) continue;
//print $key.' - '.$val.'<br>';
$result=dolibarr_set_const($db, $key, $val, 'chaine', 0, '', $conf->entity);
}
}
if (! $error)
{ {
setEventMessage($langs->trans("SetupSaved")); setEventMessage($langs->trans("SetupSaved"));
} }
else else
{ {
setEventMessage($langs->trans("Error"),'errors'); setEventMessage($langs->trans("Error"),'errors');
} }
} }
@ -67,7 +81,7 @@ llxHeader();
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>'; $linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
print_fiche_titre($langs->trans("NotificationSetup"),$linkback,'setup'); print_fiche_titre($langs->trans("NotificationSetup"),$linkback,'setup');
print $langs->trans("NotificationsDesc").'<br><br>'; print $langs->trans("NotificationsDesc").'<br><br>';
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'].'">';
@ -83,19 +97,13 @@ print "</tr>\n";
$var=!$var; $var=!$var;
print '<tr '.$bc[$var].'><td>'; print '<tr '.$bc[$var].'><td>';
print $langs->trans("NotificationEMailFrom").'</td><td>'; print $langs->trans("NotificationEMailFrom").'</td><td>';
print '<input size="32" type="text" name="email_from" value="'.$conf->global->NOTIFICATION_EMAIL_FROM.'">'; print '<input size="32" type="email" name="email_from" value="'.$conf->global->NOTIFICATION_EMAIL_FROM.'">';
if (! empty($conf->global->NOTIFICATION_EMAIL_FROM) && ! isValidEmail($conf->global->NOTIFICATION_EMAIL_FROM)) print ' '.img_warning($langs->trans("BadEMail")); if (! empty($conf->global->NOTIFICATION_EMAIL_FROM) && ! isValidEmail($conf->global->NOTIFICATION_EMAIL_FROM)) print ' '.img_warning($langs->trans("ErrorBadEMail"));
print '</td></tr>'; print '</td></tr>';
print '</table>'; print '</table>';
print '<br>'; print '<br>';
print '<center><input type="submit" class="button" value="'.$langs->trans("Modify").'"></center>';
print '</form>';
print '<br>';
print_fiche_titre($langs->trans("ListOfAvailableNotifications"),'',''); print_fiche_titre($langs->trans("ListOfAvailableNotifications"),'','');
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
@ -103,6 +111,7 @@ print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Module").'</td>'; print '<td>'.$langs->trans("Module").'</td>';
print '<td>'.$langs->trans("Code").'</td>'; print '<td>'.$langs->trans("Code").'</td>';
print '<td>'.$langs->trans("Label").'</td>'; print '<td>'.$langs->trans("Label").'</td>';
print '<td>'.$langs->trans("FixedEmailTarget").'</td>';
print "</tr>\n"; print "</tr>\n";
// Load array of available notifications // Load array of available notifications
@ -123,10 +132,21 @@ foreach($listofnotifiedevents as $notifiedevent)
print '<td>'.$elementLabel.'</td>'; print '<td>'.$elementLabel.'</td>';
print '<td>'.$notifiedevent['code'].'</td>'; print '<td>'.$notifiedevent['code'].'</td>';
print '<td>'.$label.'</td>'; print '<td>'.$label.'</td>';
$param='NOTIFICATION_FIXEDEMAIL_'.$notifiedevent['code'];
print '<td><input type="email" size="32" name="'.$param.'" value="'.dol_escape_htmltag(GETPOST($param)?GETPOST($param,'alpha'):$conf->global->$param).'">';
if (! empty($conf->global->$param) && ! isValidEmail($conf->global->$param)) print ' '.img_warning($langs->trans("ErrorBadEMail"));
print '</td>';
print '</tr>'; print '</tr>';
} }
print '</table>'; print '</table>';
$db->close(); print '<br>';
print '<center><input type="submit" class="button" value="'.$langs->trans("Save").'"></center>';
print '</form>';
llxFooter(); llxFooter();
$db->close();

View File

@ -1,90 +0,0 @@
<?php
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/admin/osc-languages.php
* \ingroup boutique
* \brief Page d'administration/configuration du module Boutique
*/
require '../main.inc.php';
$langs->load("admin");
if (!$user->admin)
accessforbidden();
llxHeader();
if (! dol_strlen(OSC_DB_NAME))
{
print "Non dispo";
llxFooter();
}
if ($sortfield == "") {
$sortfield="lower(p.label),p.price";
}
if ($sortorder == "") {
$sortorder="ASC";
}
if ($page == -1) { $page = 0 ; }
$limit = $conf->liste_limit;
$offset = $limit * $page ;
print_barre_liste("Liste des langues oscommerce", $page, "osc-languages.php");
$sql = "SELECT l.languages_id, l.name, l.code FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."languages as l";
$sql.= $db->plimit($limit, $offset);
print "<p><TABLE border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"4\">";
print "<tr class=\"liste_titre\">";
print "<td>id</td>";
print "<td>Name</td>";
print "<td>Code</td>";
print "</TR>\n";
$resql=$db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
$i = 0;
$var=True;
while ($i < $num) {
$objp = $db->fetch_object($resql);
$var=!$var;
print "<tr ".$bc[$var].">";
print "<TD>$objp->languages_id</TD>\n";
print "<TD>$objp->name</TD>\n";
print "<TD>$objp->code</TD>\n";
print "</TR>\n";
$i++;
}
$db->free();
}
print "</TABLE>";
$db->close();
llxFooter();

View File

@ -1,204 +0,0 @@
<?php
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2006 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* \file htdocs/boutique/admin/boutique.php
* \ingroup boutique
* \brief Page d'administration/configuration du module OsCommerce
*/
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
$langs->load("admin");
$langs->load("oscommerce");
if (!$user->admin) accessforbidden();
/*
* Actions
*/
if (GETPOST('save','alpha'))
{
$db->begin();
$i=0;
$i+=dolibarr_set_const($db,'OSC_DB_HOST',trim(GETPOST('oscommerce_dbhost','alpha')),'chaine',0,'',$conf->entity);
$i+=dolibarr_set_const($db,'OSC_DB_NAME',trim(GETPOST('oscommerce_dbname','alpha')),'chaine',0,'',$conf->entity);
$i+=dolibarr_set_const($db,'OSC_DB_USER',trim(GETPOST('oscommerce_dbuser','alpha')),'chaine',0,'',$conf->entity);
$i+=dolibarr_set_const($db,'OSC_DB_PASS',trim(GETPOST('oscommerce_dbpass','alpha')),'chaine',0,'',$conf->entity);
$i+=dolibarr_set_const($db,'OSC_DB_TABLE_PREFIX',trim(GETPOST('oscommerce_db_table_prefix','alpha')),'chaine',0,'',$conf->entity);
$i+=dolibarr_set_const($db,'OSC_LANGUAGE_ID',1,'chaine',0,'',$conf->entity);
if ($i >= 4)
{
$db->commit();
setEventMessage($langs->trans("OSCommerceSetupSaved"));
}
else
{
$db->rollback();
header("Location: ".$_SERVER["PHP_SELF"]);
exit;
}
}
elseif (GETPOST('test','alpha'))
{
//$resql=$db->query("select count(*) from ".MAIN_DB_PREFIX."const");
//print "< ".$db." - ".$db->db." - ".$resql." - ".$db->error()."><br>\n";
// Test de la connexion a la database webcalendar
$conf->oscommerce->db->type=$dolibarr_main_db_type;
$conf->oscommerce->db->host=GETPOST('oscommerce_dbhost','alpha');
$conf->oscommerce->db->port=GETPOST('oscommerce_dbport','alpha');
$conf->oscommerce->db->name=GETPOST('oscommerce_dbname','alpha');
$conf->oscommerce->db->user=GETPOST('oscommerce_dbuser','alpha');
$conf->oscommerce->db->pass=GETPOST('oscommerce_dbpass','alpha');
$oscommercedb=getDoliDBInstance($conf->oscommerce->db->type,$conf->oscommerce->db->host,$conf->oscommerce->db->user,$conf->oscommerce->db->pass,$conf->oscommerce->db->name,$conf->oscommerce->db->port);
if ($oscommercedb->connected == 1 && $oscommercedb->database_selected == 1)
{
// Verifie si bonne base par requete sur une table OSCommerce
$sql ="SELECT configuration_value";
$sql.=" FROM ".$_POST["oscommerce_db_table_prefix"]."configuration";
$sql.=" WHERE configuration_key='STORE_NAME'";
$resql=$oscommercedb->query($sql);
if ($resql) {
$mesg = $langs->trans("OSCommerceTestOk",GETPOST('oscommerce_dbhost','alpha'),GETPOST('oscommerce_dbname','alpha'),GETPOST('oscommerce_dbuser','alpha'));
setEventMessage($mesg);
}
else {
$mesg = $langs->trans("OSCommerceErrorConnectOkButWrongDatabase",'STORE_NAME',GETPOST('oscommerce_db_table_prefix','alpha')."configuration");
setEventMessage($mesg, 'errors');
}
//$oscommercedb->close(); Ne pas fermer car la conn de webcal est la meme que dolibarr si parametre host/user/pass identique
}
elseif ($oscommercedb->connected == 1 && $oscommercedb->database_selected != 1)
{
$mesg = $langs->trans("OSCommerceTestKo1",GETPOST('oscommerce_dbhost','alpha'),GETPOST('oscommerce_dbname','alpha'));
$mesg.="<br>".$oscommercedb->error();
setEventMessage($mesg, 'errors');
//$oscommercedb->close(); Ne pas fermer car la conn de webcal est la meme que dolibarr si parametre host/user/pass identique
}
else
{
$mesg = $langs->trans("OSCommerceTestKo2",GETPOST('oscommerce_dbhost','alpha'),GETPOST('oscommerce_dbuser','alpha'));
$mesg.="<br>".$oscommercedb->error();
setEventMessage($mesg, 'errors');
}
//$resql=$db->query("select count(*) from ".MAIN_DB_PREFIX."const");
//print "< ".$db." - ".$db->db." - ".$resql." - ".$db->error()."><br>\n";
}
/*
* Affichage page
*/
llxHeader();
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
print_fiche_titre($langs->trans("OSCommerceSetup"),$linkback,'setup');
print '<br>';
$var=true;
print '<form name="oscommerceconfig" action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print "<table class=\"noborder\" width=\"100%\">";
print "<tr class=\"liste_titre\">";
print "<td width=\"40%\">".$langs->trans("Parameter")."</td>";
print "<td>".$langs->trans("Value")."</td>";
print "<td>".$langs->trans("Examples")."</td>";
print "</tr>";
$var=!$var;
print "<tr ".$bc[$var].">";
print "<td>".$langs->trans("OSCommerceServer")."</td>";
print "<td><input type=\"text\" class=\"flat\" name=\"oscommerce_dbhost\" value=\"". (GETPOST('oscommerce_dbhost','alpha')?GETPOST('oscommerce_dbhost','alpha'):$conf->global->OSC_DB_HOST) . "\" size=\"30\"></td>";
print "<td>localhost";
//print "<br>__dolibarr_main_db_host__ <i>(".$dolibarr_main_db_host.")</i>"
print "</td>";
print "</tr>";
$var=!$var;
print "<tr ".$bc[$var].">";
print "<td>".$langs->trans("OSCommerceDatabaseName")."</td>";
print "<td><input type=\"text\" class=\"flat\" name=\"oscommerce_dbname\" value=\"". (GETPOST('oscommerce_dbname','alpha')?GETPOST('oscommerce_dbname','alpha'):$conf->global->OSC_DB_NAME) . "\" size=\"30\"></td>";
print "<td>oscommerce";
//print "<br>__dolibarr_main_db_name__ <i>(".$dolibarr_main_db_name.")</i>";
print "</td>";
print "</tr>";
$var=!$var;
print "<tr ".$bc[$var].">";
print "<td>".$langs->trans("OSCommercePrefix")."</td>";
print "<td><input type=\"text\" class=\"flat\" name=\"oscommerce_db_table_prefix\" value=\"". (GETPOST('oscommerce_db_table_prefix','alpha')?GETPOST('oscommerce_db_table_prefix','alpha'):$conf->global->DB_TABLE_PREFIX) . "\" size=\"30\"></td>";
print "<td>osc_";
print "</td>";
print "</tr>";
$var=!$var;
print "<tr ".$bc[$var].">";
print "<td>".$langs->trans("OSCommerceUser")."</td>";
print "<td><input type=\"text\" class=\"flat\" name=\"oscommerce_dbuser\" value=\"". (GETPOST('oscommerce_dbuser','alpha')?GETPOST('oscommerce_dbuser','alpha'):$conf->global->OSC_DB_USER) . "\" size=\"30\"></td>";
print "<td>oscommerceuser";
//print "<br>__dolibarr_main_db_user__ <i>(".$dolibarr_main_db_user.")</i>";
print "</td>";
print "</tr>";
$var=!$var;
print "<tr ".$bc[$var].">";
print "<td>".$langs->trans("Password")."</td>";
print "<td><input type=\"password\" class=\"flat\" name=\"oscommerce_dbpass\" value=\"" . (GETPOST('oscommerce_dbpass','alpha')?GETPOST('oscommerce_dbpass','alpha'):$conf->global->OSC_DB_PASS) . "\" size=\"30\"></td>";
print '<td>';
//if ($dolibarr_main_db_pass) print '__dolibarr_main_db_pass__ <i>('.preg_replace('/./i','*',$dolibarr_main_db_pass).')</i>';
print '&nbsp;</td>';
print "</tr>";
$var=!$var;
print "<tr ".$bc[$var].">";
print "<td>".$langs->trans("PasswordRetype")."</td>";
print "<td><input type=\"password\" class=\"flat\" name=\"oscommerce_dbpass2\" value=\"" . (GETPOST('oscommerce_dbpass2','alpha')?GETPOST('oscommerce_dbpass2','alpha'):$conf->global->OSC_DB_PASS) ."\" size=\"30\"></td>";
print '<td>';
//if ($dolibarr_main_db_pass) print '__dolibarr_main_db_pass__ <i>('.preg_replace('/./i','*',$dolibarr_main_db_pass).')</i>';
print '&nbsp;</td>';
print "</tr>";
print "</table>";
print '<br><center>';
print "<input type=\"submit\" name=\"test\" class=\"button\" value=\"".$langs->trans("TestConnection")."\">";
print "&nbsp; &nbsp;";
print "<input type=\"submit\" name=\"save\" class=\"button\" value=\"".$langs->trans("Save")."\">";
print "</center>";
print "</form>\n";
$db->close();
llxFooter();

View File

@ -1,126 +0,0 @@
<?php
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003-2005 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2006-2010 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* \file htdocs/boutique/client/card.php
* \ingroup boutique
* \brief Page fiche client OSCommerce
*/
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/boutique/osc_master.inc.php';
include_once DOL_DOCUMENT_ROOT.'/boutique/client/class/boutiqueclient.class.php';
$id=GETPOST('id', 'int');
/*
* Actions
*/
// None
/*
* View
*/
llxHeader();
if ($id > 0)
{
$client = new BoutiqueClient($dbosc);
$result = $client->fetch($id);
if ( $result )
{
print '<div class="titre">'.$langs->trans("CustomerCard").': '.$client->name.'</div><br>';
print '<table border="1" width="100%" cellspacing="0" cellpadding="4">';
print "<tr>";
print '<td width="20%">Nom</td><td width="80%">'.$client->name.'</td></tr>';
print "</table>";
/*
* Commandes
*/
$sql = "SELECT o.orders_id, o.customers_id, date_purchased, t.value as total";
$sql .= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders as o, ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders_total as t";
$sql .= " WHERE o.customers_id = " . $client->id;
$sql .= " AND o.orders_id = t.orders_id AND t.class = 'ot_total'";
//echo $sql;
$resql=$dbosc->query($sql);
if ($resql)
{
$num = $dbosc->num_rows($resql);
$i = 0;
print '<table class="noborder" width="50%">';
print "<tr class=\"liste_titre\"><td>Commandes</td>";
print "</tr>\n";
$var=True;
while ($i < $num)
{
$objp = $dbosc->fetch_object($resql);
$var=!$var;
print "<tr ".$bc[$var].">";
print '<td><a href="'.DOL_URL_ROOT.'/boutique/commande/card.php?id='.$objp->orders_id.'"><img src="/theme/'.$conf->theme.'/img/filenew.png" border="0" alt="Fiche">&nbsp;';
print dol_print_date($dbosc->jdate($objp->date_purchased),'dayhour')."</a>\n";
print $objp->total . "</a></TD>\n";
print "</tr>\n";
$i++;
}
print "</table>";
$dbosc->free($resql);
}
else
{
print "<p>ERROR 1</p>\n";
dol_print_error($dbosc);
}
}
else
{
print "<p>ERROR 1</p>\n";
dol_print_error($dbosc);
}
}
else
{
print "<p>ERROR 1</p>\n";
print "Error";
}
/* ************************************************************************** */
/* */
/* Barre d'action */
/* */
/* ************************************************************************** */
// Pas d'action
$dbosc->close();
llxFooter();

View File

@ -1,77 +0,0 @@
<?php
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* \file htdocs/boutique/client/class/boutiqueclient.class.php
* \brief Classe permettant de gerer des clients de la boutique online
* \author Rodolphe Quiedeville
*/
/**
* \class BoutiqueClient
* \brief Classe permettant de gerer des clients de la boutique online
*/
class BoutiqueClient
{
var $db ;
var $id ;
var $nom;
/**
* Constructor
*
* @param DoliDB $db Database handler
*/
function __construct($db)
{
$this->db = $db;
}
/**
* Fonction permettant de recuperer les informations d'un clients de la boutique
*
* @param int $id Id du client
* @return int <0 if KO, >0 if OK
*/
function fetch($id)
{
global $conf;
$sql = "SELECT customers_id, customers_lastname, customers_firstname FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."customers WHERE customers_id = ".$id;
$resql = $this->db->query($sql);
if ( $resql )
{
$result = $this->db->fetch_array($resql);
$this->id = $result["customers_id"];
$this->name = $result["customers_firstname"] . " " . $result["customers_lastname"];
$this->db->free($resql);
return 1;
}
else
{
print $this->db->error();
return -1;
}
}
}

View File

@ -1,91 +0,0 @@
<?php
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* \file htdocs/boutique/client/index.php
* \ingroup boutique
* \brief Page gestion client OSCommerce
*/
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/boutique/osc_master.inc.php';
$langs->load("companies");
/*
* View
*/
llxHeader();
if ($sortfield == "") {
$sortfield="lower(c.customers_lastname)";
}
if ($sortorder == "") {
$sortorder="ASC";
}
if ($page == -1) { $page = 0 ; }
$limit = $conf->liste_limit;
$offset = $limit * $page ;
print_barre_liste("Liste des clients", $page, $_SERVER["PHP_SELF"]);
$sql = "SELECT c.customers_id, c.customers_lastname, c.customers_firstname, c.customers_email_address, c.customers_newsletter";
$sql .= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."customers as c";
$sql .= " ORDER BY $sortfield $sortorder ";
$sql .= $dbosc->plimit($limit,$offset);
$resql=$dbosc->query($sql);
if ($resql)
{
$num = $dbosc->num_rows($resql);
$i = 0;
print "<table class=\"noborder\" width=\"100%\">";
print "<tr class=\"liste_titre\">";
print_liste_field_titre($langs->trans("Firstname"),$_SERVER["PHP_SELF"], "c.customers_firstname");
print_liste_field_titre($langs->trans("Lastname"),$_SERVER["PHP_SELF"], "c.customers_lastname");
print '<td>'.$langs->trans("EMail").'</td><td align="center">'.$langs->trans("Newsletter").'</td>';
print "</tr>\n";
$var=True;
while ($i < $num)
{
$objp = $dbosc->fetch_object($resql);
$var=!$var;
print "<tr ".$bc[$var].">";
print '<td><a href="card.php?id='.$objp->customers_id.'">'.$objp->customers_firstname."</a></td>\n";
print '<td><a href="card.php?id='.$objp->customers_id.'">'.$objp->customers_lastname."</a></td>\n";
print "<td>$objp->customers_email_address</td>\n";
print "<td align=\"center\">$objp->customers_newsletter</td>\n";
print "</tr>\n";
$i++;
}
print "</table>";
$dbosc->free();
}
else
{
dol_print_error($dbosc);
}
$dbosc->close();
llxFooter();

View File

@ -1,115 +0,0 @@
<?php
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* \file htdocs/boutique/commande/ca.php
* \ingroup boutique
* \brief Page ca commandes du module OsCommerce
*/
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/boutique/osc_master.inc.php';
/*
* View
*/
llxHeader();
if ($sortfield == "")
{
$sortfield="date_purchased";
}
if ($sortorder == "")
{
$sortorder="DESC";
}
if ($page == -1) { $page = 0 ; }
$limit = $conf->liste_limit;
$offset = $limit * $page ;
print_barre_liste("Liste des commandes", $page, "ca.php");
print '<table class="noborder" cellspacing="0" cellpadding="3">';
print '<tr class="liste_titre"><td>'.$langs->trans("Description").'</td>';
print '<td align="right">'.$langs->trans("Lastname").'</td></tr>';
$sql = "SELECT sum(t.value) as value";
$sql .= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders_total as t";
$sql .= " WHERE t.class = 'ot_subtotal'";
$resql=$dbosc->query($sql);
if ($resql)
{
$num = $dbosc->num_rows($resql);
$var=True;
if ($num > 0)
{
$objp = $dbosc->fetch_object($resql);
$var=!$var;
print "<tr ".$bc[$var].">";
print '<td>Somme des commandes</td>';
print '<td align="right">'.price($objp->value).'</td>';
print "</tr>\n";
$i++;
}
$dbosc->free();
}
else
{
dol_print_error($dbosc);
}
$sql = "SELECT sum(t.value) as value";
$sql .= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders_total as t";
$sql .= " WHERE t.class = 'ot_shipping'";
$resql=$dbosc->query($sql);
if ($resql)
{
$num = $dbosc->num_rows($resql);
$var=True;
if ($num > 0)
{
$objp = $dbosc->fetch_object($resql);
$var=!$var;
print "<tr ".$bc[$var].">";
print '<td>Somme des frais de port</td>';
print '<td align="right">'.price($objp->value).'</td></tr>';
$i++;
}
$dbosc->free();
}
else
{
dol_print_error($dbosc);
}
print "</table>";
$dbosc->close();
llxFooter();

View File

@ -1,155 +0,0 @@
<?php
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003-2005 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* \file htdocs/boutique/commande/card.php
* \ingroup boutique
* \brief Page fiche commande OSCommerce
*/
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/boutique/osc_master.inc.php';
include_once DOL_DOCUMENT_ROOT.'/boutique/commande/class/boutiquecommande.class.php';
$langs->load("products");
$id=GETPOST('id', 'int');
/*
* View
*/
llxHeader();
if ($id > 0)
{
$commande = new BoutiqueCommande($db);
$result = $commande->fetch($id);
if ($result)
{
print '<div class="titre">'.$langs->trans("OrderCard").': '.$commande->id.'</div><br>';
print '<table border="1" width="100%" cellspacing="0" cellpadding="4">';
print '<tr><td width="20%">Date</td><td width="80%" colspan="2">'.$commande->date.'</td></tr>';
print '<td width="20%">Client</td><td width="80%" colspan="2"><a href="'.DOL_URL_ROOT.'/boutique/client/card.php?id='.$commande->client_id.'">'.$commande->client_name.'</a></td></tr>';
print '<td width="20%">Paiement</td><td width="80%" colspan="2">'.$commande->payment_method.'</td></tr>';
print "<tr><td>".$langs->trans("Address")."</td><td>".$langs->trans("Delivery")."</td><td>".$langs->trans("Invoice")."</td></tr>";
print "<td>&nbsp;</td><td>".$commande->delivery_adr->name."<br>".$commande->delivery_adr->street."<br>".$commande->delivery_adr->zip."<br>".$commande->delivery_adr->city."<br>".$commande->delivery_adr->country."</td>";
print "<td>".$commande->billing_adr->name."<br>".$commande->billing_adr->street."<br>".$commande->billing_adr->zip."<br>".$commande->billing_adr->city."<br>".$commande->billing_adr->country."</td>";
print "</tr>";
print "</table>";
print "<br>";
/*
* Produits
*
*/
$sql = "SELECT orders_id, products_id, products_model, products_name, products_price, final_price, products_quantity";
$sql .= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders_products";
$sql .= " WHERE orders_id = " . $commande->id;
//$commande->id;
// echo $sql;
$resql=$dbosc->query($sql);
if ($resql)
{
$num = $dbosc->num_rows($resql);
$i = 0;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td align="left" width="40%">'.$langs->trans("Products").'</td>';
print '<td align="center">'.$langs->trans("Number").'</td><td align="right">'.$langs->trans("Price").'</td><td align="right">Prix final</td>';
print "</tr>\n";
$var=True;
while ($i < $num)
{
$objp = $dbosc->fetch_object($resql);
$var=!$var;
print "<tr ".$bc[$var].">";
print '<td align="left" width="40%">';
print '<a href="card.php?id='.$objp->products_id.'"><img src="/theme/'.$conf->theme.'/img/filenew.png" border="0" width="16" height="16" alt="Fiche livre"></a>';
print '<a href="card.php?id='.$objp->products_id.'">'.$objp->products_name.'</a>';
print "</td>";
print '<td align="center"><a href="card.php?id='.$objp->rowid."\">$objp->products_quantity</a></TD>\n";
print "<td align=\"right\"><a href=\"card.php?id=$objp->rowid\">".price($objp->products_price)."</a></TD>\n";
print "<td align=\"right\"><a href=\"card.php?id=$objp->rowid\">".price($objp->final_price)."</a></TD>\n";
print "</tr>\n";
$i++;
}
print "</table>";
$dbosc->free();
}
else
{
print $dbosc->error();
}
/*
*
*
*/
print "<br>";
print '<table border="1" width="100%" cellspacing="0" cellpadding="4">';
print "<tr>";
print '<td width="20%">Frais d\'expeditions</td><td width="80%">'.price($commande->total_ot_shipping).' EUR</td></tr>';
print '<td width="20%">'.$langs->trans("Lastname").'</td><td width="80%">'.price($commande->total_ot_total).' EUR</td></tr>';
print "</table>";
}
else
{
print "Fetch failed";
}
}
else
{
print "Error";
}
/* ************************************************************************** */
/* */
/* Barre d'action */
/* */
/* ************************************************************************** */
print '<br><table width="100%" border="1" cellspacing="0" cellpadding="3">';
print '<td width="20%" align="center">-</td>';
print '<td width="20%" align="center">-</td>';
print '<td width="20%" align="center">-</td>';
print '<td width="20%" align="center">-</td>';
print '<td width="20%" align="center">-</td>';
print '</table><br>';
$dbosc->close();
llxFooter();

View File

@ -1,138 +0,0 @@
<?php
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2008 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/boutique/commande/class/boutiquecommande.class.php
* \ingroup osc
* \brief Fichier de la classe des commandes de la boutique online
*/
require_once DOL_DOCUMENT_ROOT .'/societe/class/address.class.php';
include_once DOL_DOCUMENT_ROOT.'/boutique/commande/class/boutiquecommande.class.php';
/**
* Class to manage orders OSC
*/
class BoutiqueCommande
{
var $db;
var $id;
var $nom;
/**
* Constructor
*
* @param DoliDB $db Database handler
*/
function __construct($db)
{
$this->db = $db;
$this->billing_adr = new Address();
$this->delivry_adr = new Address();
$this->total_ot_subtotal = 0;
$this->total_ot_shipping = 0;
}
/**
* Get object and lines from database
*
* @param int $id id of object to load
* @param string $ref Ref of order
* @return int >0 if OK, <0 if KO
*/
function fetch($id,$ref='')
{
global $conf;
$sql = "SELECT orders_id, customers_id, customers_name, customers_company, customers_street_address, customers_suburb, customers_city, customers_postcode, customers_state, customers_country, customers_telephone, customers_email_address, customers_address_format_id, delivery_name, delivery_company, delivery_street_address, delivery_suburb, delivery_city, delivery_zipcode, delivery_state, delivery_country, delivery_address_format_id, billing_name, billing_company, billing_street_address, billing_suburb, billing_city, billing_zipcode, billing_state, billing_country, billing_address_format_id, payment_method, cc_type, cc_owner, cc_number, cc_expires, last_modified, date_purchased, orders_status, orders_date_finished, currency, currency_value";
$sql.= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders";
$sql.= " WHERE orders_id = ".$id;
$result = $this->db->query($sql);
if ( $result )
{
$array = $this->db->fetch_array($result);
$this->id = $array["orders_id"];
$this->client_id = $array["customers_id"];
$this->client_name = $array["customers_name"];
$this->payment_method = $array["payment_method"];
$this->date = $this->db->jdate($array["date_purchased"]);
$this->delivery_adr->name = $array["delivery_name"];
$this->delivery_adr->street = $array["delivery_street_address"];
$this->delivery_adr->zip = $array["delivery_zipcode"];
$this->delivery_adr->city = $array["delivery_city"];
$this->delivery_adr->country = $array["delivery_country"];
$this->billing_adr->name = $array["billing_name"];
$this->billing_adr->street = $array["billing_street_address"];
$this->billing_adr->zip = $array["billing_zipcode"];
$this->billing_adr->city = $array["billing_city"];
$this->billing_adr->country = $array["billing_country"];
$this->db->free();
/*
* Totaux
*/
$sql = "SELECT value, class ";
$sql .= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders_total WHERE orders_id = $id";
$result = $this->db->query($sql);
if ( $result )
{
$num = $this->db->num_rows($result);
$i=0;
while ($i < $num)
{
$array = $this->db->fetch_array($result);
if ($array["class"] == 'ot_total')
{
$this->total_ot_total = $array["value"];
}
if ($array["class"] == 'ot_shipping')
{
$this->total_ot_shipping = $array["value"];
}
$i++;
}
}
else
{
print $this->db->error();
}
}
else
{
print $this->db->error();
}
return $result;
}
}

View File

@ -1,92 +0,0 @@
<?php
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2006 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* \file htdocs/boutique/commande/index.php
* \ingroup boutique
* \brief Page gestion commandes OSCommerce
*/
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/boutique/osc_master.inc.php';
llxHeader();
if ($sortfield == "")
{
$sortfield="date_purchased";
}
if ($sortorder == "")
{
$sortorder="DESC";
}
if ($page == -1) { $page = 0 ; }
$limit = $conf->liste_limit;
$offset = $limit * $page ;
print_barre_liste("Liste des commandes", $page, "commande.php");
$sql = "SELECT o.orders_id, customers_id, customers_name, customers_company, customers_street_address, customers_suburb, customers_city, customers_postcode, customers_state, customers_country, customers_telephone, customers_email_address, customers_address_format_id, delivery_name, delivery_company, delivery_street_address, delivery_suburb, delivery_city, delivery_postcode, delivery_state, delivery_country, delivery_address_format_id, billing_name, billing_company, billing_street_address, billing_suburb, billing_city, billing_postcode, billing_state, billing_country, billing_address_format_id, payment_method, cc_type, cc_owner, cc_number, cc_expires, last_modified, date_purchased, orders_status, orders_date_finished, currency, currency_value, t.value";
$sql .= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders as o, ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders_total as t";
$sql .= " WHERE o.orders_id = t.orders_id AND t.class = 'ot_total'";
$sql .= " ORDER BY $sortfield $sortorder ";
$sql .= $dbosc->plimit($limit,$offset);
$resql=$dbosc->query($sql);
if ($resql)
{
$num = $dbosc->num_rows($resql);
$i = 0;
print "<table class=\"noborder\" width=\"100%\">";
print "<tr class=\"liste_titre\">";
print "<td>".$langs->trans("Ref")."</td>";
print "<td>".$langs->trans("Date")."</td>";
print_liste_field_titre("Client","commande.php", "customers_name");
print '<td align="right">'.$langs->trans("Total").'</td>';
print "</tr>\n";
$var=True;
while ($i < $num)
{
$objp = $dbosc->fetch_object($resql);
$var=!$var;
print "<tr ".$bc[$var].">";
print '<td><a href="card.php?id='.$objp->orders_id.'"><img src="/theme/'.$conf->theme.'/img/filenew.png" border="0" alt="Fiche">&nbsp;';
print $objp->orders_id ."</a></td><td>";
print dol_print_date($dbosc->jdate($objp->date_purchased),'dayhour').'</td>';
print '<td><a href="../client/card.php?id='.$objp->customers_id.'">'.$objp->customers_name."</a></TD>\n";
print '<td align="right">'.price($objp->value).'</td>';
print "</tr>\n";
$i++;
}
print "</table>";
$dbosc->free();
}
else
{
dol_print_error($dbosc);
}
$dbosc->close();
llxFooter();

View File

@ -1,97 +0,0 @@
<?php
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 Eric Seigne <erics@rycks.com>
* Copyright (C) 2006 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* \file htdocs/boutique/critiques/bestproduct.php
* \ingroup boutique
* \brief Page affichage meilleures critiques OS Commerce
*/
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/boutique/osc_master.inc.php';
/*
* View
*/
llxHeader();
if ($sortfield == "") {
$sortfield="rat";
}
if ($sortorder == "") {
$sortorder="DESC";
}
if ($page == -1) { $page = 0 ; }
$limit = $conf->liste_limit;
$offset = $limit * $page ;
print_barre_liste("Liste des produits classes par critiques", $page, "bestproduct.php");
$sql = "SELECT sum(r.reviews_rating)/count(r.reviews_rating) as rat, r.products_id, p.products_model, p.products_quantity, p.products_status";
$sql .= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."reviews as r,".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."products as p ";
$sql .= " WHERE r.products_id = p.products_id";
$sql .= " GROUP BY r.products_id, p.products_model, p.products_quantity, p.products_status";
$sql .= " ORDER BY $sortfield $sortorder ";
$sql .= $dbosc->plimit($limit,$offset);
print "<p><TABLE border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"4\">";
print "<TR class=\"liste_titre\"><td>".$langs->trans("Ref");
print '</td><TD align="center">Indice critiques</TD>';
print '</td><td align="center">Quantite';
print '</td><td align="center">Status</TD>';
print "</TR>\n";
$resql=$dbosc->query($sql);
if ($resql)
{
$num = $dbosc->num_rows($resql);
$i = 0;
$var=True;
while ($i < $num) {
$objp = $dbosc->fetch_object($resql);
$var=!$var;
print "<tr ".$bc[$var].">";
print '<TD><a href="'.DOL_URL_ROOT.'/boutique/livre/card.php?oscid='.$objp->products_id.'">'.$objp->products_model.'</a></TD>';
print '<TD align="center">'.$objp->rat."</TD>\n";
print '<TD align="center">'.$objp->products_quantity."</TD>\n";
print '<TD align="center">'.$objp->products_status."</TD>\n";
print "</TR>\n";
$i++;
}
$dbosc->free();
}
else
{
dol_print_error($dbosc);
}
print "</TABLE>";
$dbosc->close();
llxFooter();

View File

@ -1,82 +0,0 @@
<?php
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2006 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* \file htdocs/boutique/critiques/card.php
* \ingroup boutique
* \brief Page fiche critique OS Commerce
*/
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/boutique/osc_master.inc.php';
$id=$_GET["id"];
llxHeader();
if ($id)
{
$critique = new Critique($dbosc);
$result = $critique->fetch($id);
if ( $result )
{
print '<div class="titre">Fiche Critique</div><br>';
print '<table border="1" width="100%" cellspacing="0" cellpadding="4">';
print "<tr>";
print '<td width="20%">Produit</td><td width="80%">'.$critique->product_name.'</td></tr>';
print '<tr><td width="20%">Texte</td><td width="80%">'.nl2br($critique->text).'</td></tr>';
print "</table>";
}
else
{
print "Fetch failed";
}
}
/* ************************************************************************** */
/* */
/* Barre d'action */
/* */
/* ************************************************************************** */
print '<br><table width="100%" border="1" cellspacing="0" cellpadding="3">';
print '<td width="20%" align="center">-</td>';
print '<td width="20%" align="center">-</td>';
print '<td width="20%" align="center">-</td>';
print '<td width="20%" align="center">-</td>';
print '<td width="20%" align="center">-</td>';
print '</table><br>';
$dbosc->close();
llxFooter();

View File

@ -1,84 +0,0 @@
<?php
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/boutique/critiques/class/critique.class.php
* \ingroup osc
* \brief Fichier de la classe des critiques OSCommerce
*/
/**
* Classe permettant la gestion des critiques OSCommerce
*/
class Critique
{
var $db;
var $id;
var $nom;
/**
* Constructor
*
* @param DoliDB $db Database handler
*/
function __construct($db)
{
$this->db = $db;
}
/**
* Load instance
*
* @param int $id Id to load
* @return int <0 if KO, >0 if OK
*/
function fetch ($id)
{
global $conf;
$sql = "SELECT r.reviews_id, r.reviews_rating, d.reviews_text, p.products_name";
$sql .= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."reviews as r, ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."reviews_description as d";
$sql .= " ,".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."products_description as p";
$sql .= " WHERE r.reviews_id = d.reviews_id AND r.products_id=p.products_id";
$sql .= " AND p.language_id = ".$conf->global->OSC_LANGUAGE_ID. " AND d.languages_id=".$conf->global->OSC_LANGUAGE_ID;
$sql .= " AND r.reviews_id=$id";
$result = $this->db->query($sql);
if ( $result )
{
$result = $this->db->fetch_array($result);
$this->id = $result["reviews_id"];
$this->product_name = stripslashes($result["products_name"]);
$this->text = stripslashes($result["reviews_text"]);
$this->db->free($result);
}
else
{
print $this->db->lasterror();
}
return $result;
}
}

View File

@ -1,92 +0,0 @@
<?php
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2006 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* \file htdocs/boutique/critiques/index.php
* \ingroup boutique
* \brief Page gestion critiques OSCommerce
*/
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/boutique/osc_master.inc.php';
/*
* View
*/
llxHeader();
if ($sortfield == "") {
$sortfield="date_added";
}
if ($sortorder == "") {
$sortorder="DESC";
}
if ($page == -1) { $page = 0 ; }
$limit = $conf->liste_limit;
$offset = $limit * $page ;
print_barre_liste("Critiques", $page, "index.php");
$sql = "SELECT r.reviews_id, r.reviews_rating, d.reviews_text, p.products_name FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."reviews as r, ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."reviews_description as d, ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."products_description as p";
$sql .= " WHERE r.reviews_id = d.reviews_id AND r.products_id=p.products_id";
$sql .= " AND p.language_id = ".$conf->global->OSC_LANGUAGE_ID. " AND d.languages_id=".$conf->global->OSC_LANGUAGE_ID;
$sql .= " ORDER BY $sortfield $sortorder ";
$sql .= $dbosc->plimit($limit,$offset);
print "<p><TABLE border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"4\">";
print '<TR class="liste_titre">';
print "<td>Produit</td>";
print "<td>Critique</td>";
print "<td align=\"center\">Note</td>";
print "<TD align=\"right\"></TD>";
print "</TR>\n";
$resql=$dbosc->query($sql);
if ($resql) {
$num = $dbosc->num_rows($resql);
$i = 0;
$var=True;
while ($i < $num) {
$objp = $dbosc->fetch_object($resql);
$var=!$var;
print "<tr ".$bc[$var].">";
print "<TD>".substr($objp->products_name, 0, 30)."</TD>\n";
print '<TD><a href="card.php?id='.$objp->reviews_id.'">'.substr($objp->reviews_text, 0, 40)." ...</a></td>\n";
print "<td align=\"center\">$objp->reviews_rating</TD>\n";
print "</TR>\n";
$i++;
}
$dbosc->free();
}
else
{
dol_print_error($dbosc);
}
print "</TABLE>";
$dbosc->close();
llxFooter();

View File

@ -1,245 +0,0 @@
<?php
/* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/boutique/index.php
* \ingroup boutique
* \brief Main page of shop zone
*/
require '../main.inc.php';
$langs->load("shop");
$langs->load("orders");
require_once DOL_DOCUMENT_ROOT.'/boutique/osc_master.inc.php';
llxHeader("",$langs->trans("OSCommerceShop"),"");
print_fiche_titre($langs->trans("OSCommerceShop"));
print '<table width="100%" class="notopnoleftnoright">';
print '<tr><td valign="top" width="40%" class="notopnoleft">';
/*
* Turnover
*/
print_titre($langs->trans('SalesTurnover'));
print '<table class="noborder" cellspacing="0" cellpadding="3" width="100%">';
print '<tr class="liste_titre"><td>'.$langs->trans("Month").'</td>';
print '<td align="right">'.$langs->trans("Total").'</td></tr>';
$now=dol_now();
$sql = "SELECT SUM(t.value) as value, MONTH(o.date_purchased) as month";
$sql.= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders_total as t";
$sql.= " JOIN ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders as o ON o.orders_id = t.orders_id";
//$sql.= " WHERE t.class = 'ot_subtotal' AND YEAR(o.date_purchased) = YEAR(".$dbosc->idate($now).")";
$sql.= " WHERE t.class = 'ot_subtotal' AND YEAR(o.date_purchased) = YEAR('".$db->idate($now)."')";
$sql.= " GROUP BY month";
$sql.= " ORDER BY month";
//print $sql;exit;
$result=$dbosc->query($sql);
if ($result)
{
$num = $dbosc->num_rows($result);
$var=True;
$i=0;
if ($num > 0)
{
while ($i < $num)
{
$objp = $dbosc->fetch_object($result);
$var=!$var;
print "<tr ".$bc[$var].">";
print '<td align="left">'.$objp->mois.'</td>';
print '<td align="right">'.price($objp->value).'</td>';
print "</tr>\n";
$i++;
}
}
$dbosc->free();
}
else
{
dol_print_error($dbosc);
}
print "</table>";
print '</td><td valign="top" width="60%" class="notopnoleftnoright">';
print_titre($langs->trans("Orders"));
/*
* Last 5 successful commands
select o.orders_id, o.customers_id, o.customers_name, o.date_purchased, o.payement_method, o.status, t.value
from orders_total as t
join orders as o on o.orders_id = t.orders_id where t.class = 'ot_subtotal' order by o.date_purchased desc
*/
$sql = "SELECT o.orders_id, o.customers_name, o.date_purchased, t.value, o.payment_method";
$sql .= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders_total as t JOIN ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders as o on o.orders_id = t.orders_id ";
$sql .= " WHERE t.class = 'ot_subtotal' ORDER BY o.date_purchased desc";
$resql=$dbosc->query($sql);
if ($resql)
{
$langs->load("orders");
$num = $dbosc->num_rows($resql);
if ($num > 0)
{
$i = 0;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td colspan="4">'.$langs->trans("LastOrders").'</td></tr>';
$num = min($num,OSC_MAXNBCOM);
while ($i < $num)
{
$obj = $dbosc->fetch_object($resql);
print "<tr><td>".$obj->orders_id."</td><td>".$obj->customers_name."</td><td>".price($obj->value)."</td><td>".$obj->payment_method."</td></tr>";
$i++;
}
print "</table><br>";
}
}
else
{
dol_print_error($dbosc);
}
/*
* Last 5 orders on hold
*/
$sql = "SELECT o.orders_id, o.customers_name, o.date_purchased, t.value, o.payment_method";
$sql .= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders_total as t JOIN ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders as o on o.orders_id = t.orders_id ";
$sql .= " WHERE t.class = 'ot_subtotal' and o.orders_status = 5 order by o.date_purchased desc";
$resql=$dbosc->query($sql);
if ($resql)
{
$langs->load("orders");
$num = $dbosc->num_rows($resql);
if ($num > 0)
{
$i = 0;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td colspan="4">'.$langs->trans("En Attente").'</td></tr>';
$num = min($num,OSC_MAXNBCOM);
while ($i < $num)
{
$obj = $dbosc->fetch_object($resql);
print "<tr><td>$obj->orders_id</td><td>$obj->customers_name</td><td>".price($obj->value)."</td><td>$obj->payment_method</td></tr>";
$i++;
}
print "</table><br>";
}
}
else
{
dol_print_error($dbosc);
}
/*
* Commands to treat
*/
$sql = "SELECT o.orders_id, o.customers_name, o.date_purchased, t.value, o.payment_method";
$sql .= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders_total as t JOIN ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders as o on o.orders_id = t.orders_id ";
$sql .= " WHERE t.class = 'ot_subtotal' and o.orders_status = 2 order by o.date_purchased desc";
$resql=$dbosc->query($sql);
if ($resql)
{
$langs->load("orders");
$num = $dbosc->num_rows($resql);
if ($num > 0)
{
$i = 0;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td colspan="4">'.$langs->trans("TreatmentInProgress").'</td></tr>';
$num = min($num,OSC_MAXNBCOM);
while ($i < $num)
{
$obj = $dbosc->fetch_object($resql);
print "<tr><td>$obj->orders_id</td><td>$obj->customers_name</td><td>".price($obj->value)."</td><td>$obj->payment_method</td></tr>";
$i++;
}
print "</table><br>";
}
}
else
{
dol_print_error($dbosc);
}
print '</td></tr><tr>';
/*
* Last customers who ordered
*/
$sql = "SELECT o.orders_id, o.customers_name, o.delivery_country, o.date_purchased, t.value, s.orders_status_name as statut";
$sql .= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders_total as t JOIN ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders as o on o.orders_id = t.orders_id ";
$sql .= " JOIN ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders_status as s on o.orders_status = s.orders_status_id and s.language_id = 1";
$sql .= " WHERE t.class = 'ot_subtotal' order by o.date_purchased desc";
$resql=$dbosc->query($sql);
if ($resql)
{
$langs->load("orders");
$num = $dbosc->num_rows($resql);
if ($num > 0)
{
$i = 0;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td colspan="7">'.$langs->trans("Derniers clients").'</td></tr>';
$num = min($num,OSC_MAXNBCOM);
while ($i < $num)
{
$obj = $dbosc->fetch_object($resql);
print "<tr><td>$obj->date_purchased</td><td>$obj->customers_name</td><td>$obj->delivery_country</td><td>".price($obj->value)."</td><td>$obj->payment_method</td><td>$obj->orders_id</td><td>$obj->statut</td></tr>";
$i++;
}
print "</table><br>";
}
}
else
{
dol_print_error($dbosc);
}
print '</tr></table>';
llxFooter();
$dbosc->close();

View File

@ -1,89 +0,0 @@
<?php
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 Eric Seigne <erics@rycks.com>
* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* \file htdocs/boutique/notification/index.php
* \ingroup boutique
* \brief Page gestion notification OS Commerce
*/
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/boutique/osc_master.inc.php';
$langs->load("products");
llxHeader();
if ($sortfield == "") {
$sortfield="lower(c.customers_lastname)";
}
if ($sortorder == "") {
$sortorder="ASC";
}
if ($page == -1) { $page = 0 ; }
$limit = $conf->liste_limit;
$offset = $limit * $page ;
print_barre_liste("Liste des notifications", $page, "index.php");
$sql = "SELECT c.customers_id, c.customers_lastname, c.customers_firstname, p.products_name, p.products_id";
$sql .= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."products_notifications as n,".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."products_description as p";
$sql .= ",".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."customers as c";
$sql .= " WHERE n.customers_id = c.customers_id AND p.products_id=n.products_id";
$sql .= " AND p.language_id = ".$conf->global->OSC_LANGUAGE_ID;
$sql .= " ORDER BY $sortfield $sortorder ";
$sql .= $dbosc->plimit($limit,$offset);
$resql=$dbosc->query($sql);
if ($resql)
{
$num = $dbosc->num_rows($resql);
$i = 0;
print "<table class=\noborder\" width=\"100%\">";
print "<tr class=\"liste_titre\">";
print_liste_field_titre("Client",$_SERVER["PHP_SELF"], "c.customers_lastname");
print '<td>'.$langs->trans("Product").'</td>';
print "</tr>\n";
$var=True;
while ($i < $num)
{
$objp = $dbosc->fetch_object($resql);
$var=!$var;
print "<tr ".$bc[$var].">";
print "<td width='70%'><a href=\"card.php?id=$objp->rowid\">$objp->customers_firstname $objp->customers_lastname</a></TD>\n";
print '<td><a href="'.DOL_URL_ROOT.'/boutique/livre/card.php?oscid='.$objp->products_id.'">'.$objp->products_name."</a></td>";
print "</tr>\n";
$i++;
}
print "</table>";
$dbosc->free($resql);
}
else
{
dol_print_error($dbosc);
}
$dbosc->close();
llxFooter();

View File

@ -1,95 +0,0 @@
<?php
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 Eric Seigne <erics@rycks.com>
* Copyright (C) 2006 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* \file htdocs/boutique/notification/produits.php
* \ingroup boutique
* \brief Page fiche notification produits OS Commerce
*/
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/boutique/osc_master.inc.php';
/*
* View
*/
llxHeader();
if ($sortfield == "") {
$sortfield="lower(p.products_name)";
}
if ($sortorder == "") {
$sortorder="ASC";
}
if ($page == -1) { $page = 0 ; }
$limit = $conf->liste_limit;
$offset = $limit * $page ;
print_barre_liste("Liste des produits suivis", $page, "produits.php");
$sql = "SELECT p.products_name, p.products_id, count(p.products_id) as nb";
$sql .= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."products_notifications as n,".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."products_description as p";
$sql .= " WHERE p.products_id=n.products_id";
$sql .= " AND p.language_id = ".$conf->global->OSC_LANGUAGE_ID;
$sql .= " GROUP BY p.products_name, p.products_id";
$sql .= $dbosc->plimit($limit,$offset);
$resql=$dbosc->query($sql);
if ($resql)
{
$num = $dbosc->num_rows($resql);
$i = 0;
print "<p><TABLE border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"4\">";
print "<TR class=\"liste_titre\">";
print '<td>Produit</td><td align="center">Nb.</td>';
print "<td></td>";
print "<td></td>";
print "</TR>\n";
$var=True;
while ($i < $num)
{
$objp = $dbosc->fetch_object($resql);
$var=!$var;
print "<tr ".$bc[$var].">";
print '<td><a href="'.DOL_URL_ROOT.'/boutique/livre/card.php?oscid='.$objp->products_id.'">'.$objp->products_name."</a></td>";
print '<td align="center">'.$objp->nb.'</td>';
print '<td align="center"><a href="index.php?products_id='.$objp->products_id.'">Voir les clients</td>';
print '<td align="center"><a href="newsletter?products_id='.$objp->products_id.'">Envoyer une news</a></td>';
print "</TR>\n";
$i++;
}
print "</TABLE>";
$dbosc->free();
}
else
{
dol_print_error($dbosc);
}
$dbosc->close();
llxFooter();

View File

@ -1,38 +0,0 @@
<?php
/* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/boutique/osc_master.inc.php
* \brief File of preparation of the environment Dolibarr for OSCommerce
*/
/*
* Creation objet $dbosc
*/
$dbosc=getDoliDBInstance($conf->db->type,$conf->global->OSC_DB_HOST,$conf->global->OSC_DB_USER,$conf->global->OSC_DB_PASS,$conf->global->OSC_DB_NAME,$conf->global->OSC_DB_PORT);
if (! $dbosc->connected)
{
dol_syslog($dbosc,"host=".$conf->global->OSC_DB_HOST.", user=".$conf->global->OSC_DB_USER.", databasename=".$conf->global->OSC_DB_NAME.", ".$db->error,LOG_ERR);
llxHeader("",$langs->trans("OSCommerceShop"),"");
print '<div class="error">'.$langs->trans('FailedConnectDBCheckModuleSetup').'</div>';
llxFooter();
exit;
}

View File

@ -1,88 +0,0 @@
<?php
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* \file htdocs/boutique/produits/index.php
* \ingroup boutique
* \brief Page gestion produits du module OsCommerce
*/
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/boutique/osc_master.inc.php';
$langs->load("companies");
llxHeader();
if ($sortfield == "") {
$sortfield="lower(c.customers_lastname)";
}
if ($sortorder == "") {
$sortorder="ASC";
}
if ($page == -1) { $page = 0 ; }
$limit = $conf->liste_limit;
$offset = $limit * $page ;
print_barre_liste("Liste des clients", $page, $_SERVER["PHP_SELF"]);
$sql = "SELECT c.customers_id, c.customers_lastname, c.customers_firstname, c.customers_email_address, c.customers_newsletter";
$sql .= " FROM ".DB_NAME_OSC.".customers as c";
$sql .= " ORDER BY $sortfield $sortorder ";
$sql .= $dbosc->plimit($limit,$offset);
$resql=$dbosc->query($sql);
if ($resql)
{
$num = $dbosc->num_rows($resql);
$i = 0;
print "<table class=\"noborder\" width=\"100%\">";
print "<tr class=\"liste_titre\">";
print_liste_field_titre($langs->trans("Firstname"),$_SERVER["PHP_SELF"], "c.customers_firstname");
print_liste_field_titre($langs->trans("Lastname"),$_SERVER["PHP_SELF"], "c.customers_lastname");
print '<td>'.$langs->trans("EMail").'</td><td align="center">'.$langs->trans("Newsletter").'</td>';
print "</tr>\n";
$var=True;
while ($i < $num)
{
$objp = $dbosc->fetch_object($resql);
$var=!$var;
print "<tr ".$bc[$var].">";
print '<td><a href="card.php?id='.$objp->customers_id.'">'.$objp->customers_firstname."</a></td>\n";
print '<td><a href="card.php?id='.$objp->customers_id.'">'.$objp->customers_lastname."</a></td>\n";
print "<td>$objp->customers_email_address</td>\n";
print "<td align=\"center\">$objp->customers_newsletter</td>\n";
print "</tr>\n";
$i++;
}
print "</table>";
$dbosc->free($resql);
}
else
{
dol_print_error($dbosc);
}
$dbosc->close();
llxFooter();

View File

@ -1,106 +0,0 @@
<?php
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2006 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* \file htdocs/boutique/produits/osc-list.php
* \ingroup boutique
* \brief Page gestion produits du module OsCommerce
*/
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/boutique/osc_master.inc.php';
/*
* View
*/
llxHeader();
if ($sortfield == "") {
$sortfield="p.label,p.price";
}
if ($sortorder == "") {
$sortorder="ASC";
}
if ($page == -1) { $page = 0 ; }
$limit = $conf->liste_limit;
$offset = $limit * $page ;
print_barre_liste("Liste des produits oscommerce", $page, "osc-list.php");
$sql = "SELECT p.products_id, p.products_model, p.products_quantity, p.products_status, d.products_name, m.manufacturers_name, m.manufacturers_id";
$sql .= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."products as p, ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."products_description as d, ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."manufacturers as m";
$sql .= " WHERE p.products_id = d.products_id AND d.language_id =" . $conf->global->OSC_LANGUAGE_ID;
$sql .= " AND p.manufacturers_id=m.manufacturers_id";
if ($reqstock=='epuise')
{
$sql .= " AND p.products_quantity <= 0";
}
//$sql .= " ORDER BY $sortfield $sortorder ";
$sql .= $dbosc->plimit($limit,$offset);
print "<p><TABLE border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"4\">";
print '<tr class="liste_titre">';
print "<td>id</td>";
print "<td>Ref</td>";
print "<td>Titre</td>";
print "<td>Groupe</td>";
print '<td align="center">Stock</td>';
print '<td align="center">Status</td>';
print '</tr>'."\n";
$resql=$dbosc->query($sql);
if ($resql)
{
$num = $dbosc->num_rows($resql);
$i = 0;
$var=True;
while ($i < $num)
{
$objp = $dbosc->fetch_object($resql);
$var=!$var;
print "<tr ".$bc[$var].">";
print "<TD>$objp->products_id</TD>\n";
print "<TD>$objp->products_model</TD>\n";
print "<TD>$objp->products_name</TD>\n";
print "<TD>$objp->manufacturers_name</TD>\n";
print '<TD align="center">'.$objp->products_quantity."</TD>\n";
print '<TD align="center">'.$objp->products_status."</TD>\n";
print "</TR>\n";
$i++;
}
$dbosc->free();
}
else
{
dol_print_error($dbosc);
}
print "</TABLE>";
$dbosc->close();
llxFooter();

View File

@ -1,213 +0,0 @@
<?php
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* \file htdocs/boutique/promotion/class/promotion.class.php
* \brief File of class to manage discounts on online shop
*/
/**
* \class Promotion
* \brief Class to manage discounts on online shop
*/
class Promotion
{
var $db;
var $id;
var $parent_id;
var $oscid;
var $ref;
var $titre;
var $description;
var $price;
var $status;
/**
* Constructor
*
* @param DoliDB $db Database handler
*/
function __construct($db)
{
$this->db = $db;
}
/**
* Create promotion
*
* @param User $user Object user
* @param int $pid Pid
* @param int $percent Percent
* @return int <0 if KO, >0 if OK
*/
function create($user, $pid, $percent)
{
global $conf;
$sql = "SELECT products_price ";
$sql .= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."products as p";
$sql .= " WHERE p.products_id = ".$pid;
$result = $this->db->query($sql);
if ( $result )
{
$result = $this->db->fetch_array($result);
$this->price_init = $result["products_price"];
}
$newprice = $percent * $this->price_init;
$date_exp = "2003-05-01"; // TODO ????
$now=dol_now();
$sql = "INSERT INTO ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."specials ";
$sql .= " (products_id, specials_new_products_price, specials_date_added, specials_last_modified, expires_date, date_status_change, status) ";
$sql .= " VALUES ($pid, $newprice, '".$this->db->idate($now)."', NULL, '".$this->db->idate($now+3600*24*365)."', NULL, 1)";
if ($this->db->query($sql) )
{
$id = $this->db->last_insert_id(OSC_DB_NAME.".specials");
return $id;
}
else
{
print $this->db->error() . ' in ' . $sql;
}
}
/**
* Update
*
* @param int $id id
* @param User $user Object user
* @return int <0 if KO, >0 if OK
*/
function update($id, $user)
{
$sql = "UPDATE ".MAIN_DB_PREFIX."album ";
$sql .= " SET title = '" . trim($this->titre) ."'";
$sql .= ",description = '" . trim($this->description) ."'";
$sql .= " WHERE rowid = " . $id;
if ( $this->db->query($sql) ) {
return 1;
} else {
print $this->db->error() . ' in ' . $sql;
}
}
/**
* Set active
*
* @param int $id id
* @return int <0 if KO, >0 if OK
*/
function set_active($id)
{
global $conf;
$sql = "UPDATE ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."specials";
$sql .= " SET status = 1";
$sql .= " WHERE products_id = " . $id;
if ( $this->db->query($sql) ) {
return 1;
} else {
print $this->db->error() . ' in ' . $sql;
}
}
/**
* Set inactive
*
* @param int $id id
* @return int <0 if KO, >0 if OK
*/
function set_inactive($id)
{
global $conf;
$sql = "UPDATE ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."specials";
$sql .= " SET status = 0";
$sql .= " WHERE products_id = " . $id;
if ( $this->db->query($sql) ) {
return 1;
} else {
print $this->db->error() . ' in ' . $sql;
}
}
/**
* Fetch datas
*
* @param int $id id
* @return int <0 if KO, >0 if OK
*/
function fetch($id)
{
global $conf;
$sql = "SELECT c.categories_id, cd.categories_name, c.parent_id";
$sql .= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."categories as c,".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."categories_description as cd";
$sql .= " WHERE c.categories_id = cd.categories_id AND cd.language_id = ".$conf->global->OSC_LANGUAGE_ID;
$sql .= " AND c.categories_id = ".$id;
$result = $this->db->query($sql);
if ( $result ) {
$result = $this->db->fetch_array($result);
$this->id = $result["categories_id"];
$this->parent_id = $result["parent_id"];
$this->name = $result["categories_name"];
$this->titre = $result["title"];
$this->description = $result["description"];
$this->oscid = $result["osc_id"];
}
$this->db->free($result);
return $result;
}
/**
* Delete object
*
* @param User $user Object user
* @return int <0 if KO, >0 if OK
*/
function delete($user)
{
global $conf;
$sql = "DELETE FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."products WHERE products_id = $idosc ";
$sql = "DELETE FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."products_to_categories WHERE products_id = $idosc";
$sql = "DELETE FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."products_description WHERE products_id = $idosc";
}
}

View File

@ -1,119 +0,0 @@
<?php
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/boutique/promotion/index.php
* \ingroup boutique
* \brief Page gestion promotions OSCommerce
*/
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/boutique/osc_master.inc.php';
llxHeader();
if ($action == "inactive")
{
$promotion = new Promotion($dbosc);
$promotion->set_inactive($id);
}
if ($action == "active")
{
$promotion = new Promotion($dbosc);
$promotion->set_active($id);
}
if ($sortfield == "")
{
$sortfield="pd.products_name";
}
if ($sortorder == "")
{
$sortorder="ASC";
}
if ($page == -1) { $page = 0 ; }
$limit = $conf->liste_limit;
$offset = $limit * $page ;
print_barre_liste("Liste des promotions", $page, "index.php", "",$sortfield, $sortorder);
$urladd = "&sortorder=$sortorder&sortfield=$sortfield";
$sql = "SELECT pd.products_name, s.specials_new_products_price, p.products_price, p.products_model, s.status, p.products_id,";
$sql.= " expires_date as fin";
$sql.= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."specials as s,".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."products_description as pd,".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."products as p";
$sql.= " WHERE s.products_id = pd.products_id AND pd.products_id = p.products_id AND pd.language_id = ".$conf->global->OSC_LANGUAGE_ID;
$sql.= " ORDER BY $sortfield $sortorder ";
$sql.= $dbosc->plimit($limit,$offset);
$resql=$dbosc->query($sql);
if ($resql)
{
$num = $dbosc->num_rows($resql);
$i = 0;
print '<table class=\"noborder width="100%">';
print "<tr class=\"liste_titre\">";
print_liste_field_titre($langs->trans("Ref"),"index.php", "p.products_model");
print_liste_field_titre("Titre","index.php", "pd.products_name");
print "<td>&nbsp;</td><td>&nbsp;</td><td>Fin</td>";
print '<td align="right">Prix initial</td>';
print '<td align="right">Prix remise</td>';
print "</tr>\n";
$var=True;
while ($i < $num)
{
$objp = $dbosc->fetch_object($i);
$var=!$var;
print "<tr ".$bc[$var].">";
print '<td>'.$objp->products_model."</td>";
print '<td>'.$objp->products_name."</td>";
if ($objp->status == 1)
{
print '<td align="center"><img src="/theme/'.$conf->theme.'/img/icon_status_green.png" border="0" alt="actif"></td>';
print '<td align="center">';
print '<a href="index.php?action=inactive&id='.$objp->products_id.''.$urladd.'&page='.$page.'">';
print '<img src="/theme/'.$conf->theme.'/img/icon_status_red_light.png" border="0"></a></td>';
}
else
{
print '<td align="center">';
print '<a href="index.php?action=active&id='.$objp->products_id.''.$urladd.'&page='.$page.'">';
print '<img src="/theme/'.$conf->theme.'/img/icon_status_green_light.png" border="0"></a></td>';
print '<td align="center"><img src="/theme/'.$conf->theme.'/img/icon_status_red.png" border="0" alt="inactif"></td>';
}
print "<td>".dol_print_date($dbosc->jdate($objp->fin),'day')."</td>";
print '<td align="right">'.price($objp->products_price)."</td>";
print '<td align="right">'.price($objp->specials_new_products_price)."</td>";
print "</tr>";
$i++;
}
print "</TABLE>";
$dbosc->free();
}
else
{
dol_print_error($dbosc);
}
$dbosc->close();
llxFooter();

View File

@ -144,6 +144,10 @@ if ($action == 'add' && $user->rights->categorie->creer)
$action = 'confirmed'; $action = 'confirmed';
$_POST["addcat"] = ''; $_POST["addcat"] = '';
} }
else
{
setEventMessage($object->error,'errors');
}
} }
} }

View File

@ -621,8 +621,17 @@ function formCategory($db,$object,$typeid,$socid=0,$showclassifyform=1)
if ($typeid == 3) $title = $langs->trans("MembersCategoriesShort"); if ($typeid == 3) $title = $langs->trans("MembersCategoriesShort");
if ($typeid == 4) $title = $langs->trans("ContactCategoriesShort"); if ($typeid == 4) $title = $langs->trans("ContactCategoriesShort");
$linktocreate='';
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.=$langs->trans("CreateCat").' ';
$linktocreate.=img_picto($langs->trans("Create"),'filenew');
$linktocreate.="</a>";
}
print '<br>'; print '<br>';
print_fiche_titre($title,'',''); print_fiche_titre($title,$linktocreate,'');
// Form to add record into a category // Form to add record into a category
if ($showclassifyform) if ($showclassifyform)
@ -634,19 +643,10 @@ function formCategory($db,$object,$typeid,$socid=0,$showclassifyform=1)
print '<input type="hidden" name="id" value="'.$object->id.'">'; print '<input type="hidden" name="id" value="'.$object->id.'">';
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td width="40%">'; print '<tr class="liste_titre"><td width="40%">';
print $langs->trans("ClassifyInCategory").' &nbsp;'; print '<span class="hideonsmartphone">'.$langs->trans("ClassifyInCategory").' &nbsp;</span>';
print $form->select_all_categories($typeid,'auto'); print $form->select_all_categories($typeid,'auto');
print '</td><td>'; print '</td>';
print '<input type="submit" class="button" value="'.$langs->trans("Classify").'"></td>'; print '<td><input type="submit" class="button" value="'.$langs->trans("Classify").'"></td>';
if ($user->rights->categorie->creer)
{
print '<td align="right">';
print '<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).'">';
print $langs->trans("CreateCat").' ';
print img_picto($langs->trans("Create"),'filenew');
print "</a>";
print '</td>';
}
print '</tr>'; print '</tr>';
print '</table>'; print '</table>';
print '</form>'; print '</form>';
@ -679,10 +679,7 @@ function formCategory($db,$object,$typeid,$socid=0,$showclassifyform=1)
print "<tr ".$bc[$var].">"; print "<tr ".$bc[$var].">";
// Categorie // Categorie
print "<td>"; print "<td>".img_object('','category').' '.$way."</td>";
//$c->id=;
//print $c->getNomUrl(1);
print img_object('','category').' '.$way."</td>";
// Link to delete from category // Link to delete from category
print '<td align="right">'; print '<td align="right">';

View File

@ -171,7 +171,7 @@ $nbofentries=(count($data) - 1);
if ($nbofentries > 0) if ($nbofentries > 0)
{ {
print '<tr><td colspan="3">'; print '<tr '.$bc[0].'><td colspan="3">';
tree_recur($data,$data[0],0); tree_recur($data,$data[0],0);
print '</td></tr>'; print '</td></tr>';
} }

View File

@ -218,13 +218,7 @@ if ($action == 'add')
{ {
if ($i == 0) // First entry if ($i == 0) // First entry
{ {
$usertodo=new User($db); if ($value['id'] > 0) $object->userownerid=$value['id'];
if ($value['id'] > 0)
{
$usertodo->fetch($value['id']);
$object->userownerid = $usertodo->id;
}
$object->usertodo = $usertodo;
$object->transparency = (GETPOST("transparency")=='on'?1:0); $object->transparency = (GETPOST("transparency")=='on'?1:0);
} }
@ -236,13 +230,7 @@ if ($action == 'add')
if (! $error && ! empty($conf->global->AGENDA_ENABLE_DONEBY)) if (! $error && ! empty($conf->global->AGENDA_ENABLE_DONEBY))
{ {
$userdone=new User($db); if (GETPOST("doneby") > 0) $object->userdoneid = GETPOST("doneby","int");
if ($_POST["doneby"] > 0)
{
$userdone->fetch($_POST["doneby"]);
$object->userdoneid = $userdone->id;
}
$object->userdone = $userdone;
} }
$object->note = trim($_POST["note"]); $object->note = trim($_POST["note"]);
@ -263,7 +251,7 @@ if ($action == 'add')
if (! empty($conf->phenix->enabled) && GETPOST('add_phenix') == 'on') $object->use_phenix=1; if (! empty($conf->phenix->enabled) && GETPOST('add_phenix') == 'on') $object->use_phenix=1;
// Check parameters // Check parameters
if (empty($object->usertodo)) if (empty($object->userownerid))
{ {
$error++; $donotclearsession=1; $error++; $donotclearsession=1;
$action = 'create'; $action = 'create';
@ -299,19 +287,22 @@ if ($action == 'add')
{ {
unset($_SESSION['assignedtouser']); unset($_SESSION['assignedtouser']);
$moreparam='';
if ($user->id != $object->ownerid) $moreparam="usertodo=-1"; // We force to remove filter so created record is visible when going back to per user view.
$db->commit(); $db->commit();
if (! empty($backtopage)) if (! empty($backtopage))
{ {
dol_syslog("Back to ".$backtopage); dol_syslog("Back to ".$backtopage.($moreparam?(preg_match('/\?/',$backtopage)?'&'.$moreparam:'?'.$moreparam):''));
header("Location: ".$backtopage); header("Location: ".$backtopage.($moreparam?(preg_match('/\?/',$backtopage)?'&'.$moreparam:'?'.$moreparam):''));
} }
elseif($idaction) elseif($idaction)
{ {
header("Location: ".DOL_URL_ROOT.'/comm/action/card.php?id='.$idaction); header("Location: ".DOL_URL_ROOT.'/comm/action/card.php?id='.$idaction.($moreparam?'&'.$moreparam:''));
} }
else else
{ {
header("Location: ".DOL_URL_ROOT.'/comm/action/index.php'); header("Location: ".DOL_URL_ROOT.'/comm/action/index.php'.($moreparam?'?'.$moreparam:''));
} }
exit; exit;
} }
@ -389,8 +380,6 @@ if ($action == 'update')
// Users // Users
$listofuserid=array(); $listofuserid=array();
$assignedtouser=(! empty($object->userownerid) && $object->userownerid > 0 ? $object->userownerid : 0);
if ($assignedtouser) $listofuserid[$assignedtouser]=array('id'=>$assignedtouser, 'mandatory'=>0, 'transparency'=>($user->id == $assignedtouser ? $transparency : '')); // Owner first
if (! empty($_SESSION['assignedtouser'])) // Now concat assigned users if (! empty($_SESSION['assignedtouser'])) // Now concat assigned users
{ {
// Restore array with key with same value than param 'id' // Restore array with key with same value than param 'id'
@ -400,21 +389,23 @@ if ($action == 'update')
if ($val['id'] > 0 && $val['id'] != $assignedtouser) $listofuserid[$val['id']]=$val; if ($val['id'] > 0 && $val['id'] != $assignedtouser) $listofuserid[$val['id']]=$val;
} }
} }
else {
$assignedtouser=(! empty($object->userownerid) && $object->userownerid > 0 ? $object->userownerid : 0);
if ($assignedtouser) $listofuserid[$assignedtouser]=array('id'=>$assignedtouser, 'mandatory'=>0, 'transparency'=>($user->id == $assignedtouser ? $transparency : '')); // Owner first
}
$object->userassigned=array(); // Clear old content $object->userassigned=array(); $object->userownerid=0; // Clear old content
$i=0;
foreach($listofuserid as $key => $val) foreach($listofuserid as $key => $val)
{ {
if ($i == 0) $object->userownerid = $val['id'];
$object->userassigned[$val['id']]=array('id'=>$val['id'], 'mandatory'=>0, 'transparency'=>($user->id == $val['id'] ? $transparency : '')); $object->userassigned[$val['id']]=array('id'=>$val['id'], 'mandatory'=>0, 'transparency'=>($user->id == $val['id'] ? $transparency : ''));
$i++;
} }
if (! empty($conf->global->AGENDA_ENABLE_DONEBY)) if (! empty($conf->global->AGENDA_ENABLE_DONEBY))
{ {
$userdone=new User($db); if (GETPOST("doneby")) $object->userdoneid=GETPOST("doneby","int");
if ($_POST["doneby"])
{
$userdone->fetch($_POST["doneby"]);
}
$object->userdone = $userdone;
} }
// Check parameters // Check parameters
@ -428,7 +419,7 @@ if ($action == 'update')
{ {
$result=$cactioncomm->fetch(GETPOST('actioncode')); $result=$cactioncomm->fetch(GETPOST('actioncode'));
} }
if (empty($object->usertodo)) if (empty($object->userownerid))
{ {
$error++; $donotclearsession=1; $error++; $donotclearsession=1;
$action = 'edit'; $action = 'edit';
@ -812,9 +803,6 @@ if ($id > 0)
if ($object->authorid > 0) { $tmpuser=new User($db); $res=$tmpuser->fetch($object->authorid); $object->author=$tmpuser; } if ($object->authorid > 0) { $tmpuser=new User($db); $res=$tmpuser->fetch($object->authorid); $object->author=$tmpuser; }
if ($object->usermodid > 0) { $tmpuser=new User($db); $res=$tmpuser->fetch($object->usermodid); $object->usermod=$tmpuser; } if ($object->usermodid > 0) { $tmpuser=new User($db); $res=$tmpuser->fetch($object->usermodid); $object->usermod=$tmpuser; }
if ($object->userownerid > 0) { $tmpuser=new User($db); $res=$tmpuser->fetch($object->userownerid); $object->usertodo=$tmpuser; }
if ($object->userdoneid > 0) { $tmpuser=new User($db); $res=$tmpuser->fetch($object->userdoneid); $object->userdone=$tmpuser; }
/* /*
* Show tabs * Show tabs
@ -1088,7 +1076,7 @@ if ($id > 0)
$listofuserid=array(); $listofuserid=array();
if (empty($donotclearsession)) if (empty($donotclearsession))
{ {
if (is_object($object->usertodo)) $listofuserid[$object->userownerid]=array('id'=>$object->userownerid,'transparency'=>$object->transparency); // Owner first if ($object->userownerid > 0) $listofuserid[$object->userownerid]=array('id'=>$object->userownerid,'transparency'=>$object->transparency); // Owner first
if (! empty($object->userassigned)) // Now concat assigned users if (! empty($object->userassigned)) // Now concat assigned users
{ {
// Restore array with key with same value than param 'id' // Restore array with key with same value than param 'id'
@ -1115,7 +1103,12 @@ if ($id > 0)
if ($conf->global->AGENDA_ENABLE_DONEBY) if ($conf->global->AGENDA_ENABLE_DONEBY)
{ {
print '<tr><td class="nowrap">'.$langs->trans("ActionDoneBy").'</td><td colspan="3">'; print '<tr><td class="nowrap">'.$langs->trans("ActionDoneBy").'</td><td colspan="3">';
if ($object->userdoneid > 0) print $object->userdone->getNomUrl(1); if ($object->userdoneid > 0)
{
$tmpuser=new User($db);
$tmpuser->fetch($object->userdoneid);
print $tmpuser->getNomUrl(1);
}
print '</td></tr>'; print '</td></tr>';
} }

View File

@ -66,7 +66,7 @@ class ActionComm extends CommonObject
var $note; // Description var $note; // Description
var $userassigned = array(); // Array of user ids var $userassigned = array(); // Array of user ids
var $userownerid; // Id of user owner var $userownerid; // Id of user owner
var $userdoneid; // Id of user done var $userdoneid; // Id of user done
var $usertodo; // Object user of owner // deprecated var $usertodo; // Object user of owner // deprecated
var $userdone; // Object user that did action // deprecated var $userdone; // Object user that did action // deprecated
@ -99,10 +99,6 @@ class ActionComm extends CommonObject
$this->db = $db; $this->db = $db;
//$this->author = new stdClass();
//$this->usermod = new stdClass();
//$this->usertodo = new stdClass();
//$this->userdone = new stdClass();
$this->societe = new stdClass(); // deprecated $this->societe = new stdClass(); // deprecated
$this->contact = new stdClass(); // deprecated $this->contact = new stdClass(); // deprecated
} }
@ -142,8 +138,8 @@ class ActionComm extends CommonObject
if ($this->elementtype=='commande') $this->elementtype='order'; if ($this->elementtype=='commande') $this->elementtype='order';
if ($this->elementtype=='contrat') $this->elementtype='contract'; if ($this->elementtype=='contrat') $this->elementtype='contract';
$userownerid=isset($this->usertodo->id)?$this->usertodo->id:$this->userownerid; // For backward compatibility $userownerid=$this->userownerid;
$userdoneid=isset($this->userdone->id)?$this->userdone->id:$this->userdoneid; // For backward compatibility $userdoneid=$this->userdoneid;
if (! $this->type_id || ! $this->type_code) if (! $this->type_id || ! $this->type_code)
{ {
@ -361,15 +357,16 @@ class ActionComm extends CommonObject
$this->authorid = $obj->fk_user_author; $this->authorid = $obj->fk_user_author;
$this->usermodid = $obj->fk_user_mod; $this->usermodid = $obj->fk_user_mod;
if (!is_object($this->author)) $this->author = new stdClass(); // For avoid warning
$this->author->id = $obj->fk_user_author; // deprecated $this->author->id = $obj->fk_user_author; // deprecated
$this->author->firstname = $obj->firstname; // deprecated $this->author->firstname = $obj->firstname; // deprecated
$this->author->lastname = $obj->lastname; // deprecated $this->author->lastname = $obj->lastname; // deprecated
if (!is_object($this->usermod)) $this->usermod = new stdClass(); // For avoid warning
$this->usermod->id = $obj->fk_user_mod; // deprecated $this->usermod->id = $obj->fk_user_mod; // deprecated
$this->userownerid = $obj->fk_user_action; $this->userownerid = $obj->fk_user_action;
$this->userdoneid = $obj->fk_user_done; $this->userdoneid = $obj->fk_user_done;
$this->usertodo->id = $obj->fk_user_action; // deprecated
$this->userdone->id = $obj->fk_user_done; // deprecated
$this->priority = $obj->priority; $this->priority = $obj->priority;
$this->fulldayevent = $obj->fulldayevent; $this->fulldayevent = $obj->fulldayevent;
$this->location = $obj->location; $this->location = $obj->location;
@ -525,7 +522,7 @@ class ActionComm extends CommonObject
if ($this->fk_project < 0) $this->fk_project = 0; if ($this->fk_project < 0) $this->fk_project = 0;
// Check parameters // Check parameters
if ($this->percentage == 0 && $this->userdone->id > 0) if ($this->percentage == 0 && $this->userdoneid > 0)
{ {
$this->error="ErrorCantSaveADoneUserWithZeroPercentage"; $this->error="ErrorCantSaveADoneUserWithZeroPercentage";
return -1; return -1;
@ -533,8 +530,8 @@ class ActionComm extends CommonObject
$socid=($this->socid?$this->socid:((isset($this->societe->id) && $this->societe->id > 0) ? $this->societe->id : 0)); $socid=($this->socid?$this->socid:((isset($this->societe->id) && $this->societe->id > 0) ? $this->societe->id : 0));
$contactid=($this->contactid?$this->contactid:((isset($this->contact->id) && $this->contact->id > 0) ? $this->contact->id : 0)); $contactid=($this->contactid?$this->contactid:((isset($this->contact->id) && $this->contact->id > 0) ? $this->contact->id : 0));
$userownerid=($this->userownerid?$this->userownerid:((isset($this->usertodo->id) && $this->usertodo->id > 0) ? $this->usertodo->id : 0)); $userownerid=($this->userownerid?$this->userownerid:0);
$userdoneid=($this->userdoneid?$this->userdoneid:((isset($this->userdone->id) && $this->userdone->id > 0) ? $this->userdone->id : 0)); $userdoneid=($this->userdoneid?$this->userdoneid:0);
$this->db->begin(); $this->db->begin();
@ -546,9 +543,9 @@ class ActionComm extends CommonObject
$sql.= ", datep2 = ".(strval($this->datef)!='' ? "'".$this->db->idate($this->datef)."'" : 'null'); $sql.= ", datep2 = ".(strval($this->datef)!='' ? "'".$this->db->idate($this->datef)."'" : 'null');
$sql.= ", durationp = ".(isset($this->durationp) && $this->durationp >= 0 && $this->durationp != ''?"'".$this->durationp."'":"null"); // deprecated $sql.= ", durationp = ".(isset($this->durationp) && $this->durationp >= 0 && $this->durationp != ''?"'".$this->durationp."'":"null"); // deprecated
$sql.= ", note = ".($this->note ? "'".$this->db->escape($this->note)."'":"null"); $sql.= ", note = ".($this->note ? "'".$this->db->escape($this->note)."'":"null");
$sql.= ", fk_soc =". ($this->socid > 0 ? "'".$this->socid."'":"null");
$sql.= ", fk_project =". ($this->fk_project > 0 ? "'".$this->fk_project."'":"null"); $sql.= ", fk_project =". ($this->fk_project > 0 ? "'".$this->fk_project."'":"null");
$sql.= ", fk_contact =". ($contactid > 0 ? "'".$this->contactid."'":"null"); $sql.= ", fk_soc =". ($socid > 0 ? "'".$socid."'":"null");
$sql.= ", fk_contact =". ($contactid > 0 ? "'".$contactid."'":"null");
$sql.= ", priority = '".$this->priority."'"; $sql.= ", priority = '".$this->priority."'";
$sql.= ", fulldayevent = '".$this->fulldayevent."'"; $sql.= ", fulldayevent = '".$this->fulldayevent."'";
$sql.= ", location = ".($this->location ? "'".$this->db->escape($this->location)."'":"null"); $sql.= ", location = ".($this->location ? "'".$this->db->escape($this->location)."'":"null");
@ -856,8 +853,8 @@ class ActionComm extends CommonObject
} }
/** /**
* Renvoie nom clicable (avec eventuellement le picto) * Return URL of event
* Utilise $this->id, $this->code et $this->label * Use $this->id, $this->type_code, $this->label and $this->type_label
* *
* @param int $withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul * @param int $withpicto 0=Pas de picto, 1=Inclut le picto dans le lien, 2=Picto seul
* @param int $maxlength Nombre de caracteres max dans libelle * @param int $maxlength Nombre de caracteres max dans libelle
@ -868,39 +865,34 @@ class ActionComm extends CommonObject
*/ */
function getNomUrl($withpicto=0,$maxlength=0,$classname='',$option='',$overwritepicto='') function getNomUrl($withpicto=0,$maxlength=0,$classname='',$option='',$overwritepicto='')
{ {
global $langs; global $conf,$langs;
$result=''; $result='';
if ($option=='birthday') $lien = '<a '.($classname?'class="'.$classname.'" ':'').'href="'.DOL_URL_ROOT.'/contact/perso.php?id='.$this->id.'">'; if ($option=='birthday') $lien = '<a '.($classname?'class="'.$classname.'" ':'').'href="'.DOL_URL_ROOT.'/contact/perso.php?id='.$this->id.'">';
else $lien = '<a '.($classname?'class="'.$classname.'" ':'').'href="'.DOL_URL_ROOT.'/comm/action/card.php?id='.$this->id.'">'; else $lien = '<a '.($classname?'class="'.$classname.'" ':'').'href="'.DOL_URL_ROOT.'/comm/action/card.php?id='.$this->id.'">';
$lienfin='</a>'; $lienfin='</a>';
$label=$this->label; $label=$this->label;
if (empty($label)) $label=$this->libelle; // Fro backward compatibility if (empty($label)) $label=$this->libelle; // For backward compatibility
//print 'rrr'.$this->libelle; //print 'rrr'.$this->libelle.'-'.$withpicto;
if ($withpicto == 2) if ($withpicto == 2)
{ {
$libelle=$label; $libelle=$label;
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) $libelle=$langs->trans("Action".$this->type_code); if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) $libelle=$langs->transnoentities("Action".$this->type_code);
$libelleshort=''; $libelleshort='';
} }
else if (empty($this->libelle))
{
$libelle=$label;
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) $libelle=$langs->trans("Action".$this->type_code);
$libelleshort=dol_trunc($label, $maxlength);
}
else else
{ {
$libelle=$label; $libelle=(empty($this->libelle)?$label:$this->libelle.(($label && $label != $this->libelle)?' '.$label:''));
$libelleshort=dol_trunc($label,$maxlength); if (! empty($conf->global->AGENDA_USE_EVENT_TYPE) && empty($libelle)) $libelle=($langs->transnoentities("Action".$this->type_code) != "Action".$this->type_code)?$langs->transnoentities("Action".$this->type_code):$this->type_label;
$libelleshort=dol_trunc($libelle,$maxlength);
} }
if ($withpicto) if ($withpicto)
{ {
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) // Add code into ()
{ {
$libelle.=(($this->type_code && $libelle!=$langs->trans("Action".$this->type_code) && $langs->trans("Action".$this->type_code)!="Action".$this->type_code)?' ('.$langs->trans("Action".$this->type_code).')':''); $libelle.=(($this->type_code && $libelle!=$langs->transnoentities("Action".$this->type_code) && $langs->transnoentities("Action".$this->type_code)!="Action".$this->type_code)?' ('.$langs->transnoentities("Action".$this->type_code).')':'');
} }
$result.=$lien.img_object($langs->trans("ShowAction").': '.$libelle,($overwritepicto?$overwritepicto:'action')).$lienfin; $result.=$lien.img_object($langs->trans("ShowAction").': '.$libelle,($overwritepicto?$overwritepicto:'action')).$lienfin;
} }

View File

@ -100,8 +100,7 @@ if ($object->id > 0)
$author->fetch($object->author->id); $author->fetch($object->author->id);
$object->author=$author; $object->author=$author;
if ($object->contact->id > 0) $object->fetch_contact($object->contact->id); $object->fetch_contact();
if ($object->usertodo->id > 0) { $tmpuser=new User($db); $res=$tmpuser->fetch($object->usertodo->id); $object->usertodo=$tmpuser; }
$head=actions_prepare_head($object); $head=actions_prepare_head($object);
@ -195,7 +194,11 @@ if ($object->id > 0)
// Assigned to // Assigned to
print '<tr><td width="30%" class="nowrap">'.$langs->trans("ActionAffectedTo").'</td><td>'; print '<tr><td width="30%" class="nowrap">'.$langs->trans("ActionAffectedTo").'</td><td>';
if ($object->usertodo->id > 0) print $object->usertodo->getNomUrl(1); if ($object->userownerid > 0)
{
$tmpuser=new User($object->userownerid);
print $tmpuser->getNomUrl(1);
}
print '</td></tr>'; print '</td></tr>';
print '</table><br><br><table class="border" width="100%">'; print '</table><br><br><table class="border" width="100%">';

View File

@ -219,10 +219,10 @@ if (empty($action) || $action=='show_month')
$max_day_in_prev_month = date("t",dol_mktime(0,0,0,$prev_month,1,$prev_year)); // Nb of days in previous month $max_day_in_prev_month = date("t",dol_mktime(0,0,0,$prev_month,1,$prev_year)); // Nb of days in previous month
$max_day_in_month = date("t",dol_mktime(0,0,0,$month,1,$year)); // Nb of days in next month $max_day_in_month = date("t",dol_mktime(0,0,0,$month,1,$year)); // Nb of days in next month
// tmpday is a negative or null cursor to know how many days before the 1 to show on month view (if tmpday=0 we start on monday) // tmpday is a negative or null cursor to know how many days before the 1st to show on month view (if tmpday=0, 1st is monday)
$tmpday = -date("w",dol_mktime(0,0,0,$month,1,$year))+2; $tmpday = -date("w",dol_mktime(12,0,0,$month,1,$year,true))+2; // date('w') is 0 fo sunday
$tmpday+=((isset($conf->global->MAIN_START_WEEK)?$conf->global->MAIN_START_WEEK:1)-1); $tmpday+=((isset($conf->global->MAIN_START_WEEK)?$conf->global->MAIN_START_WEEK:1)-1);
if ($tmpday >= 1) $tmpday -= 7; if ($tmpday >= 1) $tmpday -= 7; // If tmpday is 0 we start with sunday, if -6, we start with monday of previous week.
// Define firstdaytoshow and lastdaytoshow (warning: lastdaytoshow is last second to show + 1) // Define firstdaytoshow and lastdaytoshow (warning: lastdaytoshow is last second to show + 1)
$firstdaytoshow=dol_mktime(0,0,0,$prev_month,$max_day_in_prev_month+$tmpday,$prev_year); $firstdaytoshow=dol_mktime(0,0,0,$prev_month,$max_day_in_prev_month+$tmpday,$prev_year);
$next_day=7 - ($max_day_in_month+1-$tmpday) % 7; $next_day=7 - ($max_day_in_month+1-$tmpday) % 7;
@ -414,7 +414,7 @@ $sql.= ' a.percent,';
$sql.= ' a.fk_user_author,a.fk_user_action,a.fk_user_done,'; $sql.= ' a.fk_user_author,a.fk_user_action,a.fk_user_done,';
$sql.= ' a.transparency, a.priority, a.fulldayevent, a.location,'; $sql.= ' a.transparency, a.priority, a.fulldayevent, a.location,';
$sql.= ' a.fk_soc, a.fk_contact,'; $sql.= ' a.fk_soc, a.fk_contact,';
$sql.= ' ca.code'; $sql.= ' ca.code as type_code, ca.libelle as type_label';
$sql.= ' FROM '.MAIN_DB_PREFIX.'c_actioncomm as ca, '.MAIN_DB_PREFIX."actioncomm as a"; $sql.= ' FROM '.MAIN_DB_PREFIX.'c_actioncomm as ca, '.MAIN_DB_PREFIX."actioncomm as a";
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc"; if (! $user->rights->societe->client->voir && ! $socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc";
if ($usergroup > 0) $sql.= ", ".MAIN_DB_PREFIX."usergroup_user as ugu"; if ($usergroup > 0) $sql.= ", ".MAIN_DB_PREFIX."usergroup_user as ugu";
@ -483,20 +483,25 @@ if ($resql)
{ {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
// Discard auto action if option is on
if (! empty($conf->global->AGENDA_ALWAYS_HIDE_AUTO) && $obj->type_code == 'AC_OTH_AUTO')
{
$i++;
continue;
}
// Create a new object action // Create a new object action
$event=new ActionComm($db); $event=new ActionComm($db);
$event->id=$obj->id; $event->id=$obj->id;
$event->datep=$db->jdate($obj->datep); // datep and datef are GMT date $event->datep=$db->jdate($obj->datep); // datep and datef are GMT date
$event->datef=$db->jdate($obj->datep2); $event->datef=$db->jdate($obj->datep2);
$event->type_code=$obj->code; $event->type_code=$obj->type_code;
$event->type_label=$obj->type_label;
$event->libelle=$obj->label; $event->libelle=$obj->label;
$event->percentage=$obj->percent; $event->percentage=$obj->percent;
//$event->author->id=$obj->fk_user_author; // user id of creator $event->authorid=$obj->fk_user_author; // user id of creator
$event->authorid=$obj->fk_user_author; // user id of creator
$event->userownerid=$obj->fk_user_action; // user id of owner $event->userownerid=$obj->fk_user_action; // user id of owner
$event->fetch_userassigned(); // This load $event->userassigned $event->fetch_userassigned(); // This load $event->userassigned
//$event->usertodo->id=$obj->fk_user_action; // user id of owner
//$event->userdone->id=$obj->fk_user_done; // deprecated
$event->priority=$obj->priority; $event->priority=$obj->priority;
$event->fulldayevent=$obj->fulldayevent; $event->fulldayevent=$obj->fulldayevent;
$event->location=$obj->location; $event->location=$obj->location;
@ -879,6 +884,7 @@ if (count($listofextcals))
$maxnbofchar=18; $maxnbofchar=18;
$cachethirdparties=array(); $cachethirdparties=array();
$cachecontacts=array(); $cachecontacts=array();
$cacheusers=array();
// Define theme_datacolor array // Define theme_datacolor array
$color_file = DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/graph-color.php"; $color_file = DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/graph-color.php";
@ -921,7 +927,7 @@ if (empty($action) || $action == 'show_month') // View by month
echo " <tr>\n"; echo " <tr>\n";
for ($iter_day = 0; $iter_day < 7; $iter_day++) for ($iter_day = 0; $iter_day < 7; $iter_day++)
{ {
/* Show days before the beginning of the current month (previous month) */ /* Show days before the beginning of the current month (previous month) */
if ($tmpday <= 0) if ($tmpday <= 0)
{ {
$style='cal_other_month cal_past'; $style='cal_other_month cal_past';
@ -934,21 +940,20 @@ if (empty($action) || $action == 'show_month') // View by month
elseif ($tmpday <= $max_day_in_month) elseif ($tmpday <= $max_day_in_month)
{ {
$curtime = dol_mktime(0, 0, 0, $month, $tmpday, $year); $curtime = dol_mktime(0, 0, 0, $month, $tmpday, $year);
$style='cal_current_month'; $style='cal_current_month';
if ($iter_day == 6) $style.=' cal_current_month_right'; if ($iter_day == 6) $style.=' cal_current_month_right';
$today=0; $today=0;
if ($todayarray['mday']==$tmpday && $todayarray['mon']==$month && $todayarray['year']==$year) $today=1; if ($todayarray['mday']==$tmpday && $todayarray['mon']==$month && $todayarray['year']==$year) $today=1;
if ($today) $style='cal_today'; if ($today) $style='cal_today';
if ($curtime < $todaytms) $style.=' cal_past'; if ($curtime < $todaytms) $style.=' cal_past';
//var_dump($todayarray['mday']."==".$tmpday." && ".$todayarray['mon']."==".$month." && ".$todayarray['year']."==".$year.' -> '.$style);
echo ' <td class="'.$style.' nowrap" width="14%" valign="top">'; echo ' <td class="'.$style.' nowrap" width="14%" valign="top">';
show_day_events($db, $tmpday, $month, $year, $month, $style, $eventarray, $maxprint, $maxnbofchar, $newparam); show_day_events($db, $tmpday, $month, $year, $month, $style, $eventarray, $maxprint, $maxnbofchar, $newparam);
echo " </td>\n"; echo " </td>\n";
} }
/* Show days after the current month (next month) */ /* Show days after the current month (next month) */
else else
{ {
$style='cal_other_month'; $style='cal_other_month';
if ($iter_day == 6) $style.=' cal_other_month_right'; if ($iter_day == 6) $style.=' cal_other_month_right';
echo ' <td class="'.$style.' nowrap" width="14%" valign="top">'; echo ' <td class="'.$style.' nowrap" width="14%" valign="top">';
@ -1032,7 +1037,7 @@ else // View by day
$today=0; $today=0;
$todayarray=dol_getdate($now,'fast'); $todayarray=dol_getdate($now,'fast');
if ($todayarray['mday']==$day && $todayarray['mon']==$month && $todayarray['year']==$year) $today=1; if ($todayarray['mday']==$day && $todayarray['mon']==$month && $todayarray['year']==$year) $today=1;
if ($today) $style='cal_today'; //if ($today) $style='cal_today';
$timestamp=dol_mktime(12,0,0,$month,$day,$year); $timestamp=dol_mktime(12,0,0,$month,$day,$year);
$arraytimestamp=dol_getdate($timestamp); $arraytimestamp=dol_getdate($timestamp);
@ -1078,7 +1083,7 @@ $db->close();
* @param int $year Year * @param int $year Year
* @param int $monthshown Current month shown in calendar view * @param int $monthshown Current month shown in calendar view
* @param string $style Style to use for this day * @param string $style Style to use for this day
* @param array $eventarray Array of events * @param array $eventarray Array of events
* @param int $maxprint Nb of actions to show each day on month view (0 means no limit) * @param int $maxprint Nb of actions to show each day on month view (0 means no limit)
* @param int $maxnbofchar Nb of characters to show for event line * @param int $maxnbofchar Nb of characters to show for event line
* @param string $newparam Parameters on current URL * @param string $newparam Parameters on current URL
@ -1091,7 +1096,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
global $user, $conf, $langs; global $user, $conf, $langs;
global $action, $filter, $filtera, $filtert, $filterd, $status, $actioncode; // Filters used into search form global $action, $filter, $filtera, $filtert, $filterd, $status, $actioncode; // Filters used into search form
global $theme_datacolor; global $theme_datacolor;
global $cachethirdparties, $cachecontacts, $colorindexused; global $cachethirdparties, $cachecontacts, $cacheusers, $colorindexused;
print '<div id="dayevent_'.sprintf("%04d",$year).sprintf("%02d",$month).sprintf("%02d",$day).'" class="dayevent">'."\n"; print '<div id="dayevent_'.sprintf("%04d",$year).sprintf("%02d",$month).sprintf("%02d",$day).'" class="dayevent">'."\n";
@ -1150,11 +1155,17 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
if (in_array($user->id, $keysofuserassigned)) if (in_array($user->id, $keysofuserassigned))
{ {
$nummytasks++; $cssclass='family_mytasks'; $nummytasks++; $cssclass='family_mytasks';
// TODO Set a color using user color
// Must defined rule to choose color of who to use. if (empty($cacheusers[$event->userownerid]))
// event->ownerid will still contains user id of owner {
// event->userassigned will be an array in future. $newuser=new User($db);
// $color=$user->color; $newuser->fetch($event->userownerid);
$cacheusers[$event->userownerid]=$newuser;
}
//var_dump($cacheusers[$event->userownerid]->color);
// We decide to choose color of owner of event (event->userownerid is user id of owner, event->userassigned contains all users assigned to event)
if (! empty($cacheusers[$event->userownerid]->color)) $color=$cacheusers[$event->userownerid]->color;
} }
else if ($event->type_code == 'ICALEVENT') else if ($event->type_code == 'ICALEVENT')
{ {
@ -1175,6 +1186,17 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
else else
{ {
$numother++; $cssclass='family_other'; $numother++; $cssclass='family_other';
if (empty($cacheusers[$event->userownerid]))
{
$newuser=new User($db);
$newuser->fetch($event->userownerid);
$cacheusers[$event->userownerid]=$newuser;
}
//var_dump($cacheusers[$event->userownerid]->color);
// We decide to choose color of owner of event (event->userownerid is user id of owner, event->userassigned contains all users assigned to event)
if (! empty($cacheusers[$event->userownerid]->color)) $color=$cacheusers[$event->userownerid]->color;
} }
if ($color == -1) // Color was not forced. Set color according to color index. if ($color == -1) // Color was not forced. Set color according to color index.
{ {
@ -1295,7 +1317,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
print "<br>\n"; print "<br>\n";
} }
else else
{ {
if ($showinfo) if ($showinfo)
{ {
print $langs->trans("EventOnFullDay")."<br>\n"; print $langs->trans("EventOnFullDay")."<br>\n";

View File

@ -44,6 +44,8 @@ $status=GETPOST("status",'alpha');
$type=GETPOST('type'); $type=GETPOST('type');
$actioncode=GETPOST("actioncode","alpha",3)?GETPOST("actioncode","alpha",3):(GETPOST("actioncode")=='0'?'0':(empty($conf->global->AGENDA_USE_EVENT_TYPE)?'AC_OTH':'')); $actioncode=GETPOST("actioncode","alpha",3)?GETPOST("actioncode","alpha",3):(GETPOST("actioncode")=='0'?'0':(empty($conf->global->AGENDA_USE_EVENT_TYPE)?'AC_OTH':''));
$dateselect=dol_mktime(0, 0, 0, GETPOST('dateselectmonth'), GETPOST('dateselectday'), GETPOST('dateselectyear')); $dateselect=dol_mktime(0, 0, 0, GETPOST('dateselectmonth'), GETPOST('dateselectday'), GETPOST('dateselectyear'));
$datestart=dol_mktime(0, 0, 0, GETPOST('datestartmonth'), GETPOST('datestartday'), GETPOST('datestartyear'));
$dateend=dol_mktime(0, 0, 0, GETPOST('dateendmonth'), GETPOST('dateendday'), GETPOST('dateendyear'));
if ($actioncode == '') $actioncode=(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE); if ($actioncode == '') $actioncode=(empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE)?'':$conf->global->AGENDA_DEFAULT_FILTER_TYPE);
if ($status == '' && ! isset($_GET['status']) && ! isset($_POST['status'])) $status=(empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS)?'':$conf->global->AGENDA_DEFAULT_FILTER_STATUS); if ($status == '' && ! isset($_GET['status']) && ! isset($_POST['status'])) $status=(empty($conf->global->AGENDA_DEFAULT_FILTER_STATUS)?'':$conf->global->AGENDA_DEFAULT_FILTER_STATUS);
@ -123,13 +125,19 @@ if (GETPOST("viewcal") || GETPOST("viewweek") || GETPOST("viewday"))
* View * View
*/ */
$form=new Form($db);
$nav='';
$nav.=' &nbsp; <form name="dateselect" action="'.$_SERVER["PHP_SELF"].'?action=show_peruser'.$param.'">';
$nav.=$form->select_date($dateselect, 'dateselect', 0, 0, 1, '', 1, 0, 1);
$nav.=' <input type="submit" name="submitdateselect" class="button" value="'.$langs->trans("Refresh").'">';
$nav.='</form>';
$now=dol_now(); $now=dol_now();
$help_url='EN:Module_Agenda_En|FR:Module_Agenda|ES:M&omodulodulo_Agenda'; $help_url='EN:Module_Agenda_En|FR:Module_Agenda|ES:M&omodulodulo_Agenda';
llxHeader('',$langs->trans("Agenda"),$help_url); llxHeader('',$langs->trans("Agenda"),$help_url);
$form=new Form($db);
// Define list of all external calendars // Define list of all external calendars
$listofextcals=array(); $listofextcals=array();
@ -148,7 +156,7 @@ if ($type) $param.="&type=".$type;
$sql = "SELECT s.nom as societe, s.rowid as socid, s.client,"; $sql = "SELECT s.nom as societe, s.rowid as socid, s.client,";
$sql.= " a.id, a.datep as dp, a.datep2 as dp2,"; $sql.= " a.id, a.datep as dp, a.datep2 as dp2,";
$sql.= " a.fk_contact, a.note, a.label, a.percent as percent,"; $sql.= " a.fk_contact, a.note, a.label, a.percent as percent,";
$sql.= " c.code as acode, c.libelle,"; $sql.= " c.code as type_code, c.libelle as type_label,";
$sql.= " ua.login as loginauthor, ua.rowid as useridauthor,"; $sql.= " ua.login as loginauthor, ua.rowid as useridauthor,";
$sql.= " ut.login as logintodo, ut.rowid as useridtodo,"; $sql.= " ut.login as logintodo, ut.rowid as useridtodo,";
//$sql.= " ud.login as logindone, ud.rowid as useriddone,"; //$sql.= " ud.login as logindone, ud.rowid as useriddone,";
@ -188,8 +196,9 @@ if ($filtera > 0 || $filtert > 0 || $filterd > 0 || $usergroup > 0)
if ($usergroup > 0) $sql.= ($filtera>0||$filtert>0||$filterd>0?" OR ":"")." ugu.fk_usergroup = ".$usergroup; if ($usergroup > 0) $sql.= ($filtera>0||$filtert>0||$filterd>0?" OR ":"")." ugu.fk_usergroup = ".$usergroup;
$sql.= ")"; $sql.= ")";
} }
//if ($dateselect > 0) $sql.= " AND a.datep BETWEEN '".$db->idate($dateselect)."' AND '".$db->idate($dateselect+3600*24-1).'"'; if ($dateselect > 0) $sql.= " AND a.datep2 >= '".$db->idate($dateselect)."' AND a.datep <= '".$db->idate($dateselect+3600*24-1)."'";
if ($dateselect > 0) $sql.= " AND a.datep BETWEEN '".$db->idate($dateselect)."' AND '".$db->idate($dateselect+3600*24-1)."'"; if ($datestart > 0) $sql.= " AND a.datep BETWEEN '".$db->idate($datestart)."' AND '".$db->idate($datestart+3600*24-1)."'";
if ($dateend > 0) $sql.= " AND a.datep2 BETWEEN '".$db->idate($dateend)."' AND '".$db->idate($dateend+3600*24-1)."'";
$sql.= $db->order($sortfield,$sortorder); $sql.= $db->order($sortfield,$sortorder);
$sql.= $db->plimit($limit + 1, $offset); $sql.= $db->plimit($limit + 1, $offset);
//print $sql; //print $sql;
@ -236,7 +245,7 @@ if ($resql)
} }
*/ */
print_barre_liste($newtitle, $page, $_SERVER["PHP_SELF"], $param,$sortfield,$sortorder,$link,$num,0,''); print_barre_liste($newtitle, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $link, $num, 0, '', 0, $nav);
//print '<br>'; //print '<br>';
print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'?'.$param.'">'."\n"; print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'?'.$param.'">'."\n";
@ -250,7 +259,7 @@ if ($resql)
print_liste_field_titre($langs->trans("DateEnd"),$_SERVER["PHP_SELF"],"a.datep2",$param,'','align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("DateEnd"),$_SERVER["PHP_SELF"],"a.datep2",$param,'','align="center"',$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);
print_liste_field_titre($langs->trans("Contact"),$_SERVER["PHP_SELF"],"a.fk_contact",$param,"","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Contact"),$_SERVER["PHP_SELF"],"a.fk_contact",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("ActionUserAsk"),$_SERVER["PHP_SELF"],"ua.login",$param,"","",$sortfield,$sortorder); //print_liste_field_titre($langs->trans("ActionUserAsk"),$_SERVER["PHP_SELF"],"ua.login",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("ActionsOwnedBy"),$_SERVER["PHP_SELF"],"ut.login",$param,"","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("ActionsOwnedBy"),$_SERVER["PHP_SELF"],"ut.login",$param,"","",$sortfield,$sortorder);
//print_liste_field_titre($langs->trans("DoneBy"),$_SERVER["PHP_SELF"],"ud.login",$param,"","",$sortfield,$sortorder); //print_liste_field_titre($langs->trans("DoneBy"),$_SERVER["PHP_SELF"],"ud.login",$param,"","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"a.percent",$param,"",'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"a.percent",$param,"",'align="right"',$sortfield,$sortorder);
@ -259,12 +268,14 @@ if ($resql)
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td class="liste_titre"></td>'; print '<td class="liste_titre"></td>';
print '<td class="liste_titre" align="center">'; print '<td class="liste_titre" align="center">';
print $form->select_date($dateselect, 'dateselect', 0, 0, 1, '', 1, 0, 1); print $form->select_date($datestart, 'datestart', 0, 0, 1, '', 1, 0, 1);
print '</td>';
print '<td class="liste_titre" align="center">';
print $form->select_date($dateend, 'dateend', 0, 0, 1, '', 1, 0, 1);
print '</td>'; print '</td>';
print '<td class="liste_titre"></td>'; print '<td class="liste_titre"></td>';
print '<td class="liste_titre"></td>'; print '<td class="liste_titre"></td>';
print '<td class="liste_titre"></td>'; //print '<td class="liste_titre"></td>';
print '<td class="liste_titre"></td>';
print '<td class="liste_titre"></td>'; print '<td class="liste_titre"></td>';
print '<td class="liste_titre" align="right"><input class="liste_titre" type="image" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">'; print '<td class="liste_titre" align="right"><input class="liste_titre" type="image" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
//print '&nbsp; '; //print '&nbsp; ';
@ -281,6 +292,13 @@ if ($resql)
{ {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
// Discard auto action if option is on
if (! empty($conf->global->AGENDA_ALWAYS_HIDE_AUTO) && $obj->type_code == 'AC_OTH_AUTO')
{
$i++;
continue;
}
$var=!$var; $var=!$var;
print "<tr ".$bc[$var].">"; print "<tr ".$bc[$var].">";
@ -288,7 +306,8 @@ if ($resql)
// Action (type) // Action (type)
print '<td>'; print '<td>';
$actionstatic->id=$obj->id; $actionstatic->id=$obj->id;
$actionstatic->type_code=$obj->acode; $actionstatic->type_code=$obj->type_code;
$actionstatic->type_label=$obj->type_label;
$actionstatic->libelle=$obj->label; $actionstatic->libelle=$obj->label;
print $actionstatic->getNomUrl(1,28); print $actionstatic->getNomUrl(1,28);
print '</td>'; print '</td>';
@ -337,6 +356,7 @@ if ($resql)
print '</td>'; print '</td>';
// User author // User author
/*
print '<td align="left">'; print '<td align="left">';
if ($obj->useridauthor) if ($obj->useridauthor)
{ {
@ -347,6 +367,7 @@ if ($resql)
} }
else print '&nbsp;'; else print '&nbsp;';
print '</td>'; print '</td>';
*/
// User to do // User to do
print '<td align="left">'; print '<td align="left">';

View File

@ -395,6 +395,13 @@ if ($resql)
{ {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql);
// Discard auto action if option is on
if (! empty($conf->global->AGENDA_ALWAYS_HIDE_AUTO) && $obj->code == 'AC_OTH_AUTO')
{
$i++;
continue;
}
// Create a new object action // Create a new object action
$event=new ActionComm($db); $event=new ActionComm($db);
$event->id=$obj->id; $event->id=$obj->id;
@ -409,7 +416,6 @@ if ($resql)
$event->authorid=$obj->fk_user_author; // user id of creator $event->authorid=$obj->fk_user_author; // user id of creator
$event->userownerid=$obj->fk_user_action; // user id of owner $event->userownerid=$obj->fk_user_action; // user id of owner
$event->fetch_userassigned(); // This load $event->userassigned $event->fetch_userassigned(); // This load $event->userassigned
//$event->userdone->id=$obj->fk_user_done; // deprecated
$event->priority=$obj->priority; $event->priority=$obj->priority;
$event->fulldayevent=$obj->fulldayevent; $event->fulldayevent=$obj->fulldayevent;
$event->location=$obj->location; $event->location=$obj->location;
@ -567,19 +573,50 @@ echo "</tr>\n";
$usernames = array(); //init $usernames = array(); //init
$usernamesid = array(); $usernamesid = array();
/* Use this to have list of users only if users have events */ /* Use this to have list of users only if users have events */
foreach ($eventarray as $daykey => $notused) if (! empty($conf->global->AGENDA_SHOWOWNERONLY_ONPERUSERVIEW))
{ {
// Get all assigned users for each event foreach ($eventarray as $daykey => $notused)
foreach ($eventarray[$daykey] as $index => $event) {
{ // Get all assigned users for each event
$event->fetch_userassigned(); foreach ($eventarray[$daykey] as $index => $event)
$listofuserid=$event->userassigned; {
foreach($listofuserid as $userid => $tmp) $event->fetch_userassigned();
{ $listofuserid=$event->userassigned;
if (! in_array($userid, $usernamesid)) $usernamesid[$userid] = $userid; foreach($listofuserid as $userid => $tmp)
} {
} if (! in_array($userid, $usernamesid)) $usernamesid[$userid] = $userid;
}
}
}
} }
/* Use this list to have for all users */
else
{
$sql = "SELECT u.rowid, u.lastname as lastname, u.firstname, u.statut, u.login, u.admin, u.entity";
$sql.= " FROM ".MAIN_DB_PREFIX."user as u";
if ($usergroup > 0) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ug ON u.rowid = ug.fk_user";
$sql.= " WHERE u.entity IN (".getEntity('user').")";
if ($usergroup > 0) $sql.= " AND ug.fk_usergroup = ".$usergroup;
if (GETPOST("usertodo","int",3) > 0) $sql.=" AND u.rowid = ".GETPOST("usertodo","int",3);
//print $sql;
$resql=$db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
$i = 0;
if ($num)
{
while ($i < $num)
{
$obj = $db->fetch_object($resql);
$usernamesid[$obj->rowid]=$obj->rowid;
$i++;
}
}
}
else dol_print_error($db);
}
//var_dump($usernamesid);
foreach($usernamesid as $id) foreach($usernamesid as $id)
{ {
$tmpuser=new User($db); $tmpuser=new User($db);
@ -609,11 +646,13 @@ else
// Load array of colors by type // Load array of colors by type
$colorsbytype=array(); $colorsbytype=array();
$sql="SELECT code, color FROM ".MAIN_DB_PREFIX."c_actioncomm"; $labelbytype=array();
$sql="SELECT code, color, libelle FROM ".MAIN_DB_PREFIX."c_actioncomm";
$resql=$db->query($sql); $resql=$db->query($sql);
while ($obj = $db->fetch_object($resql)) while ($obj = $db->fetch_object($resql))
{ {
$colorsbytype[$obj->code]=$obj->color; $colorsbytype[$obj->code]=$obj->color;
$labelbytype[$obj->code]=$obj->libelle;
} }
// Loop on each user to show calendar // Loop on each user to show calendar
@ -659,6 +698,32 @@ foreach ($usernames as $username)
echo "</table>\n"; echo "</table>\n";
if (! empty($conf->global->AGENDA_USE_EVENT_TYPE))
{
$langs->load("commercial");
print '<br>'.$langs->trans("Legend").': <br>';
foreach($colorsbytype as $code => $color)
{
if ($color)
{
print '<div style="float: left; padding: 2px; margin-right: 6px;"><div style="'.($color?'background: #'.$color.';':'').'width:16px; float: left; margin-right: 4px;">&nbsp;</div>';
print $langs->trans("Action".$code)!="Action".$code?$langs->trans("Action".$code):$labelbytype[$code];
//print $code;
print '</div>';
}
}
//$color=sprintf("%02x%02x%02x",$theme_datacolor[0][0],$theme_datacolor[0][1],$theme_datacolor[0][2]);
print '<div style="float: left; padding: 2px; margin-right: 6px;"><div class="peruser_busy" style="width:16px; float: left; margin-right: 4px;">&nbsp;</div>';
print $langs->trans("Other");
print '</div>';
/* TODO Show this if at least one cumulated event
print '<div style="float: left; padding: 2px; margin-right: 6px;"><div style="background: #222222; width:16px; float: left; margin-right: 4px;">&nbsp;</div>';
print $langs->trans("SeveralEvents");
print '</div>';
*/
}
// Add js code to manage click on a box // Add js code to manage click on a box
print '<script type="text/javascript" language="javascript"> print '<script type="text/javascript" language="javascript">
jQuery(document).ready(function() { jQuery(document).ready(function() {
@ -681,7 +746,7 @@ jQuery(document).ready(function() {
else if (ids.indexOf(",") > -1) /* There is several events */ else if (ids.indexOf(",") > -1) /* There is several events */
{ {
/* alert(\'several events\'); */ /* alert(\'several events\'); */
url = "'.DOL_URL_ROOT.'/comm/action/listactions.php?usertodo="+userid+"&dateselectyear="+year+"&dateselectmonth="+month+"&dateselectday="+dateselectday; url = "'.DOL_URL_ROOT.'/comm/action/listactions.php?usertodo="+userid+"&dateselectyear="+year+"&dateselectmonth="+month+"&dateselectday="+day;
window.location.href = url; window.location.href = url;
} }
else /* One event */ else /* One event */
@ -903,7 +968,8 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
//$title1.=count($cases1[$h]).' '.(count($cases1[$h])==1?$langs->trans("Event"):$langs->trans("Events")); //$title1.=count($cases1[$h]).' '.(count($cases1[$h])==1?$langs->trans("Event"):$langs->trans("Events"));
if (count($cases1[$h]) > 1) $title1.=count($cases1[$h]).' '.(count($cases1[$h])==1?$langs->trans("Event"):$langs->trans("Events")); if (count($cases1[$h]) > 1) $title1.=count($cases1[$h]).' '.(count($cases1[$h])==1?$langs->trans("Event"):$langs->trans("Events"));
$string1='&nbsp;'; $string1='&nbsp;';
$style1='peruser_notbusy'; if (empty($conf->global->AGENDA_NO_TRANSPARENT_ON_NOT_BUSY)) $style1='peruser_notbusy';
else $style1='peruser_busy';
foreach($cases1[$h] as $id => $ev) foreach($cases1[$h] as $id => $ev)
{ {
if ($ev['busy']) $style1='peruser_busy'; if ($ev['busy']) $style1='peruser_busy';
@ -914,7 +980,8 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
//$title2.=count($cases2[$h]).' '.(count($cases2[$h])==1?$langs->trans("Event"):$langs->trans("Events")); //$title2.=count($cases2[$h]).' '.(count($cases2[$h])==1?$langs->trans("Event"):$langs->trans("Events"));
if (count($cases2[$h]) > 1) $title2.=count($cases2[$h]).' '.(count($cases2[$h])==1?$langs->trans("Event"):$langs->trans("Events")); if (count($cases2[$h]) > 1) $title2.=count($cases2[$h]).' '.(count($cases2[$h])==1?$langs->trans("Event"):$langs->trans("Events"));
$string2='&nbsp;'; $string2='&nbsp;';
$style2='peruser_notbusy'; if (empty($conf->global->AGENDA_NO_TRANSPARENT_ON_NOT_BUSY)) $style2='peruser_notbusy';
else $style2='peruser_busy';
foreach($cases2[$h] as $id => $ev) foreach($cases2[$h] as $id => $ev)
{ {
if ($ev['busy']) $style2='peruser_busy'; if ($ev['busy']) $style2='peruser_busy';

View File

@ -770,12 +770,12 @@ else if ($action == 'addline' && $user->rights->propal->creer) {
// On defini prix unitaire // On defini prix unitaire
if (! empty($conf->global->PRODUIT_MULTIPRICES) && $object->thirdparty->price_level) if (! empty($conf->global->PRODUIT_MULTIPRICES) && $object->thirdparty->price_level)
{ {
$pu_ht = $prod->multiprices [$object->thirdparty->price_level]; $pu_ht = $prod->multiprices[$object->thirdparty->price_level];
$pu_ttc = $prod->multiprices_ttc [$object->thirdparty->price_level]; $pu_ttc = $prod->multiprices_ttc[$object->thirdparty->price_level];
$price_min = $prod->multiprices_min [$object->thirdparty->price_level]; $price_min = $prod->multiprices_min[$object->thirdparty->price_level];
$price_base_type = $prod->multiprices_base_type [$object->thirdparty->price_level]; $price_base_type = $prod->multiprices_base_type[$object->thirdparty->price_level];
$tva_tx=$prod->multiprices_tva_tx[$object->thirdparty->price_level]; if (isset($prod->multiprices_tva_tx[$object->thirdparty->price_level])) $tva_tx=$prod->multiprices_tva_tx[$object->thirdparty->price_level];
$tva_npr=$prod->multiprices_recuperableonly[$object->thirdparty->price_level]; if (isset($prod->multiprices_recuperableonly[$object->thirdparty->price_level])) $tva_npr=$prod->multiprices_recuperableonly[$object->thirdparty->price_level];
} }
elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
{ {
@ -1200,8 +1200,10 @@ else if ($action == 'down' && $user->rights->propal->creer) {
$action = 'edit_extras'; $action = 'edit_extras';
} }
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->propal->creer) { if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->propal->creer)
if ($action == 'addcontact') { {
if ($action == 'addcontact')
{
if ($object->id > 0) { if ($object->id > 0) {
$contactid = (GETPOST('userid') ? GETPOST('userid') : GETPOST('contactid')); $contactid = (GETPOST('userid') ? GETPOST('userid') : GETPOST('contactid'));
$result = $object->add_contact($contactid, $_POST ["type"], $_POST ["source"]); $result = $object->add_contact($contactid, $_POST ["type"], $_POST ["source"]);
@ -2006,62 +2008,9 @@ if ($action == 'create')
print '</tr>'; print '</tr>';
} }
// Other attributes (TODO Move this into an include) // Other attributes
$res = $object->fetch_optionals($object->id, $extralabels); $cols = 3;
$parameters = array('colspan' => ' colspan="3"'); include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified
// by
// hook
if (empty($reshook) && ! empty($extrafields->attribute_label))
{
foreach ($extrafields->attribute_label as $key => $label)
{
if ($action == 'edit_extras')
{
$value = (isset($_POST ["options_" . $key]) ? $_POST ["options_" . $key] : $object->array_options ["options_" . $key]);
}
else
{
$value = $object->array_options ["options_" . $key];
}
if ($extrafields->attribute_type [$key] == 'separate')
{
print $extrafields->showSeparator($key);
}
else
{
print '<tr><td';
if (! empty($extrafields->attribute_required [$key])) print ' class="fieldrequired"';
print '>' . $label . '</td><td colspan="5">';
// Convert date into timestamp format
if (in_array($extrafields->attribute_type [$key], array('date','datetime'))) {
$value = isset($_POST ["options_" . $key]) ? dol_mktime($_POST ["options_" . $key . "hour"], $_POST ["options_" . $key . "min"], 0, $_POST ["options_" . $key . "month"], $_POST ["options_" . $key . "day"], $_POST ["options_" . $key . "year"]) : $db->jdate($object->array_options ['options_' . $key]);
}
if ($action == 'edit_extras' && $user->rights->propal->creer && GETPOST('attribute') == $key)
{
print '<form enctype="multipart/form-data" action="' . $_SERVER["PHP_SELF"] . '" method="post" name="formsoc">';
print '<input type="hidden" name="action" value="update_extras">';
print '<input type="hidden" name="attribute" value="' . $key . '">';
print '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">';
print '<input type="hidden" name="id" value="' . $object->id . '">';
print $extrafields->showInputField($key, $value);
print '<input type="submit" class="button" value="' . $langs->trans('Modify') . '">';
print '</form>';
}
else
{
print $extrafields->showOutputField($key, $value);
if ($object->statut == 0 && $user->rights->propal->creer)
print '<a href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=edit_extras&attribute=' . $key . '">' . img_picto('', 'edit') . ' ' . $langs->trans('Modify') . '</a>';
}
print '</td></tr>' . "\n";
}
}
}
// Amount HT // Amount HT
print '<tr><td height="10" width="25%">' . $langs->trans('AmountHT') . '</td>'; print '<tr><td height="10" width="25%">' . $langs->trans('AmountHT') . '</td>';

View File

@ -186,7 +186,7 @@ if ($id > 0 || ! empty($ref))
// Si fichier png PDF d'1 page trouve // Si fichier png PDF d'1 page trouve
if (file_exists($fileimage)) if (file_exists($fileimage))
{ {
print '<img src="'.DOL_URL_ROOT . '/viewimage.php?modulepart=apercupropal&file='.urlencode($relativepathimage).'">'; print '<img style="background: #FFF" src="'.DOL_URL_ROOT . '/viewimage.php?modulepart=apercupropal&file='.urlencode($relativepathimage).'">';
} }
// Si fichier png PDF de plus d'1 page trouve // Si fichier png PDF de plus d'1 page trouve
elseif (file_exists($fileimagebis)) elseif (file_exists($fileimagebis))
@ -199,13 +199,12 @@ elseif (file_exists($fileimagebis))
if (file_exists($dir_output.$preview)) if (file_exists($dir_output.$preview))
{ {
print '<img src="'.DOL_URL_ROOT . '/viewimage.php?modulepart=apercupropal&file='.urlencode($preview).'"><p>'; print '<img style="background: #FFF" src="'.DOL_URL_ROOT . '/viewimage.php?modulepart=apercupropal&file='.urlencode($preview).'"><p>';
} }
} }
} }
print '</div>';
$db->close();
llxFooter(); llxFooter();
$db->close();

View File

@ -8,7 +8,7 @@
* Copyright (C) 2008 Raphael Bertrand <raphael.bertrand@resultic.fr> * Copyright (C) 2008 Raphael Bertrand <raphael.bertrand@resultic.fr>
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2010-2011 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2010-2011 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2012-214 Christophe Battarel <christophe.battarel@altairis.fr> * Copyright (C) 2012-2014 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* *
@ -802,7 +802,10 @@ class Propal extends CommonObject
$fk_parent_line, $fk_parent_line,
$this->lines[$i]->fk_fournprice, $this->lines[$i]->fk_fournprice,
$this->lines[$i]->pa_ht, $this->lines[$i]->pa_ht,
$this->lines[$i]->label $this->lines[$i]->label,
$this->lines[$i]->date_start,
$this->lines[$i]->date_end,
$this->lines[$i]->array_options
); );
if ($result < 0) if ($result < 0)
@ -932,6 +935,10 @@ class Propal extends CommonObject
$this->db->begin(); $this->db->begin();
// get extrafields so they will be clone
foreach($this->lines as $line)
$line->fetch_optionals($line->rowid);
// Load source object // Load source object
$objFrom = dol_clone($this); $objFrom = dol_clone($this);
@ -1070,7 +1077,7 @@ class Propal extends CommonObject
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_input_reason as dr ON p.fk_input_reason = dr.rowid'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_input_reason as dr ON p.fk_input_reason = dr.rowid';
$sql.= " WHERE p.fk_statut = c.id"; $sql.= " WHERE p.fk_statut = c.id";
$sql.= " AND p.entity = ".$conf->entity; $sql.= " AND p.entity = ".$conf->entity;
if ($ref) $sql.= " AND p.ref='".$this->db->escape($ref)."'"; if ($ref) $sql.= " AND p.ref='".$ref."'";
else $sql.= " AND p.rowid=".$rowid; else $sql.= " AND p.rowid=".$rowid;
dol_syslog(get_class($this)."::fetch", LOG_DEBUG); dol_syslog(get_class($this)."::fetch", LOG_DEBUG);

View File

@ -206,7 +206,7 @@ if ($id > 0 || ! empty($ref))
// Si fichier png PDF d'1 page trouve // Si fichier png PDF d'1 page trouve
if (file_exists($fileimage)) if (file_exists($fileimage))
{ {
print '<img src="'.DOL_URL_ROOT . '/viewimage.php?modulepart=apercucommande&file='.urlencode($relativepathimage).'">'; print '<img style="background: #FFF" src="'.DOL_URL_ROOT . '/viewimage.php?modulepart=apercucommande&file='.urlencode($relativepathimage).'">';
} }
// Si fichier png PDF de plus d'1 page trouve // Si fichier png PDF de plus d'1 page trouve
elseif (file_exists($fileimagebis)) elseif (file_exists($fileimagebis))
@ -219,13 +219,12 @@ elseif (file_exists($fileimagebis))
if (file_exists($dir_output.$preview)) if (file_exists($dir_output.$preview))
{ {
print '<img src="'.DOL_URL_ROOT . '/viewimage.php?modulepart=apercucommande&file='.urlencode($preview).'"><p>'; print '<img style="background: #FFF" src="'.DOL_URL_ROOT . '/viewimage.php?modulepart=apercucommande&file='.urlencode($preview).'"><p>';
} }
} }
} }
print '</div>';
$db->close();
llxFooter(); llxFooter();
$db->close();

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2003-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2014 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-2013 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2013 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr> * Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
@ -600,10 +600,12 @@ else if ($action == 'addline' && $user->rights->commande->creer) {
// multiprix // multiprix
if (! empty($conf->global->PRODUIT_MULTIPRICES) && ! empty($object->thirdparty->price_level)) if (! empty($conf->global->PRODUIT_MULTIPRICES) && ! empty($object->thirdparty->price_level))
{ {
$pu_ht = $prod->multiprices [$object->thirdparty->price_level]; $pu_ht = $prod->multiprices[$object->thirdparty->price_level];
$pu_ttc = $prod->multiprices_ttc [$object->thirdparty->price_level]; $pu_ttc = $prod->multiprices_ttc[$object->thirdparty->price_level];
$price_min = $prod->multiprices_min [$object->thirdparty->price_level]; $price_min = $prod->multiprices_min[$object->thirdparty->price_level];
$price_base_type = $prod->multiprices_base_type [$object->thirdparty->price_level]; $price_base_type = $prod->multiprices_base_type[$object->thirdparty->price_level];
if (isset($prod->multiprices_tva_tx[$object->client->price_level])) $tva_tx=$prod->multiprices_tva_tx[$object->client->price_level];
if (isset($prod->multiprices_recuperableonly[$object->client->price_level])) $tva_npr=$prod->multiprices_recuperableonly[$object->client->price_level];
$tva_tx=$prod->multiprices_tva_tx[$object->thirdparty->price_level]; $tva_tx=$prod->multiprices_tva_tx[$object->thirdparty->price_level];
$tva_npr=$prod->multiprices_recuperableonly[$object->thirdparty->price_level]; $tva_npr=$prod->multiprices_recuperableonly[$object->thirdparty->price_level];
} }
@ -616,14 +618,20 @@ else if ($action == 'addline' && $user->rights->commande->creer) {
$filter = array('t.fk_product' => $prod->id,'t.fk_soc' => $object->thirdparty->id); $filter = array('t.fk_product' => $prod->id,'t.fk_soc' => $object->thirdparty->id);
$result = $prodcustprice->fetch_all('', '', 0, 0, $filter); $result = $prodcustprice->fetch_all('', '', 0, 0, $filter);
if ($result) { if ($result >= 0)
if (count($prodcustprice->lines) > 0) { {
if (count($prodcustprice->lines) > 0)
{
$pu_ht = price($prodcustprice->lines [0]->price); $pu_ht = price($prodcustprice->lines [0]->price);
$pu_ttc = price($prodcustprice->lines [0]->price_ttc); $pu_ttc = price($prodcustprice->lines [0]->price_ttc);
$price_base_type = $prodcustprice->lines [0]->price_base_type; $price_base_type = $prodcustprice->lines [0]->price_base_type;
$prod->tva_tx = $prodcustprice->lines [0]->tva_tx; $prod->tva_tx = $prodcustprice->lines [0]->tva_tx;
} }
} }
else
{
setEventMessage($prodcustprice->error,'errors');
}
} }
// if price ht is forced (ie: calculated by margin rate and cost price) // if price ht is forced (ie: calculated by margin rate and cost price)
@ -1140,7 +1148,7 @@ else if ($action == 'update_extras') {
/* /*
* Add file in email form * Add file in email form
*/ */
if (GETPOST('addfile')) { if (GETPOST('addfile')) {
require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
@ -1154,7 +1162,7 @@ if (GETPOST('addfile')) {
/* /*
* Remove file in email form * Remove file in email form
*/ */
if (GETPOST('removedfile')) { if (GETPOST('removedfile')) {
require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
@ -1169,7 +1177,7 @@ if (GETPOST('removedfile')) {
/* /*
* Send mail * Send mail
*/ */
if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! GETPOST('cancel')) { if ($action == 'send' && ! GETPOST('addfile') && ! GETPOST('removedfile') && ! GETPOST('cancel')) {
$langs->load('mails'); $langs->load('mails');
@ -1875,9 +1883,9 @@ if ($action == 'create' && $user->rights->commande->creer) {
// Local taxes // Local taxes
if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0)
$nbrow ++; $nbrow++;
if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0 ) if ($mysoc->localtax2_assuj == "1" || $object->total_localtax2 != 0 )
$nbrow ++; $nbrow++;
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
@ -2122,60 +2130,9 @@ if ($action == 'create' && $user->rights->commande->creer) {
print '</tr>'; print '</tr>';
} }
// Other attributes (TODO Move this into an include) // Other attributes
$parameters = array('colspan' => ' colspan="3"'); $cols = 3;
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
if (empty($reshook) && ! empty($extrafields->attribute_label))
{
foreach ($extrafields->attribute_label as $key => $label)
{
if ($action == 'edit_extras')
{
$value = (isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]);
}
else
{
$value = $object->array_options["options_" . $key];
}
if ($extrafields->attribute_type[$key] == 'separate')
{
print $extrafields->showSeparator($key);
}
else
{
print '<tr><td';
if (! empty($extrafields->attribute_required [$key])) print ' class="fieldrequired"';
print '>' . $label . '</td><td colspan="5">';
// Convert date into timestamp format
if (in_array($extrafields->attribute_type [$key], array('date','datetime')))
{
$value = isset($_POST["options_" . $key]) ? dol_mktime($_POST["options_" . $key . "hour"], $_POST["options_" . $key . "min"], 0, $_POST["options_" . $key . "month"], $_POST["options_" . $key . "day"], $_POST["options_" . $key . "year"]) : $db->jdate($object->array_options ['options_' . $key]);
}
if ($action == 'edit_extras' && $user->rights->commande->creer && GETPOST('attribute') == $key)
{
print '<form enctype="multipart/form-data" action="' . $_SERVER["PHP_SELF"] . '" method="post" name="formsoc">';
print '<input type="hidden" name="action" value="update_extras">';
print '<input type="hidden" name="attribute" value="' . $key . '">';
print '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">';
print '<input type="hidden" name="id" value="' . $object->id . '">';
print $extrafields->showInputField($key, $value);
print '<input type="submit" class="button" value="' . $langs->trans('Modify') . '">';
print '</form>';
}
else
{
print $extrafields->showOutputField($key, $value);
if ($object->statut == 0 && $user->rights->commande->creer)
print '<a href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=edit_extras&attribute=' . $key . '">' . img_picto('', 'edit') . ' ' . $langs->trans('Modify') . '</a>';
}
print '</td></tr>' . "\n";
}
}
}
$rowspan = 4; $rowspan = 4;
if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0)
@ -2529,7 +2486,7 @@ if ($action == 'create' && $user->rights->commande->creer) {
if (is_array($contactarr) && count($contactarr) > 0) { if (is_array($contactarr) && count($contactarr) > 0) {
foreach ($contactarr as $contact) { foreach ($contactarr as $contact) {
if ($contact ['libelle'] == $langs->trans('TypeContact_commande_external_CUSTOMER')) { // TODO Use code and not label if ($contact['libelle'] == $langs->trans('TypeContact_commande_external_CUSTOMER')) { // TODO Use code and not label
$contactstatic = new Contact($db); $contactstatic = new Contact($db);
$contactstatic->fetch($contact ['id']); $contactstatic->fetch($contact ['id']);
$custcontact = $contactstatic->getFullName($langs, 1); $custcontact = $contactstatic->getFullName($langs, 1);
@ -2537,15 +2494,15 @@ if ($action == 'create' && $user->rights->commande->creer) {
} }
if (! empty($custcontact)) { if (! empty($custcontact)) {
$formmail->substit ['__CONTACTCIVNAME__'] = $custcontact; $formmail->substit['__CONTACTCIVNAME__'] = $custcontact;
} }
} }
// Tableau des parametres complementaires // Tableau des parametres complementaires
$formmail->param ['action'] = 'send'; $formmail->param['action'] = 'send';
$formmail->param ['models'] = 'order_send'; $formmail->param['models'] = 'order_send';
$formmail->param ['orderid'] = $object->id; $formmail->param['orderid'] = $object->id;
$formmail->param ['returnurl'] = $_SERVER["PHP_SELF"] . '?id=' . $object->id; $formmail->param['returnurl'] = $_SERVER["PHP_SELF"] . '?id=' . $object->id;
// Init list of files // Init list of files
if (GETPOST("mode") == 'init') { if (GETPOST("mode") == 'init') {

View File

@ -5,7 +5,7 @@
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr> * Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011 Jean Heimburger <jean@tiaris.info> * Copyright (C) 2011 Jean Heimburger <jean@tiaris.info>
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr> * Copyright (C) 2012-2014 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* *
@ -726,7 +726,8 @@ class Commande extends CommonOrder
$fk_parent_line, $fk_parent_line,
$this->lines[$i]->fk_fournprice, $this->lines[$i]->fk_fournprice,
$this->lines[$i]->pa_ht, $this->lines[$i]->pa_ht,
$this->lines[$i]->label $this->lines[$i]->label,
$this->lines[$i]->array_options
); );
if ($result < 0) if ($result < 0)
{ {
@ -863,6 +864,10 @@ class Commande extends CommonOrder
$this->db->begin(); $this->db->begin();
// get extrafields so they will be clone
foreach($this->lines as $line)
$line->fetch_optionals($line->rowid);
// Load source object // Load source object
$objFrom = dol_clone($this); $objFrom = dol_clone($this);
@ -893,6 +898,13 @@ class Commande extends CommonOrder
$this->date_validation = ''; $this->date_validation = '';
$this->ref_client = ''; $this->ref_client = '';
// Set ref
require_once DOL_DOCUMENT_ROOT ."/core/modules/commande/".$conf->global->COMMANDE_ADDON.'.php';
$obj = $conf->global->COMMANDE_ADDON;
$modCommande = new $obj;
$this->ref = $modCommande->getNextValue($objsoc,$this);
// Create clone // Create clone
$result=$this->create($user); $result=$this->create($user);
if ($result < 0) $error++; if ($result < 0) $error++;

View File

@ -146,7 +146,7 @@ if ($resql)
print '</td>'; print '</td>';
print "</tr>\n"; print "</tr>\n";
$var=True; $var=true;
while ($i < min($num,$conf->liste_limit)) while ($i < min($num,$conf->liste_limit))
{ {

View File

@ -187,7 +187,7 @@ if (! empty($conf->commande->enabled))
if ($num) if ($num)
{ {
$i = 0; $i = 0;
$var = True; $var = true;
while ($i < $num) while ($i < $num)
{ {
$var=!$var; $var=!$var;
@ -238,7 +238,7 @@ if ($resql)
if ($num) if ($num)
{ {
$i = 0; $i = 0;
$var = True; $var = true;
while ($i < $num) while ($i < $num)
{ {
$var=!$var; $var=!$var;
@ -308,7 +308,7 @@ if (! empty($conf->commande->enabled))
if ($num) if ($num)
{ {
$i = 0; $i = 0;
$var = True; $var = true;
while ($i < $num) while ($i < $num)
{ {
$var=!$var; $var=!$var;
@ -379,7 +379,7 @@ if (! empty($conf->commande->enabled))
if ($num) if ($num)
{ {
$i = 0; $i = 0;
$var = True; $var = true;
while ($i < $num) while ($i < $num)
{ {
$var=!$var; $var=!$var;

View File

@ -622,7 +622,7 @@ if (($action != 'create' && $action != 'add') || !$error)
print '</form>'; print '</form>';
print '<form name="orders2invoice" action="orderstoinvoice.php" method="GET">'; print '<form name="orders2invoice" action="orderstoinvoice.php" method="GET">';
$var=True; $var=true;
$generic_commande = new Commande($db); $generic_commande = new Commande($db);
while ($i < $num) while ($i < $num)

View File

@ -233,7 +233,11 @@ foreach ($accounts as $key=>$type)
$total[$acc->currency_code] += $solde; $total[$acc->currency_code] += $solde;
} }
} }
if (! $found) print '<tr '.$bc[$var].'><td colspan="6">'.$langs->trans("None").'</td></tr>'; if (! $found)
{
$var = !$var;
print '<tr '.$bc[$var].'><td colspan="6">'.$langs->trans("None").'</td></tr>';
}
// Total // Total
foreach ($total as $key=>$solde) foreach ($total as $key=>$solde)
{ {

View File

@ -112,7 +112,7 @@ if ($conf->salaries->enabled)
$total = 0 ; $total = 0 ;
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("PeriodEndDate"),$_SERVER["PHP_SELF"],"s.datev","",$param,'width="120"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("PeriodEndDate"),$_SERVER["PHP_SELF"],"s.datev","",$param,'width="140px"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"s.label","",$param,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"s.label","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("ExpectedToPay"),$_SERVER["PHP_SELF"],"s.amount","",$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("ExpectedToPay"),$_SERVER["PHP_SELF"],"s.amount","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("RefPayment"),$_SERVER["PHP_SELF"],"s.rowid","",$param,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("RefPayment"),$_SERVER["PHP_SELF"],"s.rowid","",$param,'',$sortfield,$sortorder);
@ -145,7 +145,7 @@ if ($conf->salaries->enabled)
$i++; $i++;
} }
print '<tr class="liste_total"><td align="right" colspan="2">'.$langs->trans("Total").'</td>'; print '<tr class="liste_total"><td colspan="2">'.$langs->trans("Total").'</td>';
print '<td align="right">'.price($total)."</td>"; print '<td align="right">'.price($total)."</td>";
print '<td align="center">&nbsp;</td>'; print '<td align="center">&nbsp;</td>';
print '<td align="center">&nbsp;</td>'; print '<td align="center">&nbsp;</td>';
@ -175,7 +175,7 @@ if ($conf->tax->enabled)
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("PeriodEndDate"),$_SERVER["PHP_SELF"],"cs.date_ech","",$param,'width="120"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("PeriodEndDate"),$_SERVER["PHP_SELF"],"cs.date_ech","",$param,'width="140px"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"c.libelle","",$param,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"c.libelle","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"cs.fk_type","",$param,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"cs.fk_type","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("ExpectedToPay"),$_SERVER["PHP_SELF"],"cs.amount","",$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("ExpectedToPay"),$_SERVER["PHP_SELF"],"cs.amount","",$param,'align="right"',$sortfield,$sortorder);
@ -305,7 +305,7 @@ if ($conf->tax->enabled)
$total = 0 ; $total = 0 ;
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("PeriodEndDate"),$_SERVER["PHP_SELF"],"pv.datev","",$param,'width="120"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("PeriodEndDate"),$_SERVER["PHP_SELF"],"pv.datev","",$param,'width="140px"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"pv.label","",$param,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"pv.label","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("ExpectedToPay"),$_SERVER["PHP_SELF"],"pv.amount","",$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("ExpectedToPay"),$_SERVER["PHP_SELF"],"pv.amount","",$param,'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("RefPayment"),$_SERVER["PHP_SELF"],"pv.rowid","",$param,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("RefPayment"),$_SERVER["PHP_SELF"],"pv.rowid","",$param,'',$sortfield,$sortorder);
@ -338,7 +338,7 @@ if ($conf->tax->enabled)
$i++; $i++;
} }
print '<tr class="liste_total"><td align="right" colspan="2">'.$langs->trans("Total").'</td>'; print '<tr class="liste_total"><td colspan="2">'.$langs->trans("Total").'</td>';
print '<td align="right">'.price($total)."</td>"; print '<td align="right">'.price($total)."</td>";
print '<td align="center">&nbsp;</td>'; print '<td align="center">&nbsp;</td>';
print '<td align="center">&nbsp;</td>'; print '<td align="center">&nbsp;</td>';

View File

@ -177,7 +177,7 @@ if ($resql)
print '</td>'; print '</td>';
print "</tr>\n"; print "</tr>\n";
$var=True; $var=true;
while ($i < min($num,$conf->liste_limit)) while ($i < min($num,$conf->liste_limit))
{ {

View File

@ -1201,8 +1201,8 @@ else if ($action == 'addline' && $user->rights->facture->creer)
$pu_ttc = $prod->multiprices_ttc[$object->thirdparty->price_level]; $pu_ttc = $prod->multiprices_ttc[$object->thirdparty->price_level];
$price_min = $prod->multiprices_min[$object->thirdparty->price_level]; $price_min = $prod->multiprices_min[$object->thirdparty->price_level];
$price_base_type = $prod->multiprices_base_type[$object->thirdparty->price_level]; $price_base_type = $prod->multiprices_base_type[$object->thirdparty->price_level];
//$tva_tx=$prod->multiprices_tva_tx[$object->thirdparty->price_level]; if (isset($prod->multiprices_tva_tx[$object->thirdparty->price_level])) $tva_tx=$prod->multiprices_tva_tx[$object->thirdparty->price_level];
//$tva_npr=$prod->multiprices_recuperableonly[$object->thirdparty->price_level]; if (isset($prod->multiprices_recuperableonly[$object->thirdparty->price_level])) $tva_npr=$prod->multiprices_recuperableonly[$object->thirdparty->price_level];
} }
elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
{ {
@ -1775,8 +1775,10 @@ else if ($action == 'print_file' and $user->rights->printipp->read) {
$action = ''; $action = '';
} }
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->facture->creer) { if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->facture->creer)
if ($action == 'addcontact') { {
if ($action == 'addcontact')
{
$result = $object->fetch($id); $result = $object->fetch($id);
if ($result > 0 && $id > 0) { if ($result > 0 && $id > 0) {
@ -3322,51 +3324,9 @@ if ($action == 'create')
print '</tr>'; print '</tr>';
} }
// Other attributes (TODO Move this into an include) // Other attributes
$res = $object->fetch_optionals($object->id, $extralabels); $cols = 5;
$parameters = array('colspan' => ' colspan="2"'); include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by
// hook
if (empty($reshook) && ! empty($extrafields->attribute_label)) {
foreach ($extrafields->attribute_label as $key => $label) {
if ($action == 'edit_extras') {
$value = (isset($_POST["options_" . $key]) ? $_POST["options_" . $key] : $object->array_options ["options_" . $key]);
} else {
$value = $object->array_options ["options_" . $key];
}
if ($extrafields->attribute_type [$key] == 'separate') {
print $extrafields->showSeparator($key);
} else {
print '<tr><td';
if (! empty($extrafields->attribute_required [$key]))
print ' class="fieldrequired"';
print '>' . $label . '</td><td colspan="5">';
// Convert date into timestamp format
if (in_array($extrafields->attribute_type [$key], array('date','datetime'))) {
$value = isset($_POST["options_" . $key]) ? dol_mktime($_POST["options_" . $key . "hour"], $_POST["options_" . $key . "min"], 0, $_POST["options_" . $key . "month"], $_POST["options_" . $key . "day"], $_POST["options_" . $key . "year"]) : $db->jdate($object->array_options ['options_' . $key]);
}
if ($action == 'edit_extras' && $user->rights->facture->creer && GETPOST('attribute') == $key) {
print '<form enctype="multipart/form-data" action="' . $_SERVER["PHP_SELF"] . '" method="post" name="formsoc">';
print '<input type="hidden" name="action" value="update_extras">';
print '<input type="hidden" name="attribute" value="' . $key . '">';
print '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">';
print '<input type="hidden" name="id" value="' . $object->id . '">';
print $extrafields->showInputField($key, $value);
print '<input type="submit" class="button" value="' . $langs->trans('Modify') . '">';
print '</form>';
} else {
print $extrafields->showOutputField($key, $value);
if ($object->statut == 0 && $user->rights->facture->creer)
print '<a href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=edit_extras&attribute=' . $key . '">' . img_picto('', 'edit') . ' ' . $langs->trans('Modify') . '</a>';
}
print '</td></tr>' . "\n";
}
}
}
print '</table><br>'; print '</table><br>';
@ -3619,21 +3579,24 @@ if ($action == 'create')
// Linked object block // Linked object block
$somethingshown = $object->showLinkedObjectBlock(); $somethingshown = $object->showLinkedObjectBlock();
if (empty($somethingshown) && ! empty($conf->commande->enabled)) $linktoelem='';
if (! empty($conf->commande->enabled))
{ {
print '<br><a href="#" id="linktoorder">' . $langs->trans('LinkedOrder') . '</a>'; $linktoelem.=($linktoelem?' &nbsp; ':'').'<a href="#" id="linktoorder">' . $langs->trans('LinkedOrder') . '</a>';
print ' print '
<script type="text/javascript" language="javascript"> <script type="text/javascript" language="javascript">
jQuery(document).ready(function() { jQuery(document).ready(function() {
jQuery("#linktoorder").click(function() { jQuery("#linktoorder").click(function() {
jQuery("#commande").toggle(); jQuery("#orderlist").toggle();
jQuery("#linktoorder").toggle();
}); });
}); });
</script> </script>
'; ';
print '<div id="commande" style="display:none">'; print '<div id="orderlist" style="display:none">';
$sql = "SELECT s.rowid as socid, s.nom as name, s.client, c.rowid, c.ref, c.ref_client, c.total_ht"; $sql = "SELECT s.rowid as socid, s.nom as name, s.client, c.rowid, c.ref, c.ref_client, c.total_ht";
$sql .= " FROM " . MAIN_DB_PREFIX . "societe as s"; $sql .= " FROM " . MAIN_DB_PREFIX . "societe as s";
@ -3641,11 +3604,12 @@ if ($action == 'create')
$sql .= ' WHERE c.fk_soc = s.rowid AND c.fk_soc = ' . $soc->id . ''; $sql .= ' WHERE c.fk_soc = s.rowid AND c.fk_soc = ' . $soc->id . '';
$resqlorderlist = $db->query($sql); $resqlorderlist = $db->query($sql);
if ($resqlorderlist) { if ($resqlorderlist)
{
$num = $db->num_rows($resqlorderlist); $num = $db->num_rows($resqlorderlist);
$i = 0; $i = 0;
print '<form action="" method="POST" name="LinkedOrder">'; print '<br><form action="" method="POST" name="LinkedOrder">';
print '<table class="noborder">'; print '<table class="noborder">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td class="nowrap"></td>'; print '<td class="nowrap"></td>';
@ -3654,7 +3618,8 @@ if ($action == 'create')
print '<td align="left">' . $langs->trans("AmountHTShort") . '</td>'; print '<td align="left">' . $langs->trans("AmountHTShort") . '</td>';
print '<td align="left">' . $langs->trans("Company") . '</td>'; print '<td align="left">' . $langs->trans("Company") . '</td>';
print '</tr>'; print '</tr>';
while ($i < $num) { while ($i < $num)
{
$objp = $db->fetch_object($resqlorderlist); $objp = $db->fetch_object($resqlorderlist);
if ($objp->socid == $soc->id) { if ($objp->socid == $soc->id) {
$var = ! $var; $var = ! $var;
@ -3672,7 +3637,7 @@ if ($action == 'create')
$i ++; $i ++;
} }
print '</table>'; print '</table>';
print '<br><center><input type="submit" class="button" value="' . $langs->trans('ToLink') . '"></center>'; print '<br><center><input type="submit" class="button" value="' . $langs->trans('ToLink') . '"> &nbsp; <input type="submit" class="button" name="cancel" value="' . $langs->trans('Cancel') . '"></center>';
print '</form>'; print '</form>';
$db->free($resqlorderlist); $db->free($resqlorderlist);
} else { } else {
@ -3682,6 +3647,9 @@ if ($action == 'create')
print '</div>'; print '</div>';
} }
// Show link to elements
if ($linktoelem) print '<br>'.$linktoelem;
// Link for paypal payment // Link for paypal payment
if (! empty($conf->paypal->enabled) && $object->statut != 0) { if (! empty($conf->paypal->enabled) && $object->statut != 0) {
include_once DOL_DOCUMENT_ROOT . '/paypal/lib/paypal.lib.php'; include_once DOL_DOCUMENT_ROOT . '/paypal/lib/paypal.lib.php';

View File

@ -398,7 +398,7 @@ if ($id > 0 || ! empty($ref))
// Si fichier png PDF d'1 page trouve // Si fichier png PDF d'1 page trouve
if (file_exists($fileimage)) if (file_exists($fileimage))
{ {
print '<img src="'.DOL_URL_ROOT . '/viewimage.php?modulepart=apercufacture&file='.urlencode($relativepathimage).'">'; print '<img style="background: #FFF" src="'.DOL_URL_ROOT . '/viewimage.php?modulepart=apercufacture&file='.urlencode($relativepathimage).'">';
} }
// Si fichier png PDF de plus d'1 page trouve // Si fichier png PDF de plus d'1 page trouve
elseif (file_exists($fileimagebis)) elseif (file_exists($fileimagebis))
@ -411,12 +411,12 @@ elseif (file_exists($fileimagebis))
if (file_exists($dir_output.$preview)) if (file_exists($dir_output.$preview))
{ {
print '<img src="'.DOL_URL_ROOT . '/viewimage.php?modulepart=apercufacture&file='.urlencode($preview).'"><p>'; print '<img style="background: #FFF" src="'.DOL_URL_ROOT . '/viewimage.php?modulepart=apercufacture&file='.urlencode($preview).'"><p>';
} }
} }
} }
$db->close();
llxFooter(); llxFooter();
$db->close();

View File

@ -8,7 +8,7 @@
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr> * Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be> * Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be>
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr> * Copyright (C) 2012-2014 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2012-2014 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2012-2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2013 Cedric Gross <c.gross@kreiz-it.fr> * Copyright (C) 2013 Cedric Gross <c.gross@kreiz-it.fr>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
@ -394,7 +394,7 @@ class Facture extends CommonInvoice
$this->lines[$i]->fk_fournprice, $this->lines[$i]->fk_fournprice,
$this->lines[$i]->pa_ht, $this->lines[$i]->pa_ht,
$this->lines[$i]->label, $this->lines[$i]->label,
'' $this->lines[$i]->array_options
); );
if ($result < 0) if ($result < 0)
{ {
@ -591,6 +591,10 @@ class Facture extends CommonInvoice
$this->db->begin(); $this->db->begin();
// get extrafields so they will be clone
foreach($this->lines as $line)
$line->fetch_optionals($line->rowid);
// Load source object // Load source object
$objFrom = dol_clone($this); $objFrom = dol_clone($this);

View File

@ -228,7 +228,7 @@ if ($action == 'create')
if (empty($conf->global->PRODUIT_MULTIPRICES)) print '<td align="right">'.$langs->trans("CurrentProductPrice").'</td>'; if (empty($conf->global->PRODUIT_MULTIPRICES)) print '<td align="right">'.$langs->trans("CurrentProductPrice").'</td>';
print "</tr>\n"; print "</tr>\n";
} }
$var=True; $var=true;
while ($i < $num) while ($i < $num)
{ {
$objp = $db->fetch_object($result); $objp = $db->fetch_object($result);
@ -447,7 +447,7 @@ else
$num = count($object->lines); $num = count($object->lines);
$i = 0; $i = 0;
$var=True; $var=true;
while ($i < $num) while ($i < $num)
{ {
$var=!$var; $var=!$var;
@ -572,7 +572,7 @@ else
if ($num > 0) if ($num > 0)
{ {
$var=True; $var=true;
while ($i < min($num,$limit)) while ($i < min($num,$limit))
{ {
$objp = $db->fetch_object($resql); $objp = $db->fetch_object($resql);

View File

@ -600,7 +600,7 @@ if ($resql)
if ($num > 0) if ($num > 0)
{ {
$var=True; $var=true;
$total_ht=0; $total_ht=0;
$total_tva=0; $total_tva=0;
$total_ttc=0; $total_ttc=0;

View File

@ -333,7 +333,7 @@ if ($resql)
if ($num > 0) if ($num > 0)
{ {
$var=True; $var=true;
$total_ht=0; $total_ht=0;
$total_tva=0; $total_tva=0;
$total_ttc=0; $total_ttc=0;

View File

@ -491,7 +491,7 @@ if ($object->id > 0)
print '<td align="center">'.$langs->trans("WithdrawalReceipt").'</td>'; print '<td align="center">'.$langs->trans("WithdrawalReceipt").'</td>';
print '<td align="center">'.$langs->trans("User").'</td><td>&nbsp;</td><td>&nbsp;</td>'; print '<td align="center">'.$langs->trans("User").'</td><td>&nbsp;</td><td>&nbsp;</td>';
print '</tr>'; print '</tr>';
$var=True; $var=true;
if ($result_sql) if ($result_sql)
{ {

View File

@ -494,7 +494,7 @@ if (! empty($conf->don->enabled) && $user->rights->societe->lire)
print '</tr>'; print '</tr>';
if ($num) if ($num)
{ {
$var = True; $var = true;
$total_ttc = $totalam = $total = 0; $total_ttc = $totalam = $total = 0;
$var=true; $var=true;
@ -908,7 +908,7 @@ if ($resql)
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("TasksToDo").'</td>'; print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("TasksToDo").'</td>';
print "</tr>\n"; print "</tr>\n";
$var = True; $var = true;
$i = 0; $i = 0;
while ($i < $db->num_rows($resql)) while ($i < $db->num_rows($resql))
{ {

View File

@ -509,7 +509,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
print '<td align="right">&nbsp;</td>'; print '<td align="right">&nbsp;</td>';
print "</tr>\n"; print "</tr>\n";
$var=True; $var=true;
$total=0; $total=0;
$totalrecu=0; $totalrecu=0;
$totalrecucreditnote=0; $totalrecucreditnote=0;
@ -687,7 +687,7 @@ if (! GETPOST('action'))
{ {
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
$i = 0; $i = 0;
$var=True; $var=true;
print_barre_liste($langs->trans('Payments'), $page, $_SERVER["PHP_SELF"],'',$sortfield,$sortorder,'',$num); print_barre_liste($langs->trans('Payments'), $page, $_SERVER["PHP_SELF"],'',$sortfield,$sortorder,'',$num);
print '<table class="noborder" width="100%">'; print '<table class="noborder" width="100%">';

View File

@ -253,7 +253,7 @@ if ($_GET["action"] == 'create')
print '<td align="center">'.$langs->trans("Amount").'</td>'; print '<td align="center">'.$langs->trans("Amount").'</td>';
print "</tr>\n"; print "</tr>\n";
$var=True; $var=true;
$total=0; $total=0;
$totalrecu=0; $totalrecu=0;

View File

@ -3,6 +3,7 @@
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2010-2014 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2010-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2014 Ferran Marcet <fmarcet@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
* 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
@ -1342,7 +1343,7 @@ class BonPrelevement extends CommonObject
fputs($this->file, ' </CstmrDrctDbtInitn>'.$CrLf); fputs($this->file, ' </CstmrDrctDbtInitn>'.$CrLf);
fputs($this->file, '</Document>'.$CrLf); fputs($this->file, '</Document>'.$CrLf);
$sql = "SELECT pl.amount"; /*$sql = "SELECT pl.amount";
$sql.= " FROM"; $sql.= " FROM";
$sql.= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,"; $sql.= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,";
$sql.= " ".MAIN_DB_PREFIX."facture as f,"; $sql.= " ".MAIN_DB_PREFIX."facture as f,";
@ -1368,7 +1369,7 @@ class BonPrelevement extends CommonObject
else else
{ {
$result = -2; $result = -2;
} }*/
} }

View File

@ -350,7 +350,7 @@ if ($id > 0)
* Payments * Payments
*/ */
$sql = "SELECT p.rowid, p.num_paiement, datep as dp, p.amount,"; $sql = "SELECT p.rowid, p.num_paiement, datep as dp, p.amount,";
$sql.= "c.libelle as paiement_type"; $sql.= "c.code as type_code,c.libelle as paiement_type";
$sql.= " FROM ".MAIN_DB_PREFIX."paiementcharge as p"; $sql.= " FROM ".MAIN_DB_PREFIX."paiementcharge as p";
$sql.= ", ".MAIN_DB_PREFIX."c_paiement as c "; $sql.= ", ".MAIN_DB_PREFIX."c_paiement as c ";
$sql.= ", ".MAIN_DB_PREFIX."chargesociales as cs"; $sql.= ", ".MAIN_DB_PREFIX."chargesociales as cs";
@ -383,8 +383,9 @@ if ($id > 0)
print "<tr ".$bc[$var]."><td>"; print "<tr ".$bc[$var]."><td>";
print '<a href="'.DOL_URL_ROOT.'/compta/payment_sc/card.php?id='.$objp->rowid.'">'.img_object($langs->trans("Payment"),"payment").' '.$objp->rowid.'</a></td>'; print '<a href="'.DOL_URL_ROOT.'/compta/payment_sc/card.php?id='.$objp->rowid.'">'.img_object($langs->trans("Payment"),"payment").' '.$objp->rowid.'</a></td>';
print '<td>'.dol_print_date($db->jdate($objp->dp),'day')."</td>\n"; print '<td>'.dol_print_date($db->jdate($objp->dp),'day')."</td>\n";
print "<td>".$objp->paiement_type.' '.$objp->num_paiement."</td>\n"; $labeltype=$langs->trans("PaymentType".$objp->type_code)!=("PaymentType".$objp->type_code)?$langs->trans("PaymentType".$objp->type_code):$objp->paiement_type;
print '<td align="right">'.price($objp->amount)."</td><td>&nbsp;".$langs->trans("Currency".$conf->currency)."</td>\n"; print "<td>".$labeltype.' '.$objp->num_paiement."</td>\n";
print '<td align="right">'.price($objp->amount)."</td><td>&nbsp;".$langs->trans("Currency".$conf->currency)."</td>\n";
print "</tr>"; print "</tr>";
$totalpaye += $objp->amount; $totalpaye += $objp->amount;
$i++; $i++;

View File

@ -241,13 +241,20 @@ if (empty($reshook))
$result = $object->delete(); $result = $object->delete();
if ($result > 0) if ($result > 0)
{ {
header("Location: ".DOL_URL_ROOT.'/contact/list.php'); if ($backtopage)
exit; {
header("Location: ".$backtopage);
exit;
}
else
{
header("Location: ".DOL_URL_ROOT.'/contact/list.php');
exit;
}
} }
else else
{ {
setEventMessage($object->error,'errors'); setEventMessage($object->error,$object->errors,'errors');
setEventMessage($object->errors,'errors');
} }
} }
@ -360,7 +367,7 @@ else
{ {
if ($action == 'delete') if ($action == 'delete')
{ {
print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$id,$langs->trans("DeleteContact"),$langs->trans("ConfirmDeleteContact"),"confirm_delete",'',0,1); print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$id.($backtopage?'&backtopage='.$backtopage:''),$langs->trans("DeleteContact"),$langs->trans("ConfirmDeleteContact"),"confirm_delete",'',0,1);
} }
} }
@ -1082,27 +1089,27 @@ else
{ {
if ($user->rights->societe->contact->creer) if ($user->rights->societe->contact->creer)
{ {
print '<a class="butAction" href="card.php?id='.$object->id.'&amp;action=edit">'.$langs->trans('Modify').'</a>'; print '<a class="butAction" href="card.php?id='.$object->id.'&action=edit">'.$langs->trans('Modify').'</a>';
} }
if (! $object->user_id && $user->rights->user->user->creer) if (! $object->user_id && $user->rights->user->user->creer)
{ {
print '<a class="butAction" href="card.php?id='.$object->id.'&amp;action=create_user">'.$langs->trans("CreateDolibarrLogin").'</a>'; print '<a class="butAction" href="card.php?id='.$object->id.'&action=create_user">'.$langs->trans("CreateDolibarrLogin").'</a>';
} }
if ($user->rights->societe->contact->supprimer) if ($user->rights->societe->contact->supprimer)
{ {
print '<a class="butActionDelete" href="card.php?id='.$object->id.'&amp;action=delete">'.$langs->trans('Delete').'</a>'; print '<a class="butActionDelete" href="card.php?id='.$object->id.'&action=delete'.($backtopage?'&backtopage='.urlencode($backtopage):'').'">'.$langs->trans('Delete').'</a>';
} }
// Activer // Activer
if ($object->statut == 0 && $user->rights->societe->contact->creer) if ($object->statut == 0 && $user->rights->societe->contact->creer)
{ {
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;action=enable">'.$langs->trans("Reactivate").'</a>'; print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=enable">'.$langs->trans("Reactivate").'</a>';
} }
// Desactiver // Desactiver
if ($object->statut == 1 && $user->rights->societe->contact->creer) if ($object->statut == 1 && $user->rights->societe->contact->creer)
{ {
print '<a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?action=disable&amp;id='.$object->id.'">'.$langs->trans("DisableUser").'</a>'; print '<a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?action=disable&id='.$object->id.'">'.$langs->trans("DisableUser").'</a>';
} }
} }

View File

@ -877,20 +877,21 @@ class Contact extends CommonObject
* @param int $withpicto Include picto with link * @param int $withpicto Include picto with link
* @param string $option Where the link point to * @param string $option Where the link point to
* @param int $maxlen Max length of * @param int $maxlen Max length of
* @param string $moreparam Add more param into URL
* @return string String with URL * @return string String with URL
*/ */
function getNomUrl($withpicto=0,$option='',$maxlen=0) function getNomUrl($withpicto=0,$option='',$maxlen=0,$moreparam='')
{ {
global $langs; global $langs;
$result=''; $result='';
$lien = '<a href="'.DOL_URL_ROOT.'/contact/card.php?id='.$this->id.'">'; $lien = '<a href="'.DOL_URL_ROOT.'/contact/card.php?id='.$this->id.$moreparam.'">';
$lienfin='</a>'; $lienfin='</a>';
if ($option == 'xxx') if ($option == 'xxx')
{ {
$lien = '<a href="'.DOL_URL_ROOT.'/contact/card.php?id='.$this->id.'">'; $lien = '<a href="'.DOL_URL_ROOT.'/contact/card.php?id='.$this->id.$moreparam.'">';
$lienfin='</a>'; $lienfin='</a>';
} }

View File

@ -1189,52 +1189,8 @@ else
} }
// Other attributes // Other attributes
$parameters=array('colspan' => ' colspan="3"'); $cols = 3;
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
$res = $object->fetch_optionals($object->id, $extralabels);
if (empty($reshook) && ! empty($extrafields->attribute_label)) {
foreach ($extrafields->attribute_label as $key => $label) {
if ($action == 'edit_extras') {
$value = (isset($_POST ["options_" . $key]) ? $_POST ["options_" . $key] : $object->array_options ["options_" . $key]);
} else {
$value = $object->array_options ["options_" . $key];
}
if ($extrafields->attribute_type [$key] == 'separate') {
print $extrafields->showSeparator($key);
} else {
print '<tr><td';
if (! empty($extrafields->attribute_required [$key]))
print ' class="fieldrequired"';
print '>' . $label . '</td><td colspan="5">';
// Convert date into timestamp format
if (in_array($extrafields->attribute_type [$key], array('date','datetime'))) {
$value = isset($_POST ["options_" . $key]) ? dol_mktime($_POST ["options_" . $key . "hour"], $_POST ["options_" . $key . "min"], 0, $_POST ["options_" . $key . "month"], $_POST ["options_" . $key . "day"], $_POST ["options_" . $key . "year"]) : $db->jdate($object->array_options ['options_' . $key]);
}
if ($action == 'edit_extras' && $user->rights->commande->creer && GETPOST('attribute') == $key) {
print '<form enctype="multipart/form-data" action="' . $_SERVER["PHP_SELF"] . '" method="post" name="formcontract">';
print '<input type="hidden" name="action" value="update_extras">';
print '<input type="hidden" name="attribute" value="' . $key . '">';
print '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">';
print '<input type="hidden" name="id" value="' . $object->id . '">';
print $extrafields->showInputField($key, $value);
print '<input type="submit" class="button" value="' . $langs->trans('Modify') . '">';
print '</form>';
} else {
print $extrafields->showOutputField($key, $value);
if ($object->statut == 0 && $user->rights->commande->creer)
print '<a href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=edit_extras&attribute=' . $key . '">' . img_picto('', 'edit') . ' ' . $langs->trans('Modify') . '</a>';
}
print '</td></tr>' . "\n";
}
}
}
print "</table>"; print "</table>";

View File

@ -28,7 +28,7 @@ $extrasize=GETPOST('size');
if (GETPOST('type')=='double' && strpos($extrasize,',')===false) $extrasize='24,8'; if (GETPOST('type')=='double' && strpos($extrasize,',')===false) $extrasize='24,8';
if (GETPOST('type')=='date') $extrasize=''; if (GETPOST('type')=='date') $extrasize='';
if (GETPOST('type')=='datetime') $extrasize=''; if (GETPOST('type')=='datetime') $extrasize='';
if (GETPOST('type')=='select') $extrasize=''; if (GETPOST('type')=='select') $extrasize='';
// Add attribute // Add attribute
@ -87,7 +87,7 @@ if ($action == 'add')
$mesg[]=$langs->trans("ErrorNoValueForRadioType"); $mesg[]=$langs->trans("ErrorNoValueForRadioType");
$action = 'create'; $action = 'create';
} }
if (((GETPOST('type')=='radio') || (GETPOST('type')=='checkbox')) && GETPOST('param')) if (((GETPOST('type')=='radio') || (GETPOST('type')=='checkbox')) && GETPOST('param'))
{ {
// Construct array for parameter (value of select list) // Construct array for parameter (value of select list)
$parameters = GETPOST('param'); $parameters = GETPOST('param');
@ -95,7 +95,7 @@ if ($action == 'add')
foreach($parameters_array as $param_ligne) foreach($parameters_array as $param_ligne)
{ {
if (!empty($param_ligne)) { if (!empty($param_ligne)) {
if (preg_match_all('/,/',$param_ligne,$matches)) if (preg_match_all('/,/',$param_ligne,$matches))
{ {
if (count($matches[0])>1) { if (count($matches[0])>1) {
$error++; $error++;
@ -104,7 +104,7 @@ if ($action == 'add')
$action = 'create'; $action = 'create';
} }
} }
else else
{ {
$error++; $error++;
$langs->load("errors"); $langs->load("errors");
@ -112,12 +112,12 @@ if ($action == 'add')
$action = 'create'; $action = 'create';
} }
} }
} }
} }
if (! $error) if (! $error)
{ {
// attrname must be alphabetical and lower case only // attrname must be alphabetical and lower case only
if (isset($_POST["attrname"]) && preg_match("/^[a-z0-9-_]+$/",$_POST['attrname'])) if (isset($_POST["attrname"]) && preg_match("/^[a-z0-9-_]+$/",$_POST['attrname']))
{ {
// Construct array for parameter (value of select list) // Construct array for parameter (value of select list)
@ -139,9 +139,9 @@ if ($action == 'add')
list($key,$value) = explode(',',$param_ligne); list($key,$value) = explode(',',$param_ligne);
$params['options'][$key] = $value; $params['options'][$key] = $value;
} }
} }
$result=$extrafields->addExtraField($_POST['attrname'],$_POST['label'],$_POST['type'],$_POST['pos'],$extrasize,$elementtype,(GETPOST('unique')?1:0),(GETPOST('required')?1:0),$default_value,$params); $result=$extrafields->addExtraField($_POST['attrname'],$_POST['label'],$_POST['type'],$_POST['pos'],$extrasize,$elementtype,(GETPOST('unique')?1:0),(GETPOST('required')?1:0),$default_value,$params,(GETPOST('alwayseditable')?1:0));
if ($result > 0) if ($result > 0)
{ {
setEventMessage($langs->trans('SetupSaved')); setEventMessage($langs->trans('SetupSaved'));
@ -164,7 +164,7 @@ if ($action == 'add')
$action = 'create'; $action = 'create';
} }
} }
else else
{ {
setEventMessage($mesg,'errors'); setEventMessage($mesg,'errors');
} }
@ -278,7 +278,7 @@ if ($action == 'update')
$params['options'][$key] = $value; $params['options'][$key] = $value;
} }
} }
$result=$extrafields->update($_POST['attrname'],$_POST['label'],$_POST['type'],$extrasize,$elementtype,(GETPOST('unique')?1:0),(GETPOST('required')?1:0),$pos,$params); $result=$extrafields->update($_POST['attrname'],$_POST['label'],$_POST['type'],$extrasize,$elementtype,(GETPOST('unique')?1:0),(GETPOST('required')?1:0),$pos,$params,(GETPOST('alwayseditable')?1:0));
if ($result > 0) if ($result > 0)
{ {
setEventMessage($langs->trans('SetupSaved')); setEventMessage($langs->trans('SetupSaved'));

View File

@ -0,0 +1,52 @@
<?php
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/core/ajax/productonoff.php
* \brief File to set tosell and tobuy for product
*/
if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Disables token renewal
if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1');
if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1');
if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1');
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/genericobject.class.php';
$action=GETPOST('action','alpha');
$id=GETPOST('id', 'int');
$value=GETPOST('value', 'int');
$object = new GenericObject($db);
/*
* View
*/
top_httphead();
print '<!-- Ajax page called with url '.$_SERVER["PHP_SELF"].'?'.$_SERVER["QUERY_STRING"].' -->'."\n";
// Registering new values
if (! empty($action) && ! empty($id) && $user->rights->produit->creer) {
if ($action == 'setstatus')
$object->setValueFrom('tosell', $value, 'product', $id);
else if ($action == 'setstatus_buy')
$object->setValueFrom('tobuy', $value, 'product', $id);
}

View File

@ -37,12 +37,28 @@ class box_clients extends ModeleBoxes
var $depends = array("societe"); var $depends = array("societe");
var $db; var $db;
var $param; var $enabled = 1;
var $info_box_head = array(); var $info_box_head = array();
var $info_box_contents = array(); var $info_box_contents = array();
/**
* Constructor
*
* @param DoliDB $db Database handler
* @param string $param More parameters
*/
function __construct($db,$param='')
{
global $conf, $user;
$this->db = $db;
// disable box for such cases
if (! empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) $this->enabled=0; // disabled by this option
}
/** /**
* Load data for box to show them later * Load data for box to show them later
* *

View File

@ -1,112 +0,0 @@
<?php
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005-2008 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/core/boxes/box_osc_client.php
* \ingroup osc
* \brief Module to generate box of shop customers
*/
include_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php';
/**
* Class to manage the box to show last customers of shop
*/
class box_osc_clients extends ModeleBoxes
{
var $boxcode="nbofcustomers";
var $boximg="object_company";
var $boxlabel="BoxNbOfCustomers";
var $depends = array("boutique");
var $db;
var $param;
var $info_box_head = array();
var $info_box_contents = array();
/**
* Load data into info_box_contents array to show array later.
*
* @param int $max Maximum number of records to load
* @return void
*/
function loadBox($max=5)
{
global $conf, $user, $langs, $db;
$langs->load("boxes");
$this->max=$max;
$this->info_box_head = array('text' => $langs->trans("BoxTitleNbOfCustomers",$max));
if ($user->rights->boutique->lire)
{
$sql = "SELECT count(*) as cus FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."customers";
$resql = $db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
$i = 0;
while ($i < $num)
{
$objp = $db->fetch_object($resql);
$this->info_box_contents[$i][0] = array('td' => 'align="center" width="16"',
'logo' => $this->boximg,
'url' => DOL_URL_ROOT."/boutique/client/index.php");
$this->info_box_contents[$i][1] = array('td' => 'align="center"',
'text' => $objp->cus,
'url' => DOL_URL_ROOT."/boutique/client/index.php");
$i++;
}
$db->free($resql);
}
else {
$this->info_box_contents[0][0] = array( 'td' => 'align="left"',
'maxlength'=>500,
'text' => ($db->error().' sql='.$sql));
}
}
else {
$this->info_box_contents[0][0] = array('td' => 'align="left"',
'text' => $langs->trans("ReadPermissionNotAllowed"));
}
}
/**
* Method to show box
*
* @param array $head Array with properties of box title
* @param array $contents Array with properties of box lines
* @return void
*/
function showBox($head = null, $contents = null)
{
parent::showBox($this->info_box_head, $this->info_box_contents);
}
}

View File

@ -39,11 +39,28 @@ class box_prospect extends ModeleBoxes
var $depends = array("societe"); var $depends = array("societe");
var $db; var $db;
var $enabled = 1;
var $info_box_head = array(); var $info_box_head = array();
var $info_box_contents = array(); var $info_box_contents = array();
/**
* Constructor
*
* @param DoliDB $db Database handler
* @param string $param More parameters
*/
function __construct($db,$param='')
{
global $conf, $user;
$this->db = $db;
// disable box for such cases
if (! empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) $this->enabled=0; // disabled by this option
}
/** /**
* Load data into info_box_contents array to show array later. * Load data into info_box_contents array to show array later.
* *

View File

@ -118,10 +118,10 @@ class CMailFile
$this->mixed_boundary = "multipart_x." . time() . ".x_boundary"; $this->mixed_boundary = "multipart_x." . time() . ".x_boundary";
// On defini related_boundary // On defini related_boundary
$this->related_boundary = 'mul_'.dol_hash(uniqid("dolibarr2")); $this->related_boundary = 'mul_'.dol_hash(uniqid("dolibarr2"), 3); // Force md5 hash (does not contains special chars)
// On defini alternative_boundary // On defini alternative_boundary
$this->alternative_boundary = 'mul_'.dol_hash(uniqid("dolibarr3")); $this->alternative_boundary = 'mul_'.dol_hash(uniqid("dolibarr3"), 3); // Force md5 hash (does not contains special chars)
// If ending method not defined // If ending method not defined
if (empty($conf->global->MAIN_MAIL_SENDMODE)) $conf->global->MAIN_MAIL_SENDMODE='mail'; if (empty($conf->global->MAIN_MAIL_SENDMODE)) $conf->global->MAIN_MAIL_SENDMODE='mail';
@ -971,7 +971,7 @@ class CMailFile
} }
// cid // cid
$this->html_images[$i]["cid"] = dol_hash(uniqid(time())); $this->html_images[$i]["cid"] = dol_hash(uniqid(time()), 3); // Force md5 hash (does not contains special chars)
$this->html = preg_replace("/src=\"$src\"|src='$src'/i", "src=\"cid:".$this->html_images[$i]["cid"]."\"", $this->html); $this->html = preg_replace("/src=\"$src\"|src='$src'/i", "src=\"cid:".$this->html_images[$i]["cid"]."\"", $this->html);
} }
$i++; $i++;

View File

@ -290,6 +290,10 @@ abstract class CommonDocGenerator
'current_datehour'=>dol_print_date($now,'dayhour','tzuser'), 'current_datehour'=>dol_print_date($now,'dayhour','tzuser'),
'current_server_date'=>dol_print_date($now,'day','tzserver'), 'current_server_date'=>dol_print_date($now,'day','tzserver'),
'current_server_datehour'=>dol_print_date($now,'dayhour','tzserver'), 'current_server_datehour'=>dol_print_date($now,'dayhour','tzserver'),
'current_date_locale'=>dol_print_date($now,'day','tzuser',$outputlangs),
'current_datehour_locale'=>dol_print_date($now,'dayhour','tzuser',$outputlangs),
'current_server_date_locale'=>dol_print_date($now,'day','tzserver',$outputlangs),
'current_server_datehour_locale'=>dol_print_date($now,'dayhour','tzserver',$outputlangs),
); );
return $array_other; return $array_other;
@ -357,7 +361,8 @@ abstract class CommonDocGenerator
$array_key.'_total_discount_ht' => price2num($object->getTotalDiscount()), $array_key.'_total_discount_ht' => price2num($object->getTotalDiscount()),
$array_key.'_note_private'=>$object->note, $array_key.'_note_private'=>$object->note,
$array_key.'_note'=>$object->note_public, $array_key.'_note_public'=>$object->note_public,
$array_key.'_note'=>$object->note_public, // For backward compatibility
// Payments // Payments
$array_key.'_already_payed_locale'=>price($alreadypayed, 0, $outputlangs), $array_key.'_already_payed_locale'=>price($alreadypayed, 0, $outputlangs),
$array_key.'_remain_to_pay_locale'=>price($object->total_ttc - $sumpayed, 0, $outputlangs), $array_key.'_remain_to_pay_locale'=>price($object->total_ttc - $sumpayed, 0, $outputlangs),

View File

@ -156,7 +156,7 @@ abstract class CommonObject
* Add a link between element $this->element and a contact * Add a link between element $this->element and a contact
* *
* @param int $fk_socpeople Id of contact to link * @param int $fk_socpeople Id of contact to link
* @param int $type_contact Type of contact (code or id) * @param int $type_contact Type of contact (code or id). For example: SALESREPFOLL
* @param int $source external=Contact extern (llx_socpeople), internal=Contact intern (llx_user) * @param int $source external=Contact extern (llx_socpeople), internal=Contact intern (llx_user)
* @param int $notrigger Disable all triggers * @param int $notrigger Disable all triggers
* @return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
@ -192,9 +192,10 @@ abstract class CommonObject
// On recherche id type_contact // On recherche id type_contact
$sql = "SELECT tc.rowid"; $sql = "SELECT tc.rowid";
$sql.= " FROM ".MAIN_DB_PREFIX."c_type_contact as tc"; $sql.= " FROM ".MAIN_DB_PREFIX."c_type_contact as tc";
$sql.= " WHERE element='".$this->element."'"; $sql.= " WHERE tc.element='".$this->element."'";
$sql.= " AND source='".$source."'"; $sql.= " AND tc.source='".$source."'";
$sql.= " AND code='".$type_contact."' AND active=1"; $sql.= " AND tc.code='".$type_contact."' AND tc.active=1";
//print $sql;
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql)
{ {
@ -337,12 +338,14 @@ abstract class CommonObject
/** /**
* Delete all links between an object $this and all its contacts * Delete all links between an object $this and all its contacts
* *
* @return int >0 if OK, <0 if KO * @param string $source '' or 'internal' or 'external'
* @param string $code Type of contact (code or id)
* @return int >0 if OK, <0 if KO
*/ */
function delete_linked_contact() function delete_linked_contact($source='',$code='')
{ {
$temp = array(); $temp = array();
$typeContact = $this->liste_type_contact(''); $typeContact = $this->liste_type_contact($source,'',0,0,$code);
foreach($typeContact as $key => $value) foreach($typeContact as $key => $value)
{ {
@ -351,7 +354,7 @@ abstract class CommonObject
$listId = implode(",", $temp); $listId = implode(",", $temp);
$sql = "DELETE FROM ".MAIN_DB_PREFIX."element_contact"; $sql = "DELETE FROM ".MAIN_DB_PREFIX."element_contact";
$sql.= " WHERE element_id =".$this->id; $sql.= " WHERE element_id = ".$this->id;
$sql.= " AND fk_c_type_contact IN (".$listId.")"; $sql.= " AND fk_c_type_contact IN (".$listId.")";
dol_syslog(get_class($this)."::delete_linked_contact", LOG_DEBUG); dol_syslog(get_class($this)."::delete_linked_contact", LOG_DEBUG);
@ -360,7 +363,7 @@ abstract class CommonObject
return 1; return 1;
} }
else else
{ {
$this->error=$this->db->lasterror(); $this->error=$this->db->lasterror();
return -1; return -1;
} }
@ -478,21 +481,23 @@ abstract class CommonObject
* @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 string $option 0=Return array id->label, 1=Return array code->label
* @param string $activeonly 0=all type of contact, 1=only the active * @param string $activeonly 0=all status of contact, 1=only the active
* @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)
*/ */
function liste_type_contact($source='internal', $order='code', $option=0, $activeonly=0) function liste_type_contact($source='internal', $order='', $option=0, $activeonly=0, $code='')
{ {
global $langs; global $langs;
if (empty($order)) $order='code';
$tab = array(); $tab = array();
$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) if ($activeonly == 1) $sql.= " AND tc.active=1"; // only the active type
$sql.= " AND tc.active=1"; // only the active type if (! empty($source) && $source != 'all') $sql.= " AND tc.source='".$source."'";
if (! empty($code)) $sql.= " AND tc.code='".$code."'";
if (! empty($source)) $sql.= " AND tc.source='".$source."'";
$sql.= " ORDER by tc.".$order; $sql.= " ORDER by tc.".$order;
//print "sql=".$sql; //print "sql=".$sql;
@ -1742,6 +1747,7 @@ abstract class CommonObject
* @param string $origin Linked element type * @param string $origin Linked element type
* @param int $origin_id Linked element id * @param int $origin_id Linked element id
* @return int <=0 if KO, >0 if OK * @return int <=0 if KO, >0 if OK
* @see fetchObjectLinked, updateObjectLinked, deleteObjectLinked
*/ */
function add_object_linked($origin=null, $origin_id=null) function add_object_linked($origin=null, $origin_id=null)
{ {
@ -1785,6 +1791,7 @@ abstract class CommonObject
* @param string $targettype Object target type * @param string $targettype Object target type
* @param string $clause 'OR' or 'AND' clause used when both source id and target id are provided * @param string $clause 'OR' or 'AND' clause used when both source id and target id are provided
* @return void * @return void
* @see add_object_linked, updateObjectLinked, deleteObjectLinked
*/ */
function fetchObjectLinked($sourceid='',$sourcetype='',$targetid='',$targettype='',$clause='OR') function fetchObjectLinked($sourceid='',$sourcetype='',$targetid='',$targettype='',$clause='OR')
{ {
@ -1814,6 +1821,12 @@ abstract class CommonObject
$sourcetype = (! empty($sourcetype) ? $sourcetype : $this->element); $sourcetype = (! empty($sourcetype) ? $sourcetype : $this->element);
$targettype = (! empty($targettype) ? $targettype : $this->element); $targettype = (! empty($targettype) ? $targettype : $this->element);
if (empty($sourceid) && empty($targetid))
{
dol_print_error('','Bad usage of function. No parameter defined and no id defined');
return -1;
}
// Links beetween objects are stored in this table // Links beetween objects are stored in this table
$sql = 'SELECT fk_source, sourcetype, fk_target, targettype'; $sql = 'SELECT fk_source, sourcetype, fk_target, targettype';
$sql.= ' FROM '.MAIN_DB_PREFIX.'element_element'; $sql.= ' FROM '.MAIN_DB_PREFIX.'element_element';
@ -1939,6 +1952,7 @@ abstract class CommonObject
* @param int $targetid Object target id * @param int $targetid Object target id
* @param string $targettype Object target type * @param string $targettype Object target type
* @return int >0 if OK, <0 if KO * @return int >0 if OK, <0 if KO
* @see add_object_linked, fetObjectLinked, deleteObjectLinked
*/ */
function updateObjectLinked($sourceid='', $sourcetype='', $targetid='', $targettype='') function updateObjectLinked($sourceid='', $sourcetype='', $targetid='', $targettype='')
{ {
@ -1984,6 +1998,7 @@ abstract class CommonObject
* @param int $targetid Object target id * @param int $targetid Object target id
* @param string $targettype Object target type * @param string $targettype Object target type
* @return int >0 if OK, <0 if KO * @return int >0 if OK, <0 if KO
* @see add_object_linked, updateObjectLinked, fetchObjectLinked
*/ */
function deleteObjectLinked($sourceid='', $sourcetype='', $targetid='', $targettype='') function deleteObjectLinked($sourceid='', $sourcetype='', $targetid='', $targettype='')
{ {

View File

@ -50,6 +50,8 @@ class ExtraFields
var $attribute_param; var $attribute_param;
// Int to store position of attribute // Int to store position of attribute
var $attribute_pos; var $attribute_pos;
// Int to store if attribute is editable regardless of the document status
var $attribute_alwayseditable;
var $error; var $error;
var $errno; var $errno;
@ -103,9 +105,10 @@ class ExtraFields
* @param int $required Is field required or not * @param int $required Is field required or not
* @param string $default_value Defaulted value * @param string $default_value Defaulted value
* @param array $param Params for field * @param array $param Params for field
* @param int $alwayseditable Is attribute always editable regardless of the document status
* @return int <=0 if KO, >0 if OK * @return int <=0 if KO, >0 if OK
*/ */
function addExtraField($attrname, $label, $type, $pos, $size, $elementtype, $unique=0, $required=0,$default_value='', $param=0) function addExtraField($attrname, $label, $type, $pos, $size, $elementtype, $unique=0, $required=0, $default_value='', $param=0, $alwayseditable=0)
{ {
if (empty($attrname)) return -1; if (empty($attrname)) return -1;
if (empty($label)) return -1; if (empty($label)) return -1;
@ -119,7 +122,7 @@ class ExtraFields
if ($result > 0 || $err1 == 'DB_ERROR_COLUMN_ALREADY_EXISTS' || $type == 'separate') if ($result > 0 || $err1 == 'DB_ERROR_COLUMN_ALREADY_EXISTS' || $type == 'separate')
{ {
// Add declaration of field into table // Add declaration of field into table
$result2=$this->create_label($attrname,$label,$type,$pos,$size,$elementtype, $unique, $required, $param); $result2=$this->create_label($attrname,$label,$type,$pos,$size,$elementtype, $unique, $required, $param, $alwayseditable);
$err2=$this->errno; $err2=$this->errno;
if ($result2 > 0 || ($err1 == 'DB_ERROR_COLUMN_ALREADY_EXISTS' && $err2 == 'DB_ERROR_RECORD_ALREADY_EXISTS')) if ($result2 > 0 || ($err1 == 'DB_ERROR_COLUMN_ALREADY_EXISTS' && $err2 == 'DB_ERROR_RECORD_ALREADY_EXISTS'))
{ {
@ -154,7 +157,7 @@ class ExtraFields
{ {
$table=$elementtype.'_extrafields'; $table=$elementtype.'_extrafields';
if (isset($attrname) && $attrname != '' && preg_match("/^\w[a-zA-Z0-9-_]*$/",$attrname)) if (! empty($attrname) && preg_match("/^\w[a-zA-Z0-9-_]*$/",$attrname) && ! is_numeric($attrname))
{ {
if ($type=='boolean') { if ($type=='boolean') {
$typedb='int'; $typedb='int';
@ -217,17 +220,17 @@ class ExtraFields
* @param int $unique Is field unique or not * @param int $unique Is field unique or not
* @param int $required Is field required or not * @param int $required Is field required or not
* @param array||string $param Params for field (ex for select list : array('options' => array(value'=>'label of option')) ) * @param array||string $param Params for field (ex for select list : array('options' => array(value'=>'label of option')) )
* @param int $alwayseditable Is attribute always editable regardless of the document status
* @return int <=0 if KO, >0 if OK * @return int <=0 if KO, >0 if OK
*/ */
private function create_label($attrname, $label='', $type='', $pos=0, $size=0, $elementtype='member', $unique=0, $required=0, $param='') private function create_label($attrname, $label='', $type='', $pos=0, $size=0, $elementtype='member', $unique=0, $required=0, $param='', $alwayseditable=0)
{ {
global $conf; global $conf;
// Clean parameters // Clean parameters
if (empty($pos)) $pos=0; if (empty($pos)) $pos=0;
if (! empty($attrname) && preg_match("/^\w[a-zA-Z0-9-_]*$/",$attrname) && ! is_numeric($attrname))
if (isset($attrname) && $attrname != '' && preg_match("/^\w[a-zA-Z0-9-_]*$/",$attrname))
{ {
if(is_array($param) and count($param) > 0) if(is_array($param) and count($param) > 0)
{ {
@ -242,7 +245,7 @@ class ExtraFields
$params=''; $params='';
} }
$sql = "INSERT INTO ".MAIN_DB_PREFIX."extrafields(name, label, type, pos, size, entity, elementtype, fieldunique, fieldrequired, param)"; $sql = "INSERT INTO ".MAIN_DB_PREFIX."extrafields(name, label, type, pos, size, entity, elementtype, fieldunique, fieldrequired, param, alwayseditable)";
$sql.= " VALUES('".$attrname."',"; $sql.= " VALUES('".$attrname."',";
$sql.= " '".$this->db->escape($label)."',"; $sql.= " '".$this->db->escape($label)."',";
$sql.= " '".$type."',"; $sql.= " '".$type."',";
@ -252,7 +255,8 @@ class ExtraFields
$sql.= " '".$elementtype."',"; $sql.= " '".$elementtype."',";
$sql.= " '".$unique."',"; $sql.= " '".$unique."',";
$sql.= " '".$required."',"; $sql.= " '".$required."',";
$sql.= " '".$params."'"; $sql.= " '".$params."',";
$sql.= " '".$alwayseditable."'";
$sql.=')'; $sql.=')';
dol_syslog(get_class($this)."::create_label", LOG_DEBUG); dol_syslog(get_class($this)."::create_label", LOG_DEBUG);
@ -348,9 +352,10 @@ class ExtraFields
* @param int $required Is field required or not * @param int $required Is field required or not
* @param int $pos Position of attribute * @param int $pos Position of attribute
* @param array $param Params for field (ex for select list : array('options' => array(value'=>'label of option')) ) * @param array $param Params for field (ex for select list : array('options' => array(value'=>'label of option')) )
* @param int $alwayseditable Is attribute always editable regardless of the document status
* @return int >0 if OK, <=0 if KO * @return int >0 if OK, <=0 if KO
*/ */
function update($attrname,$label,$type,$length,$elementtype,$unique=0,$required=0,$pos=0,$param='') function update($attrname,$label,$type,$length,$elementtype,$unique=0,$required=0,$pos=0,$param='',$alwayseditable=0)
{ {
$table=$elementtype.'_extrafields'; $table=$elementtype.'_extrafields';
@ -385,7 +390,7 @@ class ExtraFields
{ {
if ($label) if ($label)
{ {
$result=$this->update_label($attrname,$label,$type,$length,$elementtype,$unique,$required,$pos,$param); $result=$this->update_label($attrname,$label,$type,$length,$elementtype,$unique,$required,$pos,$param,$alwayseditable);
} }
if ($result > 0) if ($result > 0)
{ {
@ -433,9 +438,10 @@ class ExtraFields
* @param int $required Is field required or not * @param int $required Is field required or not
* @param int $pos Position of attribute * @param int $pos Position of attribute
* @param array $param Params for field (ex for select list : array('options' => array(value'=>'label of option')) ) * @param array $param Params for field (ex for select list : array('options' => array(value'=>'label of option')) )
* @param int $alwayseditable Is attribute always editable regardless of the document status
* @return int <=0 if KO, >0 if OK * @return int <=0 if KO, >0 if OK
*/ */
private function update_label($attrname,$label,$type,$size,$elementtype,$unique=0,$required=0,$pos=0,$param='') private function update_label($attrname,$label,$type,$size,$elementtype,$unique=0,$required=0,$pos=0,$param='',$alwayseditable=0)
{ {
global $conf; global $conf;
dol_syslog(get_class($this)."::update_label ".$attrname.", ".$label.", ".$type.", ".$size.", ".$elementtype.", ".$unique.", ".$required); dol_syslog(get_class($this)."::update_label ".$attrname.", ".$label.", ".$type.", ".$size.", ".$elementtype.", ".$unique.", ".$required);
@ -466,6 +472,7 @@ class ExtraFields
$sql.= " fieldunique,"; $sql.= " fieldunique,";
$sql.= " fieldrequired,"; $sql.= " fieldrequired,";
$sql.= " pos,"; $sql.= " pos,";
$sql.= " alwayseditable,";
$sql.= " param"; $sql.= " param";
$sql.= ") VALUES ("; $sql.= ") VALUES (";
$sql.= "'".$attrname."',"; $sql.= "'".$attrname."',";
@ -477,6 +484,7 @@ class ExtraFields
$sql.= " '".$unique."',"; $sql.= " '".$unique."',";
$sql.= " '".$required."',"; $sql.= " '".$required."',";
$sql.= " '".$pos."',"; $sql.= " '".$pos."',";
$sql.= " '".$alwayseditable."',";
$sql.= " '".$param."'"; $sql.= " '".$param."'";
$sql.= ")"; $sql.= ")";
dol_syslog(get_class($this)."::update_label", LOG_DEBUG); dol_syslog(get_class($this)."::update_label", LOG_DEBUG);
@ -530,7 +538,7 @@ class ExtraFields
if (!$forceload && !empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) if (!$forceload && !empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))
return $array_name_label; return $array_name_label;
$sql = "SELECT rowid,name,label,type,size,elementtype,fieldunique,fieldrequired,param,pos"; $sql = "SELECT rowid,name,label,type,size,elementtype,fieldunique,fieldrequired,param,pos,alwayseditable";
$sql.= " FROM ".MAIN_DB_PREFIX."extrafields"; $sql.= " FROM ".MAIN_DB_PREFIX."extrafields";
$sql.= " WHERE entity IN (0,".$conf->entity.")"; $sql.= " WHERE entity IN (0,".$conf->entity.")";
if ($elementtype) $sql.= " AND elementtype = '".$elementtype."'"; if ($elementtype) $sql.= " AND elementtype = '".$elementtype."'";
@ -558,6 +566,7 @@ class ExtraFields
$this->attribute_required[$tab->name]=$tab->fieldrequired; $this->attribute_required[$tab->name]=$tab->fieldrequired;
$this->attribute_param[$tab->name]=unserialize($tab->param); $this->attribute_param[$tab->name]=unserialize($tab->param);
$this->attribute_pos[$tab->name]=$tab->pos; $this->attribute_pos[$tab->name]=$tab->pos;
$this->attribute_alwayseditable[$tab->name]=$tab->alwayseditable;
} }
} }

View File

@ -161,29 +161,29 @@ class HookManager
{ {
//print "Before hook ".get_class($actionclassinstance)." method=".$method." hooktype=".$hooktype." results=".count($actionclassinstance->results)." resprints=".count($actionclassinstance->resprints)." resaction=".$resaction." result=".$result."<br>\n"; //print "Before hook ".get_class($actionclassinstance)." method=".$method." hooktype=".$hooktype." results=".count($actionclassinstance->results)." resprints=".count($actionclassinstance->resprints)." resaction=".$resaction." result=".$result."<br>\n";
//print 'class='.get_class($actionclassinstance).' method='.$method.' action='.$action; // jump to next module/class if method does not exists
// jump to next class if method does not exists
if (! method_exists($actionclassinstance,$method)) continue; if (! method_exists($actionclassinstance,$method)) continue;
// test to avoid to run twice a hook, when a module implements several active contexts
// test to avoid to run twice a hook, when a module implements several active contexts
if (in_array($module,$modulealreadyexecuted)) continue; if (in_array($module,$modulealreadyexecuted)) continue;
$modulealreadyexecuted[$module]=$module; // Use the $currentcontext in method for avoid to run twice $modulealreadyexecuted[$module]=$module; // Use the $currentcontext in method for avoid to run twice
// Clean class (an error may have been set into a previous call of another method for same module/hook)
$actionclassinstance->error=0;
$actionclassinstance->errors=array();
// Add current context for avoid method execution in bad context, you can add this test in your method : eg if($currentcontext != 'formfile') return; // Add current context for avoid method execution in bad context, you can add this test in your method : eg if($currentcontext != 'formfile') return;
$parameters['currentcontext'] = $context; $parameters['currentcontext'] = $context;
// Hooks that must return int (hooks with type 'addreplace') // Hooks that must return int (hooks with type 'addreplace')
if ($hooktype == 'addreplace') if ($hooktype == 'addreplace')
{ {
dol_syslog("Call method ".$method." of class ".get_class($actionclassinstance).", module=".$module.", hooktype=".$hooktype, LOG_DEBUG);
$resaction += $actionclassinstance->$method($parameters, $object, $action, $this); // $object and $action can be changed by method ($object->id during creation for example or $action to go back to other action for example) $resaction += $actionclassinstance->$method($parameters, $object, $action, $this); // $object and $action can be changed by method ($object->id during creation for example or $action to go back to other action for example)
if ($resaction < 0 || ! empty($actionclassinstance->error) || (! empty($actionclassinstance->errors) && count($actionclassinstance->errors) > 0)) if ($resaction < 0 || ! empty($actionclassinstance->error) || (! empty($actionclassinstance->errors) && count($actionclassinstance->errors) > 0))
{ {
$error++; $error++;
$this->error=$actionclassinstance->error; $this->errors=array_merge($this->errors, (array) $actionclassinstance->errors); $this->error=$actionclassinstance->error; $this->errors=array_merge($this->errors, (array) $actionclassinstance->errors);
// TODO dead code to remove (do not enable this, but fix hook instead) dol_syslog("Error on hook module=".$module.", method ".$method.", class ".get_class($actionclassinstance).", hooktype=".$hooktype.(empty($this->error)?'':" ".$this->error).(empty($this->errors)?'':" ".join(",",$this->errors)), LOG_ERR);
/* Change must be inside the method of hook if required. Only hook must decide if $action must be modified or not.
if ($method == 'doActions')
{
if ($action=='add') $action='create';
if ($action=='update') $action='edit';
}*/
} }
if (is_array($actionclassinstance->results)) $this->resArray =array_merge($this->resArray, $actionclassinstance->results); if (is_array($actionclassinstance->results)) $this->resArray =array_merge($this->resArray, $actionclassinstance->results);
@ -195,6 +195,7 @@ class HookManager
// 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
if (is_array($parameters) && ! empty($parameters['special_code']) && $parameters['special_code'] > 3 && $parameters['special_code'] != $actionclassinstance->module_number) continue; if (is_array($parameters) && ! empty($parameters['special_code']) && $parameters['special_code'] > 3 && $parameters['special_code'] != $actionclassinstance->module_number) continue;
//dol_syslog("Call method ".$method." of class ".get_class($actionclassinstance).", module=".$module.", hooktype=".$hooktype, LOG_DEBUG);
$result = $actionclassinstance->$method($parameters, $object, $action, $this); // $object and $action can be changed by method ($object->id during creation for example or $action to go back to other action for example) $result = $actionclassinstance->$method($parameters, $object, $action, $this); // $object and $action can be changed by method ($object->id during creation for example or $action to go back to other action for example)
if (! empty($actionclassinstance->results) && is_array($actionclassinstance->results)) $this->resArray =array_merge($this->resArray, $actionclassinstance->results); if (! empty($actionclassinstance->results) && is_array($actionclassinstance->results)) $this->resArray =array_merge($this->resArray, $actionclassinstance->results);

View File

@ -14,6 +14,7 @@
* Copyright (C) 2011 Herve Prot <herve.prot@symeos.com> * Copyright (C) 2011 Herve Prot <herve.prot@symeos.com>
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2013 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr> * Copyright (C) 2013 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* 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
@ -193,7 +194,7 @@ class Form
{ {
$ret.='<td align="left">'; $ret.='<td align="left">';
$ret.='<input type="submit" class="button" name="modify" value="'.$langs->trans("Modify").'">'; $ret.='<input type="submit" class="button" name="modify" value="'.$langs->trans("Modify").'">';
$ret.='<br>'."\n"; if (preg_match('/ckeditor|textarea/',$typeofdata)) $ret.='<br>'."\n";
$ret.='<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">'; $ret.='<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
$ret.='</td>'; $ret.='</td>';
} }
@ -477,9 +478,11 @@ class Form
$out=''; $out='';
$countryArray=array(); $countryArray=array();
$favorite=array();
$label=array(); $label=array();
$atleastonefavorite=0;
$sql = "SELECT rowid, code as code_iso, code_iso as code_iso3, label"; $sql = "SELECT rowid, code as code_iso, code_iso as code_iso3, label, favorite";
$sql.= " FROM ".MAIN_DB_PREFIX."c_country"; $sql.= " FROM ".MAIN_DB_PREFIX."c_country";
$sql.= " WHERE active = 1"; $sql.= " WHERE active = 1";
//$sql.= " ORDER BY code ASC"; //$sql.= " ORDER BY code ASC";
@ -502,15 +505,22 @@ class Form
$countryArray[$i]['code_iso'] = $obj->code_iso; $countryArray[$i]['code_iso'] = $obj->code_iso;
$countryArray[$i]['code_iso3'] = $obj->code_iso3; $countryArray[$i]['code_iso3'] = $obj->code_iso3;
$countryArray[$i]['label'] = ($obj->code_iso && $langs->transnoentitiesnoconv("Country".$obj->code_iso)!="Country".$obj->code_iso?$langs->transnoentitiesnoconv("Country".$obj->code_iso):($obj->label!='-'?$obj->label:'')); $countryArray[$i]['label'] = ($obj->code_iso && $langs->transnoentitiesnoconv("Country".$obj->code_iso)!="Country".$obj->code_iso?$langs->transnoentitiesnoconv("Country".$obj->code_iso):($obj->label!='-'?$obj->label:''));
$label[$i] = dol_string_unaccent($countryArray[$i]['label']); $countryArray[$i]['favorite'] = $obj->favorite;
$favorite[$i] = $obj->favorite;
$label[$i] = dol_string_unaccent($countryArray[$i]['label']);
$i++; $i++;
} }
array_multisort($label, SORT_ASC, $countryArray); array_multisort($favorite, SORT_DESC, $label, SORT_ASC, $countryArray);
foreach ($countryArray as $row) foreach ($countryArray as $row)
{ {
//print 'rr'.$selected.'-'.$row['label'].'-'.$row['code_iso'].'<br>'; if ($row['favorite'] && $row['code_iso']) $atleastonefavorite++;
if (empty($row['favorite']) && $atleastonefavorite)
{
$atleastonefavorite=0;
$out.= '<option value="" disabled="disabled">----------------------</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']) )
{ {
$foundselected=true; $foundselected=true;
@ -2703,6 +2713,7 @@ class Form
* @param int $maxlength Maximum length for labels * @param int $maxlength Maximum length for labels
* @param int $excludeafterid Exclude all categories after this leaf in category tree. * @param int $excludeafterid Exclude all categories after this leaf in category tree.
* @return void * @return void
* @see select_categories
*/ */
function select_all_categories($type, $selected='', $htmlname="parent", $maxlength=64, $excludeafterid=0) function select_all_categories($type, $selected='', $htmlname="parent", $maxlength=64, $excludeafterid=0)
{ {
@ -3987,7 +3998,7 @@ class Form
{ {
print '<input type="text" size="3" name="'.$prefix.'hour"'.($disabled?' disabled="disabled"':'').' class="flat" value="'.((int) $hourSelected).'">'; print '<input type="text" size="3" name="'.$prefix.'hour"'.($disabled?' disabled="disabled"':'').' class="flat" value="'.((int) $hourSelected).'">';
} }
print $langs->trans('Hours'); print ' '.$langs->trans('HourShort');
if ($minunderhours) print '<br>'; if ($minunderhours) print '<br>';
else print "&nbsp;"; else print "&nbsp;";
@ -4000,7 +4011,7 @@ class Form
print '>'.$min.'</option>'; print '>'.$min.'</option>';
} }
print "</select>"; print "</select>";
print $langs->trans('Minutes'). "&nbsp;"; print ' '.$langs->trans('MinuteShort'). "&nbsp;";
} }
@ -4390,7 +4401,7 @@ class Form
{ {
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).'?s='.$width.'&d='.urlencode(dol_buildpath('/theme/common/nophoto.jpg',2)).'">'; $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
} }
else else
{ {

View File

@ -266,6 +266,8 @@ class FormActions
if ($selected == 'manual') $selected='AC_OTH'; if ($selected == 'manual') $selected='AC_OTH';
if ($selected == 'auto') $selected='AC_OTH_AUTO'; if ($selected == 'auto') $selected='AC_OTH_AUTO';
if (! empty($conf->global->AGENDA_ALWAYS_HIDE_AUTO)) unset($arraylist['AC_OTH_AUTO']);
print $form->selectarray($htmlname, $arraylist, $selected); print $form->selectarray($htmlname, $arraylist, $selected);
if ($user->admin && empty($onlyautoornot) && empty($hideinfohelp)) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1); if ($user->admin && empty($onlyautoornot) && empty($hideinfohelp)) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
} }

View File

@ -682,22 +682,21 @@ class FormCompany
* @param string $selected Default selected value * @param string $selected Default selected value
* @param string $htmlname HTML select name * @param string $htmlname HTML select name
* @param string $source Source ('internal' or 'external') * @param string $source Source ('internal' or 'external')
* @param string $order Sort criteria * @param string $sortorder Sort criteria
* @param int $showempty 1=Add en empty line * @param int $showempty 1=Add en empty line
* @return void * @return void
*/ */
function selectTypeContact($object, $selected, $htmlname = 'type', $source='internal', $order='code', $showempty=0) function selectTypeContact($object, $selected, $htmlname = 'type', $source='internal', $sortorder='code', $showempty=0)
{ {
if (is_object($object) && method_exists($object, 'liste_type_contact')) if (is_object($object) && method_exists($object, 'liste_type_contact'))
{ {
$lesTypes = $object->liste_type_contact($source, $order, 0, 1); $lesTypes = $object->liste_type_contact($source, $sortorder, 0, 1);
print '<select class="flat" name="'.$htmlname.'" id="'.$htmlname.'">'; print '<select class="flat" name="'.$htmlname.'" id="'.$htmlname.'">';
if ($showempty) print '<option value="0"></option>'; if ($showempty) print '<option value="0"></option>';
foreach($lesTypes as $key=>$value) foreach($lesTypes as $key=>$value)
{ {
print '<option value="'.$key.'"'; print '<option value="'.$key.'"';
if ($key == $selected) if ($key == $selected) print ' selected';
print ' selected';
print '>'.$value.'</option>'; print '>'.$value.'</option>';
} }
print "</select>\n"; print "</select>\n";

View File

@ -73,12 +73,12 @@ class FormFile
global $conf,$langs, $hookmanager; global $conf,$langs, $hookmanager;
$hookmanager->initHooks(array('formfile')); $hookmanager->initHooks(array('formfile'));
if (! empty($conf->browser->phone)) return 0; if (! empty($conf->browser->layout) && $conf->browser->layout != 'classic') return 0;
if ((! empty($conf->global->MAIN_USE_JQUERY_FILEUPLOAD) && $useajax) || ($useajax==2)) if ((! empty($conf->global->MAIN_USE_JQUERY_FILEUPLOAD) && $useajax) || ($useajax==2))
{ {
// TODO: Cheeck this works with 2 forms on same page // TODO: Check this works with 2 forms on same page
// TODO: Cheeck this works with GED module, otherwise, force useajax to 0 // TODO: Check this works with GED module, otherwise, force useajax to 0
// TODO: This does not support option savingdocmask // TODO: This does not support option savingdocmask
// TODO: This break feature to upload links too // TODO: This break feature to upload links too
return $this->_formAjaxFileUpload($object); return $this->_formAjaxFileUpload($object);
@ -474,14 +474,14 @@ class FormFile
// Model // Model
if (! empty($modellist)) if (! empty($modellist))
{ {
$out.= '<th align="center" class="formdoc liste_titre">'; $out.= '<th align="center" class="formdoc liste_titre maxwidthonsmartphone">';
$out.= '<span class="hideonsmartphone">'.$langs->trans('Model').' </span>'; $out.= '<span class="hideonsmartphone">'.$langs->trans('Model').' </span>';
if (is_array($modellist) && count($modellist) == 1) // If there is only one element if (is_array($modellist) && count($modellist) == 1) // If there is only one element
{ {
$arraykeys=array_keys($modellist); $arraykeys=array_keys($modellist);
$modelselected=$arraykeys[0]; $modelselected=$arraykeys[0];
} }
$out.= $form->selectarray('model',$modellist,$modelselected,$showempty,0,0); $out.= $form->selectarray('model', $modellist, $modelselected, $showempty, 0, 0, '', 0, 0, 0, '', '');
$out.= '</th>'; $out.= '</th>';
} }
else else
@ -492,7 +492,7 @@ class FormFile
} }
// Language code (if multilang) // Language code (if multilang)
$out.= '<th align="center" class="formdoc liste_titre">'; $out.= '<th align="center" class="formdoc liste_titre maxwidthonsmartphone">';
if (($allowgenifempty || (is_array($modellist) && count($modellist) > 0)) && $conf->global->MAIN_MULTILANGS && ! $forcenomultilang && (! empty($modellist) || $showempty)) if (($allowgenifempty || (is_array($modellist) && count($modellist) > 0)) && $conf->global->MAIN_MULTILANGS && ! $forcenomultilang && (! empty($modellist) || $showempty))
{ {
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; include_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
@ -508,7 +508,7 @@ class FormFile
// Button // Button
$addcolumforpicto=($delallowed || $printer || $morepicto); $addcolumforpicto=($delallowed || $printer || $morepicto);
$out.= '<th align="center" colspan="'.($addcolumforpicto?'2':'1').'" class="formdocbutton liste_titre">'; $out.= '<th align="center" colspan="'.($addcolumforpicto?'2':'1').'" class="formdocbutton liste_titre maxwidthonsmartphone">';
$genbutton = '<input class="button" id="'.$forname.'_generatebutton" name="'.$forname.'_generatebutton"'; $genbutton = '<input class="button" id="'.$forname.'_generatebutton" name="'.$forname.'_generatebutton"';
$genbutton.= ' type="submit" value="'.$buttonlabel.'"'; $genbutton.= ' type="submit" value="'.$buttonlabel.'"';
if (! $allowgenifempty && ! is_array($modellist) && empty($modellist)) $genbutton.= ' disabled="disabled"'; if (! $allowgenifempty && ! is_array($modellist) && empty($modellist)) $genbutton.= ' disabled="disabled"';
@ -629,7 +629,7 @@ class FormFile
if (count($file_list) == 0 && $headershown) if (count($file_list) == 0 && $headershown)
{ {
$out.='<tr><td colspan="3">'.$langs->trans("None").'</td></tr>'; $out.='<tr '.$bc[0].'><td colspan="3">'.$langs->trans("None").'</td></tr>';
} }
$this->numoffiles++; $this->numoffiles++;
@ -1150,7 +1150,7 @@ class FormFile
$nboflinks = count($links); $nboflinks = count($links);
if ($nboflinks > 0) include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; if ($nboflinks > 0) include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
$var = true; $var = false;
foreach ($links as $link) foreach ($links as $link)
{ {
$var =! $var; $var =! $var;

View File

@ -680,7 +680,7 @@ class FormMail
/** /**
* Return template of email * Return template of email
* Search into table c_email_template * Search into table c_email_templates
* *
* @param DoliDB $db Database handler * @param DoliDB $db Database handler
* @param string $type_template Get message for key module * @param string $type_template Get message for key module
@ -692,22 +692,25 @@ class FormMail
{ {
$ret=array(); $ret=array();
$sql = "SELECT topic, content"; $sql = "SELECT label, topic, content, lang";
$sql.= " FROM ".MAIN_DB_PREFIX.'c_email_templates'; $sql.= " FROM ".MAIN_DB_PREFIX.'c_email_templates';
$sql.= " WHERE type_template='".$db->escape($type_template)."'"; $sql.= " WHERE type_template='".$db->escape($type_template)."'";
$sql.= " AND entity IN (".getEntity("c_email_templates").")"; $sql.= " AND entity IN (".getEntity("c_email_templates").")";
$sql.= " AND (fk_user is NULL or fk_user = 0 or fk_user = ".$user->id.")"; $sql.= " AND (fk_user is NULL or fk_user = 0 or fk_user = ".$user->id.")";
// TODO Add field and where filter on language code if (is_object($outputlangs)) $sql.= " AND (lang = '".$outputlangs->defaultlang."' OR lang IS NULL OR lang = '')";
$sql.= $db->order("lang,label","ASC");
//print $sql; //print $sql;
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql)
{ {
$obj = $db->fetch_object($resql); $obj = $db->fetch_object($resql); // Get first found
if ($obj) if ($obj)
{ {
$ret['label']=$obj->label;
$ret['topic']=$obj->topic; $ret['topic']=$obj->topic;
$ret['content']=$obj->content; $ret['content']=$obj->content;
$ret['lang']=$obj->lang;
} }
else else
{ {
@ -722,8 +725,10 @@ class FormMail
elseif ($type_template=='fichinter_send') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentSendFichInter"); } elseif ($type_template=='fichinter_send') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentSendFichInter"); }
elseif ($type_template=='thirdparty') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentThirdparty"); } elseif ($type_template=='thirdparty') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentThirdparty"); }
$ret['label']='default';
$ret['topic']=''; $ret['topic']='';
$ret['content']=$defaultmessage; $ret['content']=$defaultmessage;
$ret['lang']=$outputlangs->defaultlang;
} }
$db->free($resql); $db->free($resql);

View File

@ -307,6 +307,7 @@ class FormOther
* @param string $htmlname Name of combo list * @param string $htmlname Name of combo list
* @param int $nocateg Show also an entry "Not categorized" * @param int $nocateg Show also an entry "Not categorized"
* @return string Html combo list code * @return string Html combo list code
* @see select_all_categories
*/ */
function select_categories($type,$selected=0,$htmlname='search_categ',$nocateg=0) function select_categories($type,$selected=0,$htmlname='search_categ',$nocateg=0)
{ {
@ -318,7 +319,7 @@ class FormOther
$tab_categs = $static_categs->get_full_arbo($type); $tab_categs = $static_categs->get_full_arbo($type);
// Print a select with each of them // Print a select with each of them
$moreforfilter ='<select class="flat" name="'.$htmlname.'">'; $moreforfilter ='<select class="flat" id="select_categ_'.$htmlname.'" name="'.$htmlname.'">';
$moreforfilter.='<option value="">&nbsp;</option>'; // Should use -1 to say nothing $moreforfilter.='<option value="">&nbsp;</option>'; // Should use -1 to say nothing
if (is_array($tab_categs)) if (is_array($tab_categs))

View File

@ -23,12 +23,12 @@
* \brief Fichier de la classe de gestion des triggers * \brief Fichier de la classe de gestion des triggers
*/ */
require_once DOL_DOCUMENT_ROOT.'/core/triggers/DolibarrTriggers.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/triggers/dolibarrtriggers.class.php';
/** /**
* Class to manage triggers * Class to manage triggers
*/ */
class Interfaces class Interfaces
{ {
var $dir; // Directory with all core and external triggers files var $dir; // Directory with all core and external triggers files

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