diff --git a/.tx/config b/.tx/config index a89b56c1013..c20f75769ae 100644 --- a/.tx/config +++ b/.tx/config @@ -272,12 +272,6 @@ source_file = htdocs/langs/en_US/sendings.lang source_lang = en_US type = MOZILLAPROPERTIES -[dolibarr.shop] -file_filter = htdocs/langs//shop.lang -source_file = htdocs/langs/en_US/shop.lang -source_lang = en_US -type = MOZILLAPROPERTIES - [dolibarr.sms] file_filter = htdocs/langs//sms.lang source_file = htdocs/langs/en_US/sms.lang diff --git a/ChangeLog b/ChangeLog index dafb9ae8fa1..36439c46288 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,14 @@ English Dolibarr ChangeLog ***** ChangeLog for 3.7 compared to 3.6.* ***** 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: PDF event report show project and status of event. - New: Can filter on status on interventions. @@ -60,9 +68,14 @@ For users: - New: Add option MAIN_GENERATE_INVOICES_WITH_PICTURE to show picture onto PDF like MAIN_GENERATE_PROPOSALS_WITH_PICTURE dir for proposals. - 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 - 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 #1470, #1472, #1473] User 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 #1469 ] Triggers CONTACT_MODIFY and CONTACT_DELETE duplicates error message - 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: + +For users, new experimental module (need to set feature level of instance to experimental to see them): - New: Module Accounting Expert to manage accountancy Special Thanks to developpers : Olivier Geffroy @@ -96,6 +108,7 @@ For users, new experimental module: Hydroflex 120 euros Asysteo 120 euros Fournisseur médical 120 euros +- Removed: unmaintained OScommerce module For translators: - Update language files. @@ -117,6 +130,8 @@ For developers: - New: renamed table llx_c_pays to llx_c_country & libelle field to label. - New: Added hook "formConfirm" and "doActions" for fichinter card - 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, field civilite into label in the same 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 Dolibarr better: +- Deprecated module "oscommerce" were removed. - Changed the way parameters are provided to scripts sync_xxx_ldap2dolibarr.php - Some field into database were renamed from "libelle" to "label". - 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. - A lot of pages called fiche.php were renamed into card.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.* ***** For users: - 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: cents for indian ruppes are calle paisa and paise. - 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: 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.* ***** For users: diff --git a/build/makepack-dolibarr.pl b/build/makepack-dolibarr.pl index 0b881cedb35..0e8f2ea0fdd 100755 --- a/build/makepack-dolibarr.pl +++ b/build/makepack-dolibarr.pl @@ -442,6 +442,7 @@ if ($nboftargetok) { $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/nltechno*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/pos*`; $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/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`; diff --git a/build/rpm/dolibarr_fedora.spec b/build/rpm/dolibarr_fedora.spec index 439a09b8266..156f34bc066 100755 --- a/build/rpm/dolibarr_fedora.spec +++ b/build/rpm/dolibarr_fedora.spec @@ -162,7 +162,6 @@ done >>%{name}.lang %_datadir/dolibarr/htdocs/asterisk %_datadir/dolibarr/htdocs/barcode %_datadir/dolibarr/htdocs/bookmarks -%_datadir/dolibarr/htdocs/boutique %_datadir/dolibarr/htdocs/cashdesk %_datadir/dolibarr/htdocs/categories %_datadir/dolibarr/htdocs/comm diff --git a/build/rpm/dolibarr_generic.spec b/build/rpm/dolibarr_generic.spec index 945e8f4812c..176cb07975d 100755 --- a/build/rpm/dolibarr_generic.spec +++ b/build/rpm/dolibarr_generic.spec @@ -242,7 +242,6 @@ done >>%{name}.lang %_datadir/dolibarr/htdocs/asterisk %_datadir/dolibarr/htdocs/barcode %_datadir/dolibarr/htdocs/bookmarks -%_datadir/dolibarr/htdocs/boutique %_datadir/dolibarr/htdocs/cashdesk %_datadir/dolibarr/htdocs/categories %_datadir/dolibarr/htdocs/comm diff --git a/build/rpm/dolibarr_mandriva.spec b/build/rpm/dolibarr_mandriva.spec index 17b46c3c143..d75c9a84dca 100755 --- a/build/rpm/dolibarr_mandriva.spec +++ b/build/rpm/dolibarr_mandriva.spec @@ -159,7 +159,6 @@ done >>%{name}.lang %_datadir/dolibarr/htdocs/asterisk %_datadir/dolibarr/htdocs/barcode %_datadir/dolibarr/htdocs/bookmarks -%_datadir/dolibarr/htdocs/boutique %_datadir/dolibarr/htdocs/cashdesk %_datadir/dolibarr/htdocs/categories %_datadir/dolibarr/htdocs/comm diff --git a/build/rpm/dolibarr_opensuse.spec b/build/rpm/dolibarr_opensuse.spec index f6192c87c9b..41ea838f3fb 100755 --- a/build/rpm/dolibarr_opensuse.spec +++ b/build/rpm/dolibarr_opensuse.spec @@ -170,7 +170,6 @@ done >>%{name}.lang %_datadir/dolibarr/htdocs/asterisk %_datadir/dolibarr/htdocs/barcode %_datadir/dolibarr/htdocs/bookmarks -%_datadir/dolibarr/htdocs/boutique %_datadir/dolibarr/htdocs/cashdesk %_datadir/dolibarr/htdocs/categories %_datadir/dolibarr/htdocs/comm diff --git a/dev/fixperms.sh b/dev/fixperms.sh index 731e45cf703..5844e8b2916 100755 --- a/dev/fixperms.sh +++ b/dev/fixperms.sh @@ -25,4 +25,6 @@ then find ./htdocs -type f -iname "*.php" -exec chmod a-x {} \; chmod a+x ./scripts/*/*.php chmod a+x ./scripts/*/*.sh + chmod g-w ./scripts/*/*.php + chmod g-w ./scripts/*/*.sh fi diff --git a/htdocs/accountancy/admin/account.php b/htdocs/accountancy/admin/account.php index 0c929ef5de5..60ff4b125c3 100644 --- a/htdocs/accountancy/admin/account.php +++ b/htdocs/accountancy/admin/account.php @@ -65,8 +65,7 @@ if ($action == 'delete') { $accounting = new AccountingAccount($db); if ($action == 'disable') { - $accounting = $accounting->fetch($id); - if (! empty($accounting->id)) { + if ($accounting->fetch($id)) { $result = $accounting->account_desactivate($id); } @@ -75,10 +74,7 @@ if ($action == 'disable') { setEventMessage($accounting->error, 'errors'); } } else if ($action == 'enable') { - - $accounting = $accounting->fetch($id); - - if (! empty($accounting->id)) { + if ($accounting->fetch($id)) { $result = $accounting->account_activate($id); } $action = 'update'; @@ -160,7 +156,7 @@ if ($result) { print ''; print ''; - $var = True; + $var = true; while ( $i < min($num, $limit) ) { $obj = $db->fetch_object($resql); diff --git a/htdocs/accountancy/admin/export.php b/htdocs/accountancy/admin/export.php index ca7e5f84e07..dc8f50241a1 100644 --- a/htdocs/accountancy/admin/export.php +++ b/htdocs/accountancy/admin/export.php @@ -99,7 +99,7 @@ print '' print ''; print ''; -$var = True; +$var = true; print ''; print ''; diff --git a/htdocs/accountancy/admin/importaccounts.php b/htdocs/accountancy/admin/importaccounts.php index b350aa8e590..9e5c59f4555 100644 --- a/htdocs/accountancy/admin/importaccounts.php +++ b/htdocs/accountancy/admin/importaccounts.php @@ -135,7 +135,7 @@ if ($result) { print '' . "\n"; print ''; - $var = True; + $var = true; while ( $i < min($num_lines, $limit) ) { $objp = $db->fetch_object($result); $var = ! $var; diff --git a/htdocs/accountancy/admin/index.php b/htdocs/accountancy/admin/index.php index 8e548f8992e..e72df6a0431 100644 --- a/htdocs/accountancy/admin/index.php +++ b/htdocs/accountancy/admin/index.php @@ -191,7 +191,7 @@ print "
\n"; * Define Chart of accounts */ print '
' . $langs->trans("Modelcsv") . '
'; -$var = True; +$var = true; print ''; print ''; print ''; - $var = True; + $var = true; while ( $i < min($num, 250) ) { $obj = $db->fetch_object($resql); diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index 3af059cad94..3b68bd6b69e 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -227,9 +227,8 @@ if ($result) { $i ++; } - print ''; - print '
'; @@ -211,7 +211,7 @@ $sql .= " AND fk_pays = " . $mysoc->country_id; dol_syslog('accountancy/admin/index.php:: $sql=' . $sql); $resql = $db->query($sql); -$var = True; +$var = true; if ($resql) { $num = $db->num_rows($resql); diff --git a/htdocs/accountancy/admin/productaccount.php b/htdocs/accountancy/admin/productaccount.php index 5c1cba946ee..402ff72ed84 100644 --- a/htdocs/accountancy/admin/productaccount.php +++ b/htdocs/accountancy/admin/productaccount.php @@ -89,7 +89,7 @@ if ($resql) { print '' . $langs->trans("Accountancy_code_sell") . '' . $langs->trans("Accountancy_code_sell_suggest") . '
 
