Baobab: Make alarm execute as its owner.

Required for Baobab alarms to work. Not the default anymore in generic
ERP5. 2 possibilities to drop this patch:
- Make it configurable on an alarm basis (might be desired, requires
  allowing users to see who owns which alarm and take ownership).
- Fix Baobab so alarm scripts become insensitive to user executing them.
  Unlikely, as it's very tightly bound in the code.
Baobab: Make show_cancel_and_invoke_links only control "cancel" link.

Manager users want to be able to invoke activities when they are failed.
Still, they must not be allowed to cancel them.
To contribute to generic repository, it is required to make "invoke" safe,
by dropping the use of "flush" method, but rather "naturally" executing the
activity, sticking to the timerserver-based code as closely as possible.
Do not raise when encountering non-UTF-8 chars.

Instead, replace them with standard unicode "rempalcement char":
http://en.wikipedia.org/wiki/Replacement_character#Replacement_character
(cherry picked from commit 517b9c891d0491e70fd316765a9276d24d753850)
Baobab: Prevent ERP5Type.Utils import from failing on RHEL.

RHEL has an old libmagic which lacks an export accessed by python magic
module (in ctypes), which causes an exception. ZEO runs on RHEL machine,
and it must load this file for conflict resolution.
Generic fix is to happen somewhere in buildout/slapos, as ctypes should
not even try to access system library.
Don't fail when accessor is not available (really).

Also, don't try to fetch accessor when ti is None.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@45275 20353a03-c40f-0410-a6d1-a30d3c3de9de
(cherry picked from commit 16a5abe9e48d6c64304b1a13dc22af8f533cc538)
Pass value through if it's not a DateTime.

This solves a crash when a ListBox with a DateTimeField as editable field is
used to filter with a non-date expression (ex: ">01/04/2011").
Still, keep existing exception about None being converted to empty string.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@45720 20353a03-c40f-0410-a6d1-a30d3c3de9de
(cherry picked from commit f87e1a7632c0117e3aa0d10be8502159554b02f6)
Keep default value enabled, or validator fails.

Needs peer-review before pushing to generic.
Ignore "empty" role (base) categories.

Also excludes whitespace-only (base) categories & end of lines.
(cherry picked from commit 20d6f95c6368497d91a97e0c7b132eba5aa3fc26)
Baobab: Index pre-selection for stock queries.

This prevents MySQL from choosing inefficient indexes.
More investigation is required to make MySQL choose better indexes by
itself (this must become the ultimate goal).
* remove 'id' from BaseType/searchable_text_property_id_property's default.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@45070 20353a03-c40f-0410-a6d1-a30d3c3de9de
(cherry picked from commit 8f5016ac23790f9bce7bad56c3c5cf91f96d3d39)
manage_archive can take more argument as the research of currently
used connection might failed in some cases (no zsql method using a
deferred connection for example)

This should be replace later using a mapping between connection as parameter

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@45126 20353a03-c40f-0410-a6d1-a30d3c3de9de
(cherry picked from commit 07f480ed7f727f02d26904a4d6c9809d3afec678)
Add trade_phase property to Delivery property sheet

This allows portal_rules and Business Links to match against deliveries using the predicate API, which means less hard-coding of rule names in scripts (specially workflow scripts).

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@45261 20353a03-c40f-0410-a6d1-a30d3c3de9de
(cherry picked from commit 40c29c7472e73ab983ecfc86aa579e99cbf7ba1a)
Fix migration to portal types as classes when it is not triggered by activity tool

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@45287 20353a03-c40f-0410-a6d1-a30d3c3de9de
(cherry picked from commit 8b139200b46a80b0633ed60ca1090fa6732b5f3b)
Make first migration of types tool (CMF -> ERP5) work again

It was broken by the second migration (aq_dynamic -> erp5.portal_type).

And now the migration is not triggered by aq_dynamic, there is no reason anymore
to abort the transaction in OldTypesTool._migrateTypesTool if anything fails.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@45288 20353a03-c40f-0410-a6d1-a30d3c3de9de
(cherry picked from commit 748357cda4724ef3d70f6d0b33c647f7c402c659)
Patch MailHost to not send emails in tpc_finish on recent Zope

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@45325 20353a03-c40f-0410-a6d1-a30d3c3de9de
(cherry picked from commit ddba36c9652304331b9ebcfea671f37bcc3db38d)
Prevent upgrader from using default ERP5Site_getUpgraderSignature.

This prevents accidental use of the default settings for upgrade. They should just serve as an illustration of upgrader use, never be used themselves.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@45330 20353a03-c40f-0410-a6d1-a30d3c3de9de
(cherry picked from commit cf8f4fd556db2299567857dda3f13c672a2f56cc)
Translation service raises if it receives a non-ascii string.

As ERP5 decided to only contain UTF-8 strings, it is responsible for decoding
them before handing them out to translation service.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@45333 20353a03-c40f-0410-a6d1-a30d3c3de9de
(cherry picked from commit a36c868e52c8f5faf7a480100be71919dac6c00f)
PS for Category Membership State Constraint

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@45367 20353a03-c40f-0410-a6d1-a30d3c3de9de
(cherry picked from commit 865161c2bf5239d0a82fe9c032600c093a4e0fab)
Fix possible unauthorized error when upgrading a site that has no property sheet tool

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@45376 20353a03-c40f-0410-a6d1-a30d3c3de9de
(cherry picked from commit c815d752eaf0bfba6d1e8132067a8efe1e1fac5d)
Fix missing import in r45376

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@45377 20353a03-c40f-0410-a6d1-a30d3c3de9de
(cherry picked from commit f87be9100a99e105d21ad7c91fc8f19e3916aaa8)