'; + print '
'; print ''; } else { print $db->error(); diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php index 4bf603236db..f932fbfc8af 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -208,10 +208,8 @@ if ($result) { $i ++; } - print ' '; - - print ""; - + print ''; + print '
'; print ''; } else { print $db->error(); diff --git a/htdocs/adherents/index.php b/htdocs/adherents/index.php index 1ec3d71c664..62e54c17948 100644 --- a/htdocs/adherents/index.php +++ b/htdocs/adherents/index.php @@ -159,7 +159,7 @@ if ($conf->use_javascript_ajax) print '
'; print ''; print ''; - print ''; print ''; print ''."\n"; -// Show each trigger +// Show each trigger (list is in c_action_trigger) if (! empty($triggers)) { foreach ($triggers as $trigger) diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index c774faf5caa..96dff7755af 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -117,7 +117,7 @@ if ( ($action == 'update' && empty($_POST["cancel"])) } else dol_syslog($imgThumbMini); } - else dol_syslog($langs->trans("ErrorImageFormatNotSupported"),LOG_WARNING); + else dol_syslog("ErrorImageFormatNotSupported",LOG_WARNING); } else if (preg_match('/^ErrorFileIsInfectedWithAVirus/',$result)) { @@ -133,9 +133,10 @@ if ( ($action == 'update' && empty($_POST["cancel"])) } } else - { + { $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 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); - + if($_POST["optionlocaltax1"]=="localtax1on") { if(!isset($_REQUEST['lt1'])) @@ -226,13 +227,15 @@ if ($action == 'addthumb') else { $error++; - setEventMessage($langs->trans("ErrorImageFormatNotSupported"),'errors'); - dol_syslog($langs->transnoentities("ErrorImageFormatNotSupported"),LOG_WARNING); + $langs->load("errors"); + setEventMessage($langs->trans("ErrorBadImageFormat"),'errors'); + dol_syslog($langs->transnoentities("ErrorBadImageFormat"),LOG_WARNING); } } else { $error++; + $langs->load("errors"); setEventMessage($langs->trans("ErrorFileDoesNotExists",$_GET["file"]),'errors'); 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"); } print ''; - + print ''; - } + } print ''; print "
'.$langs->trans("Statistics").'
'; + print '
'; $SommeA=0; $SommeB=0; diff --git a/htdocs/admin/agenda.php b/htdocs/admin/agenda.php index c7cb4258935..5ad9673a16f 100644 --- a/htdocs/admin/agenda.php +++ b/htdocs/admin/agenda.php @@ -154,7 +154,7 @@ print '
'.$langs->trans("ActionsEvents").''.$langs->trans("All").'/'.$langs->trans("None").''; print '
'.$langs->trans("CalcLocaltax").': '; $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); @@ -1003,7 +1006,7 @@ else if($conf->global->MAIN_INFO_VALUE_LOCALTAX1!=0) { print '
'.$langs->trans("LTRate").': '. $conf->global->MAIN_INFO_VALUE_LOCALTAX1 .'
'.$langs->trans("CalcLocaltax").': '; if($conf->global->MAIN_INFO_LOCALTAX_CALC1==0) { @@ -1016,7 +1019,7 @@ else else if($conf->global->MAIN_INFO_LOCALTAX_CALC1==2){ print $langs->transcountry("CalcLocaltax3",$mysoc->country_code); } - + print '
"; print "\n"; @@ -1054,7 +1057,7 @@ else if($conf->global->MAIN_INFO_VALUE_LOCALTAX2!=0) { print ''.$langs->trans("LTRate").': '. $conf->global->MAIN_INFO_VALUE_LOCALTAX2 .''; - } + } print ''.$langs->trans("CalcLocaltax").': '; if($conf->global->MAIN_INFO_LOCALTAX_CALC2==0) { @@ -1068,7 +1071,7 @@ else { print $langs->transcountry("CalcLocaltax3",$mysoc->country_code); } - + print ''; print ""; print "\n"; diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 7a84470b320..d81f306be9e 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -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[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[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[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"; @@ -387,13 +387,14 @@ if ($id == 11) $langs->load("bills"); $langs->load("interventions"); $elementList = array( - 'proposal' => $langs->trans('Proposal'), - 'order' => $langs->trans('Order'), - 'invoice' => $langs->trans('Bill'), + '' => '', +// 'proposal' => $langs->trans('Proposal'), +// 'order' => $langs->trans('Order'), +// 'invoice' => $langs->trans('Bill'), 'invoice_supplier' => $langs->trans('SupplierBill'), 'order_supplier' => $langs->trans('SupplierOrder'), - 'intervention' => $langs->trans('InterventionCard'), - 'contract' => $langs->trans('Contract'), +// 'intervention' => $langs->trans('InterventionCard'), +// 'contract' => $langs->trans('Contract'), 'project' => $langs->trans('Project'), 'project_task' => $langs->trans('Task'), 'agenda' => $langs->trans('Agenda'), @@ -402,10 +403,11 @@ if ($id == 11) 'propal' => $langs->trans('Proposal'), 'commande' => $langs->trans('Order'), 'facture' => $langs->trans('Bill'), - 'facture_fourn' => $langs->trans('SupplierBill'), +// 'facture_fourn' => $langs->trans('SupplierBill'), 'fichinter' => $langs->trans('InterventionCard') ); if (! empty($conf->global->MAIN_SUPPORT_SHARED_CONTACT_BETWEEN_THIRDPARTIES)) $elementList["societe"] = $langs->trans('ThirdParty'); + asort($elementList); $sourceList = array( 'internal' => $langs->trans('Internal'), '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 @@ -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); } +//var_dump($elementList); /* * Show a dictionary @@ -813,7 +856,7 @@ if ($id) } if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') $alabelisused=1; } - print ''; + print ''; print ''; print ' '; print ''; @@ -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($langs->trans("Status"),0,$_SERVER["PHP_SELF"],"active",($page?'page='.$page.'&':'').'&id='.$id,"",'align="center"',$sortfield,$sortorder); - print ' '; + // Favorite - Only activated on country dictionary + 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 ' '; print ''; // 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:'')).'&code='.(! empty($obj->code)?$obj->code:'').'&id='.$id.'&'; + // Favorite + // Only activated on country dictionary + if ($id == 4) + { + print ''; + if ($iserasable) print ''.$actl[$obj->favorite].''; + else print $langs->trans("AlwaysActive"); + print ''; + } + // Active print ''; if ($isdisable) print ''.$actl[$obj->active].''; diff --git a/htdocs/admin/ldap_groups.php b/htdocs/admin/ldap_groups.php index e043bff88aa..a0bb5c4b605 100644 --- a/htdocs/admin/ldap_groups.php +++ b/htdocs/admin/ldap_groups.php @@ -219,6 +219,10 @@ if (function_exists("ldap_connect")) $info=$object->_load_ldap_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 $result2=$ldap->add($dn,$info,$user); // Now the test $result3=$ldap->delete($dn); // Clean what we did diff --git a/htdocs/admin/notification.php b/htdocs/admin/notification.php index ca68c54c805..14aeba65c29 100644 --- a/htdocs/admin/notification.php +++ b/htdocs/admin/notification.php @@ -32,6 +32,7 @@ $langs->load("other"); $langs->load("orders"); $langs->load("propal"); $langs->load("bills"); +$langs->load("errors"); // Security check if (!$user->admin) @@ -39,19 +40,32 @@ if (!$user->admin) $action = GETPOST("action"); + /* * Actions */ if ($action == 'setvalue' && $user->admin) { - $result=dolibarr_set_const($db, "NOTIFICATION_EMAIL_FROM",$_POST["email_from"],'chaine',0,'',$conf->entity); - if ($result >= 0) + $result=dolibarr_set_const($db, "NOTIFICATION_EMAIL_FROM", $_POST["email_from"], 'chaine', 0, '', $conf->entity); + if ($result < 0) $error++; + + if (! $error) + { + foreach($_POST as $key => $val) + { + if (! preg_match('/^NOTIFICATION_FIXEDEMAIL_/',$key)) continue; + //print $key.' - '.$val.'
'; + $result=dolibarr_set_const($db, $key, $val, 'chaine', 0, '', $conf->entity); + } + } + + if (! $error) { setEventMessage($langs->trans("SetupSaved")); } else - { + { setEventMessage($langs->trans("Error"),'errors'); } } @@ -67,7 +81,7 @@ llxHeader(); $linkback=''.$langs->trans("BackToModuleList").''; print_fiche_titre($langs->trans("NotificationSetup"),$linkback,'setup'); -print $langs->trans("NotificationsDesc").'

'; +print $langs->trans("NotificationsDesc").'

'; print '
'; print ''; @@ -83,19 +97,13 @@ print "\n"; $var=!$var; print ''; print $langs->trans("NotificationEMailFrom").''; -print ''; -if (! empty($conf->global->NOTIFICATION_EMAIL_FROM) && ! isValidEmail($conf->global->NOTIFICATION_EMAIL_FROM)) print ' '.img_warning($langs->trans("BadEMail")); +print ''; +if (! empty($conf->global->NOTIFICATION_EMAIL_FROM) && ! isValidEmail($conf->global->NOTIFICATION_EMAIL_FROM)) print ' '.img_warning($langs->trans("ErrorBadEMail")); print ''; print ''; print '
'; -print '
'; - -print '
'; -print '
'; - - print_fiche_titre($langs->trans("ListOfAvailableNotifications"),'',''); print ''; @@ -103,6 +111,7 @@ print ''; print ''; print ''; print ''; +print ''; print "\n"; // Load array of available notifications @@ -123,10 +132,21 @@ foreach($listofnotifiedevents as $notifiedevent) print ''; print ''; print ''; + $param='NOTIFICATION_FIXEDEMAIL_'.$notifiedevent['code']; + print ''; print ''; } print '
'.$langs->trans("Module").''.$langs->trans("Code").''.$langs->trans("Label").''.$langs->trans("FixedEmailTarget").'
'.$elementLabel.''.$notifiedevent['code'].''.$label.''; + if (! empty($conf->global->$param) && ! isValidEmail($conf->global->$param)) print ' '.img_warning($langs->trans("ErrorBadEMail")); + print '
'; -$db->close(); +print '
'; + +print '
'; + +print ''; + llxFooter(); + +$db->close(); diff --git a/htdocs/admin/osc-languages.php b/htdocs/admin/osc-languages.php deleted file mode 100644 index 804c72f2850..00000000000 --- a/htdocs/admin/osc-languages.php +++ /dev/null @@ -1,90 +0,0 @@ - - * - * 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 . - */ - -/** - * \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 "

"; -print ""; -print ""; -print ""; -print ""; -print "\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 ""; - print "\n"; - print "\n"; - print "\n"; - print "\n"; - $i++; - } - $db->free(); -} - -print "
idNameCode
$objp->languages_id$objp->name$objp->code
"; - - -$db->close(); - -llxFooter(); diff --git a/htdocs/boutique/admin/boutique.php b/htdocs/boutique/admin/boutique.php deleted file mode 100644 index b4430edcbe1..00000000000 --- a/htdocs/boutique/admin/boutique.php +++ /dev/null @@ -1,204 +0,0 @@ - - * Copyright (C) 2004 Sebastien Di Cintio - * Copyright (C) 2004 Benoit Mortier - * Copyright (C) 2006 Laurent Destailleur - * Copyright (C) 2012 Juanjo Menent - * - * 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 . - * - */ - -/** - * \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().">
\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.="
".$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.="
".$oscommercedb->error(); - setEventMessage($mesg, 'errors'); - } - - //$resql=$db->query("select count(*) from ".MAIN_DB_PREFIX."const"); - //print "< ".$db." - ".$db->db." - ".$resql." - ".$db->error().">
\n"; -} - - - -/* - * Affichage page - */ - -llxHeader(); - -$linkback=''.$langs->trans("BackToModuleList").''; -print_fiche_titre($langs->trans("OSCommerceSetup"),$linkback,'setup'); - - - -print '
'; - -$var=true; -print '

'; -print ''; -print ""; -print ""; -print ""; -print ""; -print ""; -print ""; -$var=!$var; -print ""; -print ""; -print ""; -print ""; -print ""; -$var=!$var; -print ""; -print ""; -print ""; -print ""; -print ""; -$var=!$var; -print ""; -print ""; -print ""; -print ""; -print ""; -$var=!$var; -print ""; -print ""; -print ""; -print ""; -print ""; -$var=!$var; -print ""; -print ""; -print ""; -print ''; -print ""; -$var=!$var; -print ""; -print ""; -print ""; -print ''; -print ""; -print "
".$langs->trans("Parameter")."".$langs->trans("Value")."".$langs->trans("Examples")."
".$langs->trans("OSCommerceServer")."global->OSC_DB_HOST) . "\" size=\"30\">localhost"; -//print "
__dolibarr_main_db_host__ (".$dolibarr_main_db_host.")" -print "
".$langs->trans("OSCommerceDatabaseName")."global->OSC_DB_NAME) . "\" size=\"30\">oscommerce"; -//print "
__dolibarr_main_db_name__ (".$dolibarr_main_db_name.")"; -print "
".$langs->trans("OSCommercePrefix")."global->DB_TABLE_PREFIX) . "\" size=\"30\">osc_"; -print "
".$langs->trans("OSCommerceUser")."global->OSC_DB_USER) . "\" size=\"30\">oscommerceuser"; -//print "
__dolibarr_main_db_user__ (".$dolibarr_main_db_user.")"; -print "
".$langs->trans("Password")."global->OSC_DB_PASS) . "\" size=\"30\">'; -//if ($dolibarr_main_db_pass) print '__dolibarr_main_db_pass__ ('.preg_replace('/./i','*',$dolibarr_main_db_pass).')'; -print ' 
".$langs->trans("PasswordRetype")."global->OSC_DB_PASS) ."\" size=\"30\">'; -//if ($dolibarr_main_db_pass) print '__dolibarr_main_db_pass__ ('.preg_replace('/./i','*',$dolibarr_main_db_pass).')'; -print ' 
"; - - -print '
'; -print "trans("TestConnection")."\">"; -print "   "; -print "trans("Save")."\">"; -print "
"; - -print "
\n"; - -$db->close(); - -llxFooter(); diff --git a/htdocs/boutique/admin/index.html b/htdocs/boutique/admin/index.html deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/htdocs/boutique/client/card.php b/htdocs/boutique/client/card.php deleted file mode 100644 index 4944911f408..00000000000 --- a/htdocs/boutique/client/card.php +++ /dev/null @@ -1,126 +0,0 @@ - - * Copyright (C) 2003-2005 Eric Seigne - * Copyright (C) 2006-2010 Laurent Destailleur - * - * 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 . - * - */ - -/** - * \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 '
'.$langs->trans("CustomerCard").': '.$client->name.'

'; - - print ''; - print ""; - print ''; - print "
Nom'.$client->name.'
"; - - - /* - * 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 ''; - print ""; - print "\n"; - $var=True; - while ($i < $num) - { - $objp = $dbosc->fetch_object($resql); - $var=!$var; - print ""; - - print '\n"; - print "\n"; - $i++; - } - print "
Commandes
Fiche '; - - print dol_print_date($dbosc->jdate($objp->date_purchased),'dayhour')."\n"; - print $objp->total . "
"; - $dbosc->free($resql); - } - else - { - print "

ERROR 1

\n"; - dol_print_error($dbosc); - } - - } - else - { - print "

ERROR 1

\n"; - dol_print_error($dbosc); - } -} -else -{ - print "

ERROR 1

\n"; - print "Error"; -} - - -/* ************************************************************************** */ -/* */ -/* Barre d'action */ -/* */ -/* ************************************************************************** */ - -// Pas d'action - - -$dbosc->close(); - -llxFooter(); diff --git a/htdocs/boutique/client/class/boutiqueclient.class.php b/htdocs/boutique/client/class/boutiqueclient.class.php deleted file mode 100644 index fdf393043b0..00000000000 --- a/htdocs/boutique/client/class/boutiqueclient.class.php +++ /dev/null @@ -1,77 +0,0 @@ - - * - * 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 . - * - */ - -/** - * \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; - } - } - -} diff --git a/htdocs/boutique/client/class/index.html b/htdocs/boutique/client/class/index.html deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/htdocs/boutique/client/index.php b/htdocs/boutique/client/index.php deleted file mode 100644 index dae59eb50cb..00000000000 --- a/htdocs/boutique/client/index.php +++ /dev/null @@ -1,91 +0,0 @@ - - * Copyright (C) 2004-2006 Laurent Destailleur - * - * 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 . - * - */ - -/** - * \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 ""; - print ""; - 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 ''; - print "\n"; - $var=True; - while ($i < $num) - { - $objp = $dbosc->fetch_object($resql); - $var=!$var; - print ""; - print '\n"; - print '\n"; - print "\n"; - print "\n"; - print "\n"; - $i++; - } - print "
'.$langs->trans("EMail").''.$langs->trans("Newsletter").'
'.$objp->customers_firstname."'.$objp->customers_lastname."$objp->customers_email_address$objp->customers_newsletter
"; - $dbosc->free(); -} -else -{ - dol_print_error($dbosc); -} - -$dbosc->close(); - -llxFooter(); diff --git a/htdocs/boutique/commande/ca.php b/htdocs/boutique/commande/ca.php deleted file mode 100644 index 5030e5ac559..00000000000 --- a/htdocs/boutique/commande/ca.php +++ /dev/null @@ -1,115 +0,0 @@ - - * Copyright (C) 2004-2006 Laurent Destailleur - * - * 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 . - * - */ - -/** - * \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 ''; -print ''; -print ''; - -$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 ""; - print ''; - print ''; - - print "\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 ""; - print ''; - print ''; - $i++; - } - - $dbosc->free(); -} -else -{ - dol_print_error($dbosc); -} - - -print "
'.$langs->trans("Description").''.$langs->trans("Lastname").'
Somme des commandes'.price($objp->value).'
Somme des frais de port'.price($objp->value).'
"; - -$dbosc->close(); - -llxFooter(); diff --git a/htdocs/boutique/commande/card.php b/htdocs/boutique/commande/card.php deleted file mode 100644 index f6719bb40bb..00000000000 --- a/htdocs/boutique/commande/card.php +++ /dev/null @@ -1,155 +0,0 @@ - - * Copyright (C) 2003-2005 Eric Seigne - * Copyright (C) 2004-2006 Laurent Destailleur - * - * 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 . - * - */ - -/** - * \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 '
'.$langs->trans("OrderCard").': '.$commande->id.'

'; - - print ''; - print ''; - print ''; - - print ''; - - print ""; - - print ""; - print ""; - print ""; - - print "
Date'.$commande->date.'
Client'.$commande->client_name.'
Paiement'.$commande->payment_method.'
".$langs->trans("Address")."".$langs->trans("Delivery")."".$langs->trans("Invoice")."
 ".$commande->delivery_adr->name."
".$commande->delivery_adr->street."
".$commande->delivery_adr->zip."
".$commande->delivery_adr->city."
".$commande->delivery_adr->country."
".$commande->billing_adr->name."
".$commande->billing_adr->street."
".$commande->billing_adr->zip."
".$commande->billing_adr->city."
".$commande->billing_adr->country."
"; - - print "
"; - - /* - * 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 ''; - print ''; - print ''; - print "\n"; - $var=True; - while ($i < $num) - { - $objp = $dbosc->fetch_object($resql); - $var=!$var; - print ""; - print '"; - - print '\n"; - print "\n"; - print "\n"; - - print "\n"; - $i++; - } - print "
'.$langs->trans("Products").''.$langs->trans("Number").''.$langs->trans("Price").'Prix final
'; - print 'Fiche livre'; - - print ''.$objp->products_name.''; - print "$objp->products_quantityrowid\">".price($objp->products_price)."rowid\">".price($objp->final_price)."
"; - $dbosc->free(); - } - else - { - print $dbosc->error(); - } - - /* - * - * - */ - print "
"; - - print ''; - print ""; - print ''; - print ''; - print "
Frais d\'expeditions'.price($commande->total_ot_shipping).' EUR
'.$langs->trans("Lastname").''.price($commande->total_ot_total).' EUR
"; - - - - } - else - { - print "Fetch failed"; - } -} -else -{ - print "Error"; -} - - -/* ************************************************************************** */ -/* */ -/* Barre d'action */ -/* */ -/* ************************************************************************** */ - -print '
'; -print ''; -print ''; -print ''; -print ''; -print ''; -print '
-----

'; - - - -$dbosc->close(); - -llxFooter(); diff --git a/htdocs/boutique/commande/class/boutiquecommande.class.php b/htdocs/boutique/commande/class/boutiquecommande.class.php deleted file mode 100644 index 0a3383a33a3..00000000000 --- a/htdocs/boutique/commande/class/boutiquecommande.class.php +++ /dev/null @@ -1,138 +0,0 @@ - - * Copyright (C) 2008 Laurent Destailleur - * - * 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 . - */ - -/** - * \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; - } - -} diff --git a/htdocs/boutique/commande/class/index.html b/htdocs/boutique/commande/class/index.html deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/htdocs/boutique/commande/index.php b/htdocs/boutique/commande/index.php deleted file mode 100644 index 0ce6b7b3655..00000000000 --- a/htdocs/boutique/commande/index.php +++ /dev/null @@ -1,92 +0,0 @@ - - * Copyright (C) 2006 Laurent Destailleur - * - * 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 . - * - */ - -/** - * \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 ""; - print ""; - print ""; - print ""; - print_liste_field_titre("Client","commande.php", "customers_name"); - print ''; - print "\n"; - $var=True; - while ($i < $num) - { - $objp = $dbosc->fetch_object($resql); - $var=!$var; - print ""; - - print ''; - print '\n"; - print ''; - print "\n"; - $i++; - } - print "
".$langs->trans("Ref")."".$langs->trans("Date")."'.$langs->trans("Total").'
Fiche '; - print $objp->orders_id .""; - print dol_print_date($dbosc->jdate($objp->date_purchased),'dayhour').''.$objp->customers_name."'.price($objp->value).'
"; - $dbosc->free(); -} -else -{ - dol_print_error($dbosc); -} - -$dbosc->close(); - -llxFooter(); diff --git a/htdocs/boutique/critiques/bestproduct.php b/htdocs/boutique/critiques/bestproduct.php deleted file mode 100644 index dd3cda24d96..00000000000 --- a/htdocs/boutique/critiques/bestproduct.php +++ /dev/null @@ -1,97 +0,0 @@ - - * Copyright (C) 2003 Eric Seigne - * Copyright (C) 2006 Laurent Destailleur - * - * 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 . - * - */ - -/** - * \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 "

"; -print "'; -print ''; -print "\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 ""; - print ''; - print '\n"; - print '\n"; - print '\n"; - print "\n"; - $i++; - } - $dbosc->free(); -} -else -{ - dol_print_error($dbosc); -} - -print "
".$langs->trans("Ref"); -print 'Indice critiquesQuantite'; -print 'Status
'.$objp->products_model.''.$objp->rat."'.$objp->products_quantity."'.$objp->products_status."
"; - - -$dbosc->close(); - -llxFooter(); diff --git a/htdocs/boutique/critiques/card.php b/htdocs/boutique/critiques/card.php deleted file mode 100644 index 1c75faebbee..00000000000 --- a/htdocs/boutique/critiques/card.php +++ /dev/null @@ -1,82 +0,0 @@ - - * Copyright (C) 2006 Laurent Destailleur - * - * 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 . - * - */ - -/** - * \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 '

Fiche Critique

'; - - print ''; - print ""; - print ''; - - print ''; - print "
Produit'.$critique->product_name.'
Texte'.nl2br($critique->text).'
"; - - - - } - else - { - print "Fetch failed"; - } - -} - -/* ************************************************************************** */ -/* */ -/* Barre d'action */ -/* */ -/* ************************************************************************** */ - -print '
'; -print ''; -print ''; -print ''; -print ''; -print ''; -print '
-----

'; - - - -$dbosc->close(); - -llxFooter(); - diff --git a/htdocs/boutique/critiques/class/critique.class.php b/htdocs/boutique/critiques/class/critique.class.php deleted file mode 100644 index cd3a72088ad..00000000000 --- a/htdocs/boutique/critiques/class/critique.class.php +++ /dev/null @@ -1,84 +0,0 @@ - - * - * 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 . - */ - -/** - * \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; - } - -} diff --git a/htdocs/boutique/critiques/class/index.html b/htdocs/boutique/critiques/class/index.html deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/htdocs/boutique/critiques/index.php b/htdocs/boutique/critiques/index.php deleted file mode 100644 index 35e536ed66e..00000000000 --- a/htdocs/boutique/critiques/index.php +++ /dev/null @@ -1,92 +0,0 @@ - - * Copyright (C) 2006 Laurent Destailleur - * - * 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 . - * - */ - -/** - * \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 "

"; -print ''; -print ""; -print ""; -print ""; -print ""; -print "\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 ""; - print "\n"; - print '\n"; - print "\n"; - print "\n"; - $i++; - } - $dbosc->free(); -} -else -{ - dol_print_error($dbosc); -} - -print "
ProduitCritiqueNote
".substr($objp->products_name, 0, 30)."'.substr($objp->reviews_text, 0, 40)." ...$objp->reviews_rating
"; - - -$dbosc->close(); - -llxFooter(); diff --git a/htdocs/boutique/index.php b/htdocs/boutique/index.php deleted file mode 100644 index 28cd6ec397a..00000000000 --- a/htdocs/boutique/index.php +++ /dev/null @@ -1,245 +0,0 @@ - - * Copyright (C) 2004-2007 Laurent Destailleur - * - * 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 . - */ - -/** - * \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 ''; - -print ''; -/* - * 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 '
'; - - -/* - * Turnover - */ - -print_titre($langs->trans('SalesTurnover')); - -print ''; -print ''; -print ''; - -$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 ""; - print ''; - print ''; - - print "\n"; - $i++; - } - } - - $dbosc->free(); -} -else -{ - dol_print_error($dbosc); -} - - -print "
'.$langs->trans("Month").''.$langs->trans("Total").'
'.$objp->mois.''.price($objp->value).'
"; -print '
'; -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 ''; - print ''; - print ''; - - $num = min($num,OSC_MAXNBCOM); - while ($i < $num) - { - - $obj = $dbosc->fetch_object($resql); - print ""; - $i++; - } - print "
'.$langs->trans("LastOrders").'
".$obj->orders_id."".$obj->customers_name."".price($obj->value)."".$obj->payment_method."

"; - } -} -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 ''; - print ''; - print ''; - - $num = min($num,OSC_MAXNBCOM); - while ($i < $num) - { - - $obj = $dbosc->fetch_object($resql); - print ""; - $i++; - } - print "
'.$langs->trans("En Attente").'
$obj->orders_id$obj->customers_name".price($obj->value)."$obj->payment_method

"; - } -} -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 ''; - print ''; - print ''; - - $num = min($num,OSC_MAXNBCOM); - while ($i < $num) - { - - $obj = $dbosc->fetch_object($resql); - print ""; - $i++; - } - print "
'.$langs->trans("TreatmentInProgress").'
$obj->orders_id$obj->customers_name".price($obj->value)."$obj->payment_method

"; - } -} -else -{ - dol_print_error($dbosc); -} - - -print '
'; - print ''; - print ''; - - $num = min($num,OSC_MAXNBCOM); - while ($i < $num) - { - $obj = $dbosc->fetch_object($resql); - print ""; - $i++; - } - print "
'.$langs->trans("Derniers clients").'
$obj->date_purchased$obj->customers_name$obj->delivery_country".price($obj->value)."$obj->payment_method$obj->orders_id$obj->statut

"; - } -} -else -{ - dol_print_error($dbosc); -} -print ''; - - -llxFooter(); - -$dbosc->close(); diff --git a/htdocs/boutique/notification/index.php b/htdocs/boutique/notification/index.php deleted file mode 100644 index 6799af10708..00000000000 --- a/htdocs/boutique/notification/index.php +++ /dev/null @@ -1,89 +0,0 @@ - - * Copyright (C) 2003 Eric Seigne - * Copyright (C) 2004-2006 Laurent Destailleur - * - * 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 . - * - */ - -/** - * \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 ""; - print ""; - print_liste_field_titre("Client",$_SERVER["PHP_SELF"], "c.customers_lastname"); - print ''; - print "\n"; - $var=True; - while ($i < $num) - { - $objp = $dbosc->fetch_object($resql); - $var=!$var; - print ""; - print "\n"; - print '"; - print "\n"; - $i++; - } - print "
'.$langs->trans("Product").'
rowid\">$objp->customers_firstname $objp->customers_lastname'.$objp->products_name."
"; - $dbosc->free($resql); -} -else -{ - dol_print_error($dbosc); -} - -$dbosc->close(); - -llxFooter(); diff --git a/htdocs/boutique/notification/produits.php b/htdocs/boutique/notification/produits.php deleted file mode 100644 index ad04d7d61b0..00000000000 --- a/htdocs/boutique/notification/produits.php +++ /dev/null @@ -1,95 +0,0 @@ - - * Copyright (C) 2003 Eric Seigne - * Copyright (C) 2006 Laurent Destailleur - * - * 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 . - * - */ - -/** - * \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 "

"; - print ""; - print ''; - print ""; - print ""; - print "\n"; - $var=True; - while ($i < $num) - { - $objp = $dbosc->fetch_object($resql); - $var=!$var; - print ""; - - print '"; - print ''; - - print ''; - print ''; - - print "\n"; - $i++; - } - print "
ProduitNb.
'.$objp->products_name."'.$objp->nb.'Voir les clientsEnvoyer une news
"; - $dbosc->free(); -} -else -{ - dol_print_error($dbosc); -} - -$dbosc->close(); - -llxFooter(); diff --git a/htdocs/boutique/osc_master.inc.php b/htdocs/boutique/osc_master.inc.php deleted file mode 100644 index 057c15f30e1..00000000000 --- a/htdocs/boutique/osc_master.inc.php +++ /dev/null @@ -1,38 +0,0 @@ - - * - * 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 . - */ - -/** - * \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 '

'.$langs->trans('FailedConnectDBCheckModuleSetup').'
'; - llxFooter(); - exit; -} - diff --git a/htdocs/boutique/produits/index.php b/htdocs/boutique/produits/index.php deleted file mode 100644 index 2574b7cb7f4..00000000000 --- a/htdocs/boutique/produits/index.php +++ /dev/null @@ -1,88 +0,0 @@ - - * Copyright (C) 2004-2006 Laurent Destailleur - * - * 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 . - * - */ - -/** - * \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 ""; - print ""; - 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 ''; - print "\n"; - $var=True; - while ($i < $num) - { - $objp = $dbosc->fetch_object($resql); - $var=!$var; - print ""; - print '\n"; - print '\n"; - print "\n"; - print "\n"; - print "\n"; - $i++; - } - print "
'.$langs->trans("EMail").''.$langs->trans("Newsletter").'
'.$objp->customers_firstname."'.$objp->customers_lastname."$objp->customers_email_address$objp->customers_newsletter
"; - $dbosc->free($resql); -} -else -{ - dol_print_error($dbosc); -} - -$dbosc->close(); - -llxFooter(); diff --git a/htdocs/boutique/produits/osc-list.php b/htdocs/boutique/produits/osc-list.php deleted file mode 100644 index 4edf156dd05..00000000000 --- a/htdocs/boutique/produits/osc-list.php +++ /dev/null @@ -1,106 +0,0 @@ - - * Copyright (C) 2006 Laurent Destailleur - * - * 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 . - * - */ - -/** - * \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 "

"; -print ''; -print ""; -print ""; -print ""; -print ""; -print ''; -print ''; -print ''."\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 ""; - print "\n"; - print "\n"; - print "\n"; - print "\n"; - print '\n"; - print '\n"; - print "\n"; - $i++; - } - $dbosc->free(); -} -else -{ - dol_print_error($dbosc); -} - -print "
idRefTitreGroupeStockStatus
$objp->products_id$objp->products_model$objp->products_name$objp->manufacturers_name'.$objp->products_quantity."'.$objp->products_status."
"; - - -$dbosc->close(); - -llxFooter(); diff --git a/htdocs/boutique/promotion/class/index.html b/htdocs/boutique/promotion/class/index.html deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/htdocs/boutique/promotion/class/promotion.class.php b/htdocs/boutique/promotion/class/promotion.class.php deleted file mode 100644 index 6e965ad76d1..00000000000 --- a/htdocs/boutique/promotion/class/promotion.class.php +++ /dev/null @@ -1,213 +0,0 @@ - - * - * 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 . - * - */ - -/** - * \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"; - - } - - -} diff --git a/htdocs/boutique/promotion/index.php b/htdocs/boutique/promotion/index.php deleted file mode 100644 index 10dfa09a8c1..00000000000 --- a/htdocs/boutique/promotion/index.php +++ /dev/null @@ -1,119 +0,0 @@ - - * Copyright (C) 2004-2006 Laurent Destailleur - * - * 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 . - */ - -/** - * \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 ''; - print ""; - print_liste_field_titre($langs->trans("Ref"),"index.php", "p.products_model"); - print_liste_field_titre("Titre","index.php", "pd.products_name"); - print ""; - print ''; - print ''; - print "\n"; - $var=True; - while ($i < $num) - { - $objp = $dbosc->fetch_object($i); - $var=!$var; - - print ""; - print '"; - print '"; - - if ($objp->status == 1) - { - print ''; - print ''; - } - else - { - print ''; - print ''; - } - print ""; - print '"; - print '"; - print ""; - $i++; - } - print "
  FinPrix initialPrix remise
'.$objp->products_model."'.$objp->products_name."actif'; - print ''; - print ''; - print ''; - print 'inactif".dol_print_date($dbosc->jdate($objp->fin),'day')."'.price($objp->products_price)."'.price($objp->specials_new_products_price)."
"; - $dbosc->free(); -} -else -{ - dol_print_error($dbosc); -} -$dbosc->close(); - -llxFooter(); - diff --git a/htdocs/categories/card.php b/htdocs/categories/card.php index f09a526b327..672c92b9508 100644 --- a/htdocs/categories/card.php +++ b/htdocs/categories/card.php @@ -144,6 +144,10 @@ if ($action == 'add' && $user->rights->categorie->creer) $action = 'confirmed'; $_POST["addcat"] = ''; } + else + { + setEventMessage($object->error,'errors'); + } } } diff --git a/htdocs/categories/categorie.php b/htdocs/categories/categorie.php index c74eefdc430..e9e11b656b9 100644 --- a/htdocs/categories/categorie.php +++ b/htdocs/categories/categorie.php @@ -621,8 +621,17 @@ function formCategory($db,$object,$typeid,$socid=0,$showclassifyform=1) if ($typeid == 3) $title = $langs->trans("MembersCategoriesShort"); if ($typeid == 4) $title = $langs->trans("ContactCategoriesShort"); + $linktocreate=''; + if ($showclassifyform && $user->rights->categorie->creer) + { + $linktocreate='id.'&type='.$typeid).'">'; + $linktocreate.=$langs->trans("CreateCat").' '; + $linktocreate.=img_picto($langs->trans("Create"),'filenew'); + $linktocreate.=""; + } + print '
'; - print_fiche_titre($title,'',''); + print_fiche_titre($title,$linktocreate,''); // Form to add record into a category if ($showclassifyform) @@ -634,19 +643,10 @@ function formCategory($db,$object,$typeid,$socid=0,$showclassifyform=1) print ''; print ''; print ''; - if ($user->rights->categorie->creer) - { - print ''; - } + print ''; + print ''; print ''; print '
'; - print $langs->trans("ClassifyInCategory").'  '; + print ''.$langs->trans("ClassifyInCategory").'  '; print $form->select_all_categories($typeid,'auto'); - print ''; - print ''; - print 'id.'&type='.$typeid).'">'; - print $langs->trans("CreateCat").' '; - print img_picto($langs->trans("Create"),'filenew'); - print ""; - print '
'; print ''; @@ -679,10 +679,7 @@ function formCategory($db,$object,$typeid,$socid=0,$showclassifyform=1) print ""; // Categorie - print ""; - //$c->id=; - //print $c->getNomUrl(1); - print img_object('','category').' '.$way.""; + print "".img_object('','category').' '.$way.""; // Link to delete from category print ''; diff --git a/htdocs/categories/index.php b/htdocs/categories/index.php index eceeb2890bc..76a19c91d7d 100644 --- a/htdocs/categories/index.php +++ b/htdocs/categories/index.php @@ -171,7 +171,7 @@ $nbofentries=(count($data) - 1); if ($nbofentries > 0) { - print ''; + print ''; tree_recur($data,$data[0],0); print ''; } diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index a306ff202b4..607f8e14c4e 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -218,13 +218,7 @@ if ($action == 'add') { if ($i == 0) // First entry { - $usertodo=new User($db); - if ($value['id'] > 0) - { - $usertodo->fetch($value['id']); - $object->userownerid = $usertodo->id; - } - $object->usertodo = $usertodo; + if ($value['id'] > 0) $object->userownerid=$value['id']; $object->transparency = (GETPOST("transparency")=='on'?1:0); } @@ -236,13 +230,7 @@ if ($action == 'add') if (! $error && ! empty($conf->global->AGENDA_ENABLE_DONEBY)) { - $userdone=new User($db); - if ($_POST["doneby"] > 0) - { - $userdone->fetch($_POST["doneby"]); - $object->userdoneid = $userdone->id; - } - $object->userdone = $userdone; + if (GETPOST("doneby") > 0) $object->userdoneid = GETPOST("doneby","int"); } $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; // Check parameters - if (empty($object->usertodo)) + if (empty($object->userownerid)) { $error++; $donotclearsession=1; $action = 'create'; @@ -299,19 +287,22 @@ if ($action == 'add') { unset($_SESSION['assignedtouser']); + $moreparam=''; + if ($user->id != $object->ownerid) $moreparam="usertodo=-1"; // We force to remove filter so created record is visible when going back to per user view. + $db->commit(); if (! empty($backtopage)) { - dol_syslog("Back to ".$backtopage); - header("Location: ".$backtopage); + dol_syslog("Back to ".$backtopage.($moreparam?(preg_match('/\?/',$backtopage)?'&'.$moreparam:'?'.$moreparam):'')); + header("Location: ".$backtopage.($moreparam?(preg_match('/\?/',$backtopage)?'&'.$moreparam:'?'.$moreparam):'')); } 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 { - header("Location: ".DOL_URL_ROOT.'/comm/action/index.php'); + header("Location: ".DOL_URL_ROOT.'/comm/action/index.php'.($moreparam?'?'.$moreparam:'')); } exit; } @@ -389,8 +380,6 @@ if ($action == 'update') // Users $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 { // 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; } } + 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) { + if ($i == 0) $object->userownerid = $val['id']; $object->userassigned[$val['id']]=array('id'=>$val['id'], 'mandatory'=>0, 'transparency'=>($user->id == $val['id'] ? $transparency : '')); + $i++; } if (! empty($conf->global->AGENDA_ENABLE_DONEBY)) { - $userdone=new User($db); - if ($_POST["doneby"]) - { - $userdone->fetch($_POST["doneby"]); - } - $object->userdone = $userdone; + if (GETPOST("doneby")) $object->userdoneid=GETPOST("doneby","int"); } // Check parameters @@ -428,7 +419,7 @@ if ($action == 'update') { $result=$cactioncomm->fetch(GETPOST('actioncode')); } - if (empty($object->usertodo)) + if (empty($object->userownerid)) { $error++; $donotclearsession=1; $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->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 @@ -1088,7 +1076,7 @@ if ($id > 0) $listofuserid=array(); 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 { // Restore array with key with same value than param 'id' @@ -1115,7 +1103,12 @@ if ($id > 0) if ($conf->global->AGENDA_ENABLE_DONEBY) { print ''.$langs->trans("ActionDoneBy").''; - 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 ''; } diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 62acfb963b1..b31f686c9fe 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -66,7 +66,7 @@ class ActionComm extends CommonObject var $note; // Description 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 $usertodo; // Object user of owner // deprecated var $userdone; // Object user that did action // deprecated @@ -99,10 +99,6 @@ class ActionComm extends CommonObject $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->contact = new stdClass(); // deprecated } @@ -142,8 +138,8 @@ class ActionComm extends CommonObject if ($this->elementtype=='commande') $this->elementtype='order'; if ($this->elementtype=='contrat') $this->elementtype='contract'; - $userownerid=isset($this->usertodo->id)?$this->usertodo->id:$this->userownerid; // For backward compatibility - $userdoneid=isset($this->userdone->id)?$this->userdone->id:$this->userdoneid; // For backward compatibility + $userownerid=$this->userownerid; + $userdoneid=$this->userdoneid; if (! $this->type_id || ! $this->type_code) { @@ -361,15 +357,16 @@ class ActionComm extends CommonObject $this->authorid = $obj->fk_user_author; $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->firstname = $obj->firstname; // 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->userownerid = $obj->fk_user_action; $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->fulldayevent = $obj->fulldayevent; $this->location = $obj->location; @@ -525,7 +522,7 @@ class ActionComm extends CommonObject if ($this->fk_project < 0) $this->fk_project = 0; // Check parameters - if ($this->percentage == 0 && $this->userdone->id > 0) + if ($this->percentage == 0 && $this->userdoneid > 0) { $this->error="ErrorCantSaveADoneUserWithZeroPercentage"; 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)); $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)); - $userdoneid=($this->userdoneid?$this->userdoneid:((isset($this->userdone->id) && $this->userdone->id > 0) ? $this->userdone->id : 0)); + $userownerid=($this->userownerid?$this->userownerid:0); + $userdoneid=($this->userdoneid?$this->userdoneid:0); $this->db->begin(); @@ -546,9 +543,9 @@ class ActionComm extends CommonObject $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.= ", 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_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.= ", fulldayevent = '".$this->fulldayevent."'"; $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) - * Utilise $this->id, $this->code et $this->label + * Return URL of event + * 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 $maxlength Nombre de caracteres max dans libelle @@ -868,39 +865,34 @@ class ActionComm extends CommonObject */ function getNomUrl($withpicto=0,$maxlength=0,$classname='',$option='',$overwritepicto='') { - global $langs; + global $conf,$langs; $result=''; if ($option=='birthday') $lien = ''; else $lien = ''; $lienfin=''; $label=$this->label; - if (empty($label)) $label=$this->libelle; // Fro backward compatibility - //print 'rrr'.$this->libelle; + if (empty($label)) $label=$this->libelle; // For backward compatibility + //print 'rrr'.$this->libelle.'-'.$withpicto; if ($withpicto == 2) { $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=''; } - 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 { - $libelle=$label; - $libelleshort=dol_trunc($label,$maxlength); + $libelle=(empty($this->libelle)?$label:$this->libelle.(($label && $label != $this->libelle)?' '.$label:'')); + 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 (! 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; } diff --git a/htdocs/comm/action/document.php b/htdocs/comm/action/document.php index 0556e532f35..5e180f66abb 100644 --- a/htdocs/comm/action/document.php +++ b/htdocs/comm/action/document.php @@ -100,8 +100,7 @@ if ($object->id > 0) $author->fetch($object->author->id); $object->author=$author; - if ($object->contact->id > 0) $object->fetch_contact($object->contact->id); - if ($object->usertodo->id > 0) { $tmpuser=new User($db); $res=$tmpuser->fetch($object->usertodo->id); $object->usertodo=$tmpuser; } + $object->fetch_contact(); $head=actions_prepare_head($object); @@ -195,7 +194,11 @@ if ($object->id > 0) // Assigned to print ''.$langs->trans("ActionAffectedTo").''; - if ($object->usertodo->id > 0) print $object->usertodo->getNomUrl(1); + if ($object->userownerid > 0) + { + $tmpuser=new User($object->userownerid); + print $tmpuser->getNomUrl(1); + } print ''; print '

'; diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index f94ca7cf30a..4630d486ebf 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -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_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 = -date("w",dol_mktime(0,0,0,$month,1,$year))+2; + // 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(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); - 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) $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; @@ -414,7 +414,7 @@ $sql.= ' a.percent,'; $sql.= ' a.fk_user_author,a.fk_user_action,a.fk_user_done,'; $sql.= ' a.transparency, a.priority, a.fulldayevent, a.location,'; $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"; 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"; @@ -483,20 +483,25 @@ if ($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 $event=new ActionComm($db); $event->id=$obj->id; $event->datep=$db->jdate($obj->datep); // datep and datef are GMT date $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->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->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->fulldayevent=$obj->fulldayevent; $event->location=$obj->location; @@ -879,6 +884,7 @@ if (count($listofextcals)) $maxnbofchar=18; $cachethirdparties=array(); $cachecontacts=array(); +$cacheusers=array(); // Define theme_datacolor array $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 " \n"; 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) { $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) { $curtime = dol_mktime(0, 0, 0, $month, $tmpday, $year); - $style='cal_current_month'; if ($iter_day == 6) $style.=' cal_current_month_right'; $today=0; if ($todayarray['mday']==$tmpday && $todayarray['mon']==$month && $todayarray['year']==$year) $today=1; if ($today) $style='cal_today'; if ($curtime < $todaytms) $style.=' cal_past'; - + //var_dump($todayarray['mday']."==".$tmpday." && ".$todayarray['mon']."==".$month." && ".$todayarray['year']."==".$year.' -> '.$style); echo ' \n"; } /* Show days after the current month (next month) */ else - { + { $style='cal_other_month'; if ($iter_day == 6) $style.=' cal_other_month_right'; echo ' '; print ''; print ''; + print ''; print ''; print ''; - print ''; - print ''; + //print ''; print ''; print '"; @@ -288,7 +306,8 @@ if ($resql) // Action (type) print ''; @@ -337,6 +356,7 @@ if ($resql) print ''; // User author + /* print ''; + */ // User to do print '\n"; $usernames = array(); //init $usernamesid = array(); /* 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[$daykey] as $index => $event) - { - $event->fetch_userassigned(); - $listofuserid=$event->userassigned; - foreach($listofuserid as $userid => $tmp) - { - if (! in_array($userid, $usernamesid)) $usernamesid[$userid] = $userid; - } - } + foreach ($eventarray as $daykey => $notused) + { + // Get all assigned users for each event + foreach ($eventarray[$daykey] as $index => $event) + { + $event->fetch_userassigned(); + $listofuserid=$event->userassigned; + 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) { $tmpuser=new User($db); @@ -609,11 +646,13 @@ else // Load array of colors by type $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); while ($obj = $db->fetch_object($resql)) { $colorsbytype[$obj->code]=$obj->color; + $labelbytype[$obj->code]=$obj->libelle; } // Loop on each user to show calendar @@ -659,6 +698,32 @@ foreach ($usernames as $username) echo "
'; show_day_events($db, $tmpday, $month, $year, $month, $style, $eventarray, $maxprint, $maxnbofchar, $newparam); echo " '; @@ -1032,7 +1037,7 @@ else // View by day $today=0; $todayarray=dol_getdate($now,'fast'); 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); $arraytimestamp=dol_getdate($timestamp); @@ -1078,7 +1083,7 @@ $db->close(); * @param int $year Year * @param int $monthshown Current month shown in calendar view * @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 $maxnbofchar Nb of characters to show for event line * @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 $action, $filter, $filtera, $filtert, $filterd, $status, $actioncode; // Filters used into search form global $theme_datacolor; - global $cachethirdparties, $cachecontacts, $colorindexused; + global $cachethirdparties, $cachecontacts, $cacheusers, $colorindexused; print '
'."\n"; @@ -1150,11 +1155,17 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa if (in_array($user->id, $keysofuserassigned)) { $nummytasks++; $cssclass='family_mytasks'; - // TODO Set a color using user color - // Must defined rule to choose color of who to use. - // event->ownerid will still contains user id of owner - // event->userassigned will be an array in future. - // $color=$user->color; + + 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; } else if ($event->type_code == 'ICALEVENT') { @@ -1175,6 +1186,17 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa else { $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. { @@ -1295,7 +1317,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa print "
\n"; } else - { + { if ($showinfo) { print $langs->trans("EventOnFullDay")."
\n"; diff --git a/htdocs/comm/action/listactions.php b/htdocs/comm/action/listactions.php index fbd63e4006b..c330540cb03 100644 --- a/htdocs/comm/action/listactions.php +++ b/htdocs/comm/action/listactions.php @@ -44,6 +44,8 @@ $status=GETPOST("status",'alpha'); $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':'')); $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 ($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 */ +$form=new Form($db); + +$nav=''; +$nav.='  
'; +$nav.=$form->select_date($dateselect, 'dateselect', 0, 0, 1, '', 1, 0, 1); +$nav.=' '; +$nav.='
'; + $now=dol_now(); $help_url='EN:Module_Agenda_En|FR:Module_Agenda|ES:M&omodulodulo_Agenda'; llxHeader('',$langs->trans("Agenda"),$help_url); -$form=new Form($db); - // Define list of all external calendars $listofextcals=array(); @@ -148,7 +156,7 @@ if ($type) $param.="&type=".$type; $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.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.= " ut.login as logintodo, ut.rowid as useridtodo,"; //$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; $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.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 ($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->plimit($limit + 1, $offset); //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 '
'; print '
'."\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("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("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("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); @@ -259,12 +268,14 @@ if ($resql) print '
'; - 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 ''; + print $form->select_date($dateend, 'dateend', 0, 0, 1, '', 1, 0, 1); print ''; //print '  '; @@ -281,6 +292,13 @@ if ($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; print "
'; $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; print $actionstatic->getNomUrl(1,28); print ''; if ($obj->useridauthor) { @@ -347,6 +367,7 @@ if ($resql) } else print ' '; print ''; diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index a6a11d04a99..da34983779a 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -395,6 +395,13 @@ if ($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 $event=new ActionComm($db); $event->id=$obj->id; @@ -409,7 +416,6 @@ if ($resql) $event->authorid=$obj->fk_user_author; // user id of creator $event->userownerid=$obj->fk_user_action; // user id of owner $event->fetch_userassigned(); // This load $event->userassigned - //$event->userdone->id=$obj->fk_user_done; // deprecated $event->priority=$obj->priority; $event->fulldayevent=$obj->fulldayevent; $event->location=$obj->location; @@ -567,19 +573,50 @@ echo "
\n"; + +if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) +{ + $langs->load("commercial"); + print '
'.$langs->trans("Legend").':
'; + foreach($colorsbytype as $code => $color) + { + if ($color) + { + print '

 
'; + print $langs->trans("Action".$code)!="Action".$code?$langs->trans("Action".$code):$labelbytype[$code]; + //print $code; + print '
'; + } + } + //$color=sprintf("%02x%02x%02x",$theme_datacolor[0][0],$theme_datacolor[0][1],$theme_datacolor[0][2]); + print '
 
'; + print $langs->trans("Other"); + print '
'; + /* TODO Show this if at least one cumulated event + print '
 
'; + print $langs->trans("SeveralEvents"); + print '
'; + */ +} + // Add js code to manage click on a box print ' '; - print '